Gloas alpha spec 9 (#9393)

Changes implemented

Ensure bids are for a higher slot than their parent (https://github.com/ethereum/consensus-specs/pull/5302)
Ignore PTC attestations for empty assigned slots (https://github.com/ethereum/consensus-specs/pull/5281)
Limit should_build_on_full checks to the previous slot (https://github.com/ethereum/consensus-specs/pull/5309)
Apply proposer boost if dependent roots match (https://github.com/ethereum/consensus-specs/pull/5306)
Exclude slashed validators from proposing (EIP-8045) (https://github.com/ethereum/consensus-specs/pull/5115)
Force the proposer to reorg late payloads (https://github.com/ethereum/consensus-specs/pull/5210)
Remove support for old deposit mechanism in Fulu (https://github.com/ethereum/consensus-specs/pull/4704)


  


Co-Authored-By: Eitan Seri-Levi <eserilev@ucsc.edu>

Co-Authored-By: dapplion <35266934+dapplion@users.noreply.github.com>

Co-Authored-By: Eitan Seri-Levi <eserilev@gmail.com>

Co-Authored-By: Michael Sproul <michael@sigmaprime.io>

Co-Authored-By: Michael Sproul <michaelsproul@users.noreply.github.com>
This commit is contained in:
Eitan Seri-Levi
2026-06-15 16:56:09 -07:00
committed by GitHub
parent d8e406b6ac
commit 58e35bc96f
33 changed files with 785 additions and 247 deletions

View File

@@ -299,6 +299,67 @@ async fn proposer_slashing_duplicate_in_state() {
));
}
#[tokio::test]
async fn slashings_cache_matches_state_after_block_import() {
let db_path = tempdir().unwrap();
let store = get_store(&db_path);
let harness = get_harness(store.clone(), VALIDATOR_COUNT);
// Slash a spread of validators by importing proposer slashings into the op pool, exactly as
// they would arrive over gossip.
let slashed_validators = [0u64, 7, VALIDATOR_COUNT as u64 - 1];
for &validator_index in &slashed_validators {
let slashing = harness.make_proposer_slashing(validator_index);
let ObservationOutcome::New(verified_slashing) = harness
.chain
.verify_proposer_slashing_for_gossip(slashing)
.unwrap()
else {
panic!("slashing should verify");
};
harness.chain.import_proposer_slashing(verified_slashing);
}
// Produce and import a block that includes the slashings. This drives the production flow:
// `per_block_processing` -> `slash_validator` -> `SlashingsCache::record_validator_slashing`.
harness
.extend_chain(
1,
BlockStrategy::OnCanonicalHead,
AttestationStrategy::AllValidators,
)
.await;
let state = harness.get_current_state();
// The block processing above should have left the slashings cache initialized for the head.
assert!(
state.slashings_cache_is_initialized(),
"slashings cache should be initialized after block import"
);
// The targeted validators must actually be slashed in the state (i.e. the slashings were
// included and applied, not silently dropped).
for &validator_index in &slashed_validators {
assert!(
state
.get_validator(validator_index as usize)
.unwrap()
.slashed,
"validator {validator_index} should be slashed in the state"
);
}
// The cache must agree with the `slashed` flag of *every* validator in the state.
for index in 0..state.validators().len() {
assert_eq!(
state.slashings_cache().is_slashed(index),
state.get_validator(index).unwrap().slashed,
"slashings cache disagrees with state at validator {index}"
);
}
}
#[test]
fn attester_slashing() {
let db_path = tempdir().unwrap();