diff --git a/specs/_features/eip7251/beacon-chain.md b/specs/_features/eip7251/beacon-chain.md index 47bff097a..806b8d691 100644 --- a/specs/_features/eip7251/beacon-chain.md +++ b/specs/_features/eip7251/beacon-chain.md @@ -764,7 +764,7 @@ def apply_deposit(state: BeaconState, else: # Increase balance by deposit amount index = ValidatorIndex(validator_pubkeys.index(pubkey)) - state.pending_balance_deposits.append(PendingBalanceDeposit(index=amount, amount=amount)) # [Modified in EIP-7251] + state.pending_balance_deposits.append(PendingBalanceDeposit(index=index, amount=amount)) # [Modified in EIP-7251] ``` #### Modified `add_validator_to_registry` diff --git a/tests/core/pyspec/eth2spec/test/eip7251/epoch_processing/test_process_pending_balance_deposits.py b/tests/core/pyspec/eth2spec/test/eip7251/epoch_processing/test_process_pending_balance_deposits.py index e515deb29..accb41140 100644 --- a/tests/core/pyspec/eth2spec/test/eip7251/epoch_processing/test_process_pending_balance_deposits.py +++ b/tests/core/pyspec/eth2spec/test/eip7251/epoch_processing/test_process_pending_balance_deposits.py @@ -13,8 +13,9 @@ def test_pending_deposit_min_activation_balance(spec, state): state.pending_balance_deposits.append(spec.PendingBalanceDeposit(index=index, amount=amount)) pre_balance = state.balances[index] yield from run_epoch_processing_with(spec, state, 'process_pending_balance_deposits') - assert state.balances[index] == pre_balance + amount - assert state.deposit_balance_to_consume == spec.get_activation_exit_churn_limit(state) - amount + assert state.balances[index] == pre_balance + amount + # No leftover deposit balance to consume when there are no deposits left to process + assert state.deposit_balance_to_consume == 0 assert state.pending_balance_deposits == [] @with_eip7251_and_later @@ -55,8 +56,8 @@ def test_pending_deposit_preexisting_churn(spec, state): yield from run_epoch_processing_with(spec, state, 'process_pending_balance_deposits') # balance was deposited correctly assert state.balances[index] == pre_balance + amount - # the churn limit was added to deposit balance to consume, and the deposited balance was taken from it - assert state.deposit_balance_to_consume == amount + spec.get_activation_exit_churn_limit(state) + # No leftover deposit balance to consume when there are no deposits left to process + assert state.deposit_balance_to_consume == 0 # queue emptied assert state.pending_balance_deposits == [] @@ -70,7 +71,8 @@ def test_multiple_pending_deposits_below_churn(spec, state): yield from run_epoch_processing_with(spec, state, 'process_pending_balance_deposits') for i in [0,1]: assert state.balances[i] == pre_balances[i] + amount - assert state.deposit_balance_to_consume == spec.get_activation_exit_churn_limit(state) - 2*amount + # No leftover deposit balance to consume when there are no deposits left to process + assert state.deposit_balance_to_consume == 0 assert state.pending_balance_deposits == [] @with_eip7251_and_later