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

Release - v4.0.0 #111

Merged
merged 18 commits into from
Jun 19, 2020
Merged

Release - v4.0.0 #111

merged 18 commits into from
Jun 19, 2020

Conversation

ryanio
Copy link
Contributor

@ryanio ryanio commented Apr 17, 2020

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)

Compare view

v3.0.0 => v4.0.0

Linked issues

Closes #10
Closes #102

@github-actions
Copy link

Coverage Status

Coverage remained the same at 94.992% when pulling cfdccd1 on release/4.0.0 into 7583aa9 on master.

@holgerd77
Copy link
Member

Great stuff! 😄

Do we eventually want to get https://github.com/ethereumjs/merkle-patricia-tree/issues/108 (drop level dependency) in before we release? This sounded pretty significant from what to read from the issue description and it would need a breaking change, so this would be a good occasion here.

@ryanio
Copy link
Contributor Author

ryanio commented Apr 17, 2020

@holgerd77 ah yes for sure, that sounds nice to include.
edit: I don't think the level dependency can be dropped. i wrote a reply in the issue.

@holgerd77
Copy link
Member

This "Remove dependency on ethereumjs-util" #10 is also a candidate where we might want to do something within the scope of this release. Eventually the work from @cgewecke in the works on the util library around the discussion from ethereumjs/ethereumjs-util#228 would also already help here when we would integrate an updated ethereumjs-util version (so in this case we should wait for the release there).

@ryanio
Copy link
Contributor Author

ryanio commented Apr 21, 2020

This "Remove dependency on ethereumjs-util" #10 is also a candidate where we might want to do something within the scope of this release. Eventually the work from @cgewecke in the works on the util library around the discussion from ethereumjs/ethereumjs-util#228 would also already help here when we would integrate an updated ethereumjs-util version (so in this case we should wait for the release there).

Sounds good. I already removed all of the toBuffers as mentioned in #10 with #107.

It looks like these are all the ethereumjs-util references left:

Screen Shot 2020-04-21 at 11 42 02 AM

We could remove ethereumjs-util completely and use keccak lib directly (and define constants KECCAK256_RLP, KECCAK256_NULL, etc.), but not sure how helpful that would be at the end of the day since it would introduce identical boilerplate into the repository. So I think we can wait for an upstream update of ethereumjs-util.

edit: ethereumjs-util now updated to 7.0.0 in this release.

CHANGELOG.md Outdated Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
@holgerd77
Copy link
Member

Same here, let's give this release (again 😜) a couple of days more and see how discussion around ethereumjs/ethereumjs-util#250 evolve.

@holgerd77
Copy link
Member

Hi @ryanio, people seem to stumble upon somewhat hidden breaking changes on the upcoming v4 release, see e.g. thread in #118. Can you before release go once again through the listed PRs have a deeper look into where breaking changes are introduced and more clearly label (with "[BREAKING]" or something, or eventually also some oral extra section) the changes which are breaking? Think this is necessary to avoid frustration along the upgrade process.

@holgerd77
Copy link
Member

Ah ok, or is there too much still in motion from #118 ?

@holgerd77
Copy link
Member

Sorry, wanted to post this before the last comment here, have mixed this up along another thread:

@ryanio Can we do an explicit update to ethereumjs-util v7.0.1 here as well, just to play safe? Can just be added to this branch directly I would say.

Is this otherwise ready for a review?

@ryanio
Copy link
Contributor Author

ryanio commented May 20, 2020

@holgerd77 I'd like to do a final check with @msieczko and @sz-piotr if they have drawn conclusions on any broken or inconsistent behavior that we might want to include in this release (see #118 (comment)) , otherwise it should be good!

@holgerd77
Copy link
Member

Hi Ryan, please take ethereumjs/ethereumjs-util#253 into account respectively upgrade on a new release before releasing, thanks! Think in this case we should also do here one other explicit upgrade (and tests run) on an eventual v7.0.2 util release.

gabrocheleau
gabrocheleau previously approved these changes May 27, 2020
Copy link
Contributor

@gabrocheleau gabrocheleau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed changes, all seems good.

…-copy

Include checkpoints by default in SecureTrie.copy
Copy link
Contributor

@gabrocheleau gabrocheleau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested a small change in the example in CHANGELOG.md. Perhaps this change could also be applied to the README.md

CHANGELOG.md Outdated Show resolved Hide resolved
ryanio and others added 2 commits May 27, 2020 10:17
wrap example in function

Co-authored-by: gabrocheleau <gab_rocheleau@hotmail.com>
Copy link
Contributor

@gabrocheleau gabrocheleau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed the await in front of test()

README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
gabrocheleau
gabrocheleau previously approved these changes May 28, 2020
* rename Trie.prove to Trie.createProof
tidy up typedoc

* regen docs

* add pr to changelog

* move export type up
gabrocheleau
gabrocheleau previously approved these changes Jun 16, 2020
src/baseTrie.ts Outdated Show resolved Hide resolved
@holgerd77
Copy link
Member

Does this need a final review/approval?

@ryanio
Copy link
Contributor Author

ryanio commented Jun 18, 2020

@holgerd77 yes, please! i'm ready when you are to coordinate a release on npm.

Copy link
Member

@holgerd77 holgerd77 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, had a last overall look, this looks good, also based on the review by @gabrocheleau (thanks!)!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

missing typescript types Remove dependency on ethereumjs-util
3 participants