Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
2239cce
start adding support for more tests
JereSalo Oct 7, 2025
f0a35b0
add more fork variants and dont return error if expected exception do…
JereSalo Oct 7, 2025
dccc615
add support for post state hash
JereSalo Oct 7, 2025
1ec79df
comment tests we dont want to run
JereSalo Oct 7, 2025
2455583
improve some comments
JereSalo Oct 7, 2025
e770f54
rename network to fork
JereSalo Oct 7, 2025
86c50b5
remove unnecessary checks
JereSalo Oct 7, 2025
dbe4eb8
typo
JereSalo Oct 7, 2025
163d91c
remove unnecessary code
JereSalo Oct 7, 2025
5683de0
update gitignore
JereSalo Oct 7, 2025
05a0280
restore mistake i made
JereSalo Oct 7, 2025
934c8b8
vectors targets
JereSalo Oct 7, 2025
b31f222
refactor all.rs to make it prettier
JereSalo Oct 7, 2025
21f46c4
add some reasons for skipped tests
JereSalo Oct 7, 2025
219a252
add reasons of skipped tests
JereSalo Oct 7, 2025
cd220b9
change comment in createBlobhashTx test
JereSalo Oct 7, 2025
2dbeb13
add comment
JereSalo Oct 7, 2025
965f493
Update tooling/ef_tests/blockchain/tests/all.rs
JereSalo Oct 8, 2025
a1b90fb
Update tooling/ef_tests/blockchain/fork.rs
JereSalo Oct 8, 2025
7d454f9
update comment
JereSalo Oct 8, 2025
0821ac7
merge changes from other branch
JereSalo Oct 8, 2025
b9f4354
fix skipped tests in stateless execution
JereSalo Oct 8, 2025
b3445ff
first iteration of having storage root in evm
JereSalo Oct 8, 2025
8c65367
remove skipped tests and impl default for levmaccount
JereSalo Oct 8, 2025
0edc0f2
stop skipping some tests and add comments
JereSalo Oct 8, 2025
eaaa143
improve comments
JereSalo Oct 8, 2025
b9c5dbe
clippy lint
JereSalo Oct 8, 2025
628ec36
add comment
JereSalo Oct 8, 2025
0cae51d
add comment
JereSalo Oct 8, 2025
16d89fb
add comment
JereSalo Oct 8, 2025
ddc3c46
Delete tooling/ef_tests/state/Cargo.lock
JereSalo Oct 8, 2025
7822ca4
add extra skips to sp1
JereSalo Oct 8, 2025
6da2845
add comment
JereSalo Oct 8, 2025
5fa99a1
Merge branch 'skipped_tests_reason' into levm/get_storage_root
JereSalo Oct 8, 2025
c9891d1
uncomment commented test
JereSalo Oct 9, 2025
822d5ec
merge main
JereSalo Oct 9, 2025
8d2e3ec
merge other branch
JereSalo Oct 9, 2025
3f09178
improve comments
JereSalo Oct 9, 2025
8dab81c
add comment and rename to has_storage
JereSalo Oct 9, 2025
a63a566
update comments
JereSalo Oct 9, 2025
1f67670
Merge branch 'main' into skipped_tests_reason
JereSalo Oct 9, 2025
0b73e7a
merge main
JereSalo Oct 9, 2025
6fe1bfc
Merge branch 'main' into skipped_tests_reason
JereSalo Oct 9, 2025
bd4c43b
Update tooling/ef_tests/blockchain/tests/all.rs
JereSalo Oct 10, 2025
8db673b
Delete tooling/ef_tests/state/Cargo.lock
JereSalo Oct 13, 2025
a307fb3
remove comments
JereSalo Oct 13, 2025
617fb61
merge other branch
JereSalo Oct 13, 2025
715b088
start simplifying trait
JereSalo Oct 13, 2025
d87a7c5
clippy lints
JereSalo Oct 13, 2025
af3e402
remove arc again
JereSalo Oct 13, 2025
58013de
remove comment
JereSalo Oct 13, 2025
f09efe3
run cargo fmt
JereSalo Oct 13, 2025
d44fb4e
improve comments
JereSalo Oct 13, 2025
9cd86b8
remove dyn clone crate
JereSalo Oct 13, 2025
01163d9
remove arc import
JereSalo Oct 13, 2025
0934abd
make some fixes
JereSalo Oct 13, 2025
08a320a
add git ignore
JereSalo Oct 13, 2025
4c7754a
change some things for revm runner
JereSalo Oct 13, 2025
b6ee5b5
change some things for revm runner
JereSalo Oct 13, 2025
9dc3a0e
change some things for revm runner 2
JereSalo Oct 13, 2025
f079e01
update lockfiles
JereSalo Oct 13, 2025
4014df9
move StoreVmDatabase to vm crate
JereSalo Oct 14, 2025
6b464d4
delete report
JereSalo Oct 14, 2025
bc37f5e
cargo fmt
JereSalo Oct 14, 2025
ed668ac
update lockfiles
JereSalo Oct 14, 2025
d7cc491
simple fixes
JereSalo Oct 15, 2025
f11a200
merge main
JereSalo Oct 15, 2025
ee3eab1
Merge branch 'main' into simplify_vm_database_trait
JereSalo Oct 15, 2025
3c1af30
import types on top witness.rs
JereSalo Oct 16, 2025
4ecefe9
Merge branch 'main' into simplify_vm_database_trait
JereSalo Oct 16, 2025
32dc09f
Merge branch 'main' into simplify_vm_database_trait
JereSalo Oct 17, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 7 additions & 9 deletions crates/blockchain/blockchain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ pub mod mempool;
pub mod payload;
mod smoke_test;
pub mod tracing;
pub mod vm;

use ::tracing::{debug, info};
use constants::{MAX_INITCODE_SIZE, MAX_TRANSACTION_DATA_SIZE, POST_OSAKA_GAS_LIMIT_CAP};
Expand All @@ -29,8 +28,9 @@ use ethrex_rlp::encode::RLPEncode;
use ethrex_storage::{
AccountUpdatesList, Store, UpdateBatch, error::StoreError, hash_address, hash_key,
};
use ethrex_vm::backends::levm::db::DatabaseLogger;
use ethrex_vm::{BlockExecutionResult, DynVmDatabase, Evm, EvmError};
pub use ethrex_vm::backends::levm::db as vm; // re-export VM adapters module for downstream users
use ethrex_vm::backends::levm::db::{DatabaseLogger, StoreVmDatabase};
use ethrex_vm::{BlockExecutionResult, Evm, EvmError};
use mempool::Mempool;
use payload::PayloadOrTask;
use std::collections::{BTreeMap, HashMap};
Expand All @@ -40,8 +40,6 @@ use std::time::Instant;
use tokio::sync::Mutex as TokioMutex;
use tokio_util::sync::CancellationToken;

use vm::StoreVmDatabase;

#[cfg(feature = "metrics")]
use ethrex_metrics::metrics_blocks::METRICS_BLOCKS;

Expand Down Expand Up @@ -217,8 +215,7 @@ impl Blockchain {

for block in blocks {
let parent_hash = block.header.parent_hash;
let vm_db: DynVmDatabase =
Box::new(StoreVmDatabase::new(self.storage.clone(), parent_hash));
let vm_db = StoreVmDatabase::new(self.storage.clone(), parent_hash);
let logger = Arc::new(DatabaseLogger::new(Arc::new(Mutex::new(Box::new(vm_db)))));
let mut vm = match self.options.r#type {
BlockchainType::L1 => Evm::new_from_db_for_l1(logger.clone()),
Expand Down Expand Up @@ -918,9 +915,10 @@ impl Blockchain {
}

pub fn new_evm(&self, vm_db: StoreVmDatabase) -> Result<Evm, EvmError> {
let store = Arc::new(vm_db);
let evm = match self.options.r#type {
BlockchainType::L1 => Evm::new_for_l1(vm_db),
BlockchainType::L2(fee_config) => Evm::new_for_l2(vm_db, fee_config)?,
BlockchainType::L1 => Evm::new_from_db_for_l1(store),
BlockchainType::L2(fee_config) => Evm::new_from_db_for_l2(store, fee_config),
};
Ok(evm)
}
Expand Down
7 changes: 3 additions & 4 deletions crates/blockchain/payload.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use ethrex_common::{
},
};

use ethrex_vm::{Evm, EvmError};
use ethrex_vm::{Evm, EvmError, backends::levm::db::StoreVmDatabase};

use ethrex_rlp::encode::RLPEncode;
use ethrex_storage::{Store, error::StoreError};
Expand All @@ -38,7 +38,6 @@ use crate::{
constants::{GAS_LIMIT_BOUND_DIVISOR, MIN_GAS_LIMIT, TX_GAS_COST},
error::{ChainError, InvalidBlockError},
mempool::PendingTxFilter,
vm::StoreVmDatabase,
};

use thiserror::Error;
Expand Down Expand Up @@ -237,8 +236,8 @@ impl PayloadBuildContext {

let vm_db = StoreVmDatabase::new(storage.clone(), payload.header.parent_hash);
let vm = match blockchain_type {
BlockchainType::L1 => Evm::new_for_l1(vm_db),
BlockchainType::L2(fee_config) => Evm::new_for_l2(vm_db, fee_config)?,
BlockchainType::L1 => Evm::new_from_db_for_l1(Arc::new(vm_db)),
BlockchainType::L2(fee_config) => Evm::new_from_db_for_l2(Arc::new(vm_db), fee_config),
};

Ok(PayloadBuildContext {
Expand Down
4 changes: 2 additions & 2 deletions crates/blockchain/tracing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ use std::{

use ethrex_common::{H256, tracing::CallTrace, types::Block};
use ethrex_storage::Store;
use ethrex_vm::{Evm, EvmError};
use ethrex_vm::{Evm, EvmError, backends::levm::db::StoreVmDatabase};

use crate::{Blockchain, error::ChainError, vm::StoreVmDatabase};
use crate::{Blockchain, error::ChainError};

impl Blockchain {
/// Outputs the call trace for the given transaction
Expand Down
1 change: 1 addition & 0 deletions crates/l2/common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ ethrex-rlp.workspace = true
ethrex-storage.workspace = true
ethrex-trie.workspace = true
ethrex-vm.workspace = true
ethrex-levm.workspace = true
bytes.workspace = true
thiserror.workspace = true
serde.workspace = true
Expand Down
16 changes: 8 additions & 8 deletions crates/l2/common/src/state_diff.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ use ethrex_common::types::{
AccountInfo, AccountState, AccountUpdate, BlockHeader, PrivilegedL2Transaction, TxKind,
code_hash,
};
use ethrex_levm::db::Database as LevmDatabase;
use ethrex_rlp::decode::RLPDecode;
use ethrex_storage::{error::StoreError, hash_address};
use ethrex_trie::{Trie, TrieError};
use ethrex_vm::{EvmError, VmDatabase};
use ethrex_vm::EvmError;
use serde::{Deserialize, Serialize};

use crate::{l1_messages::L1Message, privileged_transactions::PrivilegedTransactionLog};
Expand Down Expand Up @@ -536,16 +537,15 @@ impl Decoder {
/// Calculates nonce_diff between current and previous block.
pub fn get_nonce_diff(
account_update: &AccountUpdate,
db: &impl VmDatabase,
db: &impl LevmDatabase,
) -> Result<u16, StateDiffError> {
// Get previous account_state either from store or cache
let account_state = db.get_account_state(account_update.address)?;
let account_state = db
.get_account_state(account_update.address)
.map_err(EvmError::from)?;

// Get previous nonce
let prev_nonce = match account_state {
Some(state) => state.nonce,
None => 0,
};
let prev_nonce = account_state.nonce;

// Get current nonce
let new_nonce = if let Some(info) = account_update.info.clone() {
Expand All @@ -567,7 +567,7 @@ pub fn get_nonce_diff(
/// Prepare the state diff for the block.
pub fn prepare_state_diff(
last_header: BlockHeader,
db: &impl VmDatabase,
db: &impl LevmDatabase,
l1messages: &[L1Message],
privileged_transactions: &[PrivilegedL2Transaction],
account_updates: Vec<AccountUpdate>,
Expand Down
11 changes: 6 additions & 5 deletions crates/l2/prover/src/guest_program/src/execution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ use ethrex_common::{
};
#[cfg(feature = "l2")]
use ethrex_l2_common::l1_messages::L1Message;
use ethrex_vm::{Evm, EvmError, GuestProgramStateWrapper, VmDatabase};
use ethrex_vm::{Evm, EvmError, GuestProgramStateWrapper};
use std::collections::{BTreeMap, HashMap};
use std::sync::Arc;

#[cfg(feature = "l2")]
use ethrex_common::types::{
Expand Down Expand Up @@ -328,12 +329,12 @@ fn execute_stateless(

// Execute block
#[cfg(feature = "l2")]
let mut vm = Evm::new_for_l2(
wrapped_db.clone(),
let mut vm = Evm::new_from_db_for_l2(
Arc::new(wrapped_db.clone()),
fee_config.ok_or_else(|| StatelessExecutionError::FeeConfigNotFound)?,
)?;
);
#[cfg(not(feature = "l2"))]
let mut vm = Evm::new_for_l1(wrapped_db.clone());
let mut vm = Evm::new_from_db_for_l1(Arc::new(wrapped_db.clone()));
let result = vm
.execute_block(block)
.map_err(StatelessExecutionError::EvmError)?;
Expand Down
Loading
Loading