From 680017f69ce61e0970cd6e9a72c8ce58725f69d5 Mon Sep 17 00:00:00 2001 From: protolambda Date: Sat, 11 May 2019 18:33:41 +0200 Subject: [PATCH] voluntary exit test case: invalid, exit in future --- .../test_process_voluntary_exit.py | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/test_libs/pyspec/eth2spec/test/block_processing/test_process_voluntary_exit.py b/test_libs/pyspec/eth2spec/test/block_processing/test_process_voluntary_exit.py index 6b0f79288..be0ef1e7a 100644 --- a/test_libs/pyspec/eth2spec/test/block_processing/test_process_voluntary_exit.py +++ b/test_libs/pyspec/eth2spec/test/block_processing/test_process_voluntary_exit.py @@ -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 def test_validator_invalid_validator_index(state): # move state forward PERSISTENT_COMMITTEE_PERIOD epochs to allow for exit