Skip to content

Commit

Permalink
Merge pull request #4101 from jtraglia/new-pending-deposits-test
Browse files Browse the repository at this point in the history
Add new process pending deposits test
  • Loading branch information
jtraglia authored Jan 28, 2025
2 parents 294db63 + b6ddfd9 commit 663f2d3
Showing 1 changed file with 28 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,34 @@ def test_process_pending_deposits_multiple_pending_deposits_above_churn(spec, st
]


@with_electra_and_later
@spec_state_test
def test_process_pending_deposits_multiple_for_new_validator(spec, state):
"""
- There are three pending deposits in the state, all pointing to the same public key.
- The public key does not exist in the beacon state.
- The first pending deposit has an invalid signature and should be ignored.
- The second pending deposit has a valid signature and the validator should be created.
- The third pending deposit has a valid signature and should be applied.
"""
# A new validator, pubkey doesn't exist in the state
validator_index = len(state.validators)
amount = spec.EFFECTIVE_BALANCE_INCREMENT

# Add pending deposits to the state
# Provide different amounts so we can tell which were applied
state.pending_deposits.append(prepare_pending_deposit(spec, validator_index, amount * 1, signed=False))
state.pending_deposits.append(prepare_pending_deposit(spec, validator_index, amount * 2, signed=True))
state.pending_deposits.append(prepare_pending_deposit(spec, validator_index, amount * 4, signed=True))

yield from run_process_pending_deposits(spec, state)

# The second and third deposits were applied
assert state.balances[validator_index] == amount * 6
# No more pending deposits
assert state.pending_deposits == []


@with_electra_and_later
@spec_state_test
def test_process_pending_deposits_skipped_deposit_exiting_validator(spec, state):
Expand Down

0 comments on commit 663f2d3

Please sign in to comment.