mirror of
https://github.com/status-im/eth2.0-specs.git
synced 2025-02-20 06:18:15 +00:00
Expose attestation helper in pyspec tests
This commit is contained in:
parent
248363ce21
commit
0ec1ec77b8
@ -219,15 +219,14 @@ def add_attestations_to_state(spec, state, attestations, slot):
|
|||||||
spec.process_attestation(state, attestation)
|
spec.process_attestation(state, attestation)
|
||||||
|
|
||||||
|
|
||||||
def next_epoch_with_attestations(spec,
|
def next_slots_with_attestations(spec,
|
||||||
state,
|
state,
|
||||||
|
slot_count,
|
||||||
fill_cur_epoch,
|
fill_cur_epoch,
|
||||||
fill_prev_epoch):
|
fill_prev_epoch):
|
||||||
assert state.slot % spec.SLOTS_PER_EPOCH == 0
|
|
||||||
|
|
||||||
post_state = state.copy()
|
post_state = state.copy()
|
||||||
signed_blocks = []
|
signed_blocks = []
|
||||||
for _ in range(spec.SLOTS_PER_EPOCH):
|
for _ in range(slot_count):
|
||||||
block = build_empty_block_for_next_slot(spec, post_state)
|
block = build_empty_block_for_next_slot(spec, post_state)
|
||||||
if fill_cur_epoch and post_state.slot >= spec.MIN_ATTESTATION_INCLUSION_DELAY:
|
if fill_cur_epoch and post_state.slot >= spec.MIN_ATTESTATION_INCLUSION_DELAY:
|
||||||
slot_to_attest = post_state.slot - spec.MIN_ATTESTATION_INCLUSION_DELAY + 1
|
slot_to_attest = post_state.slot - spec.MIN_ATTESTATION_INCLUSION_DELAY + 1
|
||||||
@ -256,6 +255,19 @@ def next_epoch_with_attestations(spec,
|
|||||||
return state, signed_blocks, post_state
|
return state, signed_blocks, post_state
|
||||||
|
|
||||||
|
|
||||||
|
def next_epoch_with_attestations(spec,
|
||||||
|
state,
|
||||||
|
fill_cur_epoch,
|
||||||
|
fill_prev_epoch):
|
||||||
|
assert state.slot % spec.SLOTS_PER_EPOCH == 0
|
||||||
|
|
||||||
|
return next_slots_with_attestations(spec,
|
||||||
|
state,
|
||||||
|
spec.SLOTS_PER_EPOCH,
|
||||||
|
fill_cur_epoch,
|
||||||
|
fill_prev_epoch)
|
||||||
|
|
||||||
|
|
||||||
def prepare_state_with_attestations(spec, state, participation_fn=None):
|
def prepare_state_with_attestations(spec, state, participation_fn=None):
|
||||||
"""
|
"""
|
||||||
Prepare state with attestations according to the ``participation_fn``.
|
Prepare state with attestations according to the ``participation_fn``.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user