1818from eth_consensus_specs .utils .ssz .ssz_typing import BitList
1919
2020
21+ def get_parent_slot (state ):
22+ # Outside of block processing, the bid in the state is still the
23+ # parent block's bid, so its slot is the parent block's slot.
24+ return state .latest_execution_payload_bid .slot
25+
26+
2127def process_attestation (spec , state , attestation ):
2228 if is_post_gloas (spec ):
23- # Outside of block processing, the bid in the state is still the
24- # parent block's bid, so its slot is the parent block's slot.
25- spec .process_attestation (state , attestation , state .latest_execution_payload_bid .slot )
29+ spec .process_attestation (state , attestation , get_parent_slot (state ))
2630 else :
2731 spec .process_attestation (state , attestation )
2832
@@ -32,6 +36,7 @@ def run_attestation_processing(spec, state, attestation, valid=True):
3236 Run ``process_attestation``, yielding:
3337 - pre-state ('pre')
3438 - attestation ('attestation')
39+ - parent slot ('parent_slot' in meta, Gloas and later)
3540 - post-state ('post').
3641 If ``valid == False``, run expecting ``AssertionError``
3742 """
@@ -40,6 +45,10 @@ def run_attestation_processing(spec, state, attestation, valid=True):
4045
4146 yield "attestation" , attestation
4247
48+ # Gloas takes the parent block's slot as an extra input.
49+ if is_post_gloas (spec ):
50+ yield "parent_slot" , "meta" , int (get_parent_slot (state ))
51+
4352 # If the attestation is invalid, processing is aborted, and there is no post-state.
4453 if not valid :
4554 expect_assertion_error (lambda : process_attestation (spec , state , attestation ))
0 commit comments