From a399d953d3c2e32744c94eb6397a6454dbac7775 Mon Sep 17 00:00:00 2001 From: Hsiao-Wei Wang Date: Thu, 2 Dec 2021 17:21:42 +0800 Subject: [PATCH] Add assertion to `test_shorter_chain_but_heavier_weight` --- .../pyspec/eth2spec/test/phase0/fork_choice/test_get_head.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/core/pyspec/eth2spec/test/phase0/fork_choice/test_get_head.py b/tests/core/pyspec/eth2spec/test/phase0/fork_choice/test_get_head.py index d2c84fce7..a524cbd56 100644 --- a/tests/core/pyspec/eth2spec/test/phase0/fork_choice/test_get_head.py +++ b/tests/core/pyspec/eth2spec/test/phase0/fork_choice/test_get_head.py @@ -166,6 +166,9 @@ def test_shorter_chain_but_heavier_weight(spec, state): signed_short_block = state_transition_and_sign_block(spec, short_state, short_block) yield from tick_and_add_block(spec, store, signed_short_block, test_steps) + # Since the long chain has higher proposer_score at slot 1, the latest long block is the head + assert spec.get_head(store) == spec.hash_tree_root(long_block) + short_attestation = get_valid_attestation(spec, short_state, short_block.slot, signed=True) yield from tick_and_run_on_attestation(spec, store, short_attestation, test_steps)