mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-01 03:33:47 +00:00
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:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user