Finalize deposit requests before processing

This commit is contained in:
Mikhail Kalinin 2024-06-25 17:47:18 +06:00
parent 5c3a51ae79
commit 179ee8ee78

View File

@ -851,15 +851,19 @@ def process_pending_deposits(state: BeaconState) -> None:
next_deposit_index = 0 next_deposit_index = 0
deposits_to_postpone = [] deposits_to_postpone = []
is_churn_limit_reached = False is_churn_limit_reached = False
finalized_slot = compute_start_slot_at_epoch(state.finalized_checkpoint.epoch)
for deposit in state.pending_deposits: for deposit in state.pending_deposits:
# Do not process any deposit requests if Eth1 bridge deposits are not yet applied # Do not process a deposit request if Eth1 bridge deposits are not yet applied.
if (state.deposit_requests_start_index != UNSET_DEPOSIT_REQUESTS_START_INDEX is_deposit_request = deposit.slot > GENESIS_SLOT
and state.eth1_deposit_index < state.deposit_requests_start_index if is_deposit_request and state.eth1_deposit_index < state.deposit_requests_start_index:
and deposit.slot > GENESIS_SLOT):
break break
# Check if number of processed deposits fits in the limit # Check if deposit has been finalized, otherwise, stop processing.
if deposit.slot > finalized_slot:
break
# Check if number of processed deposits fits in the limit, otherwise, stop processing.
if next_deposit_index > MAX_PENDING_DEPOSITS_PER_EPOCH_PROCESSING: if next_deposit_index > MAX_PENDING_DEPOSITS_PER_EPOCH_PROCESSING:
break break