From 48b9928194099be110e18bf8392cb2f8ed1a6b10 Mon Sep 17 00:00:00 2001 From: james-prysm Date: Fri, 12 Jul 2024 14:30:49 -0500 Subject: [PATCH] adding out of validator range test --- .../test_process_pending_deposits.py | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/tests/core/pyspec/eth2spec/test/electra/epoch_processing/test_process_pending_deposits.py b/tests/core/pyspec/eth2spec/test/electra/epoch_processing/test_process_pending_deposits.py index c2c463dab..f4f6b70fb 100644 --- a/tests/core/pyspec/eth2spec/test/electra/epoch_processing/test_process_pending_deposits.py +++ b/tests/core/pyspec/eth2spec/test/electra/epoch_processing/test_process_pending_deposits.py @@ -15,6 +15,8 @@ from eth2spec.test.helpers.keys import privkeys, pubkeys def run_process_pending_deposits(spec, state): yield from run_epoch_processing_with( spec, state, 'process_pending_deposits') + + @with_electra_and_later @@ -174,6 +176,37 @@ def test_pending_deposit_validator_exiting_but_not_withdrawn(spec, state): assert len(state.pending_deposits) == 1 +@with_electra_and_later +@spec_state_test +def test_pending_deposit_not_in_validator_set(spec, state): + index = 2000 + amount = spec.MIN_ACTIVATION_BALANCE + withdrawal_credentials = ( + spec.ETH1_ADDRESS_WITHDRAWAL_PREFIX + + spec.hash(pubkeys[index])[1:] + ) + deposit_data = build_deposit_data(spec, + pubkeys[index], + privkeys[index], + amount, + withdrawal_credentials, + signed=True) + state.pending_deposits.append(spec.PendingDeposit( + pubkey=pubkeys[index], + withdrawal_credentials=withdrawal_credentials, + amount=amount, + slot=spec.GENESIS_SLOT, + signature=deposit_data.signature, + )) + value_error = False + try: + yield from run_process_pending_deposits(spec, state) + except ValueError: + value_error = True + + assert value_error + + @with_electra_and_later @spec_state_test def test_pending_deposit_min_activation_balance(spec, state):