test_eth1_vote_no_reset

This commit is contained in:
protolambda 2019-06-25 22:26:35 +02:00
parent b2034a54a0
commit c4c9bd32e2
No known key found for this signature in database
GPG Key ID: EC89FDBB2B4C7623
1 changed files with 17 additions and 0 deletions

View File

@ -6,6 +6,23 @@ def run_process_final_updates(spec, state):
yield from run_epoch_processing_to(spec, state, 'process_final_updates') yield from run_epoch_processing_to(spec, state, 'process_final_updates')
@with_all_phases
@spec_state_test
def test_eth1_vote_no_reset(spec, state):
assert spec.SLOTS_PER_ETH1_VOTING_PERIOD > spec.SLOTS_PER_EPOCH
# skip ahead to near the end of the epoch
state.slot = spec.SLOTS_PER_EPOCH - 2
for i in range(state.slot + 1): # add a vote for each skipped slot.
state.eth1_data_votes.append(
spec.Eth1Data(deposit_root=b'\xaa' * 32,
deposit_count=state.eth1_deposit_index,
block_hash=b'\xbb' * 32))
yield from run_process_final_updates(spec, state)
assert len(state.eth1_data_votes) == spec.SLOTS_PER_EPOCH
@with_all_phases @with_all_phases
@spec_state_test @spec_state_test
def test_eth1_vote_reset(spec, state): def test_eth1_vote_reset(spec, state):