Skip to content

Conversation

xqft
Copy link
Contributor

@xqft xqft commented Jan 13, 2025

Motivation

We want to benchmark our block prover against other solutions, using Ethereum mainnet/testnet blocks. For this we need to fetch state from an Ethereum chain.

Description

  • adds l2/prover/bench crate
  • adds state fetching functions from the JSON-RPC API (account, block, storage, proofs)
  • adds a RpcDB type to download and cache needed state during block execution
  • adds an execute() function to the Prover type

Some bugs were discovered while testing execution of blocks:

  • fixes state verification (via state and storage MPTs), verify_db()
  • fixes withdrawals not being processed when using ExecutionDB
  • fixes beacon root call state changes not being comitted when using ExecutionDB
  • fixes serialization errors in SP1 caused by the requests_hash field of a block header

Copy link

github-actions bot commented Jan 13, 2025

| File                                                                       | Lines | Diff |
+----------------------------------------------------------------------------+-------+------+
| /home/runner/work/ethrex/ethrex/cmd/ethrex_l2/src/commands/test.rs         | 207   | -3   |
+----------------------------------------------------------------------------+-------+------+
| /home/runner/work/ethrex/ethrex/crates/blockchain/blockchain.rs            | 203   | -9   |
+----------------------------------------------------------------------------+-------+------+
| /home/runner/work/ethrex/ethrex/crates/blockchain/payload.rs               | 546   | -15  |
+----------------------------------------------------------------------------+-------+------+
| /home/runner/work/ethrex/ethrex/crates/l2/proposer/prover_server.rs        | 457   | +8   |
+----------------------------------------------------------------------------+-------+------+
| /home/runner/work/ethrex/ethrex/crates/l2/prover/bench/src/cache.rs        | 23    | +23  |
+----------------------------------------------------------------------------+-------+------+
| /home/runner/work/ethrex/ethrex/crates/l2/prover/bench/src/constants.rs    | 39    | +39  |
+----------------------------------------------------------------------------+-------+------+
| /home/runner/work/ethrex/ethrex/crates/l2/prover/bench/src/lib.rs          | 3     | +3   |
+----------------------------------------------------------------------------+-------+------+
| /home/runner/work/ethrex/ethrex/crates/l2/prover/bench/src/main.rs         | 101   | +101 |
+----------------------------------------------------------------------------+-------+------+
| /home/runner/work/ethrex/ethrex/crates/l2/prover/bench/src/rpc/db.rs       | 413   | +413 |
+----------------------------------------------------------------------------+-------+------+
| /home/runner/work/ethrex/ethrex/crates/l2/prover/bench/src/rpc/mod.rs      | 319   | +319 |
+----------------------------------------------------------------------------+-------+------+
| /home/runner/work/ethrex/ethrex/crates/l2/prover/src/prover.rs             | 146   | +28  |
+----------------------------------------------------------------------------+-------+------+
| /home/runner/work/ethrex/ethrex/crates/l2/prover/zkvm/interface/build.rs   | 29    | +14  |
+----------------------------------------------------------------------------+-------+------+
| /home/runner/work/ethrex/ethrex/crates/l2/prover/zkvm/interface/src/lib.rs | 179   | +15  |
+----------------------------------------------------------------------------+-------+------+
| /home/runner/work/ethrex/ethrex/crates/l2/utils/prover/proving_systems.rs  | 128   | +5   |
+----------------------------------------------------------------------------+-------+------+
| /home/runner/work/ethrex/ethrex/crates/l2/utils/test_data_io.rs            | 88    | +3   |
+----------------------------------------------------------------------------+-------+------+
| /home/runner/work/ethrex/ethrex/crates/vm/backends/revm_b.rs               | 554   | +29  |
+----------------------------------------------------------------------------+-------+------+
| /home/runner/work/ethrex/ethrex/crates/vm/db.rs                            | 363   | +188 |
+----------------------------------------------------------------------------+-------+------+
| /home/runner/work/ethrex/ethrex/crates/vm/execution_db.rs                  | 175   | -54  |
+----------------------------------------------------------------------------+-------+------+

Total lines added: +1188
Total lines removed: 81
Total lines changed: 1269

@xqft xqft changed the base branch from main to l2/touched_state January 15, 2025 20:46
Copy link
Contributor

@fborello-lambda fborello-lambda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ready to merge 🚀

I would add a block cache to test the bench quickly.

@jrchatruc jrchatruc enabled auto-merge February 24, 2025 14:09
.PHONY: sp1

# Execution only
ifdef BLOCK_NUMBER
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where does block number come from?

)))
}

fn execute(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this working after updating Rust to 1.82?

@jrchatruc jrchatruc added this pull request to the merge queue Feb 24, 2025
Merged via the queue into main with commit 1084c97 Feb 24, 2025
24 checks passed
@jrchatruc jrchatruc deleted the l2/rpc_bench branch February 24, 2025 20:37
JereSalo pushed a commit that referenced this pull request Feb 28, 2025
**Motivation**

We want to benchmark our block prover against other solutions, using
Ethereum mainnet/testnet blocks. For this we need to fetch state from an
Ethereum chain.

**Description**

- adds `l2/prover/bench` crate
- adds state fetching functions from the JSON-RPC API (account, block,
storage, proofs)
- adds a `RpcDB` type to download and cache needed state during block
execution
- adds an `execute()` function to the `Prover` type

Some bugs were discovered while testing execution of blocks:
- fixes state verification (via state and storage MPTs), `verify_db()`
- fixes withdrawals not being processed when using `ExecutionDB`
- fixes beacon root call state changes not being comitted when using
`ExecutionDB`
- fixes serialization errors in SP1 caused by the `requests_hash` field
of a block header

---------

Co-authored-by: Mario Rugiero <[email protected]>
Co-authored-by: fborello-lambda <[email protected]>
Co-authored-by: Javier Chatruc <[email protected]>
Co-authored-by: ilitteri <[email protected]>
fkrause98 pushed a commit that referenced this pull request Mar 5, 2025
**Motivation**

We want to benchmark our block prover against other solutions, using
Ethereum mainnet/testnet blocks. For this we need to fetch state from an
Ethereum chain.

**Description**

- adds `l2/prover/bench` crate
- adds state fetching functions from the JSON-RPC API (account, block,
storage, proofs)
- adds a `RpcDB` type to download and cache needed state during block
execution
- adds an `execute()` function to the `Prover` type

Some bugs were discovered while testing execution of blocks:
- fixes state verification (via state and storage MPTs), `verify_db()`
- fixes withdrawals not being processed when using `ExecutionDB`
- fixes beacon root call state changes not being comitted when using
`ExecutionDB`
- fixes serialization errors in SP1 caused by the `requests_hash` field
of a block header

---------

Co-authored-by: Mario Rugiero <[email protected]>
Co-authored-by: fborello-lambda <[email protected]>
Co-authored-by: Javier Chatruc <[email protected]>
Co-authored-by: ilitteri <[email protected]>
fkrause98 pushed a commit that referenced this pull request Mar 5, 2025
**Motivation**

We want to benchmark our block prover against other solutions, using
Ethereum mainnet/testnet blocks. For this we need to fetch state from an
Ethereum chain.

**Description**

- adds `l2/prover/bench` crate
- adds state fetching functions from the JSON-RPC API (account, block,
storage, proofs)
- adds a `RpcDB` type to download and cache needed state during block
execution
- adds an `execute()` function to the `Prover` type

Some bugs were discovered while testing execution of blocks:
- fixes state verification (via state and storage MPTs), `verify_db()`
- fixes withdrawals not being processed when using `ExecutionDB`
- fixes beacon root call state changes not being comitted when using
`ExecutionDB`
- fixes serialization errors in SP1 caused by the `requests_hash` field
of a block header

---------

Co-authored-by: Mario Rugiero <[email protected]>
Co-authored-by: fborello-lambda <[email protected]>
Co-authored-by: Javier Chatruc <[email protected]>
Co-authored-by: ilitteri <[email protected]>
pedrobergamini pushed a commit to pedrobergamini/ethrex that referenced this pull request Aug 24, 2025
…based approach (lambdaclass#1709)

**Motivation**

A `ExecutionDB` is created from a block's pre-execution but the current
implementation is incorrect and not all needed data gets stored. The
goal is to replace this with another approach, using an auxiliary
"caching" database that will retrieve data from a `Store` or an RPC
endpoint (like in lambdaclass#1705) during the pre-execution of a block, finally
resulting in a db that contains all the needed execution data.

**Description**

- replace `ExecutionDB::from_exec()` to use the `CacheDB`, rename it to
`from_store()`
- some refactors
pedrobergamini pushed a commit to pedrobergamini/ethrex that referenced this pull request Aug 24, 2025
…class#1705)

**Motivation**

We want to benchmark our block prover against other solutions, using
Ethereum mainnet/testnet blocks. For this we need to fetch state from an
Ethereum chain.

**Description**

- adds `l2/prover/bench` crate
- adds state fetching functions from the JSON-RPC API (account, block,
storage, proofs)
- adds a `RpcDB` type to download and cache needed state during block
execution
- adds an `execute()` function to the `Prover` type

Some bugs were discovered while testing execution of blocks:
- fixes state verification (via state and storage MPTs), `verify_db()`
- fixes withdrawals not being processed when using `ExecutionDB`
- fixes beacon root call state changes not being comitted when using
`ExecutionDB`
- fixes serialization errors in SP1 caused by the `requests_hash` field
of a block header

---------

Co-authored-by: Mario Rugiero <[email protected]>
Co-authored-by: fborello-lambda <[email protected]>
Co-authored-by: Javier Chatruc <[email protected]>
Co-authored-by: ilitteri <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

L2 Rollup client

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants