From fcafdc14a388373c12e59a0c72d169b83b865b5e Mon Sep 17 00:00:00 2001 From: inphi Date: Thu, 10 Nov 2022 14:11:05 -0500 Subject: [PATCH] remove eip4844 partial/full withdrawwals tests --- .../test_process_full_withdrawals.py | 43 ------------------- .../test_process_partial_withdrawals.py | 43 ------------------- 2 files changed, 86 deletions(-) delete mode 100644 tests/core/pyspec/eth2spec/test/eip4844/epoch_processing/test_process_full_withdrawals.py delete mode 100644 tests/core/pyspec/eth2spec/test/eip4844/epoch_processing/test_process_partial_withdrawals.py diff --git a/tests/core/pyspec/eth2spec/test/eip4844/epoch_processing/test_process_full_withdrawals.py b/tests/core/pyspec/eth2spec/test/eip4844/epoch_processing/test_process_full_withdrawals.py deleted file mode 100644 index 1a7cda91d..000000000 --- a/tests/core/pyspec/eth2spec/test/eip4844/epoch_processing/test_process_full_withdrawals.py +++ /dev/null @@ -1,43 +0,0 @@ -from eth2spec.test.context import ( - with_eip4844_and_later, - spec_state_test, -) -from eth2spec.test.helpers.epoch_processing import ( - run_epoch_processing_to, -) -from eth2spec.test.helpers.withdrawals import ( - set_validator_fully_withdrawable, -) - - -def run_process_full_withdrawals_no_op(spec, state, num_expected_withdrawals=None): - run_epoch_processing_to(spec, state, 'process_full_withdrawals') - - state.next_withdrawal_index = 0 - to_be_withdrawn_indices = [ - index for index, validator in enumerate(state.validators) - if spec.is_fully_withdrawable_validator(validator, state.balances[index], spec.get_current_epoch(state)) - ] - - if num_expected_withdrawals is not None: - assert len(to_be_withdrawn_indices) == num_expected_withdrawals - else: - num_expected_withdrawals = len(to_be_withdrawn_indices) - - pre_state = state.copy() - - yield 'pre', state - spec.process_full_withdrawals(state) - yield 'post', state - - # Make sure state has NOT been changed - assert state == pre_state - - -@with_eip4844_and_later -@spec_state_test -def test_no_op(spec, state): - # Make one validator withdrawable - set_validator_fully_withdrawable(spec, state, 0) - - yield from run_process_full_withdrawals_no_op(spec, state, 1) diff --git a/tests/core/pyspec/eth2spec/test/eip4844/epoch_processing/test_process_partial_withdrawals.py b/tests/core/pyspec/eth2spec/test/eip4844/epoch_processing/test_process_partial_withdrawals.py deleted file mode 100644 index 78be3eb6c..000000000 --- a/tests/core/pyspec/eth2spec/test/eip4844/epoch_processing/test_process_partial_withdrawals.py +++ /dev/null @@ -1,43 +0,0 @@ -from eth2spec.test.context import ( - spec_state_test, - with_eip4844_and_later, -) -from eth2spec.test.helpers.epoch_processing import run_epoch_processing_to -from eth2spec.test.helpers.withdrawals import ( - set_validator_partially_withdrawable, -) - - -def run_process_partial_withdrawals_no_op(spec, state, num_expected_withdrawals=None): - # Run rest of epoch processing before predicting partial withdrawals as - # balance changes can affect withdrawability - run_epoch_processing_to(spec, state, 'process_partial_withdrawals') - - partially_withdrawable_indices = [ - index for index, validator in enumerate(state.validators) - if spec.is_partially_withdrawable_validator(validator, state.balances[index]) - ] - num_partial_withdrawals = min(len(partially_withdrawable_indices), spec.MAX_PARTIAL_WITHDRAWALS_PER_EPOCH) - - if num_expected_withdrawals is not None: - assert num_partial_withdrawals == num_expected_withdrawals - else: - num_expected_withdrawals = num_partial_withdrawals - - pre_state = state.copy() - - yield 'pre', state - spec.process_partial_withdrawals(state) - yield 'post', state - - # Make sure state has NOT been changed - assert state == pre_state - - -@with_eip4844_and_later -@spec_state_test -def test_no_op(spec, state): - validator_index = len(state.validators) // 2 - set_validator_partially_withdrawable(spec, state, validator_index) - - yield from run_process_partial_withdrawals_no_op(spec, state, 1)