From 21b878364a615ad0a5938ae566a416b10e98393d Mon Sep 17 00:00:00 2001 From: Aditya Asgaonkar Date: Sat, 3 Apr 2021 17:09:08 -0700 Subject: [PATCH] Fix checkpoint hierarchy consistency in tests --- .../test/phase0/unittests/fork_choice/test_on_block.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/core/pyspec/eth2spec/test/phase0/unittests/fork_choice/test_on_block.py b/tests/core/pyspec/eth2spec/test/phase0/unittests/fork_choice/test_on_block.py index 79c55b2eb..536241bf8 100644 --- a/tests/core/pyspec/eth2spec/test/phase0/unittests/fork_choice/test_on_block.py +++ b/tests/core/pyspec/eth2spec/test/phase0/unittests/fork_choice/test_on_block.py @@ -307,13 +307,15 @@ def test_on_block_outside_safe_slots_but_finality(spec, state): # Mock justified and finalized update in state just_fin_state = store.block_states[last_block_root] 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(), ) + assert new_justified.epoch > store.justified_checkpoint.epoch new_finalized = spec.Checkpoint( - epoch=store.finalized_checkpoint.epoch + 1, + epoch=spec.compute_epoch_at_slot(just_block.slot), root=just_block.parent_root, ) + assert new_finalized.epoch > store.finalized_checkpoint.epoch just_fin_state.current_justified_checkpoint = new_justified just_fin_state.finalized_checkpoint = new_finalized