Fix checkpoint hierarchy consistency in tests

This commit is contained in:
Aditya Asgaonkar 2021-04-03 17:09:08 -07:00
parent 2478e1526a
commit 21b878364a
1 changed files with 4 additions and 2 deletions

View File

@ -307,13 +307,15 @@ def test_on_block_outside_safe_slots_but_finality(spec, state):
# Mock justified and finalized update in state # Mock justified and finalized update in state
just_fin_state = store.block_states[last_block_root] just_fin_state = store.block_states[last_block_root]
new_justified = spec.Checkpoint( new_justified = spec.Checkpoint(
epoch=store.justified_checkpoint.epoch + 1, epoch=spec.compute_epoch_at_slot(just_block.slot) + 1,
root=just_block.hash_tree_root(), root=just_block.hash_tree_root(),
) )
assert new_justified.epoch > store.justified_checkpoint.epoch
new_finalized = spec.Checkpoint( new_finalized = spec.Checkpoint(
epoch=store.finalized_checkpoint.epoch + 1, epoch=spec.compute_epoch_at_slot(just_block.slot),
root=just_block.parent_root, root=just_block.parent_root,
) )
assert new_finalized.epoch > store.finalized_checkpoint.epoch
just_fin_state.current_justified_checkpoint = new_justified just_fin_state.current_justified_checkpoint = new_justified
just_fin_state.finalized_checkpoint = new_finalized just_fin_state.finalized_checkpoint = new_finalized