Changes for fusaka-devnet-1 (#7559)

Changes for [fusaka-devnet-1](https://notes.ethereum.org/@ethpandaops/fusaka-devnet-1)


  [Consensus Specs v1.6.0-alpha.1](https://github.com/ethereum/consensus-specs/pull/4346)
* [EIP-7917: Deterministic Proposer Lookahead](https://eips.ethereum.org/EIPS/eip-7917)
* [EIP-7892: Blob Parameter Only Hardforks](https://eips.ethereum.org/EIPS/eip-7892)
This commit is contained in:
ethDreamer
2025-06-09 11:10:08 +02:00
committed by GitHub
parent 170cd0f587
commit b08d49c4cb
18 changed files with 201 additions and 39 deletions

View File

@@ -181,7 +181,7 @@ pub fn compute_proposer_duties_from_head<T: BeaconChainTypes>(
ensure_state_is_in_epoch(&mut state, head_state_root, request_epoch, &chain.spec)?;
let indices = state
.get_beacon_proposer_indices(&chain.spec)
.get_beacon_proposer_indices(request_epoch, &chain.spec)
.map_err(BeaconChainError::from)?;
let dependent_root = state

View File

@@ -523,7 +523,8 @@ pub fn validate_blob_sidecar_for_gossip<T: BeaconChainTypes, O: ObservationStrat
&chain.spec,
)?;
let proposers = state.get_beacon_proposer_indices(&chain.spec)?;
let epoch = state.current_epoch();
let proposers = state.get_beacon_proposer_indices(epoch, &chain.spec)?;
let proposer_index = *proposers
.get(blob_slot.as_usize() % T::EthSpec::slots_per_epoch() as usize)
.ok_or_else(|| BeaconChainError::NoProposerForSlot(blob_slot))?;

View File

@@ -962,7 +962,8 @@ impl<T: BeaconChainTypes> GossipVerifiedBlock<T> {
&chain.spec,
)?;
let proposers = state.get_beacon_proposer_indices(&chain.spec)?;
let epoch = state.current_epoch();
let proposers = state.get_beacon_proposer_indices(epoch, &chain.spec)?;
let proposer_index = *proposers
.get(block.slot().as_usize() % T::EthSpec::slots_per_epoch() as usize)
.ok_or_else(|| BeaconChainError::NoProposerForSlot(block.slot()))?;

View File

@@ -669,7 +669,8 @@ fn verify_proposer_and_signature<T: BeaconChainTypes>(
&chain.spec,
)?;
let proposers = state.get_beacon_proposer_indices(&chain.spec)?;
let epoch = state.current_epoch();
let proposers = state.get_beacon_proposer_indices(epoch, &chain.spec)?;
// Prime the proposer shuffling cache with the newly-learned value.
Ok::<_, GossipDataColumnError>(EpochBlockProposers {
epoch: column_epoch,

View File

@@ -377,7 +377,7 @@ fn advance_head<T: BeaconChainTypes>(beacon_chain: &Arc<BeaconChain<T>>) -> Resu
state.current_epoch(),
head_block_root,
state
.get_beacon_proposer_indices(&beacon_chain.spec)
.get_beacon_proposer_indices(state.current_epoch(), &beacon_chain.spec)
.map_err(BeaconChainError::from)?,
state.fork(),
)

View File

@@ -9,6 +9,7 @@ use beacon_chain::{
BeaconChain, ChainConfig, NotifyExecutionLayer, StateSkipConfig, WhenSlotSkipped,
};
use operation_pool::PersistedOperationPool;
use state_processing::EpochProcessingError;
use state_processing::{per_slot_processing, per_slot_processing::Error as SlotProcessingError};
use std::sync::LazyLock;
use types::{
@@ -67,11 +68,23 @@ fn massive_skips() {
};
assert!(state.slot() > 1, "the state should skip at least one slot");
assert_eq!(
error,
SlotProcessingError::BeaconStateError(BeaconStateError::InsufficientValidators),
"should return error indicating that validators have been slashed out"
)
if state.fork_name_unchecked().fulu_enabled() {
// post-fulu this is done in per_epoch_processing
assert_eq!(
error,
SlotProcessingError::EpochProcessingError(EpochProcessingError::BeaconStateError(
BeaconStateError::InsufficientValidators
)),
"should return error indicating that validators have been slashed out"
)
} else {
assert_eq!(
error,
SlotProcessingError::BeaconStateError(BeaconStateError::InsufficientValidators),
"should return error indicating that validators have been slashed out"
)
}
}
#[tokio::test]

View File

@@ -81,7 +81,7 @@ async fn missed_blocks_across_epochs() {
epoch,
decision_root,
state
.get_beacon_proposer_indices(&harness.chain.spec)
.get_beacon_proposer_indices(epoch, &harness.chain.spec)
.unwrap(),
state.fork(),
)
@@ -147,7 +147,9 @@ async fn missed_blocks_basic() {
let mut slot_in_epoch = slot % slots_per_epoch;
let mut prev_slot = Slot::new(idx - 1);
let mut duplicate_block_root = *_state.block_roots().get(idx as usize).unwrap();
let mut validator_indexes = _state.get_beacon_proposer_indices(&harness1.spec).unwrap();
let mut validator_indexes = _state
.get_beacon_proposer_indices(epoch, &harness1.spec)
.unwrap();
let mut missed_block_proposer = validator_indexes[slot_in_epoch.as_usize()];
let mut proposer_shuffling_decision_root = _state
.proposer_shuffling_decision_root(duplicate_block_root)
@@ -219,7 +221,9 @@ async fn missed_blocks_basic() {
prev_slot = Slot::new(idx - 1);
slot_in_epoch = slot % slots_per_epoch;
duplicate_block_root = *_state2.block_roots().get(idx as usize).unwrap();
validator_indexes = _state2.get_beacon_proposer_indices(&harness2.spec).unwrap();
validator_indexes = _state2
.get_beacon_proposer_indices(epoch, &harness2.spec)
.unwrap();
missed_block_proposer = validator_indexes[slot_in_epoch.as_usize()];
let beacon_proposer_cache = harness2
@@ -317,7 +321,9 @@ async fn missed_blocks_basic() {
slot_in_epoch = slot % slots_per_epoch;
prev_slot = Slot::new(idx - 1);
duplicate_block_root = *_state3.block_roots().get(idx as usize).unwrap();
validator_indexes = _state3.get_beacon_proposer_indices(&harness3.spec).unwrap();
validator_indexes = _state3
.get_beacon_proposer_indices(epoch, &harness3.spec)
.unwrap();
missed_block_proposer = validator_indexes[slot_in_epoch.as_usize()];
proposer_shuffling_decision_root = _state3
.proposer_shuffling_decision_root_at_epoch(epoch, duplicate_block_root)