From 63d4ae2800983b8dcf12bcdedf0a56305a27503a Mon Sep 17 00:00:00 2001 From: Eitan Seri- Levi Date: Tue, 3 Mar 2026 20:11:35 -0800 Subject: [PATCH] attestataion data index --- beacon_node/beacon_chain/src/beacon_chain.rs | 34 +++++++++++++------- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/beacon_node/beacon_chain/src/beacon_chain.rs b/beacon_node/beacon_chain/src/beacon_chain.rs index 3454585add..eba296df35 100644 --- a/beacon_node/beacon_chain/src/beacon_chain.rs +++ b/beacon_node/beacon_chain/src/beacon_chain.rs @@ -114,6 +114,7 @@ use state_processing::{ per_slot_processing, state_advance::{complete_state_advance, partial_state_advance}, }; +use types::consts::gloas::PAYLOAD_STATUS_FULL; use std::borrow::Cow; use std::cmp::Ordering; use std::collections::HashMap; @@ -2011,19 +2012,24 @@ impl BeaconChain { drop(head_timer); // Only attest to a block if it is fully verified (i.e. not optimistic or invalid). - match self - .canonical_head - .fork_choice_read_lock() - .get_block_execution_status(&beacon_block_root) - { - Some(execution_status) if execution_status.is_valid_or_irrelevant() => (), - Some(execution_status) => { + // Also grab the block's slot from fork choice for use later. + let payload_status = { + let fork_choice = self.canonical_head.fork_choice_read_lock(); + let proto_block = fork_choice + .get_block(&beacon_block_root) + .ok_or(Error::HeadMissingFromForkChoice(beacon_block_root))?; + if !proto_block.execution_status.is_valid_or_irrelevant() { return Err(Error::HeadBlockNotFullyVerified { beacon_block_root, - execution_status, + execution_status: proto_block.execution_status, }); } - None => return Err(Error::HeadMissingFromForkChoice(beacon_block_root)), + + if proto_block.slot < request_slot && proto_block.payload_status == PAYLOAD_STATUS_FULL { + 1 + } else { + 0 + } }; /* @@ -2068,7 +2074,7 @@ impl BeaconChain { ) }; - Ok(Attestation::::empty_for_signing( + let mut attestation = Attestation::::empty_for_signing( request_index, committee_len, request_slot, @@ -2076,7 +2082,13 @@ impl BeaconChain { justified_checkpoint, target, &self.spec, - )?) + )?; + + if self.spec.fork_name_at_slot::(request_slot).gloas_enabled() { + attestation.data_mut().index = payload_status + } + + Ok(attestation) } /// Performs the same validation as `Self::verify_unaggregated_attestation_for_gossip`, but for