Skip to content

Commit b08d49c

Browse files
authored
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](ethereum/consensus-specs#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)
1 parent 170cd0f commit b08d49c

File tree

18 files changed

+201
-39
lines changed

18 files changed

+201
-39
lines changed

beacon_node/beacon_chain/src/beacon_proposer_cache.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ pub fn compute_proposer_duties_from_head<T: BeaconChainTypes>(
181181
ensure_state_is_in_epoch(&mut state, head_state_root, request_epoch, &chain.spec)?;
182182

183183
let indices = state
184-
.get_beacon_proposer_indices(&chain.spec)
184+
.get_beacon_proposer_indices(request_epoch, &chain.spec)
185185
.map_err(BeaconChainError::from)?;
186186

187187
let dependent_root = state

beacon_node/beacon_chain/src/blob_verification.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,8 @@ pub fn validate_blob_sidecar_for_gossip<T: BeaconChainTypes, O: ObservationStrat
523523
&chain.spec,
524524
)?;
525525

526-
let proposers = state.get_beacon_proposer_indices(&chain.spec)?;
526+
let epoch = state.current_epoch();
527+
let proposers = state.get_beacon_proposer_indices(epoch, &chain.spec)?;
527528
let proposer_index = *proposers
528529
.get(blob_slot.as_usize() % T::EthSpec::slots_per_epoch() as usize)
529530
.ok_or_else(|| BeaconChainError::NoProposerForSlot(blob_slot))?;

beacon_node/beacon_chain/src/block_verification.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -962,7 +962,8 @@ impl<T: BeaconChainTypes> GossipVerifiedBlock<T> {
962962
&chain.spec,
963963
)?;
964964

965-
let proposers = state.get_beacon_proposer_indices(&chain.spec)?;
965+
let epoch = state.current_epoch();
966+
let proposers = state.get_beacon_proposer_indices(epoch, &chain.spec)?;
966967
let proposer_index = *proposers
967968
.get(block.slot().as_usize() % T::EthSpec::slots_per_epoch() as usize)
968969
.ok_or_else(|| BeaconChainError::NoProposerForSlot(block.slot()))?;

beacon_node/beacon_chain/src/data_column_verification.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -669,7 +669,8 @@ fn verify_proposer_and_signature<T: BeaconChainTypes>(
669669
&chain.spec,
670670
)?;
671671

672-
let proposers = state.get_beacon_proposer_indices(&chain.spec)?;
672+
let epoch = state.current_epoch();
673+
let proposers = state.get_beacon_proposer_indices(epoch, &chain.spec)?;
673674
// Prime the proposer shuffling cache with the newly-learned value.
674675
Ok::<_, GossipDataColumnError>(EpochBlockProposers {
675676
epoch: column_epoch,

beacon_node/beacon_chain/src/state_advance_timer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ fn advance_head<T: BeaconChainTypes>(beacon_chain: &Arc<BeaconChain<T>>) -> Resu
377377
state.current_epoch(),
378378
head_block_root,
379379
state
380-
.get_beacon_proposer_indices(&beacon_chain.spec)
380+
.get_beacon_proposer_indices(state.current_epoch(), &beacon_chain.spec)
381381
.map_err(BeaconChainError::from)?,
382382
state.fork(),
383383
)

beacon_node/beacon_chain/tests/tests.rs

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ use beacon_chain::{
99
BeaconChain, ChainConfig, NotifyExecutionLayer, StateSkipConfig, WhenSlotSkipped,
1010
};
1111
use operation_pool::PersistedOperationPool;
12+
use state_processing::EpochProcessingError;
1213
use state_processing::{per_slot_processing, per_slot_processing::Error as SlotProcessingError};
1314
use std::sync::LazyLock;
1415
use types::{
@@ -67,11 +68,23 @@ fn massive_skips() {
6768
};
6869

6970
assert!(state.slot() > 1, "the state should skip at least one slot");
70-
assert_eq!(
71-
error,
72-
SlotProcessingError::BeaconStateError(BeaconStateError::InsufficientValidators),
73-
"should return error indicating that validators have been slashed out"
74-
)
71+
72+
if state.fork_name_unchecked().fulu_enabled() {
73+
// post-fulu this is done in per_epoch_processing
74+
assert_eq!(
75+
error,
76+
SlotProcessingError::EpochProcessingError(EpochProcessingError::BeaconStateError(
77+
BeaconStateError::InsufficientValidators
78+
)),
79+
"should return error indicating that validators have been slashed out"
80+
)
81+
} else {
82+
assert_eq!(
83+
error,
84+
SlotProcessingError::BeaconStateError(BeaconStateError::InsufficientValidators),
85+
"should return error indicating that validators have been slashed out"
86+
)
87+
}
7588
}
7689

7790
#[tokio::test]

beacon_node/beacon_chain/tests/validator_monitor.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ async fn missed_blocks_across_epochs() {
8181
epoch,
8282
decision_root,
8383
state
84-
.get_beacon_proposer_indices(&harness.chain.spec)
84+
.get_beacon_proposer_indices(epoch, &harness.chain.spec)
8585
.unwrap(),
8686
state.fork(),
8787
)
@@ -147,7 +147,9 @@ async fn missed_blocks_basic() {
147147
let mut slot_in_epoch = slot % slots_per_epoch;
148148
let mut prev_slot = Slot::new(idx - 1);
149149
let mut duplicate_block_root = *_state.block_roots().get(idx as usize).unwrap();
150-
let mut validator_indexes = _state.get_beacon_proposer_indices(&harness1.spec).unwrap();
150+
let mut validator_indexes = _state
151+
.get_beacon_proposer_indices(epoch, &harness1.spec)
152+
.unwrap();
151153
let mut missed_block_proposer = validator_indexes[slot_in_epoch.as_usize()];
152154
let mut proposer_shuffling_decision_root = _state
153155
.proposer_shuffling_decision_root(duplicate_block_root)
@@ -219,7 +221,9 @@ async fn missed_blocks_basic() {
219221
prev_slot = Slot::new(idx - 1);
220222
slot_in_epoch = slot % slots_per_epoch;
221223
duplicate_block_root = *_state2.block_roots().get(idx as usize).unwrap();
222-
validator_indexes = _state2.get_beacon_proposer_indices(&harness2.spec).unwrap();
224+
validator_indexes = _state2
225+
.get_beacon_proposer_indices(epoch, &harness2.spec)
226+
.unwrap();
223227
missed_block_proposer = validator_indexes[slot_in_epoch.as_usize()];
224228

225229
let beacon_proposer_cache = harness2
@@ -317,7 +321,9 @@ async fn missed_blocks_basic() {
317321
slot_in_epoch = slot % slots_per_epoch;
318322
prev_slot = Slot::new(idx - 1);
319323
duplicate_block_root = *_state3.block_roots().get(idx as usize).unwrap();
320-
validator_indexes = _state3.get_beacon_proposer_indices(&harness3.spec).unwrap();
324+
validator_indexes = _state3
325+
.get_beacon_proposer_indices(epoch, &harness3.spec)
326+
.unwrap();
321327
missed_block_proposer = validator_indexes[slot_in_epoch.as_usize()];
322328
proposer_shuffling_decision_root = _state3
323329
.proposer_shuffling_decision_root_at_epoch(epoch, duplicate_block_root)

beacon_node/http_api/src/proposer_duties.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ fn compute_historic_proposer_duties<T: BeaconChainTypes>(
227227
}
228228

229229
let indices = state
230-
.get_beacon_proposer_indices(&chain.spec)
230+
.get_beacon_proposer_indices(epoch, &chain.spec)
231231
.map_err(BeaconChainError::from)
232232
.map_err(warp_utils::reject::unhandled_error)?;
233233

beacon_node/store/src/partial_beacon_state.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,8 @@ where
147147
List<PendingPartialWithdrawal, E::PendingPartialWithdrawalsLimit>,
148148
#[superstruct(only(Electra, Fulu))]
149149
pub pending_consolidations: List<PendingConsolidation, E::PendingConsolidationsLimit>,
150+
#[superstruct(only(Fulu))]
151+
pub proposer_lookahead: Vector<u64, E::ProposerLookaheadSlots>,
150152
}
151153

152154
impl<E: EthSpec> PartialBeaconState<E> {
@@ -444,7 +446,8 @@ impl<E: EthSpec> TryInto<BeaconState<E>> for PartialBeaconState<E> {
444446
earliest_consolidation_epoch,
445447
pending_deposits,
446448
pending_partial_withdrawals,
447-
pending_consolidations
449+
pending_consolidations,
450+
proposer_lookahead
448451
],
449452
[historical_summaries]
450453
),

consensus/state_processing/src/per_epoch_processing/errors.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ pub enum EpochProcessingError {
3030
MissingEarliestExitEpoch,
3131
MissingExitBalanceToConsume,
3232
PendingDepositsLogicError,
33+
ProposerLookaheadOutOfBounds(usize),
3334
}
3435

3536
impl From<InclusionError> for EpochProcessingError {

0 commit comments

Comments
 (0)