Merkle Patricia Tree Versions Save

Project is in active development and has been moved to the EthereumJS VM monorepo.

v4.0.0

3 years ago

This release introduces a major API upgrade from callbacks to Promises.

Example using async/await syntax:

import { BaseTrie as Trie } from 'merkle-patricia-tree'
const trie = new Trie()
async function test() {
  await trie.put(Buffer.from('test'), Buffer.from('one'))
  const value = await trie.get(Buffer.from('test'))
  console.log(value.toString()) // 'one'
}
test()

Breaking Changes

Trie methods

See the docs for the latest Promise-based method signatures.

Trie.prove renamed to Trie.createProof

To clarify the method's purpose Trie.prove has been renamed to Trie.createProof. Trie.prove has been deprecated but will remain as an alias for Trie.createProof until removed.

Trie raw methods

getRaw, putRaw and delRaw were deprecated in v3.0.0 and have been removed from this release. Instead, please use trie.db.get, trie.db.put, and trie.db.del. If using a SecureTrie or CheckpointTrie, use trie._mainDB to override the checkpointing mechanism and interact directly with the db.

SecureTrie.copy

SecureTrie.copy now includes checkpoint metadata by default. To maintain original behavior of not copying checkpoint state, pass false to param includeCheckpoints.

Changed

  • Convert trieNode to ES6 class (#71)
  • Merge checkpoint and secure interface with their ES6 classes (#73)
  • Extract db-related methods from baseTrie (#74)
  • _lookupNode callback to use standard error, response pattern (#83)
  • Accept leveldb in constructor, minor fixes (#92)
  • Refactor TrieNode, add levelup types (#98)
  • Promisify rest of library (#107)
  • Use Nibbles type for number[] (#115)
  • Upgrade ethereumjs-util to 7.0.0 / Upgrade level-mem to 5.0.1 (#116)
  • Create dual ES5 and ES2017 builds (#117)
  • Include checkpoints by default in SecureTrie.copy (#119)
  • Rename Trie.prove to Trie.createProof (#122)

Added

  • Support for proofs of null/absence. Dried up prove/verify. (#82)
  • Add more Ethereum state DB focused example accessing account values (#89)

Fixed

  • Drop ethereumjs-testing dep and fix bug in branch value update (#69)
  • Fix prove and verifyProof in SecureTrie (#79)
  • Fixed src code links in docs (#93)

Dev / Testing / CI

  • Update tape to v4.10.1 (#81)
  • Org links and git hooks (#87)
  • Use module.exports syntax in util files (#90)
  • Rename deprecated sha3 consts and func to keccak256 (#91)
  • Migrate to Typescript (#96)
  • Fix Travis's xvfb service (#97)
  • Fix test cases and docs (#104)
  • Upgrade CI Provider from Travis to GH Actions (#105)
  • Upgrade test suite to TS (#106)
  • Better document _formatNode (#109)
  • Move failingRefactorTests to secure.spec.ts (#110)
  • Fix test suite typos (#114)

v3.0.0

5 years ago

This release comes along with some major version bump of the underlying level database storage backend. If you have the library deeper integrated in one of your projects make sure that the new DB version plays well with the rest of the code.

The release also introduces modern ES6 JavaScript for the library (thanks @alextsg) switching to ES6 classes and clean inheritance on all the modules.

  • Replace levelup 1.2.1 + memdown 1.0.0 with level-mem 3.0.1 and upgrade level-ws to 1.0.0, PR #56
  • Support for ES6 classes, PRs #57, #61
  • Updated async and readable-stream dependencies (resulting in smaller browser builds), PR #60
  • Updated, automated and cleaned up API documentation build, PR #63

v2.3.2

5 years ago
  • Fixed a bug in verify proof if the tree contains an extension node with an embedded branch node, PR #51
  • Fixed _scratch 'leak' to global/window, PR #42
  • Fixed coverage report leaving certain tests, PR #53

v2.3.1

6 years ago
  • Fix OutOfMemory bug when trying to create a read stream on large trie structures (e.g. a current state DB from a Geth node), PR #38
  • Fix race condition due to mutated _getDBs/_putDBs, PR #28

v2.3.0

6 years ago
  • Methods for merkle proof generation Trie.prove() and verification Trie.verifyProof() (see ./proof.js)