Commit 0efcebd
[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
File tree
20 files changed
+2239
-201
lines changed- .github
- assets
- workflows
- prdoc
- substrate/frame/revive/rpc
- .sqlx
- migrations
- src
20 files changed
+2239
-201
lines changedLarge diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
45 | | - | |
| 45 | + | |
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
49 | | - | |
| 49 | + | |
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 26 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
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