Add Gloas EF test infrastructure and fork choice exclusion.

- Add fork choice constants to consts.rs (PayloadStatus, timeliness indices)
- Add payload_timely_threshold() helper to EthSpec
- Exclude Gloas from fork_choice tests until implementation is complete
- Add PayloadAttestation operation test handler for EF tests
This commit is contained in:
Jimmy Chen
2026-01-20 15:47:49 +11:00
parent ae38421589
commit 7d95ef3074
5 changed files with 54 additions and 2 deletions

View File

@@ -296,6 +296,11 @@ impl<E: EthSpec> Case for ForkChoiceTest<E> {
self.description.clone()
}
fn is_enabled_for_fork(fork_name: ForkName) -> bool {
// Gloas fork choice not yet implemented
fork_name != ForkName::Gloas
}
fn result(&self, _case_index: usize, fork_name: ForkName) -> Result<(), Error> {
let tester = Tester::new(self, testing_spec::<E>(fork_name))?;

View File

@@ -8,7 +8,7 @@ use state_processing::common::update_progressive_balances_cache::initialize_prog
use state_processing::epoch_cache::initialize_epoch_cache;
use state_processing::per_block_processing::process_operations::{
altair_deneb, base, gloas, process_consolidation_requests, process_deposit_requests,
process_withdrawal_requests,
process_payload_attestation, process_withdrawal_requests,
};
use state_processing::{
ConsensusContext,
@@ -28,7 +28,7 @@ use types::{
Attestation, AttesterSlashing, BeaconBlock, BeaconBlockBody, BeaconBlockBodyBellatrix,
BeaconBlockBodyCapella, BeaconBlockBodyDeneb, BeaconBlockBodyElectra, BeaconBlockBodyFulu,
BeaconState, BlindedPayload, ConsolidationRequest, Deposit, DepositRequest, ExecutionPayload,
ForkVersionDecode, FullPayload, ProposerSlashing, SignedBlsToExecutionChange,
ForkVersionDecode, FullPayload, PayloadAttestation, ProposerSlashing, SignedBlsToExecutionChange,
SignedVoluntaryExit, SyncAggregate, WithdrawalRequest,
};
@@ -545,6 +545,32 @@ impl<E: EthSpec> Operation<E> for ConsolidationRequest {
}
}
impl<E: EthSpec> Operation<E> for PayloadAttestation<E> {
fn handler_name() -> String {
"payload_attestation".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(path)
}
fn apply_to(
&self,
state: &mut BeaconState<E>,
spec: &ChainSpec,
_extra: &Operations<E, Self>,
) -> Result<(), BlockProcessingError> {
initialize_epoch_cache(state, spec)?;
initialize_progressive_balances_cache(state, spec)?;
let mut ctxt = ConsensusContext::new(state.slot());
process_payload_attestation(state, self, 0, VerifySignatures::True, &mut ctxt, spec)
}
}
impl<E: EthSpec, O: Operation<E>> LoadCase for Operations<E, O> {
fn load_from_dir(path: &Path, fork_name: ForkName) -> Result<Self, Error> {
let spec = &testing_spec::<E>(fork_name);