Skip to content

Commit 0e15532

Browse files
committed
Add guard when fill_prev_epoch is True in epoch 0
`state_transition_with_full_block` takes two flags, `fill_cur_epoch` and `fill_prev_epoch`, to control what attestations to include into the new testing block. While `fill_cur_epoch` uses `MIN_ATTESTATION_INCLUSION_DELAY` as the minimum slot before taking effect, `fill_prev_epoch` results in an annoying assert, requiring caller to work around the case of calling the function as usual at the start. This adds a similar minimum slot `SLOTS_PER_EPOCH` for `fill_prev_epoch` before which the flag is ignored, same as for `fill_cur_epoch`.
1 parent e525946 commit 0e15532

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tests/core/pyspec/eth2spec/test/helpers/attestations.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ def state_transition_with_full_block(spec,
280280
)
281281
for attestation in attestations:
282282
block.body.attestations.append(attestation)
283-
if fill_prev_epoch:
283+
if fill_prev_epoch and state.slot >= spec.SLOTS_PER_EPOCH:
284284
slot_to_attest = state.slot - spec.SLOTS_PER_EPOCH + 1
285285
attestations = get_valid_attestation_at_slot(
286286
state,

0 commit comments

Comments
 (0)