From 0e155327fd66aabdc160044637b8f54d4327b69f Mon Sep 17 00:00:00 2001 From: Etan Kissling Date: Tue, 9 Jan 2024 15:41:35 +0100 Subject: [PATCH] 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`. --- tests/core/pyspec/eth2spec/test/helpers/attestations.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/core/pyspec/eth2spec/test/helpers/attestations.py b/tests/core/pyspec/eth2spec/test/helpers/attestations.py index 6cd35c5380..7fecfd7cc9 100644 --- a/tests/core/pyspec/eth2spec/test/helpers/attestations.py +++ b/tests/core/pyspec/eth2spec/test/helpers/attestations.py @@ -280,7 +280,7 @@ def state_transition_with_full_block(spec, ) for attestation in attestations: block.body.attestations.append(attestation) - if fill_prev_epoch: + if fill_prev_epoch and state.slot >= spec.SLOTS_PER_EPOCH: slot_to_attest = state.slot - spec.SLOTS_PER_EPOCH + 1 attestations = get_valid_attestation_at_slot( state,