From b02c2e1c498ef36d65c5b3204208e94f89520a07 Mon Sep 17 00:00:00 2001 From: Danny Ryan Date: Mon, 10 Aug 2020 21:00:23 -0600 Subject: [PATCH] fix randao mix in sanity tests --- .../eth2spec/test/phase0/sanity/test_blocks.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/tests/core/pyspec/eth2spec/test/phase0/sanity/test_blocks.py b/tests/core/pyspec/eth2spec/test/phase0/sanity/test_blocks.py index fa4e690af..5b98abac4 100644 --- a/tests/core/pyspec/eth2spec/test/phase0/sanity/test_blocks.py +++ b/tests/core/pyspec/eth2spec/test/phase0/sanity/test_blocks.py @@ -73,12 +73,10 @@ def test_same_slot_block_transition(spec, state): def test_empty_block_transition(spec, state): pre_slot = state.slot pre_eth1_votes = len(state.eth1_data_votes) + pre_mix = spec.get_randao_mix(state, spec.get_current_epoch(state)) yield 'pre', state - # Ensure pre-state has default randao - assert spec.get_randao_mix(state, spec.get_current_epoch(state)) == spec.Bytes32() - block = build_empty_block_for_next_slot(spec, state) signed_block = state_transition_and_sign_block(spec, state, block) @@ -88,7 +86,7 @@ def test_empty_block_transition(spec, state): assert len(state.eth1_data_votes) == pre_eth1_votes + 1 assert spec.get_block_root_at_slot(state, pre_slot) == signed_block.message.parent_root - assert spec.get_randao_mix(state, spec.get_current_epoch(state)) != spec.Bytes32() + assert spec.get_randao_mix(state, spec.get_current_epoch(state)) != pre_mix @with_all_phases @@ -98,12 +96,10 @@ def test_empty_block_transition(spec, state): def test_empty_block_transition_large_validator_set(spec, state): pre_slot = state.slot pre_eth1_votes = len(state.eth1_data_votes) + pre_mix = spec.get_randao_mix(state, spec.get_current_epoch(state)) yield 'pre', state - # Ensure pre-state has default randao - assert spec.get_randao_mix(state, spec.get_current_epoch(state)) == spec.Bytes32() - block = build_empty_block_for_next_slot(spec, state) signed_block = state_transition_and_sign_block(spec, state, block) @@ -113,7 +109,7 @@ def test_empty_block_transition_large_validator_set(spec, state): assert len(state.eth1_data_votes) == pre_eth1_votes + 1 assert spec.get_block_root_at_slot(state, pre_slot) == signed_block.message.parent_root - assert spec.get_randao_mix(state, spec.get_current_epoch(state)) != spec.Bytes32() + assert spec.get_randao_mix(state, spec.get_current_epoch(state)) != pre_mix def process_and_sign_block_without_header_validations(spec, state, block):