Skip to content

Commit ade55a2

Browse files
authored
Fix Gloas EF test failures and add test exclusions (#8687)
* Added gloas exclusion to `FinalityHandler` * Fix Gloas EF test failures and add test exclusions - Fix execution_payload_availability initialization in fork upgrade to set all bits to true per spec (was all zeros) - Fix minimal spec gloas_fork_version: [0x07,0x00,0x00,0x01] (was 0x00) - Fix payload attestation signature domain to use get_domain instead of compute_domain with genesis fork version - Add proposer slashing handler to clear builder_pending_payment per EIP-7732 spec - Add Gloas test exclusions for unimplemented functionality: - sanity_blocks, sanity_slots, random, transition, finality handlers - deposit_request operation (requires builder deposit functionality) - Python exclusions for check_all_files_accessed.py * fmt
1 parent c276fe6 commit ade55a2

File tree

7 files changed

+83
-10
lines changed

7 files changed

+83
-10
lines changed

consensus/state_processing/src/per_block_processing/process_operations.rs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,30 @@ pub fn process_proposer_slashings<E: EthSpec>(
387387
verify_proposer_slashing(proposer_slashing, state, verify_signatures, spec)
388388
.map_err(|e| e.into_with_index(i))?;
389389

390+
// [New in Gloas:EIP7732]
391+
// Remove the BuilderPendingPayment corresponding to this proposal
392+
// if it is still in the 2-epoch window.
393+
let slot = proposer_slashing.signed_header_1.message.slot;
394+
let proposal_epoch = slot.epoch(E::slots_per_epoch());
395+
let current_epoch = state.current_epoch();
396+
let slot_in_epoch = slot.as_u64() % E::slots_per_epoch();
397+
398+
let payment_index = if proposal_epoch == current_epoch {
399+
Some(E::slots_per_epoch() + slot_in_epoch)
400+
} else if proposal_epoch == current_epoch.saturating_sub(1u64) {
401+
Some(slot_in_epoch)
402+
} else {
403+
None
404+
};
405+
406+
if let Some(index) = payment_index {
407+
if let Ok(builder_pending_payments) = state.builder_pending_payments_mut() {
408+
if let Some(payment) = builder_pending_payments.get_mut(index as usize) {
409+
*payment = BuilderPendingPayment::default();
410+
}
411+
}
412+
}
413+
390414
slash_validator(
391415
state,
392416
proposer_slashing.signed_header_1.message.proposer_index as usize,

consensus/state_processing/src/per_block_processing/signature_sets.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -318,9 +318,14 @@ where
318318
);
319319
}
320320

321-
let domain = spec.compute_domain(
321+
let epoch = indexed_payload_attestation
322+
.data
323+
.slot
324+
.epoch(E::slots_per_epoch());
325+
let domain = spec.get_domain(
326+
epoch,
322327
Domain::PTCAttester,
323-
spec.genesis_fork_version,
328+
&state.fork(),
324329
state.genesis_validators_root(),
325330
);
326331

consensus/state_processing/src/upgrade/gloas.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
use milhouse::{List, Vector};
22
use ssz_types::BitVector;
33
use std::mem;
4+
use typenum::Unsigned;
45
use types::{
56
BeaconState, BeaconStateError as Error, BeaconStateGloas, BuilderPendingPayment, ChainSpec,
67
EthSpec, ExecutionPayloadBid, Fork,
@@ -91,7 +92,12 @@ pub fn upgrade_state_to_gloas<E: EthSpec>(
9192
// Gloas
9293
builders: List::default(),
9394
next_withdrawal_builder_index: 0,
94-
execution_payload_availability: BitVector::default(), // All bits set to false initially
95+
// All bits set to true per spec:
96+
// execution_payload_availability = [0b1 for _ in range(SLOTS_PER_HISTORICAL_ROOT)]
97+
execution_payload_availability: BitVector::from_bytes(
98+
vec![0xFFu8; E::SlotsPerHistoricalRoot::to_usize() / 8].into(),
99+
)
100+
.expect("SlotsPerHistoricalRoot is always divisible by 8"),
95101
builder_pending_payments: Vector::new(vec![
96102
BuilderPendingPayment::default();
97103
E::builder_pending_payments_limit()

consensus/types/src/core/chain_spec.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1248,7 +1248,7 @@ impl ChainSpec {
12481248
fulu_fork_version: [0x06, 0x00, 0x00, 0x01],
12491249
fulu_fork_epoch: None,
12501250
// Gloas
1251-
gloas_fork_version: [0x07, 0x00, 0x00, 0x00],
1251+
gloas_fork_version: [0x07, 0x00, 0x00, 0x01],
12521252
gloas_fork_epoch: None,
12531253
// Other
12541254
network_id: 2, // lighthouse testnet network id

testing/ef_tests/check_all_files_accessed.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,19 @@
4747
"bls12-381-tests/hash_to_G2",
4848
"tests/.*/eip7732",
4949
"tests/.*/eip7805",
50+
# TODO(EIP-7732): Gloas execution_payload_bid tests require process_execution_payload_bid
51+
# which is not yet implemented.
52+
"tests/.*/gloas/operations/execution_payload_bid/.*",
53+
# TODO(EIP-7732): Gloas deposit_request tests require builder deposit functionality
54+
# (apply_deposit_for_builder, add_builder_to_registry) which is not yet implemented.
55+
"tests/.*/gloas/operations/deposit_request/.*",
56+
# TODO(EIP-7732): Gloas sanity, transition, random, finality, and fork_choice tests require
57+
# full block processing which is not yet complete.
58+
"tests/.*/gloas/sanity/.*",
59+
"tests/.*/gloas/transition/.*",
60+
"tests/.*/gloas/random/.*",
61+
"tests/.*/gloas/finality/.*",
62+
"tests/.*/gloas/fork_choice/.*",
5063
# Ignore MatrixEntry SSZ tests for now.
5164
"tests/.*/fulu/ssz_static/MatrixEntry/.*",
5265
# EIP-7916 is still in draft and hasn't been implemented yet https://eips.ethereum.org/EIPS/eip-7916
@@ -59,8 +72,6 @@
5972
# Ignore full epoch tests for now (just test the sub-transitions).
6073
"tests/.*/.*/epoch_processing/.*/pre_epoch.ssz_snappy",
6174
"tests/.*/.*/epoch_processing/.*/post_epoch.ssz_snappy",
62-
# Ignore gloas tests for now
63-
"tests/.*/gloas/.*",
6475
# Ignore KZG tests that target internal kzg library functions
6576
"tests/.*/compute_verify_cell_kzg_proof_batch_challenge/.*",
6677
"tests/.*/compute_challenge/.*",

testing/ef_tests/src/cases/operations.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,10 @@ impl<E: EthSpec> Operation<E> for DepositRequest {
503503
}
504504

505505
fn is_enabled_for_fork(fork_name: ForkName) -> bool {
506-
fork_name.electra_enabled()
506+
// TODO(EIP-7732): Gloas deposit_request tests require builder deposit functionality
507+
// (apply_deposit_for_builder, add_builder_to_registry) which is not yet implemented.
508+
// https://github.com/sigp/lighthouse/issues/XXXX
509+
fork_name.electra_enabled() && fork_name != ForkName::Gloas
507510
}
508511

509512
fn decode(path: &Path, _fork_name: ForkName, _spec: &ChainSpec) -> Result<Self, Error> {

testing/ef_tests/src/handler.rs

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -491,10 +491,11 @@ impl<E: EthSpec + TypeName> Handler for SanityBlocksHandler<E> {
491491
"blocks".into()
492492
}
493493

494-
fn is_enabled_for_fork(&self, _fork_name: ForkName) -> bool {
494+
fn is_enabled_for_fork(&self, fork_name: ForkName) -> bool {
495495
// NOTE: v1.1.0-beta.4 doesn't mark the historical blocks test as requiring real crypto, so
496496
// only run these tests with real crypto for now.
497-
cfg!(not(feature = "fake_crypto"))
497+
// TODO(EIP-7732): Gloas sanity tests require full block processing which is not yet complete
498+
fork_name != ForkName::Gloas && cfg!(not(feature = "fake_crypto"))
498499
}
499500
}
500501

@@ -519,7 +520,9 @@ impl<E: EthSpec + TypeName> Handler for SanitySlotsHandler<E> {
519520

520521
fn is_enabled_for_fork(&self, fork_name: ForkName) -> bool {
521522
// Some sanity tests compute sync committees, which requires real crypto.
522-
fork_name == ForkName::Base || cfg!(not(feature = "fake_crypto"))
523+
// TODO(EIP-7732): Gloas sanity tests require full block processing which is not yet complete
524+
fork_name != ForkName::Gloas
525+
&& (fork_name == ForkName::Base || cfg!(not(feature = "fake_crypto")))
523526
}
524527
}
525528

@@ -541,6 +544,11 @@ impl<E: EthSpec + TypeName> Handler for RandomHandler<E> {
541544
fn handler_name(&self) -> String {
542545
"random".into()
543546
}
547+
548+
fn is_enabled_for_fork(&self, fork_name: ForkName) -> bool {
549+
// TODO(EIP-7732): Gloas random tests require full block processing which is not yet complete
550+
fork_name != ForkName::Gloas
551+
}
544552
}
545553

546554
#[derive(Educe)]
@@ -631,6 +639,11 @@ impl<E: EthSpec + TypeName> Handler for TransitionHandler<E> {
631639
fn handler_name(&self) -> String {
632640
"core".into()
633641
}
642+
643+
fn is_enabled_for_fork(&self, fork_name: ForkName) -> bool {
644+
// TODO(EIP-7732): Gloas transition tests require full block processing which is not yet complete
645+
fork_name != ForkName::Gloas
646+
}
634647
}
635648

636649
#[derive(Educe)]
@@ -652,6 +665,11 @@ impl<E: EthSpec + TypeName> Handler for FinalityHandler<E> {
652665
fn handler_name(&self) -> String {
653666
"finality".into()
654667
}
668+
669+
fn is_enabled_for_fork(&self, fork_name: ForkName) -> bool {
670+
// TODO(EIP-7732): Gloas finality tests require full block processing which is not yet complete
671+
fork_name != ForkName::Gloas
672+
}
655673
}
656674

657675
pub struct ForkChoiceHandler<E> {
@@ -699,6 +717,12 @@ impl<E: EthSpec + TypeName> Handler for ForkChoiceHandler<E> {
699717
return false;
700718
}
701719

720+
// TODO(EIP-7732): Gloas fork choice not yet implemented
721+
// https://github.com/sigp/lighthouse/issues/XXXX
722+
if fork_name == ForkName::Gloas {
723+
return false;
724+
}
725+
702726
// No FCU override tests prior to bellatrix.
703727
if self.handler_name == "should_override_forkchoice_update"
704728
&& !fork_name.bellatrix_enabled()

0 commit comments

Comments
 (0)