Revert "Move test case to new location"

This reverts commit e2cbdb2b672e1b7a74a94e60e3218c7b79743e88.
This commit is contained in:
Justin Traglia 2022-05-10 10:48:59 -05:00
parent 5868a53cf1
commit d1f0187076
2 changed files with 26 additions and 27 deletions

View File

@ -1,3 +1,5 @@
import pytest
from eth2spec.test.helpers.deposits import mock_deposit from eth2spec.test.helpers.deposits import mock_deposit
from eth2spec.test.helpers.state import next_epoch, next_slots from eth2spec.test.helpers.state import next_epoch, next_slots
from eth2spec.test.helpers.constants import MINIMAL from eth2spec.test.helpers.constants import MINIMAL
@ -342,3 +344,27 @@ def test_activation_queue_activation_and_ejection__exceed_scaled_churn_limit(spe
churn_limit = spec.get_validator_churn_limit(state) churn_limit = spec.get_validator_churn_limit(state)
assert churn_limit > spec.config.MIN_PER_EPOCH_CHURN_LIMIT assert churn_limit > spec.config.MIN_PER_EPOCH_CHURN_LIMIT
yield from run_test_activation_queue_activation_and_ejection(spec, state, churn_limit * 2) yield from run_test_activation_queue_activation_and_ejection(spec, state, churn_limit * 2)
@with_all_phases
@spec_state_test
def test_invalid_large_withdrawable_epoch(spec, state):
"""
This test forces a validator into a withdrawable epoch that overflows the
epoch (uint64) type. To do this we need two validators, one validator that
already has an exit epoch and another with a low effective balance. When
calculating the withdrawable epoch for the second validator, it will
use the greatest exit epoch of all of the validators. If the first
validator is given an exit epoch between
(FAR_FUTURE_EPOCH-MIN_VALIDATOR_WITHDRAWABILITY_DELAY+1) and
(FAR_FUTURE_EPOCH-1), it will cause an overflow.
"""
assert spec.is_active_validator(state.validators[0], spec.get_current_epoch(state))
assert spec.is_active_validator(state.validators[1], spec.get_current_epoch(state))
state.validators[0].exit_epoch = spec.FAR_FUTURE_EPOCH - 1
state.validators[1].effective_balance = spec.config.EJECTION_BALANCE
with pytest.raises(ValueError):
yield from run_process_registry_updates(spec, state)
yield 'post', None

View File

@ -1,27 +0,0 @@
import pytest
from eth2spec.test.context import spec_state_test, with_all_phases
@with_all_phases
@spec_state_test
def test_invalid_large_withdrawable_epoch(spec, state):
"""
This test forces a validator into a withdrawable epoch that overflows the
epoch (uint64) type. To do this we need two validators, one validator that
already has an exit epoch and another with a low effective balance. When
calculating the withdrawable epoch for the second validator, it will
use the greatest exit epoch of all of the validators. If the first
validator is given an exit epoch between
(FAR_FUTURE_EPOCH-MIN_VALIDATOR_WITHDRAWABILITY_DELAY+1) and
(FAR_FUTURE_EPOCH-1), it will cause an overflow.
"""
assert spec.is_active_validator(state.validators[0], spec.get_current_epoch(state))
assert spec.is_active_validator(state.validators[1], spec.get_current_epoch(state))
state.validators[0].exit_epoch = spec.FAR_FUTURE_EPOCH - 1
state.validators[1].effective_balance = spec.config.EJECTION_BALANCE
yield 'pre', state
with pytest.raises(ValueError):
spec.initiate_validator_exit(state, 1)
yield 'post', None