diff --git a/ethereum-consensus/src/electra/presets/mainnet.rs b/ethereum-consensus/src/electra/presets/mainnet.rs index 3a0061c0c..e3ede4d56 100644 --- a/ethereum-consensus/src/electra/presets/mainnet.rs +++ b/ethereum-consensus/src/electra/presets/mainnet.rs @@ -1,5 +1,8 @@ pub use crate::electra::presets::Preset; -use crate::electra::spec; +use crate::{ + electra::spec, + phase0::mainnet::{MAX_COMMITTEES_PER_SLOT, MAX_VALIDATORS_PER_COMMITTEE}, +}; pub use spec::*; @@ -32,3 +35,9 @@ pub const PRESET: Preset = Preset { max_withdrawal_requests_per_payload: MAX_WITHDRAWAL_REQUESTS_PER_PAYLOAD, max_pending_partials_per_withdrawals_sweep: MAX_PENDING_PARTIALS_PER_WITHDRAWALS_SWEEP, }; + +const MAX_VALIDATORS_PER_SLOT: usize = + MAX_COMMITTEES_PER_SLOT as usize * MAX_VALIDATORS_PER_COMMITTEE; + +pub type Attestation = + spec::Attestation; diff --git a/ethereum-consensus/src/electra/presets/minimal.rs b/ethereum-consensus/src/electra/presets/minimal.rs index 690cb99b5..bf6574c95 100644 --- a/ethereum-consensus/src/electra/presets/minimal.rs +++ b/ethereum-consensus/src/electra/presets/minimal.rs @@ -1,5 +1,8 @@ pub use crate::electra::presets::Preset; -use crate::electra::spec; +use crate::{ + electra::spec, + phase0::minimal::{MAX_COMMITTEES_PER_SLOT, MAX_VALIDATORS_PER_COMMITTEE}, +}; pub use spec::*; @@ -32,3 +35,9 @@ pub const PRESET: Preset = Preset { max_withdrawal_requests_per_payload: MAX_WITHDRAWAL_REQUESTS_PER_PAYLOAD, max_pending_partials_per_withdrawals_sweep: MAX_PENDING_PARTIALS_PER_WITHDRAWALS_SWEEP, }; + +const MAX_VALIDATORS_PER_SLOT: usize = + MAX_COMMITTEES_PER_SLOT as usize * MAX_VALIDATORS_PER_COMMITTEE; + +pub type Attestation = + spec::Attestation; diff --git a/spec-tests/runners/ssz_static.rs b/spec-tests/runners/ssz_static.rs index 7f6fb71b0..0829ce63e 100644 --- a/spec-tests/runners/ssz_static.rs +++ b/spec-tests/runners/ssz_static.rs @@ -35,6 +35,31 @@ fn run_test( Ok(()) } +macro_rules! gen_electra { + ($test_case:expr, $($handler:ident),*) => { + let result = match $test_case.meta.handler.0.as_str() { + $( + stringify!($handler) => gen_match_for! { + $test_case, + (mainnet, electra), + (minimal, electra) + { + gen_exec! { + $test_case, load_test, run_test:: + } + } + }, + )* + _ => Err(Error::InternalContinue), + }; + match result { + Ok(()) => return Ok(()), + Err(Error::InternalContinue) => {}, + Err(err) => return Err(err) + } + }; +} + macro_rules! gen_deneb_and_later { ($test_case:expr, $($handler:ident),*) => { let result = match $test_case.meta.handler.0.as_str() { @@ -165,6 +190,11 @@ macro_rules! gen_match { } pub fn dispatch(test: &TestCase) -> Result<(), Error> { + gen_electra! { + test, + Attestation + } + gen_deneb_and_later! { test, BlobSidecar, diff --git a/spec-tests/spec-test-version b/spec-tests/spec-test-version index 0d0c52f84..8c0ee2b55 100644 --- a/spec-tests/spec-test-version +++ b/spec-tests/spec-test-version @@ -1 +1 @@ -v1.4.0 +v1.5.0-alpha.0 diff --git a/spec-tests/test_meta.rs b/spec-tests/test_meta.rs index 4c2341f65..6ee8cda01 100644 --- a/spec-tests/test_meta.rs +++ b/spec-tests/test_meta.rs @@ -33,6 +33,7 @@ pub enum Fork { Bellatrix, Capella, Deneb, + Electra, Eip6110, Whisk, } @@ -45,6 +46,7 @@ impl From<&str> for Fork { "bellatrix" => Self::Bellatrix, "capella" => Self::Capella, "deneb" => Self::Deneb, + "electra" => Self::Electra, "eip6110" => Self::Eip6110, "whisk" => Self::Whisk, fork => panic!("unsupported fork: {fork:?}"),