mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-15 19:02:42 +00:00
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:
@@ -19,7 +19,7 @@ use types::{
|
||||
milhouse::Cow,
|
||||
ActivationQueue, BeaconState, BeaconStateError, ChainSpec, Checkpoint, DepositData, Epoch,
|
||||
EthSpec, ExitCache, ForkName, List, ParticipationFlags, PendingDeposit,
|
||||
ProgressiveBalancesCache, RelativeEpoch, Unsigned, Validator,
|
||||
ProgressiveBalancesCache, RelativeEpoch, Unsigned, Validator, Vector,
|
||||
};
|
||||
|
||||
pub struct SinglePassConfig {
|
||||
@@ -30,6 +30,7 @@ pub struct SinglePassConfig {
|
||||
pub pending_deposits: bool,
|
||||
pub pending_consolidations: bool,
|
||||
pub effective_balance_updates: bool,
|
||||
pub proposer_lookahead: bool,
|
||||
}
|
||||
|
||||
impl Default for SinglePassConfig {
|
||||
@@ -48,6 +49,7 @@ impl SinglePassConfig {
|
||||
pending_deposits: true,
|
||||
pending_consolidations: true,
|
||||
effective_balance_updates: true,
|
||||
proposer_lookahead: true,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,6 +62,7 @@ impl SinglePassConfig {
|
||||
pending_deposits: false,
|
||||
pending_consolidations: false,
|
||||
effective_balance_updates: false,
|
||||
proposer_lookahead: false,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -460,9 +463,43 @@ pub fn process_epoch_single_pass<E: EthSpec>(
|
||||
next_epoch_cache.into_epoch_cache(next_epoch_activation_queue, spec)?;
|
||||
}
|
||||
|
||||
if conf.proposer_lookahead && fork_name.fulu_enabled() {
|
||||
process_proposer_lookahead(state, spec)?;
|
||||
}
|
||||
|
||||
Ok(summary)
|
||||
}
|
||||
|
||||
// TOOO(EIP-7917): use balances cache
|
||||
pub fn process_proposer_lookahead<E: EthSpec>(
|
||||
state: &mut BeaconState<E>,
|
||||
spec: &ChainSpec,
|
||||
) -> Result<(), Error> {
|
||||
let mut lookahead = state.proposer_lookahead()?.clone().to_vec();
|
||||
|
||||
// Shift out proposers in the first epoch
|
||||
lookahead.copy_within((E::slots_per_epoch() as usize).., 0);
|
||||
|
||||
let next_epoch = state
|
||||
.current_epoch()
|
||||
.safe_add(spec.min_seed_lookahead.as_u64())?
|
||||
.safe_add(1)?;
|
||||
let last_epoch_proposers = state.get_beacon_proposer_indices(next_epoch, spec)?;
|
||||
|
||||
// Fill in the last epoch with new proposer indices
|
||||
let last_epoch_start = E::proposer_lookahead_slots().safe_sub(E::slots_per_epoch() as usize)?;
|
||||
for (i, proposer) in last_epoch_proposers.into_iter().enumerate() {
|
||||
let index = last_epoch_start.safe_add(i)?;
|
||||
*lookahead
|
||||
.get_mut(index)
|
||||
.ok_or(Error::ProposerLookaheadOutOfBounds(index))? = proposer as u64;
|
||||
}
|
||||
|
||||
*state.proposer_lookahead_mut()? = Vector::new(lookahead)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn process_single_inactivity_update(
|
||||
inactivity_score: &mut Cow<u64>,
|
||||
validator_info: &ValidatorInfo,
|
||||
|
||||
Reference in New Issue
Block a user