check invalid state root

This commit is contained in:
protolambda 2019-06-27 00:43:50 +02:00
parent 8445d1d90c
commit f7b3c87715
No known key found for this signature in database
GPG Key ID: EC89FDBB2B4C7623
1 changed files with 16 additions and 0 deletions

View File

@ -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 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 @with_all_phases
@spec_state_test @spec_state_test
def test_skipped_slots(spec, state): def test_skipped_slots(spec, state):