Add test for compute_fork_digest

This commit is contained in:
lsankar4033 2020-06-05 20:26:11 -07:00
parent e6d8a8641d
commit ffeecfbca5

View File

@ -314,6 +314,19 @@ def test_get_block_signature(spec, state):
)
@with_all_phases
@spec_state_test
def test_compute_fork_digest(spec, state):
actual_fork_digest = spec.compute_fork_digest(state.fork.current_version, state.genesis_validators_root)
expected_fork_data_root = spec.hash_tree_root(
spec.ForkData(current_version=state.fork.current_version,
genesis_validators_root=state.genesis_validators_root))
expected_fork_digest = spec.ForkDigest(expected_fork_data_root[:4])
assert actual_fork_digest == expected_fork_digest
# Attesting