From a626a798501f732068fb5e841cca51d4635f6cd4 Mon Sep 17 00:00:00 2001 From: Alex Stokes Date: Fri, 5 Apr 2024 14:08:39 -0600 Subject: [PATCH] bugfix: use right test tool to construct Electra `AttesterSlashing` from Deneb attestations --- .../pyspec/eth2spec/test/helpers/fork_transition.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tests/core/pyspec/eth2spec/test/helpers/fork_transition.py b/tests/core/pyspec/eth2spec/test/helpers/fork_transition.py index 078b9779f8..14c593d321 100644 --- a/tests/core/pyspec/eth2spec/test/helpers/fork_transition.py +++ b/tests/core/pyspec/eth2spec/test/helpers/fork_transition.py @@ -17,6 +17,7 @@ PHASE0, POST_FORK_OF, PREVIOUS_FORK_OF, + DENEB, ) from eth2spec.test.helpers.deposits import ( prepare_state_and_deposit, @@ -296,8 +297,15 @@ def run_transition_with_operation(state, operation_dict = {'proposer_slashings': [proposer_slashing]} else: # operation_type == OperationType.ATTESTER_SLASHING: + if is_at_fork and spec.fork == DENEB: + # NOTE: attestation format changes between Deneb and Electra + # so attester slashing must be made with the `post_spec` + target_spec = post_spec + else: + target_spec = spec + attester_slashing = get_valid_attester_slashing_by_indices( - spec, state, + target_spec, state, [selected_validator_index], signed_1=True, signed_2=True, )