mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-30 04:37:13 +00:00
Extract consensus changes from gloas-envelope-processing
This commit is contained in:
@@ -4794,7 +4794,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
||||
let proposal_epoch = proposal_slot.epoch(T::EthSpec::slots_per_epoch());
|
||||
if head_state.current_epoch() == proposal_epoch {
|
||||
return get_expected_withdrawals(&unadvanced_state, &self.spec)
|
||||
.map(|(withdrawals, _)| withdrawals)
|
||||
.map(|(withdrawals, _, _)| withdrawals)
|
||||
.map_err(Error::PrepareProposerFailed);
|
||||
}
|
||||
|
||||
@@ -4812,7 +4812,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
||||
&self.spec,
|
||||
)?;
|
||||
get_expected_withdrawals(&advanced_state, &self.spec)
|
||||
.map(|(withdrawals, _)| withdrawals)
|
||||
.map(|(withdrawals, _, _)| withdrawals)
|
||||
.map_err(Error::PrepareProposerFailed)
|
||||
}
|
||||
|
||||
|
||||
@@ -1412,7 +1412,7 @@ async fn proposer_shuffling_changing_with_lookahead() {
|
||||
|
||||
let consolidation_request: ConsolidationRequest = ConsolidationRequest {
|
||||
source_address: validator_to_topup
|
||||
.get_execution_withdrawal_address(spec)
|
||||
.get_execution_withdrawal_address(spec, ForkName::Fulu)
|
||||
.unwrap(),
|
||||
source_pubkey: validator_to_topup.pubkey,
|
||||
target_pubkey: validator_to_topup.pubkey,
|
||||
@@ -1491,7 +1491,7 @@ async fn proposer_shuffling_changing_with_lookahead() {
|
||||
let validator = current_epoch_state
|
||||
.get_validator(validator_to_topup_index)
|
||||
.unwrap();
|
||||
assert!(validator.has_compounding_withdrawal_credential(spec));
|
||||
assert!(validator.has_compounding_withdrawal_credential(spec, ForkName::Fulu));
|
||||
assert_eq!(validator.effective_balance, 95_000_000_000);
|
||||
|
||||
// The shuffling for the current epoch from `prev_epoch_state` should match the shuffling
|
||||
|
||||
@@ -32,7 +32,7 @@ pub fn get_next_withdrawals<T: BeaconChainTypes>(
|
||||
}
|
||||
|
||||
match get_expected_withdrawals(&state, &chain.spec) {
|
||||
Ok((withdrawals, _)) => Ok(withdrawals),
|
||||
Ok((withdrawals, _, _)) => Ok(withdrawals),
|
||||
Err(e) => Err(warp_utils::reject::custom_server_error(format!(
|
||||
"failed to get expected withdrawal: {:?}",
|
||||
e
|
||||
|
||||
@@ -113,16 +113,18 @@ impl<E: EthSpec> BlsToExecutionChanges<E> {
|
||||
.validators()
|
||||
.get(validator_index as usize)
|
||||
.is_none_or(|validator| {
|
||||
let prune = validator.has_execution_withdrawal_credential(spec)
|
||||
&& head_block
|
||||
.message()
|
||||
.body()
|
||||
.bls_to_execution_changes()
|
||||
.map_or(true, |recent_changes| {
|
||||
!recent_changes
|
||||
.iter()
|
||||
.any(|c| c.message.validator_index == validator_index)
|
||||
});
|
||||
let prune = validator.has_execution_withdrawal_credential(
|
||||
spec,
|
||||
head_state.fork_name_unchecked(),
|
||||
) && head_block
|
||||
.message()
|
||||
.body()
|
||||
.bls_to_execution_changes()
|
||||
.map_or(true, |recent_changes| {
|
||||
!recent_changes
|
||||
.iter()
|
||||
.any(|c| c.message.validator_index == validator_index)
|
||||
});
|
||||
if prune {
|
||||
validator_indices_pruned.push(validator_index);
|
||||
}
|
||||
|
||||
@@ -582,7 +582,12 @@ impl<E: EthSpec> OperationPool<E> {
|
||||
address_change.signature_is_still_valid(&state.fork())
|
||||
&& state
|
||||
.get_validator(address_change.as_inner().message.validator_index as usize)
|
||||
.is_ok_and(|validator| !validator.has_execution_withdrawal_credential(spec))
|
||||
.is_ok_and(|validator| {
|
||||
!validator.has_execution_withdrawal_credential(
|
||||
spec,
|
||||
state.fork_name_unchecked(),
|
||||
)
|
||||
})
|
||||
},
|
||||
|address_change| address_change.as_inner().clone(),
|
||||
E::MaxBlsToExecutionChanges::to_usize(),
|
||||
|
||||
@@ -35,6 +35,8 @@ impl<E: EthSpec> OnDiskConsensusContext<E> {
|
||||
proposer_index,
|
||||
current_block_root,
|
||||
indexed_attestations,
|
||||
indexed_payload_attestations: _,
|
||||
// TODO(EIP-7732): add indexed_payload_attestations to the on-disk format.
|
||||
} = ctxt;
|
||||
OnDiskConsensusContext {
|
||||
slot,
|
||||
|
||||
Reference in New Issue
Block a user