Skip to content

Commit

Permalink
Merge branch 'master' into add-runTx-blockGasUsed
Browse files Browse the repository at this point in the history
  • Loading branch information
holgerd77 committed May 21, 2021
2 parents eb9dd07 + 452c6ae commit f79ec2b
Show file tree
Hide file tree
Showing 19 changed files with 1,588 additions and 2,111 deletions.
2 changes: 1 addition & 1 deletion packages/block/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
},
"dependencies": {
"@ethereumjs/common": "^2.2.0",
"merkle-patricia-tree": "^4.1.0",
"merkle-patricia-tree": "^4.2.0",
"@ethereumjs/tx": "^3.1.4",
"ethereumjs-util": "^7.0.10"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"@ethereumjs/common": "^2.2.0",
"@ethereumjs/devp2p": "^4.0.0",
"@ethereumjs/tx": "^3.1.4",
"merkle-patricia-tree": "^4.1.0",
"merkle-patricia-tree": "^4.2.0",
"@ethereumjs/vm": "^5.3.2",
"chalk": "^2.4.2",
"ethereumjs-util": "^7.0.10",
Expand Down
14 changes: 14 additions & 0 deletions packages/trie/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,20 @@ 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).

## 4.2.0 - 2021-05-20

### Changed Delete Behavior: NO Default Node Deletes

This release changes the behavior on trie node deletes after doing a `commit()` on a checkpoint trie (`CheckpointTrie`). This was the scenario where trie nodes were deleted from the database in older versions of the library. After a long discussion we decided to switch to a more conservative approach and keep the trie nodes in the DB in all scenarios. This now allows for setting back the state root to an older root (e.g. with the `StateManager` included in the `VM`) and still be sure to operate on a consistent and complete trie. This had been reported as a problem in some usage scenarios by third-party users of the library.

So the default behavior on the trie is now: there are no node deletions happening in all type of setups and usage scenarios, so for a `BaseTrie`, `CheckpointTrie` or `SecureTrie` and working checkpointed or non-checkpointed.

While this change is not directly breaking, it might nevertheless have side effects depending on your usage scenario. If you use a somewhat larger trie and do a lot of change operations, this will significantly increase the disk space used. We have nevertheless decided to make this a non-breaking release since we don't expect this to be the usual way the trie library is used. Instead the former behavior appeared more as some sort of "bug" when reported by developers integrating the library.

If you want to switch back to a trie where nodes are deleted (so for non-checkpointed tries directly along a trie operation or for checkpointed tries along a `commit()`) there is a new parameter `deleteFromDB` introduced which can be used to switch to a delete behavior on instantiation (the default is `false` here).

See: PR [#1219](https://github.com/ethereumjs/ethereumjs-monorepo/pull/1219)

## 4.1.0 - 2021-02-16

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.
Expand Down
2 changes: 2 additions & 0 deletions packages/trie/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ The only backing store supported is LevelDB through the `levelup` module.

There are 3 variants of the tree implemented in this library, namely: `BaseTrie`, `CheckpointTrie` and `SecureTrie`. `CheckpointTrie` adds checkpointing functionality to the `BaseTrie` with the methods `checkpoint`, `commit` and `revert`. `SecureTrie` extends `CheckpointTrie` and is the most suitable variant for Ethereum applications. It stores values under the `keccak256` hash of their keys.

By default trie nodes are not deleted from the underlying DB to not corrupt older trie states (as of `v4.2.0`). If you are only interested in the latest state of a trie you can switch to a delete behavior (e.g. if you want to save disk space) by using the `deleteFromDB` constructor option (see related release notes in the changelog for more details).

## Initialization and Basic Usage

```typescript
Expand Down
14 changes: 7 additions & 7 deletions packages/trie/docs/README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
[merkle-patricia-tree](README.md)
merkle-patricia-tree

# merkle-patricia-tree

## Index
## Table of contents

### Modules
### Classes

* ["baseTrie"](modules/_basetrie_.md)
* ["checkpointTrie"](modules/_checkpointtrie_.md)
* ["secure"](modules/_secure_.md)
* ["util/walkController"](modules/_util_walkcontroller_.md)
- [BaseTrie](classes/basetrie.md)
- [CheckpointTrie](classes/checkpointtrie.md)
- [SecureTrie](classes/securetrie.md)
- [WalkController](classes/walkcontroller.md)
Loading

0 comments on commit f79ec2b

Please sign in to comment.