From 37d1a0750db7f01c3781638f8a35f36a1a78dc3f Mon Sep 17 00:00:00 2001 From: Hsiao-Wei Wang Date: Fri, 19 Jun 2020 22:29:49 +0800 Subject: [PATCH] Use `get_shard_winning_roots` to verify --- .../block_processing/test_process_shard_transition.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/core/pyspec/eth2spec/test/phase1/block_processing/test_process_shard_transition.py b/tests/core/pyspec/eth2spec/test/phase1/block_processing/test_process_shard_transition.py index ead555098..0a0722b9c 100644 --- a/tests/core/pyspec/eth2spec/test/phase1/block_processing/test_process_shard_transition.py +++ b/tests/core/pyspec/eth2spec/test/phase1/block_processing/test_process_shard_transition.py @@ -65,6 +65,10 @@ def run_successful_crosslink_tests(spec, state, target_len_offset_slot, valid=Tr for attestation in attestations: _, _, _ = run_attestation_processing(spec, state, attestation) + _, winning_roots = spec.get_shard_winning_roots(state, attestations) + assert len(winning_roots) == 1 + assert winning_roots[0] == shard_transitions[shard].hash_tree_root() + pre_gasprice = state.shard_states[shard].gasprice pre_shard_state = state.shard_states[shard] yield from run_shard_transitions_processing(spec, state, shard_transitions, attestations, valid=valid) @@ -135,6 +139,9 @@ def test_no_winning_root(spec, state): _, _, _ = run_attestation_processing(spec, state, attestation) + _, winning_roots = spec.get_shard_winning_roots(state, [attestation]) + assert len(winning_roots) == 0 + # No winning root, shard_transitions[shard] is empty shard_transitions = [spec.ShardTransition()] * spec.MAX_SHARDS pre_shard_state = state.shard_states[shard]