Use `get_shard_winning_roots` to verify

This commit is contained in:
Hsiao-Wei Wang 2020-06-19 22:29:49 +08:00
parent 43605eebe8
commit 37d1a0750d
No known key found for this signature in database
GPG Key ID: 95B070122902DEA4
1 changed files with 7 additions and 0 deletions

View File

@ -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]