Move `get_state_root` to `pyspec/tests/helpers.py`
This commit is contained in:
parent
b6b4d3cbaf
commit
5f341ae493
|
@ -410,3 +410,11 @@ def next_epoch(state):
|
|||
block = build_empty_block_for_next_slot(state)
|
||||
block.slot += spec.SLOTS_PER_EPOCH - (state.slot % spec.SLOTS_PER_EPOCH)
|
||||
state_transition(state, block)
|
||||
|
||||
|
||||
def get_state_root(state, slot) -> bytes:
|
||||
"""
|
||||
Return the state root at a recent ``slot``.
|
||||
"""
|
||||
assert slot < state.slot <= slot + spec.SLOTS_PER_HISTORICAL_ROOT
|
||||
return state.latest_state_roots[slot % spec.SLOTS_PER_HISTORICAL_ROOT]
|
||||
|
|
|
@ -38,6 +38,7 @@ from .helpers import (
|
|||
build_deposit_data,
|
||||
build_empty_block_for_next_slot,
|
||||
fill_aggregate_attestation,
|
||||
get_state_root,
|
||||
get_valid_attestation,
|
||||
get_valid_attester_slashing,
|
||||
get_valid_proposer_slashing,
|
||||
|
@ -51,14 +52,6 @@ from .helpers import (
|
|||
pytestmark = pytest.mark.sanity
|
||||
|
||||
|
||||
def get_state_root(state, slot) -> bytes:
|
||||
"""
|
||||
Return the state root at a recent ``slot``.
|
||||
"""
|
||||
assert slot < state.slot <= slot + SLOTS_PER_HISTORICAL_ROOT
|
||||
return state.latest_state_roots[slot % SLOTS_PER_HISTORICAL_ROOT]
|
||||
|
||||
|
||||
def test_slot_transition(state):
|
||||
test_state = deepcopy(state)
|
||||
cache_state(test_state)
|
||||
|
|
Loading…
Reference in New Issue