diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index 0063d887..b1be4b92 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -69,12 +69,6 @@ jobs: - zkvm: zisk test: prove_empty_block # ere image intentionally doesn't bake big proving key for CI # Ethrex - - el: ethrex - test: execute_mainnet_blocks # Still quite heavy to run in CI - - el: ethrex - test: execute_invalid_blocks # Still quite heavy to run in CI - - el: ethrex - zkvm: risc0 # See https://github.com/eth-act/ere/issues/121 - el: ethrex zkvm: openvm # See https://github.com/eth-act/ere/issues/168 - el: ethrex diff --git a/Cargo.lock b/Cargo.lock index a433bf3a..6850cd46 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1316,6 +1316,7 @@ name = "benchmark-runner" version = "0.1.0" dependencies = [ "alloy-eips", + "alloy-genesis", "alloy-rlp", "anyhow", "bincode", @@ -2789,7 +2790,7 @@ dependencies = [ [[package]] name = "ethrex-blockchain" version = "0.1.0" -source = "git+https://github.com/lambdaclass/ethrex.git?rev=5b4c943007b96152453e5a8f8a1a592608b11ea0#5b4c943007b96152453e5a8f8a1a592608b11ea0" +source = "git+https://github.com/lambdaclass/ethrex.git?rev=cfb805c6c70df1f6172f1982c9ed8952b7399d28#cfb805c6c70df1f6172f1982c9ed8952b7399d28" dependencies = [ "bytes", "cfg-if", @@ -2809,7 +2810,7 @@ dependencies = [ [[package]] name = "ethrex-common" version = "0.1.0" -source = "git+https://github.com/lambdaclass/ethrex.git?rev=5b4c943007b96152453e5a8f8a1a592608b11ea0#5b4c943007b96152453e5a8f8a1a592608b11ea0" +source = "git+https://github.com/lambdaclass/ethrex.git?rev=cfb805c6c70df1f6172f1982c9ed8952b7399d28#cfb805c6c70df1f6172f1982c9ed8952b7399d28" dependencies = [ "bytes", "crc32fast", @@ -2837,12 +2838,12 @@ dependencies = [ [[package]] name = "ethrex-crypto" version = "0.1.0" -source = "git+https://github.com/lambdaclass/ethrex.git?rev=5b4c943007b96152453e5a8f8a1a592608b11ea0#5b4c943007b96152453e5a8f8a1a592608b11ea0" +source = "git+https://github.com/lambdaclass/ethrex.git?rev=cfb805c6c70df1f6172f1982c9ed8952b7399d28#cfb805c6c70df1f6172f1982c9ed8952b7399d28" [[package]] name = "ethrex-l2-common" version = "0.1.0" -source = "git+https://github.com/lambdaclass/ethrex.git?rev=5b4c943007b96152453e5a8f8a1a592608b11ea0#5b4c943007b96152453e5a8f8a1a592608b11ea0" +source = "git+https://github.com/lambdaclass/ethrex.git?rev=cfb805c6c70df1f6172f1982c9ed8952b7399d28#cfb805c6c70df1f6172f1982c9ed8952b7399d28" dependencies = [ "bytes", "ethereum-types", @@ -2862,7 +2863,7 @@ dependencies = [ [[package]] name = "ethrex-levm" version = "0.1.0" -source = "git+https://github.com/lambdaclass/ethrex.git?rev=5b4c943007b96152453e5a8f8a1a592608b11ea0#5b4c943007b96152453e5a8f8a1a592608b11ea0" +source = "git+https://github.com/lambdaclass/ethrex.git?rev=cfb805c6c70df1f6172f1982c9ed8952b7399d28#cfb805c6c70df1f6172f1982c9ed8952b7399d28" dependencies = [ "ark-bn254", "ark-ec", @@ -2894,7 +2895,7 @@ dependencies = [ [[package]] name = "ethrex-metrics" version = "0.1.0" -source = "git+https://github.com/lambdaclass/ethrex.git?rev=5b4c943007b96152453e5a8f8a1a592608b11ea0#5b4c943007b96152453e5a8f8a1a592608b11ea0" +source = "git+https://github.com/lambdaclass/ethrex.git?rev=cfb805c6c70df1f6172f1982c9ed8952b7399d28#cfb805c6c70df1f6172f1982c9ed8952b7399d28" dependencies = [ "ethrex-common", "serde", @@ -2906,7 +2907,7 @@ dependencies = [ [[package]] name = "ethrex-rlp" version = "0.1.0" -source = "git+https://github.com/lambdaclass/ethrex.git?rev=5b4c943007b96152453e5a8f8a1a592608b11ea0#5b4c943007b96152453e5a8f8a1a592608b11ea0" +source = "git+https://github.com/lambdaclass/ethrex.git?rev=cfb805c6c70df1f6172f1982c9ed8952b7399d28#cfb805c6c70df1f6172f1982c9ed8952b7399d28" dependencies = [ "bytes", "ethereum-types", @@ -2920,7 +2921,7 @@ dependencies = [ [[package]] name = "ethrex-storage" version = "0.1.0" -source = "git+https://github.com/lambdaclass/ethrex.git?rev=5b4c943007b96152453e5a8f8a1a592608b11ea0#5b4c943007b96152453e5a8f8a1a592608b11ea0" +source = "git+https://github.com/lambdaclass/ethrex.git?rev=cfb805c6c70df1f6172f1982c9ed8952b7399d28#cfb805c6c70df1f6172f1982c9ed8952b7399d28" dependencies = [ "anyhow", "async-trait", @@ -2941,7 +2942,7 @@ dependencies = [ [[package]] name = "ethrex-trie" version = "0.1.0" -source = "git+https://github.com/lambdaclass/ethrex.git?rev=5b4c943007b96152453e5a8f8a1a592608b11ea0#5b4c943007b96152453e5a8f8a1a592608b11ea0" +source = "git+https://github.com/lambdaclass/ethrex.git?rev=cfb805c6c70df1f6172f1982c9ed8952b7399d28#cfb805c6c70df1f6172f1982c9ed8952b7399d28" dependencies = [ "anyhow", "bytes", @@ -2961,7 +2962,7 @@ dependencies = [ [[package]] name = "ethrex-vm" version = "0.1.0" -source = "git+https://github.com/lambdaclass/ethrex.git?rev=5b4c943007b96152453e5a8f8a1a592608b11ea0#5b4c943007b96152453e5a8f8a1a592608b11ea0" +source = "git+https://github.com/lambdaclass/ethrex.git?rev=cfb805c6c70df1f6172f1982c9ed8952b7399d28#cfb805c6c70df1f6172f1982c9ed8952b7399d28" dependencies = [ "bincode", "bytes", @@ -2975,6 +2976,7 @@ dependencies = [ "ethrex-trie", "hex", "lazy_static", + "rkyv", "serde", "sha3", "thiserror 2.0.16", @@ -3449,7 +3451,7 @@ dependencies = [ [[package]] name = "guest_program" version = "0.1.0" -source = "git+https://github.com/lambdaclass/ethrex.git?rev=5b4c943007b96152453e5a8f8a1a592608b11ea0#5b4c943007b96152453e5a8f8a1a592608b11ea0" +source = "git+https://github.com/lambdaclass/ethrex.git?rev=cfb805c6c70df1f6172f1982c9ed8952b7399d28#cfb805c6c70df1f6172f1982c9ed8952b7399d28" dependencies = [ "bytes", "ethrex-blockchain", diff --git a/Cargo.toml b/Cargo.toml index 1b48577d..7b9f9e6d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -121,9 +121,9 @@ reth-errors = { git = "https://github.com/kevaundray/reth", rev = "6de1d8358ca27 reth-trie-common = { git = "https://github.com/kevaundray/reth", rev = "6de1d8358ca2790d47852317c457a9a426a2e09f" } reth-chainspec = { git = "https://github.com/kevaundray/reth", rev = "6de1d8358ca2790d47852317c457a9a426a2e09f" } -ethrex-guest-program = { git = "https://github.com/lambdaclass/ethrex.git", rev = "5b4c943007b96152453e5a8f8a1a592608b11ea0", package = "guest_program" } -ethrex-common = { git = "https://github.com/lambdaclass/ethrex.git", rev = "5b4c943007b96152453e5a8f8a1a592608b11ea0", default-features = false } -ethrex-rlp = { git = "https://github.com/lambdaclass/ethrex.git", rev = "5b4c943007b96152453e5a8f8a1a592608b11ea0", default-features = false } +ethrex-guest-program = { git = "https://github.com/lambdaclass/ethrex.git", rev = "cfb805c6c70df1f6172f1982c9ed8952b7399d28", package = "guest_program" } +ethrex-common = { git = "https://github.com/lambdaclass/ethrex.git", rev = "cfb805c6c70df1f6172f1982c9ed8952b7399d28", default-features = false } +ethrex-rlp = { git = "https://github.com/lambdaclass/ethrex.git", rev = "cfb805c6c70df1f6172f1982c9ed8952b7399d28", default-features = false } # alloy diff --git a/crates/benchmark-runner/Cargo.toml b/crates/benchmark-runner/Cargo.toml index 8a7092b7..14eab197 100644 --- a/crates/benchmark-runner/Cargo.toml +++ b/crates/benchmark-runner/Cargo.toml @@ -13,6 +13,7 @@ ere-dockerized.workspace = true alloy-rlp.workspace = true alloy-eips.workspace = true +alloy-genesis.workspace = true reth-stateless.workspace = true diff --git a/crates/benchmark-runner/src/stateless_validator.rs b/crates/benchmark-runner/src/stateless_validator.rs index 9404ba4e..b47fb44c 100644 --- a/crates/benchmark-runner/src/stateless_validator.rs +++ b/crates/benchmark-runner/src/stateless_validator.rs @@ -164,7 +164,7 @@ fn write_stdin(si: &StatelessInput, el: &ExecutionClient) -> Result { let ethrex_program_input = ProgramInput { blocks: vec![ethrex_block], - db: from_reth_witness_to_ethrex_witness(si.block.number, si)?, + execution_witness: from_reth_witness_to_ethrex_witness(si.block.number, si)?, elasticity_multiplier: 2u64, // NOTE: Ethrex doesn't derive this value from chain config. }; @@ -212,30 +212,17 @@ fn from_reth_witness_to_ethrex_witness( .map(|ttd| TryInto::::try_into(ttd).unwrap()), terminal_total_difficulty_passed: si.chain_config.terminal_total_difficulty_passed, blob_schedule: BlobSchedule { - cancun: si - .chain_config - .blob_schedule - .get("Cancun") - .map(|s| ForkBlobSchedule { - // Reth and Ethrex have some mismatched data type representations. Reth uses bigger ints. - // Downcasting should never cause an overflow, but let's be safe and panic if this ever happens. - base_fee_update_fraction: s.update_fraction.try_into().unwrap(), - target: s.target_blob_count.try_into().unwrap(), - max: s.max_blob_count.try_into().unwrap(), - }) + cancun: get_blob_schedule(&si.chain_config, "cancun") .unwrap_or_else(|| BlobSchedule::default().cancun), - prague: si - .chain_config - .blob_schedule - .get("prague") - .map(|s| ForkBlobSchedule { - // Reth and Ethrex have some mismatched data type representations. Reth uses bigger ints. - // Downcasting should never cause an overflow, but let's be safe and panic if this ever happens. - base_fee_update_fraction: s.update_fraction.try_into().unwrap(), - target: s.target_blob_count.try_into().unwrap(), - max: s.max_blob_count.try_into().unwrap(), - }) + prague: get_blob_schedule(&si.chain_config, "prague") .unwrap_or_else(|| BlobSchedule::default().prague), + osaka: get_blob_schedule(&si.chain_config, "osaka") + .unwrap_or_else(|| BlobSchedule::default().osaka), + bpo1: get_blob_schedule(&si.chain_config, "bpo1"), + bpo2: get_blob_schedule(&si.chain_config, "bpo2"), + bpo3: get_blob_schedule(&si.chain_config, "bpo3"), + bpo4: get_blob_schedule(&si.chain_config, "bpo4"), + bpo5: get_blob_schedule(&si.chain_config, "bpo5"), }, deposit_contract_address: si .chain_config @@ -268,3 +255,19 @@ fn from_reth_witness_to_ethrex_witness( keys, }) } + +fn get_blob_schedule( + chain_config: &alloy_genesis::ChainConfig, + name: &str, +) -> Option { + chain_config + .blob_schedule + .get(name) + .map(|s| ForkBlobSchedule { + // Reth and Ethrex have some mismatched data type representations. Reth uses bigger ints. + // Downcasting should never cause an overflow, but let's be safe and panic if this ever happens. + base_fee_update_fraction: s.update_fraction.try_into().unwrap(), + target: s.target_blob_count.try_into().unwrap(), + max: s.max_blob_count.try_into().unwrap(), + }) +} diff --git a/ere-guests/stateless-validator/ethrex/risc0/Cargo.toml b/ere-guests/stateless-validator/ethrex/risc0/Cargo.toml index a1026a71..ec1f769c 100644 --- a/ere-guests/stateless-validator/ethrex/risc0/Cargo.toml +++ b/ere-guests/stateless-validator/ethrex/risc0/Cargo.toml @@ -10,20 +10,23 @@ risc0-zkvm = { version = "3.0.3", default-features = false, features = [ "std", "unstable", ] } -rkyv = "0.8.10" - -zkvm_interface = { git = "https://github.com/lambdaclass/ethrex.git", rev = "5b4c943007b96152453e5a8f8a1a592608b11ea0", default-features = false, features = [ +risc0-zkvm-platform = { version = "=2.2.1", default-features = false, features = [ + "sys-getenv", +] } +guest_program = { git = "https://github.com/lambdaclass/ethrex.git", rev = "cfb805c6c70df1f6172f1982c9ed8952b7399d28", default-features = false, features = [ "c-kzg", ] } +rkyv = { version = "0.8.10", features = ["unaligned"] } + -ethrex-common = { git = "https://github.com/lambdaclass/ethrex.git", rev = "5b4c943007b96152453e5a8f8a1a592608b11ea0", default-features = false } -ethrex-storage = { git = "https://github.com/lambdaclass/ethrex.git", rev = "5b4c943007b96152453e5a8f8a1a592608b11ea0", default-features = false } -ethrex-rlp = { git = "https://github.com/lambdaclass/ethrex.git", rev = "5b4c943007b96152453e5a8f8a1a592608b11ea0" } -ethrex-vm = { git = "https://github.com/lambdaclass/ethrex.git", rev = "5b4c943007b96152453e5a8f8a1a592608b11ea0", default-features = false, features = [ +ethrex-common = { git = "https://github.com/lambdaclass/ethrex.git", rev = "cfb805c6c70df1f6172f1982c9ed8952b7399d28", default-features = false } +ethrex-storage = { git = "https://github.com/lambdaclass/ethrex.git", rev = "cfb805c6c70df1f6172f1982c9ed8952b7399d28", default-features = false } +ethrex-rlp = { git = "https://github.com/lambdaclass/ethrex.git", rev = "cfb805c6c70df1f6172f1982c9ed8952b7399d28" } +ethrex-vm = { git = "https://github.com/lambdaclass/ethrex.git", rev = "cfb805c6c70df1f6172f1982c9ed8952b7399d28", default-features = false, features = [ "c-kzg", ] } -ethrex-blockchain = { git = "https://github.com/lambdaclass/ethrex.git", rev = "5b4c943007b96152453e5a8f8a1a592608b11ea0", default-features = false } -ethrex-l2-common = { git = "https://github.com/lambdaclass/ethrex.git", rev = "5b4c943007b96152453e5a8f8a1a592608b11ea0", default-features = false } +ethrex-blockchain = { git = "https://github.com/lambdaclass/ethrex.git", rev = "cfb805c6c70df1f6172f1982c9ed8952b7399d28", default-features = false } +ethrex-l2-common = { git = "https://github.com/lambdaclass/ethrex.git", rev = "cfb805c6c70df1f6172f1982c9ed8952b7399d28", default-features = false } [patch.crates-io] sha2 = { git = "https://github.com/risc0/RustCrypto-hashes", tag = "sha2-v0.10.8-risczero.0" } @@ -44,4 +47,4 @@ c-kzg = { git = "https://github.com/risc0/c-kzg-4844", tag = "c-kzg/v1.0.3-riscz # bls12_381 = { git = "https://github.com/lambdaclass/zkcrypto-bls12_381", branch = "expose-fp-struct" } [features] -l2 = ["zkvm_interface/l2"] +l2 = ["guest_program/l2"] diff --git a/ere-guests/stateless-validator/ethrex/risc0/src/main.rs b/ere-guests/stateless-validator/ethrex/risc0/src/main.rs index bccb3b0d..8ad8e284 100644 --- a/ere-guests/stateless-validator/ethrex/risc0/src/main.rs +++ b/ere-guests/stateless-validator/ethrex/risc0/src/main.rs @@ -1,25 +1,34 @@ use risc0_zkvm::guest::env; +use guest_program::{execution::execution_program, input::ProgramInput}; use rkyv::rancor::Error; -use zkvm_interface::{execution::execution_program, io::ProgramInput}; fn main() { println!("start reading input"); let start = env::cycle_count(); let input = env::read_frame(); - let input = rkyv::from_bytes::(&input).unwrap(); + let mut input = rkyv::from_bytes::(&input).unwrap(); let end = env::cycle_count(); eprintln!("reading input (cycle tracker): {}", end - start); println!("public inputs preparation"); let start = env::cycle_count(); let block_hash = input.blocks[0].hash(); + // Ethrex forces the block hash of any provided block to be zero, instead of accepting pre-calculated values + // and just checking them again. + input.blocks[0].header.hash = Default::default(); let parent_hash = input.blocks[0].header.parent_hash; let end = env::cycle_count(); eprintln!("public inputs preparation (cycle tracker): {}", end - start); println!("start stateless validation"); let start = env::cycle_count(); + if input.blocks.len() != 1 { + env::commit(&block_hash.0); + env::commit(&parent_hash.0); + env::commit(&false); + return; + } let res = execution_program(input); let end = env::cycle_count(); eprintln!("stateless validation (cycle tracker): {}", end - start); diff --git a/ere-guests/stateless-validator/ethrex/sp1/Cargo.toml b/ere-guests/stateless-validator/ethrex/sp1/Cargo.toml index 5666f41e..a41c4a49 100644 --- a/ere-guests/stateless-validator/ethrex/sp1/Cargo.toml +++ b/ere-guests/stateless-validator/ethrex/sp1/Cargo.toml @@ -10,27 +10,23 @@ sp1-zkvm = { version = "=5.0.8" } rkyv = { version = "0.8.10", features = ["std", "unaligned"] } -guest_program = { git = "https://github.com/lambdaclass/ethrex.git", rev = "5b4c943007b96152453e5a8f8a1a592608b11ea0" } +guest_program = { git = "https://github.com/lambdaclass/ethrex.git", rev = "cfb805c6c70df1f6172f1982c9ed8952b7399d28" } -ethrex-common = { git = "https://github.com/lambdaclass/ethrex.git", rev = "5b4c943007b96152453e5a8f8a1a592608b11ea0", default-features = false } -ethrex-storage = { git = "https://github.com/lambdaclass/ethrex.git", rev = "5b4c943007b96152453e5a8f8a1a592608b11ea0", default-features = false } -ethrex-rlp = { git = "https://github.com/lambdaclass/ethrex.git", rev = "5b4c943007b96152453e5a8f8a1a592608b11ea0" } -ethrex-vm = { git = "https://github.com/lambdaclass/ethrex.git", rev = "5b4c943007b96152453e5a8f8a1a592608b11ea0", default-features = false } -ethrex-blockchain = { git = "https://github.com/lambdaclass/ethrex.git", rev = "5b4c943007b96152453e5a8f8a1a592608b11ea0", default-features = false } -ethrex-l2-common = { git = "https://github.com/lambdaclass/ethrex.git", rev = "5b4c943007b96152453e5a8f8a1a592608b11ea0", default-features = false } +ethrex-common = { git = "https://github.com/lambdaclass/ethrex.git", rev = "cfb805c6c70df1f6172f1982c9ed8952b7399d28", default-features = false } +ethrex-storage = { git = "https://github.com/lambdaclass/ethrex.git", rev = "cfb805c6c70df1f6172f1982c9ed8952b7399d28", default-features = false } +ethrex-rlp = { git = "https://github.com/lambdaclass/ethrex.git", rev = "cfb805c6c70df1f6172f1982c9ed8952b7399d28" } +ethrex-vm = { git = "https://github.com/lambdaclass/ethrex.git", rev = "cfb805c6c70df1f6172f1982c9ed8952b7399d28", default-features = false } +ethrex-blockchain = { git = "https://github.com/lambdaclass/ethrex.git", rev = "cfb805c6c70df1f6172f1982c9ed8952b7399d28", default-features = false } +ethrex-l2-common = { git = "https://github.com/lambdaclass/ethrex.git", rev = "cfb805c6c70df1f6172f1982c9ed8952b7399d28", default-features = false } [patch.crates-io] sha2-v0-10-8 = { git = "https://github.com/sp1-patches/RustCrypto-hashes", package = "sha2", tag = "patch-sha2-0.10.8-sp1-4.0.0" } sha3-v0-10-8 = { git = "https://github.com/sp1-patches/RustCrypto-hashes", package = "sha3", tag = "patch-sha3-0.10.8-sp1-4.0.0" } crypto-bigint = { git = "https://github.com/sp1-patches/RustCrypto-bigint", tag = "patch-0.5.5-sp1-4.0.0" } tiny-keccak = { git = "https://github.com/sp1-patches/tiny-keccak", tag = "patch-2.0.2-sp1-4.0.0" } -curve25519-dalek = { git = "https://github.com/sp1-patches/curve25519-dalek", tag = "patch-4.1.3-sp1-5.0.0" } -curve25519-dalek-ng = { git = "https://github.com/sp1-patches/curve25519-dalek-ng", tag = "patch-4.1.1-sp1-5.0.0" } p256 = { git = "https://github.com/sp1-patches/elliptic-curves", tag = "patch-p256-13.2-sp1-5.0.0" } secp256k1 = { git = "https://github.com/sp1-patches/rust-secp256k1", tag = "patch-0.29.1-sp1-5.0.0" } -substrate-bn = { git = "https://github.com/sp1-patches/bn", tag = "patch-0.6.0-sp1-5.0.0" } -rsa = { git = "https://github.com/sp1-patches/RustCrypto-RSA", tag = "patch-0.9.6-sp1-5.0.0" } ecdsa = { git = "https://github.com/sp1-patches/signatures", tag = "patch-16.9-sp1-4.1.0" } k256 = { git = "https://github.com/sp1-patches/elliptic-curves", tag = "patch-k256-13.4-sp1-5.0.0" } diff --git a/ere-guests/stateless-validator/ethrex/sp1/src/main.rs b/ere-guests/stateless-validator/ethrex/sp1/src/main.rs index 35f7836a..2f6cd7a9 100644 --- a/ere-guests/stateless-validator/ethrex/sp1/src/main.rs +++ b/ere-guests/stateless-validator/ethrex/sp1/src/main.rs @@ -24,6 +24,7 @@ pub fn main() { sp1_zkvm::io::commit(&block_hash.0); sp1_zkvm::io::commit(&parent_hash.0); sp1_zkvm::io::commit(&false); + return; } let res = execution_program(input); println!("cycle-tracker-report-end: validation"); diff --git a/tests/src/stateless_validator.rs b/tests/src/stateless_validator.rs index ccbb5034..11548c5c 100644 --- a/tests/src/stateless_validator.rs +++ b/tests/src/stateless_validator.rs @@ -13,7 +13,7 @@ mod tests { use crate::utils::{ assert_executions_successful, assert_proving_successful, filter_el_zkvm_pairs_from_env, - get_env_zkvm_or_default, run_guest, untar, + run_guest, untar, }; #[tokio::test] @@ -24,7 +24,7 @@ mod tests { (ExecutionClient::Reth, ErezkVM::OpenVM), // (ExecutionClient::Reth, ErezkVM::Pico), // See https://github.com/eth-act/ere/issues/173 (ExecutionClient::Ethrex, ErezkVM::SP1), - // (ExecutionClient::Ethrex, ErezkVM::Risc0), // See https://github.com/eth-act/ere/issues/121 + (ExecutionClient::Ethrex, ErezkVM::Risc0), // (ExecutionClient::Ethrex, ErezkVM::OpenVM), // See https://github.com/eth-act/ere/issues/168 // (ExecutionClient::Ethrex, ErezkVM::Pico), // See https://github.com/eth-act/ere/issues/174 ]); @@ -40,7 +40,7 @@ mod tests { (ExecutionClient::Reth, ErezkVM::Pico), (ExecutionClient::Reth, ErezkVM::Zisk), (ExecutionClient::Ethrex, ErezkVM::SP1), - // (ExecutionClient::Ethrex, ErezkVM::Risc0), // See https://github.com/eth-act/ere/issues/121 + (ExecutionClient::Ethrex, ErezkVM::Risc0), // (ExecutionClient::Ethrex, ErezkVM::OpenVM), // See https://github.com/eth-act/ere/issues/168 // (ExecutionClient::Ethrex, ErezkVM::Pico), // See https://github.com/eth-act/ere/issues/174 // (ExecutionClient::Ethrex, ErezkVM::Zisk), // See https://github.com/eth-act/ere/issues/XXX @@ -50,15 +50,17 @@ mod tests { #[tokio::test] async fn execute_mainnet_blocks() { - let zkvms = get_env_zkvm_or_default(vec![ - ErezkVM::SP1, - ErezkVM::Risc0, - ErezkVM::OpenVM, - ErezkVM::Pico, - ErezkVM::Zisk, + let el_zkvms = filter_el_zkvm_pairs_from_env(vec![ + (ExecutionClient::Reth, ErezkVM::SP1), + (ExecutionClient::Reth, ErezkVM::Risc0), + (ExecutionClient::Reth, ErezkVM::OpenVM), + (ExecutionClient::Reth, ErezkVM::Pico), + (ExecutionClient::Reth, ErezkVM::Zisk), + (ExecutionClient::Ethrex, ErezkVM::SP1), + (ExecutionClient::Ethrex, ErezkVM::Risc0), ]); - for zkvm in &zkvms { - println!("Using zkVM: {zkvm}"); + + for (el, zkvm) in el_zkvms { let bench_fixtures_dir = tempdir().unwrap(); untar( &PathBuf::from(env!("CARGO_MANIFEST_DIR")) @@ -70,14 +72,14 @@ mod tests { .join("mainnet-zkevm-fixtures-input"); let output_folder = OutputDir::new().unwrap(); - let el = ExecutionClient::Reth; - let el_str = el.as_ref().to_lowercase(); let inputs = stateless_validator::stateless_validator_inputs(input_folder, el).unwrap(); let len_inputs = inputs.len(); assert_eq!(len_inputs, 15); + + let el_str = el.as_ref().to_lowercase(); run_guest( &format!("stateless-validator/{el_str}"), - &[*zkvm], + &[zkvm], inputs, output_folder.path(), Some(el_str), @@ -89,41 +91,46 @@ mod tests { #[tokio::test] async fn execute_invalid_block() { - let eest_fixtures_path = PathBuf::from("assets/eest-invalid-block"); - let bench_fixtures_dir = tempdir().unwrap(); - ExecSpecTestBlocksAndWitnessBuilder::default() - .with_input_folder(eest_fixtures_path) - .unwrap() - .build() - .unwrap() - .generate_to_path(bench_fixtures_dir.path()) - .await - .unwrap(); - - let output_folder = OutputDir::new().unwrap(); - let el = ExecutionClient::Reth; - let el_str = el.as_ref().to_lowercase(); - let inputs = - stateless_validator::stateless_validator_inputs(bench_fixtures_dir.path(), el).unwrap(); - - let len_inputs = inputs.len(); - assert_eq!(len_inputs, 1); - - run_guest( - &format!("stateless-validator/{el_str}"), - &get_env_zkvm_or_default(vec![ - ErezkVM::SP1, - ErezkVM::Risc0, - ErezkVM::OpenVM, - ErezkVM::Pico, - ErezkVM::Zisk, - ]), - inputs, - output_folder.path(), - Some(el_str), - Action::Execute, - ); - assert_executions_successful::(output_folder.path(), len_inputs); + let el_zkvms = filter_el_zkvm_pairs_from_env(vec![ + (ExecutionClient::Reth, ErezkVM::SP1), + (ExecutionClient::Reth, ErezkVM::Risc0), + (ExecutionClient::Reth, ErezkVM::OpenVM), + (ExecutionClient::Reth, ErezkVM::Pico), + (ExecutionClient::Reth, ErezkVM::Zisk), + (ExecutionClient::Ethrex, ErezkVM::SP1), + (ExecutionClient::Ethrex, ErezkVM::Risc0), + ]); + for (el, zkvm) in el_zkvms { + let eest_fixtures_path = PathBuf::from("assets/eest-invalid-block"); + let bench_fixtures_dir = tempdir().unwrap(); + ExecSpecTestBlocksAndWitnessBuilder::default() + .with_input_folder(eest_fixtures_path) + .unwrap() + .build() + .unwrap() + .generate_to_path(bench_fixtures_dir.path()) + .await + .unwrap(); + + let output_folder = OutputDir::new().unwrap(); + let inputs = + stateless_validator::stateless_validator_inputs(bench_fixtures_dir.path(), el) + .unwrap(); + + let len_inputs = inputs.len(); + assert_eq!(len_inputs, 1); + + let el_str = el.as_ref().to_lowercase(); + run_guest( + &format!("stateless-validator/{el_str}"), + &[zkvm], + inputs, + output_folder.path(), + Some(el_str), + Action::Execute, + ); + assert_executions_successful::(output_folder.path(), len_inputs); + } } async fn empty_block(action: Action, el_zkvms: &[(ExecutionClient, ErezkVM)]) {