mirror of
https://github.com/sigp/lighthouse.git
synced 2026-04-28 02:03:32 +00:00
update process_operations deposit length check
This commit is contained in:
@@ -357,17 +357,34 @@ pub fn process_deposits<E: EthSpec>(
|
|||||||
deposits: &[Deposit],
|
deposits: &[Deposit],
|
||||||
spec: &ChainSpec,
|
spec: &ChainSpec,
|
||||||
) -> Result<(), BlockProcessingError> {
|
) -> Result<(), BlockProcessingError> {
|
||||||
let expected_deposit_len = std::cmp::min(
|
// [Modified in Electra:EIP6110]
|
||||||
E::MaxDeposits::to_u64(),
|
// Disable former deposit mechanism once all prior deposits are processed
|
||||||
state.get_outstanding_deposit_len()?,
|
//
|
||||||
);
|
// If `deposit_receipts_start_index` does not exist as a field on `state`, electra is disabled
|
||||||
block_verify!(
|
// which means we always want to use the old check, so this field defaults to `u64::MAX`.
|
||||||
deposits.len() as u64 == expected_deposit_len,
|
let eth1_deposit_index_limit = state.deposit_receipts_start_index().unwrap_or(u64::MAX);
|
||||||
BlockProcessingError::DepositCountInvalid {
|
|
||||||
expected: expected_deposit_len as usize,
|
if state.eth1_deposit_index() < eth1_deposit_index_limit {
|
||||||
found: deposits.len(),
|
let expected_deposit_len = std::cmp::min(
|
||||||
}
|
E::MaxDeposits::to_u64(),
|
||||||
);
|
state.get_outstanding_deposit_len()?,
|
||||||
|
);
|
||||||
|
block_verify!(
|
||||||
|
deposits.len() as u64 == expected_deposit_len,
|
||||||
|
BlockProcessingError::DepositCountInvalid {
|
||||||
|
expected: expected_deposit_len as usize,
|
||||||
|
found: deposits.len(),
|
||||||
|
}
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
block_verify!(
|
||||||
|
deposits.len() as u64 == 0,
|
||||||
|
BlockProcessingError::DepositCountInvalid {
|
||||||
|
expected: 0,
|
||||||
|
found: deposits.len(),
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// Verify merkle proofs in parallel.
|
// Verify merkle proofs in parallel.
|
||||||
deposits
|
deposits
|
||||||
|
|||||||
Reference in New Issue
Block a user