Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 0 additions & 6 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
24 changes: 13 additions & 11 deletions Cargo.lock

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

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions crates/benchmark-runner/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ ere-dockerized.workspace = true

alloy-rlp.workspace = true
alloy-eips.workspace = true
alloy-genesis.workspace = true

reth-stateless.workspace = true

Expand Down
49 changes: 26 additions & 23 deletions crates/benchmark-runner/src/stateless_validator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ fn write_stdin(si: &StatelessInput, el: &ExecutionClient) -> Result<Input> {

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.
};

Expand Down Expand Up @@ -212,30 +212,17 @@ fn from_reth_witness_to_ethrex_witness(
.map(|ttd| TryInto::<u128>::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
Expand Down Expand Up @@ -268,3 +255,19 @@ fn from_reth_witness_to_ethrex_witness(
keys,
})
}

fn get_blob_schedule(
chain_config: &alloy_genesis::ChainConfig,
name: &str,
) -> Option<ethrex_common::types::ForkBlobSchedule> {
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(),
})
}
23 changes: 13 additions & 10 deletions ere-guests/stateless-validator/ethrex/risc0/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand All @@ -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"]
13 changes: 11 additions & 2 deletions ere-guests/stateless-validator/ethrex/risc0/src/main.rs
Original file line number Diff line number Diff line change
@@ -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::<ProgramInput, Error>(&input).unwrap();
let mut input = rkyv::from_bytes::<ProgramInput, Error>(&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);
Expand Down
18 changes: 7 additions & 11 deletions ere-guests/stateless-validator/ethrex/sp1/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }

Expand Down
1 change: 1 addition & 0 deletions ere-guests/stateless-validator/ethrex/sp1/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
Loading