Skip to content

Commit 2f094d8

Browse files
xqftjrchatruc
andauthored
fix(l2): bench crate (#2601)
**Motivation** <!-- Why does this pull request exist? What are its goals? --> **Description** <!-- A clear and concise general description of the changes this PR introduces --> <!-- Link to issues: Resolves #111, Resolves #222 --> Closes #issue_number --------- Co-authored-by: Javier Chatruc <[email protected]>
1 parent 470a3ac commit 2f094d8

File tree

4 files changed

+12
-25
lines changed

4 files changed

+12
-25
lines changed

.github/workflows/pr-main_l1.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@ jobs:
3030
uses: Swatinem/rust-cache@v2
3131

3232
- name: Run cargo check
33-
run: cargo check --workspace
33+
run: cargo check --workspace --exclude ethrex-prover-bench
3434

3535
- name: Run cargo clippy
3636
run: |
37-
cargo clippy --workspace -- -D warnings
38-
cargo clippy --all-targets --all-features --workspace --exclude ethrex-prover --exclude zkvm_interface -- -D warnings
37+
cargo clippy --workspace --exclude ethrex-prover-bench -- -D warnings
38+
cargo clippy --all-targets --all-features --workspace --exclude ethrex-prover --exclude ethrex-prover-bench --exclude zkvm_interface -- -D warnings
3939
4040
- name: Run cargo fmt
4141
run: |

.github/workflows/pr-main_l2.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,12 @@ jobs:
6262
uses: Swatinem/rust-cache@v2
6363

6464
- name: Run cargo check
65-
run: cargo check --workspace
65+
run: cargo check --workspace --exclude ethrex-prover-bench
6666

6767
- name: Run cargo clippy
6868
run: |
69-
cargo clippy --workspace -- -D warnings
70-
cargo clippy --all-targets --all-features --workspace --exclude ethrex-prover --exclude zkvm_interface -- -D warnings
69+
cargo clippy --workspace --exclude ethrex-prover-bench -- -D warnings
70+
cargo clippy --all-targets --all-features --workspace --exclude ethrex-prover --exclude zkvm_interface --exclude ethrex-prover-bench -- -D warnings
7171
7272
- name: Run cargo fmt
7373
run: |

Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ members = [
1515
"crates/l2/",
1616
"crates/l2/contracts",
1717
"crates/l2/prover",
18+
"crates/l2/prover/bench",
1819
"crates/l2/sdk",
1920
"crates/networking/p2p",
2021
"crates/networking/rpc",

crates/l2/prover/bench/src/rpc/db.rs

+5-19
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ use std::cell::RefCell;
22
use std::collections::HashMap;
33

44
use crate::constants::{CANCUN_CONFIG, RPC_RATE_LIMIT};
5-
use crate::rpc::{get_account, retry};
5+
use crate::rpc::{get_account, get_block, retry};
66

77
use bytes::Bytes;
88
use ethrex_common::{
9-
types::{AccountInfo, AccountState, Block, TxKind},
9+
types::{AccountInfo, AccountState, Block, Fork, TxKind},
1010
Address, H256, U256,
1111
};
1212
use ethrex_levm::db::Database as LevmDatabase;
@@ -245,9 +245,9 @@ impl RpcDB {
245245
let mut db = GeneralizedDatabase::new(Arc::new(self.clone()), CacheDB::new());
246246

247247
// pre-execute and get all state changes
248-
let execution_updates = LEVM::execute_block(block, &mut db)
249-
.map_err(Box::new)?
250-
.account_updates;
248+
let result = LEVM::execute_block(block, &mut db).map_err(Box::new)?;
249+
let execution_updates =
250+
LEVM::get_state_transitions(&mut db, Fork::default()).map_err(Box::new)?;
251251

252252
let index: Vec<(Address, Vec<H256>)> = self
253253
.cache
@@ -508,20 +508,6 @@ impl LevmDatabase for RpcDB {
508508
fn get_chain_config(&self) -> ethrex_common::types::ChainConfig {
509509
*CANCUN_CONFIG
510510
}
511-
512-
fn get_account_info_by_hash(
513-
&self,
514-
_block_hash: ethrex_common::types::BlockHash,
515-
address: Address,
516-
) -> Result<Option<ethrex_common::types::AccountInfo>, DatabaseError> {
517-
// TODO: Fetch the block from the RPC API given its block hash.
518-
let info = self.get_account_info(address)?;
519-
Ok(Some(ethrex_common::types::AccountInfo {
520-
code_hash: info.bytecode_hash(),
521-
balance: info.balance,
522-
nonce: info.nonce,
523-
}))
524-
}
525511
}
526512

527513
/// Get all potential child nodes of a node whose value was deleted.

0 commit comments

Comments
 (0)