[test_on_block_finalized_skip_slots] Make target state right after skipped slots

This commit is contained in:
Hsiao-Wei Wang 2021-08-31 18:40:26 +08:00
parent 9b065c7816
commit b23ed05eee
No known key found for this signature in database
GPG Key ID: 1111A8A81778319E

View File

@ -210,6 +210,9 @@ def test_on_block_finalized_skip_slots(spec, state):
# Skip the rest slots of epoch 1 and the first slot of epoch 2 # Skip the rest slots of epoch 1 and the first slot of epoch 2
next_slots(spec, state, spec.SLOTS_PER_EPOCH) next_slots(spec, state, spec.SLOTS_PER_EPOCH)
# The state after the skipped slots
target_state = state.copy()
# Fill epoch 3 and 4 # Fill epoch 3 and 4
for _ in range(2): for _ in range(2):
state, store, _ = yield from apply_next_epoch_with_attestations( state, store, _ = yield from apply_next_epoch_with_attestations(
@ -223,8 +226,8 @@ def test_on_block_finalized_skip_slots(spec, state):
# Now build a block at later slot than finalized *epoch* # Now build a block at later slot than finalized *epoch*
# Includes finalized block in chain and the skipped slots # Includes finalized block in chain and the skipped slots
block = build_empty_block_for_next_slot(spec, state) block = build_empty_block_for_next_slot(spec, target_state)
signed_block = state_transition_and_sign_block(spec, state, block) signed_block = state_transition_and_sign_block(spec, target_state, block)
yield from tick_and_add_block(spec, store, signed_block, test_steps) yield from tick_and_add_block(spec, store, signed_block, test_steps)
yield 'steps', test_steps yield 'steps', test_steps