Merge branch 'unstable' into progressive-list-tests

This commit is contained in:
Mac L
2026-02-13 05:41:12 +11:00
302 changed files with 11461 additions and 4504 deletions

View File

@@ -1,6 +1,6 @@
# To download/extract nightly tests, run:
# CONSENSUS_SPECS_TEST_VERSION=nightly make
CONSENSUS_SPECS_TEST_VERSION ?= v1.7.0-alpha.1
CONSENSUS_SPECS_TEST_VERSION ?= v1.7.0-alpha.2
REPO_NAME := consensus-spec-tests
OUTPUT_DIR := ./$(REPO_NAME)

View File

@@ -47,8 +47,25 @@ excluded_paths = [
"bls12-381-tests/hash_to_G2",
"tests/.*/eip7732",
"tests/.*/eip7805",
# TODO(gloas): remove these ignores as more Gloas operations are implemented
"tests/.*/gloas/operations/payload_attestation/.*",
# TODO(EIP-7732): remove these ignores as Gloas consensus is implemented
"tests/.*/gloas/epoch_processing/.*",
"tests/.*/gloas/finality/.*",
"tests/.*/gloas/fork/.*",
"tests/.*/gloas/fork_choice/.*",
"tests/.*/gloas/networking/.*",
"tests/.*/gloas/rewards/.*",
"tests/.*/gloas/sanity/.*",
"tests/.*/gloas/transition/.*",
# Ignore MatrixEntry SSZ tests for now.
"tests/.*/fulu/ssz_static/MatrixEntry/.*",
"tests/.*/.*/ssz_static/MatrixEntry/.*",
# TODO(gloas): Ignore Gloas light client stuff for now
"tests/.*/gloas/ssz_static/LightClient.*/.*",
# Execution payload header is irrelevant after Gloas, this type will probably be deleted.
"tests/.*/gloas/ssz_static/ExecutionPayloadHeader/.*",
# ForkChoiceNode is internal to fork choice and probably doesn't need SSZ tests.
"tests/.*/gloas/ssz_static/ForkChoiceNode/.*",
# EIP-7916 is still in draft and hasn't been implemented yet https://eips.ethereum.org/EIPS/eip-7916
"tests/general/phase0/ssz_generic/progressive_bitlist",
"tests/general/phase0/ssz_generic/containers/.*/ProgressiveBitsStruct.*",
@@ -58,11 +75,13 @@ excluded_paths = [
# Ignore full epoch tests for now (just test the sub-transitions).
"tests/.*/.*/epoch_processing/.*/pre_epoch.ssz_snappy",
"tests/.*/.*/epoch_processing/.*/post_epoch.ssz_snappy",
# Ignore gloas tests for now
"tests/.*/gloas/.*",
# Ignore inactivity_scores tests for now (should implement soon).
"tests/.*/.*/rewards/inactivity_scores/.*",
# Ignore KZG tests that target internal kzg library functions
"tests/.*/compute_verify_cell_kzg_proof_batch_challenge/.*",
"tests/.*/compute_challenge/.*",
# We don't need these manifest files at the moment.
"tests/.*/manifest.yaml"
]

View File

@@ -1,7 +1,7 @@
use super::*;
use serde::Deserialize;
use std::marker::PhantomData;
use types::data_column_custody_group::{CustodyIndex, compute_columns_for_custody_group};
use types::data::{CustodyIndex, compute_columns_for_custody_group};
#[derive(Debug, Clone, Deserialize)]
#[serde(bound = "E: EthSpec", deny_unknown_fields)]

View File

@@ -28,9 +28,9 @@ use std::sync::Arc;
use std::time::Duration;
use types::{
Attestation, AttestationRef, AttesterSlashing, AttesterSlashingRef, BeaconBlock, BeaconState,
BlobSidecar, BlobsList, BlockImportSource, Checkpoint, DataColumnSidecarList,
DataColumnSubnetId, ExecutionBlockHash, Hash256, IndexedAttestation, KzgProof,
ProposerPreparationData, SignedBeaconBlock, Slot, Uint256,
BlobSidecar, BlobsList, BlockImportSource, Checkpoint, DataColumnSidecar,
DataColumnSidecarList, DataColumnSubnetId, ExecutionBlockHash, Hash256, IndexedAttestation,
KzgProof, ProposerPreparationData, SignedBeaconBlock, Slot, Uint256,
};
// When set to true, cache any states fetched from the db.
@@ -252,7 +252,15 @@ impl<E: EthSpec> LoadCase for ForkChoiceTest<E> {
columns_vec
.into_iter()
.map(|column| {
ssz_decode_file(&path.join(format!("{column}.ssz_snappy")))
ssz_decode_file_with(
&path.join(format!("{column}.ssz_snappy")),
|bytes| {
DataColumnSidecar::from_ssz_bytes_for_fork(
bytes, fork_name,
)
.map(Arc::new)
},
)
})
.collect::<Result<Vec<_>, _>>()
})
@@ -297,6 +305,15 @@ impl<E: EthSpec> Case for ForkChoiceTest<E> {
}
fn result(&self, _case_index: usize, fork_name: ForkName) -> Result<(), Error> {
// TODO(gloas): We have not implemented this change to fork choice/proposer boost yet.
// https://github.com/sigp/lighthouse/issues/8689
if self.description == "voting_source_beyond_two_epoch"
|| self.description == "justified_update_not_realized_finality"
|| self.description == "justified_update_always_if_better"
{
return Err(Error::SkippedKnownFailure);
}
let tester = Tester::new(self, testing_spec::<E>(fork_name))?;
for step in &self.steps {
@@ -431,7 +448,7 @@ impl<E: EthSpec> Tester<E> {
.spec(spec.clone())
.keypairs(vec![])
.chain_config(ChainConfig {
reconstruct_historic_states: true,
archive: true,
..ChainConfig::default()
})
.genesis_state_ephemeral_store(case.anchor_state.clone())
@@ -471,7 +488,7 @@ impl<E: EthSpec> Tester<E> {
let since_genesis = tick
.checked_sub(genesis_time)
.ok_or_else(|| Error::FailedToParseTest("tick is prior to genesis".into()))?;
let slots_since_genesis = since_genesis / self.spec.seconds_per_slot;
let slots_since_genesis = since_genesis / self.spec.get_slot_duration().as_secs();
Ok(self.spec.genesis_slot + slots_since_genesis)
}
@@ -515,13 +532,15 @@ impl<E: EthSpec> Tester<E> {
valid: bool,
) -> Result<(), Error> {
let block_root = block.canonical_root();
let mut data_column_success = true;
if let Some(columns) = columns.clone() {
let gossip_verified_data_columns = columns
.into_iter()
.map(|column| {
let subnet_id = DataColumnSubnetId::from_column_index(column.index, &self.spec);
let subnet_id =
DataColumnSubnetId::from_column_index(*column.index(), &self.spec);
GossipVerifiedDataColumn::new(column.clone(), subnet_id, &self.harness.chain)
.unwrap_or_else(|_| {
data_column_success = false;
@@ -542,13 +561,21 @@ impl<E: EthSpec> Tester<E> {
let block = Arc::new(block);
let result: Result<Result<Hash256, ()>, _> = self
.block_on_dangerous(self.harness.chain.process_block(
block_root,
RpcBlock::new_without_blobs(Some(block_root), block.clone()),
NotifyExecutionLayer::Yes,
BlockImportSource::Lookup,
|| Ok(()),
))?
.block_on_dangerous(
self.harness.chain.process_block(
block_root,
RpcBlock::new(
block.clone(),
None,
&self.harness.chain.data_availability_checker,
self.harness.chain.spec.clone(),
)
.map_err(|e| Error::InternalError(format!("{:?}", e)))?,
NotifyExecutionLayer::Yes,
BlockImportSource::Lookup,
|| Ok(()),
),
)?
.map(|avail: AvailabilityProcessingStatus| avail.try_into());
let success = data_column_success && result.as_ref().is_ok_and(|inner| inner.is_ok());
if success != valid {
@@ -632,13 +659,21 @@ impl<E: EthSpec> Tester<E> {
let block = Arc::new(block);
let result: Result<Result<Hash256, ()>, _> = self
.block_on_dangerous(self.harness.chain.process_block(
block_root,
RpcBlock::new_without_blobs(Some(block_root), block.clone()),
NotifyExecutionLayer::Yes,
BlockImportSource::Lookup,
|| Ok(()),
))?
.block_on_dangerous(
self.harness.chain.process_block(
block_root,
RpcBlock::new(
block.clone(),
None,
&self.harness.chain.data_availability_checker,
self.harness.chain.spec.clone(),
)
.map_err(|e| Error::InternalError(format!("{:?}", e)))?,
NotifyExecutionLayer::Yes,
BlockImportSource::Lookup,
|| Ok(()),
),
)?
.map(|avail: AvailabilityProcessingStatus| avail.try_into());
let success = blob_success && result.as_ref().is_ok_and(|inner| inner.is_ok());
if success != valid {

View File

@@ -2,7 +2,7 @@ use super::*;
use alloy_primitives::U256;
use serde::Deserialize;
use std::marker::PhantomData;
use types::data_column_custody_group::get_custody_groups;
use types::data::get_custody_groups;
#[derive(Debug, Clone, Deserialize)]
#[serde(bound = "E: EthSpec", deny_unknown_fields)]

View File

@@ -6,7 +6,7 @@ use tree_hash::Hash256;
use typenum::Unsigned;
use types::{
BeaconBlockBody, BeaconBlockBodyCapella, BeaconBlockBodyDeneb, BeaconBlockBodyElectra,
BeaconBlockBodyFulu, BeaconBlockBodyGloas, BeaconState, FullPayload, light_client_update,
BeaconBlockBodyFulu, BeaconBlockBodyGloas, BeaconState, FullPayload, light_client,
};
#[derive(Debug, Clone, Deserialize)]
@@ -97,16 +97,16 @@ impl<E: EthSpec> Case for BeaconStateMerkleProofValidity<E> {
state.update_tree_hash_cache().unwrap();
let proof = match self.merkle_proof.leaf_index {
light_client_update::CURRENT_SYNC_COMMITTEE_INDEX_ELECTRA
| light_client_update::CURRENT_SYNC_COMMITTEE_INDEX => {
light_client::consts::CURRENT_SYNC_COMMITTEE_INDEX_ELECTRA
| light_client::consts::CURRENT_SYNC_COMMITTEE_INDEX => {
state.compute_current_sync_committee_proof()
}
light_client_update::NEXT_SYNC_COMMITTEE_INDEX_ELECTRA
| light_client_update::NEXT_SYNC_COMMITTEE_INDEX => {
light_client::consts::NEXT_SYNC_COMMITTEE_INDEX_ELECTRA
| light_client::consts::NEXT_SYNC_COMMITTEE_INDEX => {
state.compute_next_sync_committee_proof()
}
light_client_update::FINALIZED_ROOT_INDEX_ELECTRA
| light_client_update::FINALIZED_ROOT_INDEX => state.compute_finalized_root_proof(),
light_client::consts::FINALIZED_ROOT_INDEX_ELECTRA
| light_client::consts::FINALIZED_ROOT_INDEX => state.compute_finalized_root_proof(),
_ => {
return Err(Error::FailedToParseTest(
"Could not retrieve merkle proof, invalid index".to_string(),

View File

@@ -7,19 +7,22 @@ use ssz::Decode;
use state_processing::common::update_progressive_balances_cache::initialize_progressive_balances_cache;
use state_processing::epoch_cache::initialize_epoch_cache;
use state_processing::per_block_processing::process_operations::{
process_consolidation_requests, process_deposit_requests, process_withdrawal_requests,
process_consolidation_requests, process_deposit_requests_post_gloas,
process_deposit_requests_pre_gloas, process_withdrawal_requests,
};
use state_processing::{
ConsensusContext,
envelope_processing::{EnvelopeProcessingError, process_execution_payload_envelope},
per_block_processing::{
VerifyBlockRoot, VerifySignatures,
errors::BlockProcessingError,
process_block_header, process_execution_payload,
process_block_header, process_execution_payload, process_execution_payload_bid,
process_operations::{
altair_deneb, base, process_attester_slashings, process_bls_to_execution_changes,
process_deposits, process_exits, process_proposer_slashings,
altair_deneb, base, gloas, process_attester_slashings,
process_bls_to_execution_changes, process_deposits, process_exits,
process_proposer_slashings,
},
process_sync_aggregate, process_withdrawals,
process_sync_aggregate, withdrawals,
},
};
use std::fmt::Debug;
@@ -28,7 +31,7 @@ use types::{
BeaconBlockBodyCapella, BeaconBlockBodyDeneb, BeaconBlockBodyElectra, BeaconBlockBodyFulu,
BeaconState, BlindedPayload, ConsolidationRequest, Deposit, DepositRequest, ExecutionPayload,
ForkVersionDecode, FullPayload, ProposerSlashing, SignedBlsToExecutionChange,
SignedVoluntaryExit, SyncAggregate, WithdrawalRequest,
SignedExecutionPayloadEnvelope, SignedVoluntaryExit, SyncAggregate, WithdrawalRequest,
};
#[derive(Debug, Clone, Default, Deserialize)]
@@ -45,7 +48,13 @@ struct ExecutionMetadata {
/// Newtype for testing withdrawals.
#[derive(Debug, Clone, Deserialize)]
pub struct WithdrawalsPayload<E: EthSpec> {
payload: FullPayload<E>,
payload: Option<ExecutionPayload<E>>,
}
/// Newtype for testing execution payload bids.
#[derive(Debug, Clone, Deserialize)]
pub struct ExecutionPayloadBidBlock<E: EthSpec> {
block: BeaconBlock<E>,
}
#[derive(Debug, Clone)]
@@ -58,6 +67,8 @@ pub struct Operations<E: EthSpec, O: Operation<E>> {
}
pub trait Operation<E: EthSpec>: Debug + Sync + Sized {
type Error: Debug;
fn handler_name() -> String;
fn filename() -> String {
@@ -75,10 +86,12 @@ pub trait Operation<E: EthSpec>: Debug + Sync + Sized {
state: &mut BeaconState<E>,
spec: &ChainSpec,
_: &Operations<E, Self>,
) -> Result<(), BlockProcessingError>;
) -> Result<(), Self::Error>;
}
impl<E: EthSpec> Operation<E> for Attestation<E> {
type Error = BlockProcessingError;
fn handler_name() -> String {
"attestation".into()
}
@@ -98,9 +111,18 @@ impl<E: EthSpec> Operation<E> for Attestation<E> {
_: &Operations<E, Self>,
) -> Result<(), BlockProcessingError> {
initialize_epoch_cache(state, spec)?;
initialize_progressive_balances_cache(state, spec)?;
let mut ctxt = ConsensusContext::new(state.slot());
if state.fork_name_unchecked().altair_enabled() {
initialize_progressive_balances_cache(state, spec)?;
if state.fork_name_unchecked().gloas_enabled() {
gloas::process_attestation(
state,
self.to_ref(),
0,
&mut ctxt,
VerifySignatures::True,
spec,
)
} else if state.fork_name_unchecked().altair_enabled() {
altair_deneb::process_attestation(
state,
self.to_ref(),
@@ -122,6 +144,8 @@ impl<E: EthSpec> Operation<E> for Attestation<E> {
}
impl<E: EthSpec> Operation<E> for AttesterSlashing<E> {
type Error = BlockProcessingError;
fn handler_name() -> String {
"attester_slashing".into()
}
@@ -153,6 +177,8 @@ impl<E: EthSpec> Operation<E> for AttesterSlashing<E> {
}
impl<E: EthSpec> Operation<E> for Deposit {
type Error = BlockProcessingError;
fn handler_name() -> String {
"deposit".into()
}
@@ -177,6 +203,8 @@ impl<E: EthSpec> Operation<E> for Deposit {
}
impl<E: EthSpec> Operation<E> for ProposerSlashing {
type Error = BlockProcessingError;
fn handler_name() -> String {
"proposer_slashing".into()
}
@@ -204,6 +232,8 @@ impl<E: EthSpec> Operation<E> for ProposerSlashing {
}
impl<E: EthSpec> Operation<E> for SignedVoluntaryExit {
type Error = BlockProcessingError;
fn handler_name() -> String {
"voluntary_exit".into()
}
@@ -228,6 +258,8 @@ impl<E: EthSpec> Operation<E> for SignedVoluntaryExit {
}
impl<E: EthSpec> Operation<E> for BeaconBlock<E> {
type Error = BlockProcessingError;
fn handler_name() -> String {
"block_header".into()
}
@@ -259,6 +291,8 @@ impl<E: EthSpec> Operation<E> for BeaconBlock<E> {
}
impl<E: EthSpec> Operation<E> for SyncAggregate<E> {
type Error = BlockProcessingError;
fn handler_name() -> String {
"sync_aggregate".into()
}
@@ -287,6 +321,8 @@ impl<E: EthSpec> Operation<E> for SyncAggregate<E> {
}
impl<E: EthSpec> Operation<E> for BeaconBlockBody<E, FullPayload<E>> {
type Error = BlockProcessingError;
fn handler_name() -> String {
"execution_payload".into()
}
@@ -296,7 +332,7 @@ impl<E: EthSpec> Operation<E> for BeaconBlockBody<E, FullPayload<E>> {
}
fn is_enabled_for_fork(fork_name: ForkName) -> bool {
fork_name.bellatrix_enabled()
fork_name.bellatrix_enabled() && !fork_name.gloas_enabled()
}
fn decode(path: &Path, fork_name: ForkName, _spec: &ChainSpec) -> Result<Self, Error> {
@@ -307,8 +343,7 @@ impl<E: EthSpec> Operation<E> for BeaconBlockBody<E, FullPayload<E>> {
ForkName::Deneb => BeaconBlockBody::Deneb(<_>::from_ssz_bytes(bytes)?),
ForkName::Electra => BeaconBlockBody::Electra(<_>::from_ssz_bytes(bytes)?),
ForkName::Fulu => BeaconBlockBody::Fulu(<_>::from_ssz_bytes(bytes)?),
// TODO(EIP-7732): See if we need to handle Gloas here
_ => panic!(),
_ => panic!("Not supported after Gloas"),
})
})
}
@@ -330,7 +365,10 @@ impl<E: EthSpec> Operation<E> for BeaconBlockBody<E, FullPayload<E>> {
}
}
}
impl<E: EthSpec> Operation<E> for BeaconBlockBody<E, BlindedPayload<E>> {
type Error = BlockProcessingError;
fn handler_name() -> String {
"execution_payload".into()
}
@@ -340,7 +378,7 @@ impl<E: EthSpec> Operation<E> for BeaconBlockBody<E, BlindedPayload<E>> {
}
fn is_enabled_for_fork(fork_name: ForkName) -> bool {
fork_name.bellatrix_enabled()
fork_name.bellatrix_enabled() && !fork_name.gloas_enabled()
}
fn decode(path: &Path, fork_name: ForkName, _spec: &ChainSpec) -> Result<Self, Error> {
@@ -367,8 +405,7 @@ impl<E: EthSpec> Operation<E> for BeaconBlockBody<E, BlindedPayload<E>> {
let inner = <BeaconBlockBodyFulu<E, FullPayload<E>>>::from_ssz_bytes(bytes)?;
BeaconBlockBody::Fulu(inner.clone_as_blinded())
}
// TODO(EIP-7732): See if we need to handle Gloas here
_ => panic!(),
_ => panic!("Not supported after Gloas"),
})
})
}
@@ -391,7 +428,77 @@ impl<E: EthSpec> Operation<E> for BeaconBlockBody<E, BlindedPayload<E>> {
}
}
impl<E: EthSpec> Operation<E> for SignedExecutionPayloadEnvelope<E> {
type Error = EnvelopeProcessingError;
fn handler_name() -> String {
"execution_payload".into()
}
fn filename() -> String {
"signed_envelope.ssz_snappy".into()
}
fn is_enabled_for_fork(fork_name: ForkName) -> bool {
fork_name.gloas_enabled()
}
fn decode(path: &Path, _: ForkName, _spec: &ChainSpec) -> Result<Self, Error> {
ssz_decode_file(path)
}
fn apply_to(
&self,
state: &mut BeaconState<E>,
spec: &ChainSpec,
extra: &Operations<E, Self>,
) -> Result<(), Self::Error> {
let valid = extra
.execution_metadata
.as_ref()
.is_some_and(|e| e.execution_valid);
if valid {
process_execution_payload_envelope(state, None, self, VerifySignatures::True, spec)
} else {
Err(EnvelopeProcessingError::ExecutionInvalid)
}
}
}
impl<E: EthSpec> Operation<E> for ExecutionPayloadBidBlock<E> {
type Error = BlockProcessingError;
fn handler_name() -> String {
"execution_payload_bid".into()
}
fn filename() -> String {
"block.ssz_snappy".into()
}
fn is_enabled_for_fork(fork_name: ForkName) -> bool {
fork_name.gloas_enabled()
}
fn decode(path: &Path, _fork_name: ForkName, spec: &ChainSpec) -> Result<Self, Error> {
ssz_decode_file_with(path, |bytes| BeaconBlock::from_ssz_bytes(bytes, spec))
.map(|block| ExecutionPayloadBidBlock { block })
}
fn apply_to(
&self,
state: &mut BeaconState<E>,
spec: &ChainSpec,
_: &Operations<E, Self>,
) -> Result<(), BlockProcessingError> {
process_execution_payload_bid(state, self.block.to_ref(), VerifySignatures::True, spec)?;
Ok(())
}
}
impl<E: EthSpec> Operation<E> for WithdrawalsPayload<E> {
type Error = BlockProcessingError;
fn handler_name() -> String {
"withdrawals".into()
}
@@ -405,12 +512,17 @@ impl<E: EthSpec> Operation<E> for WithdrawalsPayload<E> {
}
fn decode(path: &Path, fork_name: ForkName, _spec: &ChainSpec) -> Result<Self, Error> {
ssz_decode_file_with(path, |bytes| {
ExecutionPayload::from_ssz_bytes_by_fork(bytes, fork_name)
})
.map(|payload| WithdrawalsPayload {
payload: payload.into(),
})
if fork_name.gloas_enabled() {
// No payload present or required for Gloas tests.
Ok(WithdrawalsPayload { payload: None })
} else {
ssz_decode_file_with(path, |bytes| {
ExecutionPayload::from_ssz_bytes_by_fork(bytes, fork_name)
})
.map(|payload| WithdrawalsPayload {
payload: Some(payload),
})
}
}
fn apply_to(
@@ -419,12 +531,22 @@ impl<E: EthSpec> Operation<E> for WithdrawalsPayload<E> {
spec: &ChainSpec,
_: &Operations<E, Self>,
) -> Result<(), BlockProcessingError> {
// TODO(EIP-7732): implement separate gloas and non-gloas variants of process_withdrawals
process_withdrawals::<_, FullPayload<_>>(state, self.payload.to_ref(), spec)
if state.fork_name_unchecked().gloas_enabled() {
withdrawals::gloas::process_withdrawals(state, spec)
} else {
let full_payload = FullPayload::from(self.payload.clone().unwrap());
withdrawals::capella_electra::process_withdrawals::<_, FullPayload<_>>(
state,
full_payload.to_ref(),
spec,
)
}
}
}
impl<E: EthSpec> Operation<E> for SignedBlsToExecutionChange {
type Error = BlockProcessingError;
fn handler_name() -> String {
"bls_to_execution_change".into()
}
@@ -457,6 +579,8 @@ impl<E: EthSpec> Operation<E> for SignedBlsToExecutionChange {
}
impl<E: EthSpec> Operation<E> for WithdrawalRequest {
type Error = BlockProcessingError;
fn handler_name() -> String {
"withdrawal_request".into()
}
@@ -481,6 +605,8 @@ impl<E: EthSpec> Operation<E> for WithdrawalRequest {
}
impl<E: EthSpec> Operation<E> for DepositRequest {
type Error = BlockProcessingError;
fn handler_name() -> String {
"deposit_request".into()
}
@@ -499,11 +625,17 @@ impl<E: EthSpec> Operation<E> for DepositRequest {
spec: &ChainSpec,
_extra: &Operations<E, Self>,
) -> Result<(), BlockProcessingError> {
process_deposit_requests(state, std::slice::from_ref(self), spec)
if state.fork_name_unchecked().gloas_enabled() {
process_deposit_requests_post_gloas(state, std::slice::from_ref(self), spec)
} else {
process_deposit_requests_pre_gloas(state, std::slice::from_ref(self), spec)
}
}
}
impl<E: EthSpec> Operation<E> for ConsolidationRequest {
type Error = BlockProcessingError;
fn handler_name() -> String {
"consolidation_request".into()
}

View File

@@ -305,6 +305,10 @@ impl<T, E> SszStaticHandler<T, E> {
Self::for_forks(vec![ForkName::Fulu])
}
pub fn gloas_only() -> Self {
Self::for_forks(vec![ForkName::Gloas])
}
pub fn altair_and_later() -> Self {
Self::for_forks(ForkName::list_all()[1..].to_vec())
}
@@ -329,6 +333,10 @@ impl<T, E> SszStaticHandler<T, E> {
Self::for_forks(ForkName::list_all()[6..].to_vec())
}
pub fn gloas_and_later() -> Self {
Self::for_forks(ForkName::list_all()[7..].to_vec())
}
pub fn pre_electra() -> Self {
Self::for_forks(ForkName::list_all()[0..5].to_vec())
}
@@ -387,6 +395,11 @@ where
T::name().into()
}
fn disabled_forks(&self) -> Vec<ForkName> {
// TODO(gloas): Can be removed once we enable Gloas on all tests
vec![]
}
fn is_enabled_for_fork(&self, fork_name: ForkName) -> bool {
self.supported_forks.contains(&fork_name)
}
@@ -409,6 +422,11 @@ where
fn handler_name(&self) -> String {
BeaconState::<E>::name().into()
}
fn disabled_forks(&self) -> Vec<ForkName> {
// TODO(gloas): Can be removed once we enable Gloas on all tests
vec![]
}
}
impl<T, E> Handler for SszStaticWithSpecHandler<T, E>
@@ -431,6 +449,11 @@ where
T::name().into()
}
fn disabled_forks(&self) -> Vec<ForkName> {
// TODO(gloas): Can be removed once we enable Gloas on all tests
vec![]
}
fn is_enabled_for_fork(&self, fork_name: ForkName) -> bool {
self.supported_forks.contains(&fork_name)
}
@@ -1105,6 +1128,30 @@ impl<E: EthSpec + TypeName, O: Operation<E>> Handler for OperationsHandler<E, O>
fn handler_name(&self) -> String {
O::handler_name()
}
fn disabled_forks(&self) -> Vec<ForkName> {
// TODO(gloas): Can be removed once we enable Gloas on all tests
vec![]
}
fn is_enabled_for_fork(&self, fork_name: ForkName) -> bool {
Self::Case::is_enabled_for_fork(fork_name)
&& (!fork_name.gloas_enabled()
|| self.handler_name() == "attestation"
|| self.handler_name() == "attester_slashing"
|| self.handler_name() == "block_header"
|| self.handler_name() == "bls_to_execution_change"
|| self.handler_name() == "consolidation_request"
|| self.handler_name() == "deposit_request"
|| self.handler_name() == "deposit"
|| self.handler_name() == "execution_payload"
|| self.handler_name() == "execution_payload_bid"
|| self.handler_name() == "proposer_slashing"
|| self.handler_name() == "sync_aggregate"
|| self.handler_name() == "withdrawal_request"
|| self.handler_name() == "withdrawals"
|| self.handler_name() == "voluntary_exit")
}
}
#[derive(Educe)]

View File

@@ -1,11 +1,11 @@
pub use case_result::CaseResult;
pub use cases::WithdrawalsPayload;
pub use cases::{
Case, EffectiveBalanceUpdates, Eth1DataReset, FeatureName, HistoricalRootsUpdate,
HistoricalSummariesUpdate, InactivityUpdates, JustificationAndFinalization,
ParticipationFlagUpdates, ParticipationRecordUpdates, PendingBalanceDeposits,
PendingConsolidations, ProposerLookahead, RandaoMixesReset, RegistryUpdates,
RewardsAndPenalties, Slashings, SlashingsReset, SyncCommitteeUpdates,
Case, EffectiveBalanceUpdates, Eth1DataReset, ExecutionPayloadBidBlock, FeatureName,
HistoricalRootsUpdate, HistoricalSummariesUpdate, InactivityUpdates,
JustificationAndFinalization, ParticipationFlagUpdates, ParticipationRecordUpdates,
PendingBalanceDeposits, PendingConsolidations, ProposerLookahead, RandaoMixesReset,
RegistryUpdates, RewardsAndPenalties, Slashings, SlashingsReset, SyncCommitteeUpdates,
WithdrawalsPayload,
};
pub use decode::log_file_access;
pub use error::Error;

View File

@@ -1,5 +1,5 @@
//! Mapping from types to canonical string identifiers used in testing.
use types::historical_summary::HistoricalSummary;
use types::state::HistoricalSummary;
use types::*;
pub trait TypeName {
@@ -55,12 +55,15 @@ type_name_generic!(BeaconBlockBodyCapella, "BeaconBlockBody");
type_name_generic!(BeaconBlockBodyDeneb, "BeaconBlockBody");
type_name_generic!(BeaconBlockBodyElectra, "BeaconBlockBody");
type_name_generic!(BeaconBlockBodyFulu, "BeaconBlockBody");
type_name_generic!(BeaconBlockBodyGloas, "BeaconBlockBody");
type_name!(BeaconBlockHeader);
type_name_generic!(BeaconState);
type_name!(BlobIdentifier);
type_name_generic!(DataColumnsByRootIdentifier, "DataColumnsByRootIdentifier");
type_name_generic!(BlobSidecar);
type_name_generic!(DataColumnSidecar);
type_name_generic!(DataColumnSidecarFulu, "DataColumnSidecar");
type_name_generic!(DataColumnSidecarGloas, "DataColumnSidecar");
type_name!(Checkpoint);
type_name!(ConsolidationRequest);
type_name_generic!(ContributionAndProof);
@@ -69,6 +72,9 @@ type_name!(DepositData);
type_name!(DepositMessage);
type_name!(DepositRequest);
type_name!(Eth1Data);
type_name!(Builder);
type_name!(BuilderPendingPayment);
type_name!(BuilderPendingWithdrawal);
type_name!(WithdrawalRequest);
type_name_generic!(ExecutionPayload);
type_name_generic!(ExecutionPayloadBellatrix, "ExecutionPayload");
@@ -76,6 +82,7 @@ type_name_generic!(ExecutionPayloadCapella, "ExecutionPayload");
type_name_generic!(ExecutionPayloadDeneb, "ExecutionPayload");
type_name_generic!(ExecutionPayloadElectra, "ExecutionPayload");
type_name_generic!(ExecutionPayloadFulu, "ExecutionPayload");
type_name_generic!(ExecutionPayloadGloas, "ExecutionPayload");
type_name_generic!(FullPayload, "ExecutionPayload");
type_name_generic!(ExecutionPayloadHeader);
type_name_generic!(ExecutionPayloadHeaderBellatrix, "ExecutionPayloadHeader");
@@ -83,7 +90,11 @@ type_name_generic!(ExecutionPayloadHeaderCapella, "ExecutionPayloadHeader");
type_name_generic!(ExecutionPayloadHeaderDeneb, "ExecutionPayloadHeader");
type_name_generic!(ExecutionPayloadHeaderElectra, "ExecutionPayloadHeader");
type_name_generic!(ExecutionPayloadHeaderFulu, "ExecutionPayloadHeader");
type_name_generic!(ExecutionPayloadBid);
type_name_generic!(SignedExecutionPayloadBid);
type_name_generic!(ExecutionRequests);
type_name_generic!(ExecutionPayloadEnvelope);
type_name_generic!(SignedExecutionPayloadEnvelope);
type_name_generic!(BlindedPayload, "ExecutionPayloadHeader");
type_name!(Fork);
type_name!(ForkData);
@@ -91,6 +102,7 @@ type_name_generic!(HistoricalBatch);
type_name_generic!(IndexedAttestation);
type_name_generic!(IndexedAttestationBase, "IndexedAttestation");
type_name_generic!(IndexedAttestationElectra, "IndexedAttestation");
type_name_generic!(IndexedPayloadAttestation);
type_name_generic!(LightClientBootstrap);
type_name_generic!(LightClientBootstrapAltair, "LightClientBootstrap");
type_name_generic!(LightClientBootstrapCapella, "LightClientBootstrap");
@@ -143,10 +155,15 @@ type_name_generic!(LightClientUpdateDeneb, "LightClientUpdate");
type_name_generic!(LightClientUpdateElectra, "LightClientUpdate");
type_name_generic!(LightClientUpdateFulu, "LightClientUpdate");
type_name_generic!(PendingAttestation);
type_name_generic!(PayloadAttestation);
type_name!(PayloadAttestationData);
type_name!(PayloadAttestationMessage);
type_name!(PendingConsolidation);
type_name!(PendingPartialWithdrawal);
type_name!(PendingDeposit);
type_name!(ProposerSlashing);
type_name!(ProposerPreferences);
type_name!(SignedProposerPreferences);
type_name_generic!(SignedAggregateAndProof);
type_name_generic!(SignedAggregateAndProofBase, "SignedAggregateAndProof");
type_name_generic!(SignedAggregateAndProofElectra, "SignedAggregateAndProof");

View File

@@ -87,6 +87,18 @@ fn operations_execution_payload_blinded() {
OperationsHandler::<MainnetEthSpec, BeaconBlockBody<_, BlindedPayload<_>>>::default().run();
}
#[test]
fn operations_execution_payload_envelope() {
OperationsHandler::<MinimalEthSpec, SignedExecutionPayloadEnvelope<_>>::default().run();
OperationsHandler::<MainnetEthSpec, SignedExecutionPayloadEnvelope<_>>::default().run();
}
#[test]
fn operations_execution_payload_bid() {
OperationsHandler::<MinimalEthSpec, ExecutionPayloadBidBlock<_>>::default().run();
OperationsHandler::<MainnetEthSpec, ExecutionPayloadBidBlock<_>>::default().run();
}
#[test]
fn operations_withdrawals() {
OperationsHandler::<MinimalEthSpec, WithdrawalsPayload<_>>::default().run();
@@ -94,7 +106,7 @@ fn operations_withdrawals() {
}
#[test]
fn operations_withdrawal_reqeusts() {
fn operations_withdrawal_requests() {
OperationsHandler::<MinimalEthSpec, WithdrawalRequest>::default().run();
OperationsHandler::<MainnetEthSpec, WithdrawalRequest>::default().run();
}
@@ -239,10 +251,14 @@ macro_rules! ssz_static_test_no_run {
#[cfg(feature = "fake_crypto")]
mod ssz_static {
use ef_tests::{Handler, SszStaticHandler, SszStaticTHCHandler, SszStaticWithSpecHandler};
use types::historical_summary::HistoricalSummary;
use types::state::HistoricalSummary;
use types::{
AttesterSlashingBase, AttesterSlashingElectra, ConsolidationRequest, DepositRequest,
LightClientBootstrapAltair, PendingDeposit, PendingPartialWithdrawal, WithdrawalRequest, *,
AttesterSlashingBase, AttesterSlashingElectra, Builder, BuilderPendingPayment,
BuilderPendingWithdrawal, ConsolidationRequest, DepositRequest, ExecutionPayloadBid,
ExecutionPayloadEnvelope, IndexedPayloadAttestation, LightClientBootstrapAltair,
PayloadAttestation, PayloadAttestationData, PayloadAttestationMessage, PendingDeposit,
PendingPartialWithdrawal, SignedExecutionPayloadBid, SignedExecutionPayloadEnvelope,
WithdrawalRequest, *,
};
ssz_static_test!(attestation_data, AttestationData);
@@ -368,6 +384,10 @@ mod ssz_static {
.run();
SszStaticHandler::<BeaconBlockBodyFulu<MinimalEthSpec>, MinimalEthSpec>::fulu_only().run();
SszStaticHandler::<BeaconBlockBodyFulu<MainnetEthSpec>, MainnetEthSpec>::fulu_only().run();
SszStaticHandler::<BeaconBlockBodyGloas<MinimalEthSpec>, MinimalEthSpec>::gloas_only()
.run();
SszStaticHandler::<BeaconBlockBodyGloas<MainnetEthSpec>, MainnetEthSpec>::gloas_only()
.run();
}
// Altair and later
@@ -595,6 +615,10 @@ mod ssz_static {
.run();
SszStaticHandler::<ExecutionPayloadFulu<MinimalEthSpec>, MinimalEthSpec>::fulu_only().run();
SszStaticHandler::<ExecutionPayloadFulu<MainnetEthSpec>, MainnetEthSpec>::fulu_only().run();
SszStaticHandler::<ExecutionPayloadGloas<MinimalEthSpec>, MinimalEthSpec>::gloas_only()
.run();
SszStaticHandler::<ExecutionPayloadGloas<MainnetEthSpec>, MainnetEthSpec>::gloas_only()
.run();
}
#[test]
@@ -621,6 +645,20 @@ mod ssz_static {
.run();
}
#[test]
fn execution_payload_bid() {
SszStaticHandler::<ExecutionPayloadBid<MinimalEthSpec>, MinimalEthSpec>::gloas_and_later()
.run();
SszStaticHandler::<ExecutionPayloadBid<MainnetEthSpec>, MainnetEthSpec>::gloas_and_later()
.run();
}
#[test]
fn signed_execution_payload_bid() {
SszStaticHandler::<SignedExecutionPayloadBid<MinimalEthSpec>, MinimalEthSpec>::gloas_and_later().run();
SszStaticHandler::<SignedExecutionPayloadBid<MainnetEthSpec>, MainnetEthSpec>::gloas_and_later().run();
}
#[test]
fn withdrawal() {
SszStaticHandler::<Withdrawal, MinimalEthSpec>::capella_and_later().run();
@@ -659,9 +697,13 @@ mod ssz_static {
#[test]
fn data_column_sidecar() {
SszStaticHandler::<DataColumnSidecar<MinimalEthSpec>, MinimalEthSpec>::fulu_and_later()
SszStaticHandler::<DataColumnSidecarFulu<MinimalEthSpec>, MinimalEthSpec>::fulu_only()
.run();
SszStaticHandler::<DataColumnSidecar<MainnetEthSpec>, MainnetEthSpec>::fulu_and_later()
SszStaticHandler::<DataColumnSidecarFulu<MainnetEthSpec>, MainnetEthSpec>::fulu_only()
.run();
SszStaticHandler::<DataColumnSidecarGloas<MinimalEthSpec>, MinimalEthSpec>::gloas_only()
.run();
SszStaticHandler::<DataColumnSidecarGloas<MainnetEthSpec>, MainnetEthSpec>::gloas_only()
.run();
}
@@ -722,6 +764,81 @@ mod ssz_static {
SszStaticHandler::<ExecutionRequests<MinimalEthSpec>, MinimalEthSpec>::electra_and_later()
.run();
}
// Gloas and later
#[test]
fn builder() {
SszStaticHandler::<Builder, MinimalEthSpec>::gloas_and_later().run();
SszStaticHandler::<Builder, MainnetEthSpec>::gloas_and_later().run();
}
#[test]
fn builder_pending_payment() {
SszStaticHandler::<BuilderPendingPayment, MinimalEthSpec>::gloas_and_later().run();
SszStaticHandler::<BuilderPendingPayment, MainnetEthSpec>::gloas_and_later().run();
}
#[test]
fn builder_pending_withdrawal() {
SszStaticHandler::<BuilderPendingWithdrawal, MinimalEthSpec>::gloas_and_later().run();
SszStaticHandler::<BuilderPendingWithdrawal, MainnetEthSpec>::gloas_and_later().run();
}
#[test]
fn payload_attestation_data() {
SszStaticHandler::<PayloadAttestationData, MinimalEthSpec>::gloas_and_later().run();
SszStaticHandler::<PayloadAttestationData, MainnetEthSpec>::gloas_and_later().run();
}
#[test]
fn payload_attestation() {
SszStaticHandler::<PayloadAttestation<MinimalEthSpec>, MinimalEthSpec>::gloas_and_later()
.run();
SszStaticHandler::<PayloadAttestation<MainnetEthSpec>, MainnetEthSpec>::gloas_and_later()
.run();
}
#[test]
fn payload_attestation_message() {
SszStaticHandler::<PayloadAttestationMessage, MinimalEthSpec>::gloas_and_later().run();
SszStaticHandler::<PayloadAttestationMessage, MainnetEthSpec>::gloas_and_later().run();
}
#[test]
fn indexed_payload_attestation() {
SszStaticHandler::<IndexedPayloadAttestation<MinimalEthSpec>, MinimalEthSpec>::gloas_and_later()
.run();
SszStaticHandler::<IndexedPayloadAttestation<MainnetEthSpec>, MainnetEthSpec>::gloas_and_later()
.run();
}
#[test]
fn execution_payload_envelope() {
SszStaticHandler::<ExecutionPayloadEnvelope<MinimalEthSpec>, MinimalEthSpec>::gloas_and_later()
.run();
SszStaticHandler::<ExecutionPayloadEnvelope<MainnetEthSpec>, MainnetEthSpec>::gloas_and_later()
.run();
}
#[test]
fn signed_execution_payload_envelope() {
SszStaticHandler::<SignedExecutionPayloadEnvelope<MinimalEthSpec>, MinimalEthSpec>::gloas_and_later()
.run();
SszStaticHandler::<SignedExecutionPayloadEnvelope<MainnetEthSpec>, MainnetEthSpec>::gloas_and_later()
.run();
}
#[test]
fn proposer_preferences() {
SszStaticHandler::<ProposerPreferences, MinimalEthSpec>::gloas_and_later().run();
SszStaticHandler::<ProposerPreferences, MainnetEthSpec>::gloas_and_later().run();
}
#[test]
fn signed_proposer_preferences() {
SszStaticHandler::<SignedProposerPreferences, MinimalEthSpec>::gloas_and_later().run();
SszStaticHandler::<SignedProposerPreferences, MainnetEthSpec>::gloas_and_later().run();
}
}
#[test]