Skip to content

perf(core): make disklayer in snapshots use the database#2848

Merged
edg-l merged 11 commits into
edgl_snapshots_v2from
edgl_disklayer_db
May 22, 2025
Merged

perf(core): make disklayer in snapshots use the database#2848
edg-l merged 11 commits into
edgl_snapshots_v2from
edgl_disklayer_db

Conversation

@edg-l

@edg-l edg-l commented May 20, 2025

Copy link
Copy Markdown
Contributor

Motivation

Continuation of #2664

Implements the disk layer to use the database and save full snapshots.

@edg-l edg-l requested a review from a team as a code owner May 20, 2025 12:18
@edg-l edg-l marked this pull request as draft May 20, 2025 12:18
@edg-l edg-l added the performance Block execution throughput and performance in general label May 20, 2025
@github-actions

github-actions Bot commented May 20, 2025

Copy link
Copy Markdown

Lines of code report

Total lines added: 288
Total lines removed: 2
Total lines changed: 290

Detailed view
+---------------------------------------------+-------+------+
| File                                        | Lines | Diff |
+---------------------------------------------+-------+------+
| ethrex/crates/storage/api.rs                | 266   | +17  |
+---------------------------------------------+-------+------+
| ethrex/crates/storage/snapshot/difflayer.rs | 206   | -2   |
+---------------------------------------------+-------+------+
| ethrex/crates/storage/snapshot/disklayer.rs | 177   | +43  |
+---------------------------------------------+-------+------+
| ethrex/crates/storage/snapshot/error.rs     | 24    | +3   |
+---------------------------------------------+-------+------+
| ethrex/crates/storage/snapshot/tree.rs      | 707   | +41  |
+---------------------------------------------+-------+------+
| ethrex/crates/storage/store.rs              | 1342  | +29  |
+---------------------------------------------+-------+------+
| ethrex/crates/storage/store_db/in_memory.rs | 632   | +31  |
+---------------------------------------------+-------+------+
| ethrex/crates/storage/store_db/libmdbx.rs   | 1413  | +57  |
+---------------------------------------------+-------+------+
| ethrex/crates/storage/store_db/redb.rs      | 1269  | +67  |
+---------------------------------------------+-------+------+

@github-actions

github-actions Bot commented May 21, 2025

Copy link
Copy Markdown

Benchmark Block Execution Results Comparison Against Main

Command Mean [s] Min [s] Max [s] Relative
base 213.955 ± 1.466 212.321 216.574 1.00 ± 0.01
head 213.179 ± 0.937 211.110 214.558 1.00

@edg-l

edg-l commented May 22, 2025

Copy link
Copy Markdown
Contributor Author

pr commit: a8ca81f

macOS M3 36gb

pr load-test:

First blocks: 0.58, 0.55, 0.54

Last blocks 0.38, 0.37, 0.32

pr load-test-erc20:

First blocks: 1.04, 0.86, 0.83, 0.99, 0.99

Last blocks: 0.58, 0.58, 0.56

Main:

load-test:

First blocks: 0.38, 0.23, 0.23, 0.30, 0.27
Last blocks: 0.21, 0.20, 0.12

load-test-erc20:

First blocks: 0.60, 0.53, 0.47, 0.48, 0.58, 0.56, 0.54
Last blocks: 0.40, 0.40, 0.36

@edg-l edg-l marked this pull request as ready for review May 22, 2025 10:38
@edg-l

edg-l commented May 22, 2025

Copy link
Copy Markdown
Contributor Author

merging into the other pr

@edg-l edg-l merged commit 3bd6661 into edgl_snapshots_v2 May 22, 2025
22 of 29 checks passed
@edg-l edg-l deleted the edgl_disklayer_db branch May 22, 2025 12:28
edg-l added a commit that referenced this pull request May 13, 2026
Mirrors EELS PR #2848 (tests-bal@v7.1.1, devnets/bal/7):
ethereum/execution-specs#2848

PR #2836 already refunded the 23-byte AUTH_BASE portion when the
authority's pre-state code slot held a delegation indicator. #2848
broadens the condition: when the auth is a clear (`auth.address ==
0x00`), no new indicator bytes are written regardless of pre-state
code, so the AUTH_BASE refill applies even against an authority with
no prior code.

Equivalent to EELS:
    if authority_account.code_hash != EMPTY_CODE_HASH
       or auth.address == NULL_ADDRESS:
        refund = STATE_BYTES_PER_AUTH_BASE * COST_PER_STATE_BYTE
edg-l added a commit that referenced this pull request May 13, 2026
Picks up EELS PR #2848 (refund AUTH_BASE on delegation clear),
implemented in the previous commit. Eels_commit bumped to bcb8dc5f8
(tip of tests-bal@v7.1.1).
akshay-ap pushed a commit to akshay-ap/ethrex that referenced this pull request May 19, 2026
**Motivation**

Bring ethrex up to bal-devnet-7 (BAL fixtures `bal@v7.1.1`). Stacked
on top of #bal-devnet-6-pr (now in main).

**Description**

Aligns EIP-8037 state-gas accounting with bal-devnet-7 spec progression
(EELS PRs lambdaclass#2815 / lambdaclass#2816 / lambdaclass#2823 / lambdaclass#2827 / lambdaclass#2828 / lambdaclass#2836 / lambdaclass#2845 /
lambdaclass#2848),
bumps Amsterdam fixtures from `snobal-devnet-6@v1.1.0` to `bal@v7.1.1`,
and bumps the pinned hive version past the ethrex `--http.api` fix.

Main changes:

- EIP-8037 state-gas alignment with bal-devnet-7:
  - System-call state-gas reservoir.
  - Halt refunds spilled state gas (Policy A).
  - Tx-level CREATE failure refunds intrinsic `NEW_ACCOUNT`;
    `intrinsic_state_gas_charged` preserved across the failure path.
  - Tx-CREATE collision refund with regular-gas burn; billing matches
    EELS.
  - Cross-frame revert leaks inline credits.
  - Cross-frame revert reservoir formula fix.
  - Block-level `state_gas_used` subtracts `state_refund`.
- Remove same-tx SELFDESTRUCT state-gas refund (EELS PR lambdaclass#2845, v7.1.0).
- EIP-7702:
  - `set_delegation` refund via dedicated `state_refund` channel.
  - `set_delegation` refunds `AUTH_BASE` on existing delegation
    (EELS PR lambdaclass#2836).
  - `set_delegation` refunds `AUTH_BASE` on delegation clear
    (EELS PR lambdaclass#2848, v7.1.1).
- levm fixes pulled from main:
  - `revert` doesn't unmark the account as existing (lambdaclass#6592).
  - Account erroneously considered as existing after zero-value transfer
    (lambdaclass#6591).
- Tooling / tests:
  - Per-tx gas-dimension dump on block `gas_used` mismatch.
  - Bump Amsterdam fixtures to `bal@v7.1.1`.
  - Annotate BAL balance-mismatch errors with gas-equivalent diff and
    recognised state-gas constant multiples.
  - Unskip 74 bal-devnet-6 Amsterdam fixtures now passing.
  - Skip 21 stale EIP-8025 fixtures pinned at `bal@v5.7.0`
    (zkevm@v0.3.3 bundle, pre-bal-7).
  - Drop stale bal-devnet-6 known-issues entries from
    `docs/known_issues.md` and hive `KNOWN_EXCLUDED_TESTS`.
- CI:
  - Bump pinned hive version past the ethrex `--http.api` flag
    feature-detect fix (`c4d839b3`, hive lambdaclass#1485). Without this, hive
    starts ethrex with the default HTTP namespace allowlist
    (`eth,net,web3`) and tests touching `admin_*`/`debug_*`/`txpool_*`
    fail.

**Local test run**

`./run_test.sh` against `tests-bal@v7.1.1`: 2,145 / 2,145 pass.
`cargo test -p ethrex-test --tests`: 453 / 453 pass.

**Checklist**

- [ ] Updated `STORE_SCHEMA_VERSION` (crates/storage/lib.rs) if the PR
  includes breaking changes to the `Store` requiring a re-sync.

---------

Co-authored-by: Lucas Fiegl <iovoid@users.noreply.github.com>
Co-authored-by: Ivan Litteri <67517699+ilitteri@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

performance Block execution throughput and performance in general

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant