Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new process pending deposits test #4101

Merged
merged 3 commits into from
Jan 28, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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