diff --git a/CHANGELOG.md b/CHANGELOG.md index 31d69c5..5426b1f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,33 +8,58 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) ## [4.0.0] - 2020-04-17 -This release introduces a major API upgrade from callbacks to Promises. Behind the scenes the library and its tests have been refactored to TypeScript. - -See the items below for other various updates and fixes included in this release. - -- Move `failingRefactorTests` to `secure.spec.ts`, PR [#110](https://github.com/ethereumjs/merkle-patricia-tree/pull/110) -- Better document `_formatNode`, PR [#109](https://github.com/ethereumjs/merkle-patricia-tree/pull/109) -- Promisify rest of library, PR [#107](https://github.com/ethereumjs/merkle-patricia-tree/pull/107) -- Upgrade test suite to TS, PR [#106](https://github.com/ethereumjs/merkle-patricia-tree/pull/106) -- Upgrade from Travis to GH Actions, PR [#105](https://github.com/ethereumjs/merkle-patricia-tree/pull/105) -- Fix test cases and docs, PR [#104](https://github.com/ethereumjs/merkle-patricia-tree/pull/104) -- Refactor TrieNode, add levelup types, PR [#98](https://github.com/ethereumjs/merkle-patricia-tree/pull/98) -- Fix Travis's xvfb service, PR [#97](https://github.com/ethereumjs/merkle-patricia-tree/pull/97) -- Migrate to Typescript, PR [#96](https://github.com/ethereumjs/merkle-patricia-tree/pull/96) -- fixed src code links in docs, PR [#93](https://github.com/ethereumjs/merkle-patricia-tree/pull/93) -- Re-add raw methods, accept leveldb in constructor, minor fixes, PR [#92](https://github.com/ethereumjs/merkle-patricia-tree/pull/92) -- Rename deprecated sha3 consts and func to keccak256, PR [#91](https://github.com/ethereumjs/merkle-patricia-tree/pull/91) -- Use module.exports syntax in util files, PR [#90](https://github.com/ethereumjs/merkle-patricia-tree/pull/90) -- Add more Ethereum state DB focused example accessing account values, PR [#89](https://github.com/ethereumjs/merkle-patricia-tree/pull/89) -- Org links and git hooks, PR [#87](https://github.com/ethereumjs/merkle-patricia-tree/pull/87) -- \_lookupNode callback to use standard error, response pattern, PR [#83](https://github.com/ethereumjs/merkle-patricia-tree/pull/83) -- Support for proofs of null/absence. Dried up prove/verify. PR [#82](https://github.com/ethereumjs/merkle-patricia-tree/pull/82) -- Update tape to v4.10.1, PR [#81](https://github.com/ethereumjs/merkle-patricia-tree/pull/81) -- Fix prove and verifyProof in SecureTrie, PR [#79](https://github.com/ethereumjs/merkle-patricia-tree/pull/79) -- Extract db-related methods from baseTrie, PR [#74](https://github.com/ethereumjs/merkle-patricia-tree/pull/74) -- Merge checkpoint and secure interface with their ES6 classes, PR [#73](https://github.com/ethereumjs/merkle-patricia-tree/pull/73) -- Convert trieNode to ES6 class, PR [#71](https://github.com/ethereumjs/merkle-patricia-tree/pull/71) -- Drop ethereumjs-testing dep and fix bug in branch value update, PR [#69](https://github.com/ethereumjs/merkle-patricia-tree/pull/69) +This release introduces a major API upgrade from callbacks to Promises. + +See the [docs](https://github.com/ethereumjs/merkle-patricia-tree/tree/master/docs) for the latest method signatures. + +Example using async/await syntax: + +```typescript +import { BaseTrie as Trie } from 'merkle-patricia-tree' + +const trie = new Trie() +await trie.put(Buffer.from('test'), Buffer.from('one')) +const value = await trie.get(Buffer.from('test')) +``` + +### Changed + +- Convert trieNode to ES6 class ([#71](https://github.com/ethereumjs/merkle-patricia-tree/pull/71)) +- Merge checkpoint and secure interface with their ES6 classes ([#73](https://github.com/ethereumjs/merkle-patricia-tree/pull/73)) +- Extract db-related methods from baseTrie ([#74](https://github.com/ethereumjs/merkle-patricia-tree/pull/74)) +- \_lookupNode callback to use standard error, response pattern ([#83](https://github.com/ethereumjs/merkle-patricia-tree/pull/83)) +- Accept leveldb in constructor, minor fixes ([#92](https://github.com/ethereumjs/merkle-patricia-tree/pull/92)) +- Refactor TrieNode, add levelup types ([#98](https://github.com/ethereumjs/merkle-patricia-tree/pull/98)) +- Promisify rest of library ([#107](https://github.com/ethereumjs/merkle-patricia-tree/pull/107)) +- Use `Nibbles` type for `number[]` ([#115](https://github.com/ethereumjs/merkle-patricia-tree/pull/115)) +- Upgrade ethereumjs-util to 7.0.0 / Upgrade level-mem to 5.0.1 ([#116](https://github.com/ethereumjs/merkle-patricia-tree/pull/116)) +- Create dual ES5 and ES2017 builds ([#117](https://github.com/ethereumjs/merkle-patricia-tree/pull/117)) + +### Added + +- Support for proofs of null/absence. Dried up prove/verify. ([#82](https://github.com/ethereumjs/merkle-patricia-tree/pull/82)) +- Add more Ethereum state DB focused example accessing account values ([#89](https://github.com/ethereumjs/merkle-patricia-tree/pull/89)) + +### Fixed + +- Drop ethereumjs-testing dep and fix bug in branch value update ([#69](https://github.com/ethereumjs/merkle-patricia-tree/pull/69)) +- Fix prove and verifyProof in SecureTrie ([#79](https://github.com/ethereumjs/merkle-patricia-tree/pull/70)) +- Fixed src code links in docs ([#93](https://github.com/ethereumjs/merkle-patricia-tree/pull/93)) + +### Dev / Testing / CI + +- Update tape to v4.10.1 ([#81](https://github.com/ethereumjs/merkle-patricia-tree/pull/81)) +- Org links and git hooks ([#87](https://github.com/ethereumjs/merkle-patricia-tree/pull/87)) +- Use module.exports syntax in util files ([#90](https://github.com/ethereumjs/merkle-patricia-tree/pull/90)) +- Rename deprecated sha3 consts and func to keccak256 ([#91](https://github.com/ethereumjs/merkle-patricia-tree/pull/91)) +- Migrate to Typescript ([#96](https://github.com/ethereumjs/merkle-patricia-tree/pull/96)) +- Fix Travis's xvfb service ([#97](https://github.com/ethereumjs/merkle-patricia-tree/pull/97)) +- Fix test cases and docs ([#104](https://github.com/ethereumjs/merkle-patricia-tree/pull/104)) +- Upgrade CI Provider from Travis to GH Actions ([#105](https://github.com/ethereumjs/merkle-patricia-tree/pull/105)) +- Upgrade test suite to TS ([#106](https://github.com/ethereumjs/merkle-patricia-tree/pull/106)) +- Better document `_formatNode` ([#109](https://github.com/ethereumjs/merkle-patricia-tree/pull/109)) +- Move `failingRefactorTests` to `secure.spec.ts` ([#110](https://github.com/ethereumjs/merkle-patricia-tree/pull/110)) +- Fix test suite typos ([#114](https://github.com/ethereumjs/merkle-patricia-tree/pull/110)) [4.0.0]: https://github.com/ethereumjs/merkle-patricia-tree/compare/v3.0.0...v4.0.0 diff --git a/docs/classes/_basetrie_.trie.md b/docs/classes/_basetrie_.trie.md index 5bb9f22..310a4fe 100644 --- a/docs/classes/_basetrie_.trie.md +++ b/docs/classes/_basetrie_.trie.md @@ -3,7 +3,7 @@ # Class: Trie Use `import { BaseTrie as Trie } from 'merkle-patricia-tree'` for the base interface. -In Ethereum applications stick with the Secure Trie Overlay `import { SecureTrie } from 'merkle-patricia-tree'`. +In Ethereum applications stick with the Secure Trie Overlay `import { SecureTrie as Trie } from 'merkle-patricia-tree'`. The API for the base and the secure interface are about the same. **`param`** A [levelup](https://github.com/Level/levelup) instance. By default creates an in-memory [memdown](https://github.com/Level/memdown) instance. diff --git a/src/baseTrie.ts b/src/baseTrie.ts index d13490b..5145f39 100644 --- a/src/baseTrie.ts +++ b/src/baseTrie.ts @@ -28,7 +28,7 @@ type FoundNode = (nodeRef: Buffer, node: TrieNode, key: Nibbles, walkController: /** * Use `import { BaseTrie as Trie } from 'merkle-patricia-tree'` for the base interface. - * In Ethereum applications stick with the Secure Trie Overlay `import { SecureTrie } from 'merkle-patricia-tree'`. + * In Ethereum applications stick with the Secure Trie Overlay `import { SecureTrie as Trie } from 'merkle-patricia-tree'`. * The API for the base and the secure interface are about the same. * @param {Object} [db] - A [levelup](https://github.com/Level/levelup) instance. By default creates an in-memory [memdown](https://github.com/Level/memdown) instance. * If the db is `null` or left undefined, then the trie will be stored in memory via [memdown](https://github.com/Level/memdown)