Skip to content

Commit

Permalink
Merge pull request #1108 from ethereumjs/new-mpt-release
Browse files Browse the repository at this point in the history
MPT: New Release v4.1.0
  • Loading branch information
holgerd77 authored Feb 16, 2021
2 parents 5fb23ad + 830c9d0 commit 9dfc747
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 12 deletions.
2 changes: 1 addition & 1 deletion packages/block/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"homepage": "https://github.com/ethereumjs/ethereumjs-vm/tree/master/packages/block#readme",
"dependencies": {
"@ethereumjs/common": "^2.0.0",
"merkle-patricia-tree": "^4.0.0",
"merkle-patricia-tree": "^4.1.0",
"@ethereumjs/tx": "^3.0.2",
"@types/bn.js": "^4.11.6",
"ethereumjs-util": "^7.0.8"
Expand Down
2 changes: 1 addition & 1 deletion packages/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"@ethereumjs/blockchain": "^5.0.0",
"@ethereumjs/common": "^2.0.0",
"@ethereumjs/devp2p": "^3.0.3",
"merkle-patricia-tree": "^4.0.0",
"merkle-patricia-tree": "^4.1.0",
"@ethereumjs/vm": "^5.0.0",
"chalk": "^2.4.2",
"ethereumjs-util": "^7.0.8",
Expand Down
21 changes: 18 additions & 3 deletions packages/trie/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,26 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
(modification: no type change headlines) and this project adheres to
[Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## UNRELEASED
## 4.1.0 - 2021-02-16

## New features
This release comes with a reworked checkpointing mechanism (PR [#1030](https://github.com/ethereumjs/ethereumjs-monorepo/pull/1030) and subsequently PR [#1035](https://github.com/ethereumjs/ethereumjs-monorepo/pull/1035)). Instead of copying over the whole DB on checkpoints the operations in between checkpoints are now recorded in memory and either applied in batch on a `Trie.checkpoint()` call or discarded along a `Trie.revert()`. This more fine-grained operational mode leads to a substantial performance gain (up to 50x) when working with larger tries.

There is a new exported `WalkController` class. Also, `trie.walkTrie()` is now a public method. Using the `WalkController`, one can create own custom ways to traverse the trie. [#135](https://github.com/ethereumjs/merkle-patricia-tree/pull/135)
Another performance related bug has been fixed along PR [#127](https://github.com/ethereumjs/merkle-patricia-tree/pull/127) removing an unnecessary double-serialization call on nodes. This gives a general performance gain of 10-20% on putting new values in a trie.

Other changes:

## New Features

A new exported `WalkController` class has been added and `trie.walkTrie()` has been made a public method along. This allows for creating own custom ways to traverse a trie. PR [#135](https://github.com/ethereumjs/merkle-patricia-tree/pull/135)

### Refactoring, Development and Documentation

- Better `Trie` code documentation, PR [#125](https://github.com/ethereumjs/merkle-patricia-tree/pull/125)
- Internal `Trie` function reordering & partial retwrite, PR [#125](https://github.com/ethereumjs/merkle-patricia-tree/pull/125)
- Added simple integrated profiling, PR [#128](https://github.com/ethereumjs/merkle-patricia-tree/pull/128)
- Reworked benchmarking to be based on `benchmark.js`, basic CI integration, PR [#130](https://github.com/ethereumjs/merkle-patricia-tree/pull/130)
- Upgrade to `ethereumjs-config` `2.0` libs for linting and formatting, PR [#133](https://github.com/ethereumjs/merkle-patricia-tree/pull/133)
- Switched coverage from `coverall` to `codecov`, PR [#137](https://github.com/ethereumjs/merkle-patricia-tree/pull/137)

## [4.0.0] - 2020-04-17

Expand Down
2 changes: 0 additions & 2 deletions packages/trie/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ This is an implementation of the modified merkle patricia tree as specified in t
The only backing store supported is LevelDB through the `levelup` module.

Note: this `README` reflects the state of the library from `v5.0.0` (UNRELEASED) onwards. See `README` from the [standalone repository](https://github.com/ethereumjs/merkle-patricia-tree) for an introduction on the last preceeding release.

# INSTALL

`npm install merkle-patricia-tree`
Expand Down
2 changes: 1 addition & 1 deletion packages/trie/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "merkle-patricia-tree",
"version": "4.0.0",
"version": "4.1.0",
"description": "This is an implementation of the modified merkle patricia tree as specified in Ethereum's yellow paper.",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down
13 changes: 10 additions & 3 deletions packages/trie/src/baseTrie.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,21 +58,28 @@ export class Trie {
this.db = db ? new DB(db) : new DB()
this._root = this.EMPTY_TRIE_ROOT
if (root) {
this._setRoot(root)
this.setRoot(root)
}
}

/** Sets the current root of the `trie` */
set root(value: Buffer) {
this._setRoot(value)
this.setRoot(value)
}

/** Gets the current root of the `trie` */
get root(): Buffer {
return this._root
}

_setRoot(value?: Buffer) {
/**
* This method is deprecated.
* Please use `Trie.root(value)` instead.
*
* @param value
* @deprecated
*/
setRoot(value?: Buffer) {
if (!value) {
value = this.EMPTY_TRIE_ROOT
}
Expand Down
2 changes: 1 addition & 1 deletion packages/vm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"@ethereumjs/block": "^3.0.0",
"@ethereumjs/blockchain": "^5.0.0",
"@ethereumjs/common": "^2.0.0",
"merkle-patricia-tree": "^4.0.0",
"merkle-patricia-tree": "^4.1.0",
"@ethereumjs/tx": "^3.0.2",
"async-eventemitter": "^0.2.4",
"core-js-pure": "^3.0.1",
Expand Down

0 comments on commit 9dfc747

Please sign in to comment.