voluntary exit test case: invalid, exit in future

This commit is contained in:
protolambda 2019-05-11 18:33:41 +02:00
parent 636a45a415
commit 680017f69c
No known key found for this signature in database
GPG Key ID: EC89FDBB2B4C7623
1 changed files with 20 additions and 0 deletions

View File

@ -108,6 +108,26 @@ def test_success_exit_queue(state):
) )
@spec_state_test
def test_validator_exit_in_future(state):
# move state forward PERSISTENT_COMMITTEE_PERIOD epochs to allow for exit
state.slot += spec.PERSISTENT_COMMITTEE_PERIOD * spec.SLOTS_PER_EPOCH
current_epoch = get_current_epoch(state)
validator_index = get_active_validator_indices(state, current_epoch)[0]
privkey = pubkey_to_privkey[state.validator_registry[validator_index].pubkey]
voluntary_exit = build_voluntary_exit(
state,
current_epoch,
validator_index,
privkey,
)
voluntary_exit.epoch += 1
yield from run_voluntary_exit_processing(state, voluntary_exit, False)
@spec_state_test @spec_state_test
def test_validator_invalid_validator_index(state): def test_validator_invalid_validator_index(state):
# move state forward PERSISTENT_COMMITTEE_PERIOD epochs to allow for exit # move state forward PERSISTENT_COMMITTEE_PERIOD epochs to allow for exit