Skip to content
This repository was archived by the owner on Jan 19, 2021. It is now read-only.

Commit 3ed946a

Browse files
authored
Rename Trie.prove to Trie.createProof (#122)
* rename Trie.prove to Trie.createProof tidy up typedoc * regen docs * add pr to changelog * move export type up
1 parent 0a6a2ca commit 3ed946a

17 files changed

+594
-475
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ test()
2929

3030
See the [docs](https://github.com/ethereumjs/merkle-patricia-tree/tree/master/docs) for the latest Promise-based method signatures.
3131

32+
#### Trie.prove renamed to Trie.createProof
33+
34+
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.
35+
3236
#### Trie raw methods
3337

3438
`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.
@@ -50,6 +54,7 @@ See the [docs](https://github.com/ethereumjs/merkle-patricia-tree/tree/master/do
5054
- Upgrade ethereumjs-util to 7.0.0 / Upgrade level-mem to 5.0.1 ([#116](https://github.com/ethereumjs/merkle-patricia-tree/pull/116))
5155
- Create dual ES5 and ES2017 builds ([#117](https://github.com/ethereumjs/merkle-patricia-tree/pull/117))
5256
- Include checkpoints by default in SecureTrie.copy ([#119](https://github.com/ethereumjs/merkle-patricia-tree/pull/119))
57+
- Rename Trie.prove to Trie.createProof ([#122](https://github.com/ethereumjs/merkle-patricia-tree/pull/122))
5358

5459
### Added
5560

README.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
[![js-standard-style](https://cdn.rawgit.com/feross/standard/master/badge.svg)](https://github.com/feross/standard)
99

10-
This is an implementation of the modified merkle patricia tree as specified in the [Ethereum's Yellow Paper](http://gavwood.com/Paper.pdf):
10+
This is an implementation of the modified merkle patricia tree as specified in the [Ethereum Yellow Paper](http://gavwood.com/Paper.pdf):
1111

1212
> The modified Merkle Patricia tree (trie) provides a persistent data structure to map between arbitrary-length binary data (byte arrays). It is defined in terms of a mutable data structure to map between 256-bit binary fragments and arbitrary-length binary data. The core of the trie, and its sole requirement in terms of the protocol specification is to provide a single 32-byte value that identifies a given set of key-value pairs.
1313
@@ -42,10 +42,13 @@ test()
4242
## Merkle Proofs
4343

4444
```typescript
45+
const trie = new Trie()
46+
4547
async function test() {
46-
const prove = await Trie.prove(trie, Buffer.from('test'))
47-
const value = await Trie.verifyProof(trie.root, Buffer.from('test'), prove)
48-
console.log(value.toString())
48+
await trie.put(Buffer.from('test'), Buffer.from('one'))
49+
const proof = await Trie.createProof(trie, Buffer.from('test'))
50+
const value = await Trie.verifyProof(trie.root, Buffer.from('test'), proof)
51+
console.log(value.toString()) // 'one'
4952
}
5053

5154
test()

0 commit comments

Comments
 (0)