Skip to content

Commit 23f7676

Browse files
committed
Merge remote-tracking branch 'mpt/monorepo' into monorepo-add-mpt
2 parents c0e9b8a + c447c53 commit 23f7676

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+6085
-0
lines changed

packages/trie/.eslintrc.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
module.exports = {
2+
extends: '@ethereumjs/eslint-config-defaults',
3+
parserOptions: {
4+
project: ['./tsconfig.json', './tsconfig.benchmarks.json'],
5+
},
6+
overrides: [
7+
{
8+
files: ['benchmarks/*.ts'],
9+
rules: {
10+
'no-console': 'off',
11+
},
12+
},
13+
],
14+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Contributing
2+
3+
Great that you want to contribute to the `EthereumJS` [ecosystem](https://ethereumjs.readthedocs.io/en/latest/introduction.html). `EthereumJS` is managed by the Ethereum Foundation and largely driven by the wider community. Everyone is welcome to join the effort and help to improve on the libraries (see our [Code of Conduct](https://ethereumjs.readthedocs.io/en/latest/code_of_conduct.html) 🌷).
4+
5+
We have written up some [Contribution Guidelines](https://ethereumjs.readthedocs.io/en/latest/contributing.html#how-to-start) to help you getting started.
6+
7+
These include information on how we work with **Git** and how our **general workflow** and **technical setup** looks like (stuff like language, tooling, code quality and style).
8+
9+
Happy Coding! 👾 😀 💻
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: Build
2+
on:
3+
push:
4+
branches:
5+
- master
6+
tags:
7+
- '*'
8+
pull_request:
9+
types: [opened, reopened, synchronize]
10+
jobs:
11+
lint:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/setup-node@v1
15+
- uses: actions/checkout@v2
16+
- run: npm install
17+
- run: npm run lint
18+
19+
coverage:
20+
runs-on: ubuntu-latest
21+
steps:
22+
- uses: actions/setup-node@v1
23+
- uses: actions/checkout@v2
24+
- run: npm install
25+
- run: npm run coverage
26+
- uses: codecov/codecov-action@v1
27+
with:
28+
file: ./coverage/lcov.info
29+
30+
test:
31+
runs-on: ubuntu-latest
32+
strategy:
33+
matrix:
34+
node-version: [10.x, 12.x, 13.x]
35+
steps:
36+
- name: Use Node.js ${{ matrix.node-version }}
37+
uses: actions/setup-node@v1
38+
with:
39+
node-version: ${{ matrix.node-version }}
40+
- uses: actions/checkout@v2
41+
- run: npm install
42+
- run: npm run test
43+
44+
benchmarks:
45+
runs-on: ubuntu-latest
46+
steps:
47+
- uses: actions/setup-node@v1
48+
- uses: actions/checkout@v1
49+
- run: npm install
50+
- run: npm run benchmarks | tee output.txt
51+
52+
- name: Set auto-push for benchmarks to true if on master
53+
id: auto_push
54+
run: |
55+
if [$REF == 'refs/heads/master']
56+
then
57+
echo "::set-output name=auto_push::true"
58+
else
59+
echo "::set-output name=auto_push::false"
60+
fi
61+
env:
62+
REF: ${{ github.ref }}
63+
64+
- name: Compare benchmarks
65+
uses: rhysd/github-action-benchmark@v1
66+
with:
67+
tool: 'benchmarkjs'
68+
# Where the output from the benchmark tool is stored
69+
output-file-path: ./output.txt
70+
# Enable alert commit comment
71+
comment-on-alert: true
72+
# Always leave a commit comment comparing the current benchmark with previous
73+
comment-always: true
74+
# GitHub API token to make a commit comment
75+
github-token: ${{ secrets.GITHUB_TOKEN }}
76+
# Push and deploy to GitHub pages branch automatically (if on master)
77+
auto-push: ${{ steps.auto_push.outputs.auto_push }}

packages/trie/.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package-lock.json
2+
node_modules
3+
dist
4+
dist.browser
5+
.nyc_output
6+
coverage
7+
benchmarks/*.js

packages/trie/.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "test/jsonTests"]
2+
path = test/jsonTests
3+
url = https://github.com/ethereum/tests

packages/trie/.npmignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
.travis.yml
2+
.babelrc
3+
index.js
4+
5+
*.tgz
6+
7+
test/
8+
src/

packages/trie/.prettierignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
node_modules
2+
.vscode
3+
package.json
4+
dist
5+
dist.browser
6+
.nyc_output
7+
*.json
8+
docs

packages/trie/CHANGELOG.md

Lines changed: 157 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,157 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
6+
(modification: no type change headlines) and this project adheres to
7+
[Semantic Versioning](http://semver.org/spec/v2.0.0.html).
8+
9+
## UNRELEASED
10+
11+
## New features
12+
13+
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)
14+
15+
## [4.0.0] - 2020-04-17
16+
17+
This release introduces a major API upgrade from callbacks to Promises.
18+
19+
Example using async/await syntax:
20+
21+
```typescript
22+
import { BaseTrie as Trie } from 'merkle-patricia-tree'
23+
const trie = new Trie()
24+
async function test() {
25+
await trie.put(Buffer.from('test'), Buffer.from('one'))
26+
const value = await trie.get(Buffer.from('test'))
27+
console.log(value.toString()) // 'one'
28+
}
29+
test()
30+
```
31+
32+
### Breaking Changes
33+
34+
#### Trie methods
35+
36+
See the [docs](https://github.com/ethereumjs/merkle-patricia-tree/tree/master/docs) for the latest Promise-based method signatures.
37+
38+
#### Trie.prove renamed to Trie.createProof
39+
40+
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.
41+
42+
#### Trie raw methods
43+
44+
`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.
45+
46+
#### SecureTrie.copy
47+
48+
`SecureTrie.copy` now includes checkpoint metadata by default. To maintain original behavior of _not_ copying checkpoint state, pass `false` to param `includeCheckpoints`.
49+
50+
### Changed
51+
52+
- Convert trieNode to ES6 class ([#71](https://github.com/ethereumjs/merkle-patricia-tree/pull/71))
53+
- Merge checkpoint and secure interface with their ES6 classes ([#73](https://github.com/ethereumjs/merkle-patricia-tree/pull/73))
54+
- Extract db-related methods from baseTrie ([#74](https://github.com/ethereumjs/merkle-patricia-tree/pull/74))
55+
- \_lookupNode callback to use standard error, response pattern ([#83](https://github.com/ethereumjs/merkle-patricia-tree/pull/83))
56+
- Accept leveldb in constructor, minor fixes ([#92](https://github.com/ethereumjs/merkle-patricia-tree/pull/92))
57+
- Refactor TrieNode, add levelup types ([#98](https://github.com/ethereumjs/merkle-patricia-tree/pull/98))
58+
- Promisify rest of library ([#107](https://github.com/ethereumjs/merkle-patricia-tree/pull/107))
59+
- Use `Nibbles` type for `number[]` ([#115](https://github.com/ethereumjs/merkle-patricia-tree/pull/115))
60+
- Upgrade ethereumjs-util to 7.0.0 / Upgrade level-mem to 5.0.1 ([#116](https://github.com/ethereumjs/merkle-patricia-tree/pull/116))
61+
- Create dual ES5 and ES2017 builds ([#117](https://github.com/ethereumjs/merkle-patricia-tree/pull/117))
62+
- Include checkpoints by default in SecureTrie.copy ([#119](https://github.com/ethereumjs/merkle-patricia-tree/pull/119))
63+
- Rename Trie.prove to Trie.createProof ([#122](https://github.com/ethereumjs/merkle-patricia-tree/pull/122))
64+
65+
### Added
66+
67+
- Support for proofs of null/absence. Dried up prove/verify. ([#82](https://github.com/ethereumjs/merkle-patricia-tree/pull/82))
68+
- Add more Ethereum state DB focused example accessing account values ([#89](https://github.com/ethereumjs/merkle-patricia-tree/pull/89))
69+
70+
### Fixed
71+
72+
- Drop ethereumjs-testing dep and fix bug in branch value update ([#69](https://github.com/ethereumjs/merkle-patricia-tree/pull/69))
73+
- Fix prove and verifyProof in SecureTrie ([#79](https://github.com/ethereumjs/merkle-patricia-tree/pull/79))
74+
- Fixed src code links in docs ([#93](https://github.com/ethereumjs/merkle-patricia-tree/pull/93))
75+
76+
### Dev / Testing / CI
77+
78+
- Update tape to v4.10.1 ([#81](https://github.com/ethereumjs/merkle-patricia-tree/pull/81))
79+
- Org links and git hooks ([#87](https://github.com/ethereumjs/merkle-patricia-tree/pull/87))
80+
- Use module.exports syntax in util files ([#90](https://github.com/ethereumjs/merkle-patricia-tree/pull/90))
81+
- Rename deprecated sha3 consts and func to keccak256 ([#91](https://github.com/ethereumjs/merkle-patricia-tree/pull/91))
82+
- Migrate to Typescript ([#96](https://github.com/ethereumjs/merkle-patricia-tree/pull/96))
83+
- Fix Travis's xvfb service ([#97](https://github.com/ethereumjs/merkle-patricia-tree/pull/97))
84+
- Fix test cases and docs ([#104](https://github.com/ethereumjs/merkle-patricia-tree/pull/104))
85+
- Upgrade CI Provider from Travis to GH Actions ([#105](https://github.com/ethereumjs/merkle-patricia-tree/pull/105))
86+
- Upgrade test suite to TS ([#106](https://github.com/ethereumjs/merkle-patricia-tree/pull/106))
87+
- Better document `_formatNode` ([#109](https://github.com/ethereumjs/merkle-patricia-tree/pull/109))
88+
- Move `failingRefactorTests` to `secure.spec.ts` ([#110](https://github.com/ethereumjs/merkle-patricia-tree/pull/110))
89+
- Fix test suite typos ([#114](https://github.com/ethereumjs/merkle-patricia-tree/pull/110))
90+
91+
[4.0.0]: https://github.com/ethereumjs/merkle-patricia-tree/compare/v3.0.0...v4.0.0
92+
93+
## [3.0.0] - 2019-01-03
94+
95+
This release comes along with some major version bump of the underlying `level`
96+
database storage backend. If you have the library deeper integrated in one of
97+
your projects make sure that the new DB version plays well with the rest of the
98+
code.
99+
100+
The release also introduces modern `ES6` JavaScript for the library (thanks @alextsg)
101+
switching to `ES6` classes and clean inheritance on all the modules.
102+
103+
- Replace `levelup` 1.2.1 + `memdown` 1.0.0 with `level-mem` 3.0.1 and upgrade `level-ws` to 1.0.0, PR [#56](https://github.com/ethereumjs/merkle-patricia-tree/pull/56)
104+
- Support for `ES6` classes, PRs [#57](https://github.com/ethereumjs/merkle-patricia-tree/pull/57), [#61](https://github.com/ethereumjs/merkle-patricia-tree/pull/61)
105+
- Updated `async` and `readable-stream` dependencies (resulting in smaller browser builds), PR [#60](https://github.com/ethereumjs/merkle-patricia-tree/pull/60)
106+
- Updated, automated and cleaned up [API documentation](https://github.com/ethereumjs/merkle-patricia-tree/blob/master/docs/index.md) build, PR [#63](https://github.com/ethereumjs/merkle-patricia-tree/pull/63)
107+
108+
[3.0.0]: https://github.com/ethereumjs/merkle-patricia-tree/compare/v2.3.2...v3.0.0
109+
110+
## [2.3.2] - 2018-09-24
111+
112+
- Fixed a bug in verify proof if the tree contains an extension node with an embedded branch node, PR [#51](https://github.com/ethereumjs/merkle-patricia-tree/pull/51)
113+
- Fixed `_scratch` 'leak' to global/window, PR [#42](https://github.com/ethereumjs/merkle-patricia-tree/pull/42)
114+
- Fixed coverage report leaving certain tests, PR [#53](https://github.com/ethereumjs/merkle-patricia-tree/pull/53)
115+
116+
[2.3.2]: https://github.com/ethereumjs/merkle-patricia-tree/compare/v2.3.1...v2.3.2
117+
118+
## [2.3.1] - 2018-03-14
119+
120+
- Fix OutOfMemory bug when trying to create a read stream on large trie structures
121+
(e.g. a current state DB from a Geth node), PR [#38](https://github.com/ethereumjs/merkle-patricia-tree/pull/38)
122+
- Fix race condition due to mutated `_getDBs`/`_putDBs`, PR [#28](https://github.com/ethereumjs/merkle-patricia-tree/pull/28)
123+
124+
[2.3.1]: https://github.com/ethereumjs/merkle-patricia-tree/compare/v2.3.0...v2.3.1
125+
126+
## [2.3.0] - 2017-11-30
127+
128+
- Methods for merkle proof generation `Trie.prove()` and verification `Trie.verifyProof()` (see [./proof.js](./proof.js))
129+
130+
[2.3.0]: https://github.com/ethereumjs/merkle-patricia-tree/compare/v2.2.0...v2.3.0
131+
132+
## [2.2.0] - 2017-08-03
133+
134+
- Renamed `root` functions argument to `nodeRef` for passing a node reference
135+
- Make `findPath()` (path to node for given key) a public method
136+
137+
[2.2.0]: https://github.com/ethereumjs/merkle-patricia-tree/compare/v2.1.2...v2.2.0
138+
139+
## [2.1.2] - 2016-03-01
140+
141+
- Added benchmark (see [./benchmarks/](./benchmarks/))
142+
- Updated dependencies
143+
144+
[2.1.2]: https://github.com/ethereumjs/merkle-patricia-tree/compare/v2.1.1...v2.1.2
145+
146+
## [2.1.1] - 2016-01-06
147+
148+
- Added README, API documentation
149+
- Dependency updates
150+
151+
[2.1.1]: https://github.com/ethereumjs/merkle-patricia-tree/compare/2.0.3...v2.1.1
152+
153+
## [2.0.3] - 2015-09-24
154+
155+
- Initial, first of the currently released version on npm
156+
157+
[2.0.3]: https://github.com/ethereumjs/merkle-patricia-tree/compare/1.1.x...2.0.3

0 commit comments

Comments
 (0)