Gloas set AttestationData.index (#9100)

For gloas `attestation.data.index` should be set to 1 if we are attesting to a block whose slot is not the attestation duty slot and slot payload_status is `FULL`


  


Co-Authored-By: Eitan Seri- Levi <eserilev@gmail.com>

Co-Authored-By: Eitan Seri-Levi <eserilev@ucsc.edu>

Co-Authored-By: dapplion <35266934+dapplion@users.noreply.github.com>
This commit is contained in:
Eitan Seri-Levi
2026-04-26 15:40:22 +02:00
committed by GitHub
parent 6323cd3827
commit 276c4d5ff3
6 changed files with 209 additions and 23 deletions

View File

@@ -102,6 +102,7 @@ impl<E: EthSpec> Hash for Attestation<E> {
impl<E: EthSpec> Attestation<E> {
/// Produces an attestation with empty signature.
#[allow(clippy::too_many_arguments)]
pub fn empty_for_signing(
committee_index: u64,
committee_length: usize,
@@ -109,6 +110,7 @@ impl<E: EthSpec> Attestation<E> {
beacon_block_root: Hash256,
source: Checkpoint,
target: Checkpoint,
payload_present: bool,
spec: &ChainSpec,
) -> Result<Self, Error> {
if spec.fork_name_at_slot::<E>(slot).electra_enabled() {
@@ -116,12 +118,19 @@ impl<E: EthSpec> Attestation<E> {
committee_bits
.set(committee_index as usize, true)
.map_err(|_| Error::InvalidCommitteeIndex)?;
// Gloas attestation data index now indicates payload presence.
// Pre-gloas index is always 0.
let index = if spec.fork_name_at_slot::<E>(slot).gloas_enabled() && payload_present {
1u64
} else {
0u64
};
Ok(Attestation::Electra(AttestationElectra {
aggregation_bits: BitList::with_capacity(committee_length)
.map_err(|_| Error::InvalidCommitteeLength)?,
data: AttestationData {
slot,
index: 0u64,
index,
beacon_block_root,
source,
target,