Skip to content

Commit 0efcebd

Browse files
[eth-rpc]: add resumable block sync and improve CLI arguments (#11153)
- New `block_sync` module syncs backward from the latest finalized block to the first EVM block, with restart-safe checkpoint tracking via a `sync_state` SQLite table. - On restart, fills only the top gap (new blocks) and bottom gap (remaining backfill) without re-syncing completed ranges. - Auto-discovers and persists `first_evm_block` — the lowest block with EVM support on the chain. - Chain identity verification: stores genesis hash in `sync_state` and validates on startup; detects stale boundaries after reorgs. New `--eth-pruning` flag replaces `--database-url`, `--cache-size`, `--index-last-n-blocks`, and `--earliest-receipt-block`: - `--eth-pruning archive` (default): persistent on-disk DB with backward historical sync. - `--eth-pruning <N>`: in-memory DB keeping the latest N blocks. | Previous flag | Replacement | Notes | |---|---|---| | `--cache-size N` | `--eth-pruning N` | In-memory DB, keeps latest N blocks | | `--database-url sqlite::memory:` | `--eth-pruning N` | --eth-pruning N always uses in-memory DB | | `--database-url /path/to/db.sqlite` | `--base-path /path/to/dir` | Persistent DB stored as `eth-rpc.db` inside the directory | | `--index-last-n-blocks N` | `--eth-pruning archive` | Syncs all finalized blocks down to the first EVM block | | `--earliest-receipt-block N` | _(removed)_ | Replaced by auto-discovered `first_evm_block` | > **Note:** `--dev` automatically uses a temporary directory with an on-disk DB, which is deleted on exit. > **Note:** When `--base-path` is omitted, the DB is stored in the default OS data directory: > - macOS: `~/Library/Application Support/eth-rpc/` > - Linux: `~/.local/share/eth-rpc/` > - Windows: `%APPDATA%\eth-rpc\` ```bash eth-rpc --dev eth-rpc --node-rpc-url wss://example.com:443 --eth-pruning 512 eth-rpc --node-rpc-url wss://example.com:443 eth-rpc --node-rpc-url wss://example.com:443 --base-path /data/eth-rpc eth-rpc --node-rpc-url wss://example.com:443 --eth-pruning archive paritytech/contract-issues#271 --------- Co-authored-by: cmd[bot] <41898282+github-actions[bot]@users.noreply.github.com> (cherry picked from commit 8c6f760)
1 parent 2f9a3d8 commit 0efcebd

20 files changed

+2239
-201
lines changed

.github/assets/revive-dev-node-polkavm-resolc.json

Lines changed: 650 additions & 12 deletions
Large diffs are not rendered by default.
Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,13 @@
1-
{}
1+
{
2+
"fixtures/solidity/complex/create/create2_many/test.json::1::E M3 S+": "Failed",
3+
"fixtures/solidity/complex/create/create2_many/test.json::1::Y M3 S+": "Failed",
4+
"fixtures/solidity/complex/create/create_many/test.json::1::E M3 S+": "Failed",
5+
"fixtures/solidity/complex/create/create_many/test.json::1::Y M3 S+": "Failed",
6+
"fixtures/solidity/translated_semantic_tests/array/array_storage_index_boundary_test/test.json::0::E M0 S-": "Failed",
7+
"fixtures/solidity/translated_semantic_tests/array/array_storage_push_empty/test.json::0::E M0 S-": "Failed",
8+
"fixtures/solidity/translated_semantic_tests/array/copying/bytes_storage_to_storage/test.json::0::E M0 S-": "Failed",
9+
"fixtures/solidity/translated_semantic_tests/array/copying/nested_array_element_storage_to_memory/test.json::0::E M0 S-": "Failed",
10+
"fixtures/solidity/translated_semantic_tests/array/copying/nested_array_element_storage_to_storage/test.json::0::E M0 S-": "Failed",
11+
"fixtures/solidity/translated_semantic_tests/events/event_indexed_string/test.json::0::E M0 S-": "Failed",
12+
"fixtures/solidity/translated_semantic_tests/storageLayoutSpecifier/mapping_storage_end/test.json::0::E M0 S-": "Failed"
13+
}

.github/workflows/tests-evm.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,11 @@ jobs:
4242
id: download
4343
uses: ./.github/actions/get-resolc
4444
- name: Run revive differential tests
45-
uses: paritytech/revive-differential-tests/.github/actions/run-differential-tests@004a36f4e88228ee1331cb598c8873ab7315e3f0
45+
uses: paritytech/revive-differential-tests/.github/actions/run-differential-tests@b9cff329db2c981f706297150c6cb1f4a5d490c3
4646
with:
4747
platform: ${{ matrix.platform }}
4848
cargo-command: "forklift cargo"
49-
revive-differential-tests-ref: "004a36f4e88228ee1331cb598c8873ab7315e3f0"
49+
revive-differential-tests-ref: "b9cff329db2c981f706297150c6cb1f4a5d490c3"
5050
resolc-path: ${{ steps.download.outputs.resolc-path }}
5151
expectations-file-path: ./.github/assets/${{ matrix.platform }}.json
5252

Cargo.lock

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

prdoc/pr_11153.prdoc

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
title: '[eth-rpc]: add resumable block sync and improve CLI arguments'
2+
doc:
3+
- audience: Runtime Dev
4+
description: |
5+
### Resumable block sync
6+
- New block_sync module syncs backward from the latest finalized block to the first EVM block, with restart-safe checkpoint tracking via a sync_state SQLite table.
7+
- On restart, fills only the top gap (new blocks) and bottom gap (remaining backfill) without re-syncing completed ranges.
8+
- Auto-discovers and persists `first_evm_block` — the lowest block with EVM support on the chain.
9+
- Chain identity verification: validates stored genesis hash on startup to detect database reuse across different chains; verifies sync boundary hashes to detect pruned blocks on the connected node.
10+
11+
### CLI rework
12+
New `--eth-pruning` flag replaces `--database-url`, `--cache-size`, `--index-last-n-blocks`, and `--earliest-receipt-block`:
13+
- `--eth-pruning archive` (default): persistent on-disk DB with backward historical sync.
14+
- `--eth-pruning <N>`: in-memory DB keeping the latest N blocks.
15+
crates:
16+
- name: pallet-revive-eth-rpc
17+
bump: major

substrate/frame/revive/rpc/.sqlx/query-0b667102134cdbe0776b46a8ffa651cefd9590006ea59b8fa7490dae024c16ac.json

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

substrate/frame/revive/rpc/.sqlx/query-2e21c8b990a008294d9cbaa229d521a7a2e2fa33b3d93b5c2c7aece64a4fe79b.json

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

substrate/frame/revive/rpc/.sqlx/query-481e21860552d88454b30e7e5cb31748994229fa131fa9b608c987cbd97b3b6c.json

Lines changed: 26 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

substrate/frame/revive/rpc/.sqlx/query-872ea7628d20866aa6e9e701e8c2f5d5d045f26ad888d26ff07d4cd5130c398f.json

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

substrate/frame/revive/rpc/.sqlx/query-fa3e8dbe73656b1dfee46df2deee48cae1255f7d77bd8d1b403ddc057a5d0b2c.json

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)