diff --git a/test_libs/pyspec/eth2spec/test/sanity/test_blocks.py b/test_libs/pyspec/eth2spec/test/sanity/test_blocks.py index 8150b06f6..0a879dac6 100644 --- a/test_libs/pyspec/eth2spec/test/sanity/test_blocks.py +++ b/test_libs/pyspec/eth2spec/test/sanity/test_blocks.py @@ -66,6 +66,22 @@ def test_empty_block_transition(spec, state): assert spec.get_randao_mix(state, spec.get_current_epoch(state)) != spec.ZERO_HASH +@with_all_phases +@spec_state_test +def test_invalid_state_root(spec, state): + yield 'pre', state + + block = build_empty_block_for_next_slot(spec, state) + block.state_root = b"\xaa" * 32 + sign_block(spec, state, block) + + expect_assertion_error( + lambda: spec.state_transition(state, block, validate_state_root=True)) + + yield 'blocks', [block] + yield 'post', None + + @with_all_phases @spec_state_test def test_skipped_slots(spec, state):