Skip to content

Commit

Permalink
trie: trie package renaming to mpt (#3719)
Browse files Browse the repository at this point in the history
* trie: trie package renaming to mpt

* adjust ci with mpt

* trie: trie package renaming to mpt

* adjust ci with mpt

* mpt: update version

* trie: renaming to mpt for clarity

* mpt: rename

* trie: adjust proof naming scheme

* trie: fix isRawMPTNode import

* trie: don't export internally used verifyRangeProof

* mpt: minor adjustments

* mpt: fix example script
  • Loading branch information
gabrocheleau authored Oct 7, 2024
1 parent 3136bd2 commit 2f70c44
Show file tree
Hide file tree
Showing 163 changed files with 376 additions and 337 deletions.
28 changes: 13 additions & 15 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ jobs:
with:
path: ${{github.workspace}}/packages/ethereum-tests
key: submodule-${{ steps.create-cache-key.outputs.submodule-cache-key}}
outputs:

outputs:
submodule-cache-key: submodule-${{ steps.create-cache-key.outputs.submodule-cache-key}}

build:
Expand All @@ -51,7 +51,7 @@ jobs:
with:
path: ${{github.workspace}}/node_modules
key: npm-${{ hashFiles('package-lock.json') }}

- name: Use Node.js 20
uses: actions/setup-node@v4
with:
Expand All @@ -60,7 +60,7 @@ jobs:

- run: npm ci
working-directory: ${{github.workspace}}

- name: Cache dependencies
uses: actions/cache/save@v4
with:
Expand All @@ -73,7 +73,7 @@ jobs:
path: ${{github.workspace}}
key: npm-${{ hashFiles('package-lock.json') }}-${{ github.run_id }}

outputs:
outputs:
dep-cache-key: ${{ steps.dep-cache.outputs.cache-primary-key }}-${{ github.run_id }}

block:
Expand All @@ -82,7 +82,7 @@ jobs:
with:
dep-cache-key: ${{ needs.build.outputs.dep-cache-key }}
submodule-cache-key: ${{ needs.checkout-submodules.outputs.submodule-cache-key }}

blockchain:
needs: build
uses: ./.github/workflows/blockchain-build.yml
Expand Down Expand Up @@ -139,6 +139,12 @@ jobs:
with:
dep-cache-key: ${{ needs.build.outputs.dep-cache-key }}

mpt:
needs: build
uses: ./.github/workflows/mpt-build.yml
with:
dep-cache-key: ${{ needs.build.outputs.dep-cache-key }}

rlp:
needs: build
uses: ./.github/workflows/rlp-build.yml
Expand All @@ -151,12 +157,6 @@ jobs:
with:
dep-cache-key: ${{ needs.build.outputs.dep-cache-key }}

trie:
needs: build
uses: ./.github/workflows/trie-build.yml
with:
dep-cache-key: ${{ needs.build.outputs.dep-cache-key }}

tx:
needs: [build, checkout-submodules]
uses: ./.github/workflows/tx-build.yml
Expand Down Expand Up @@ -188,7 +188,7 @@ jobs:
uses: ./.github/workflows/wallet-build.yml
with:
dep-cache-key: ${{ needs.build.outputs.dep-cache-key }}

lint:
needs: build
uses: ./.github/workflows/lint.yml
Expand All @@ -201,5 +201,3 @@ jobs:
with:
dep-cache-key: ${{ needs.build.outputs.dep-cache-key }}
submodule-cache-key: ${{ needs.checkout-submodules.outputs.submodule-cache-key }}


Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Trie
name: MPT
on:
workflow_call:
inputs:
Expand All @@ -15,18 +15,18 @@ on:
default: 'none'

env:
cwd: ${{github.workspace}}/packages/trie
cwd: ${{github.workspace}}/packages/mpt

defaults:
run:
working-directory: packages/trie
working-directory: packages/mpt

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}-trie
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}-mpt
cancel-in-progress: true

jobs:
test-trie:
test-mpt:
runs-on: ubuntu-latest

steps:
Expand All @@ -35,7 +35,7 @@ jobs:
uses: actions/checkout@v4

# We restore the code/deps from cache if triggered from workflow_call (i.e. have valid cache key)
- if: inputs.dep-cache-key != 'none'
- if: inputs.dep-cache-key != 'none'
uses: actions/cache/restore@v4
id: dep-cache
with:
Expand All @@ -50,16 +50,16 @@ jobs:

- name: Install Dependencies (if not restored from cache)
if: steps.dep-cache.outputs.cache-hit != 'true'
run: npm ci
run: npm ci
working-directory: ${{ github.workspace }}

- run: npm run coverage
- uses: codecov/codecov-action@v3
with:
files: ${{ env.cwd }}/coverage/lcov.info
flags: trie
flags: mpt

# trie-benchmarks:
# mpt-benchmarks:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
Expand All @@ -85,7 +85,7 @@ jobs:
# # Where the output from the benchmark tool is stored
# output-file-path: ${{ env.cwd }}/output.txt
# # Location of data in gh-pages branch
# benchmark-data-dir-path: dev/bench/trie
# benchmark-data-dir-path: dev/bench/mpt
# # GitHub API token to make a commit comment
# github-token: ${{ secrets.GITHUB_TOKEN }}
# # Push and deploy to GitHub pages branch automatically (if on master)
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/node-versions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ jobs:
run: npm run test:node
working-directory: packages/evm

- name: Test Trie
- name: Test MPT
run: npm run test:node
working-directory: packages/trie
working-directory: packages/mpt

- name: Test Tx
run: npm run test:node
Expand Down
66 changes: 48 additions & 18 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/block/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"dependencies": {
"@ethereumjs/common": "^4.4.0",
"@ethereumjs/rlp": "^5.0.2",
"@ethereumjs/trie": "^6.2.1",
"@ethereumjs/mpt": "^6.2.2",
"@ethereumjs/tx": "^5.4.0",
"@ethereumjs/util": "^9.1.0",
"ethereum-cryptography": "^3.0.0"
Expand Down
2 changes: 1 addition & 1 deletion packages/block/src/block/block.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ConsensusType } from '@ethereumjs/common'
import { MerklePatriciaTrie } from '@ethereumjs/mpt'
import { RLP } from '@ethereumjs/rlp'
import { MerklePatriciaTrie } from '@ethereumjs/trie'
import { Blob4844Tx, Capability } from '@ethereumjs/tx'
import {
BIGINT_0,
Expand Down
2 changes: 1 addition & 1 deletion packages/block/src/block/constructors.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { MerklePatriciaTrie } from '@ethereumjs/mpt'
import { RLP } from '@ethereumjs/rlp'
import { MerklePatriciaTrie } from '@ethereumjs/trie'
import {
type TxOptions,
createTx,
Expand Down
2 changes: 1 addition & 1 deletion packages/block/src/helpers.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { MerklePatriciaTrie } from '@ethereumjs/mpt'
import { RLP } from '@ethereumjs/rlp'
import { MerklePatriciaTrie } from '@ethereumjs/trie'
import { Blob4844Tx } from '@ethereumjs/tx'
import { BIGINT_0, BIGINT_1, TypeOutput, isHexString, toType } from '@ethereumjs/util'

Expand Down
2 changes: 1 addition & 1 deletion packages/block/tsconfig.prod.cjs.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"references": [
{ "path": "../common/tsconfig.prod.cjs.json" },
{ "path": "../rlp/tsconfig.prod.cjs.json" },
{ "path": "../trie/tsconfig.prod.cjs.json" },
{ "path": "../mpt/tsconfig.prod.cjs.json" },
{ "path": "../tx/tsconfig.prod.cjs.json" },
{ "path": "../util/tsconfig.prod.cjs.json" }
]
Expand Down
2 changes: 1 addition & 1 deletion packages/block/tsconfig.prod.esm.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"references": [
{ "path": "../common/tsconfig.prod.esm.json" },
{ "path": "../rlp/tsconfig.prod.esm.json" },
{ "path": "../trie/tsconfig.prod.esm.json" },
{ "path": "../mpt/tsconfig.prod.esm.json" },
{ "path": "../tx/tsconfig.prod.esm.json" },
{ "path": "../util/tsconfig.prod.esm.json" }
]
Expand Down
2 changes: 1 addition & 1 deletion packages/blockchain/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"@ethereumjs/block": "^5.3.0",
"@ethereumjs/common": "^4.4.0",
"@ethereumjs/rlp": "^5.0.2",
"@ethereumjs/trie": "^6.2.1",
"@ethereumjs/mpt": "^6.2.2",
"@ethereumjs/tx": "^5.4.0",
"@ethereumjs/util": "^9.1.0",
"debug": "^4.3.3",
Expand Down
4 changes: 2 additions & 2 deletions packages/blockchain/src/helpers.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ChainGenesis } from '@ethereumjs/common'
import { genesisStateRoot as genMerkleGenesisStateRoot } from '@ethereumjs/trie'
import { genesisMPTStateRoot } from '@ethereumjs/mpt'

import type { Chain, Common } from '@ethereumjs/common'
import type { GenesisState } from '@ethereumjs/util'
Expand Down Expand Up @@ -29,7 +29,7 @@ export async function genGenesisStateRoot(
if (genCommon.isActivatedEIP(6800)) {
throw Error(`Verkle tree state not yet supported`)
} else {
return genMerkleGenesisStateRoot(genesisState)
return genesisMPTStateRoot(genesisState)
}
}

Expand Down
Loading

0 comments on commit 2f70c44

Please sign in to comment.