mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-16 03:12:41 +00:00
Attestation superstruct changes for EIP 7549 (#5644)
* update * experiment * superstruct changes * revert * superstruct changes * fix tests * indexed attestation * indexed attestation superstruct * updated TODOs
This commit is contained in:
@@ -27,6 +27,12 @@ pub fn get_attesting_indices_from_state<E: EthSpec>(
|
||||
state: &BeaconState<E>,
|
||||
att: &Attestation<E>,
|
||||
) -> Result<Vec<u64>, BeaconStateError> {
|
||||
let committee = state.get_beacon_committee(att.data.slot, att.data.index)?;
|
||||
get_attesting_indices::<E>(committee.committee, &att.aggregation_bits)
|
||||
let committee = state.get_beacon_committee(att.data().slot, att.data().index)?;
|
||||
match att {
|
||||
Attestation::Base(att) => {
|
||||
get_attesting_indices::<E>(committee.committee, &att.aggregation_bits)
|
||||
}
|
||||
// TODO(electra) implement get_attesting_indices for electra
|
||||
Attestation::Electra(_) => todo!(),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use super::get_attesting_indices;
|
||||
use crate::per_block_processing::errors::{AttestationInvalid as Invalid, BlockOperationError};
|
||||
use types::*;
|
||||
use types::{indexed_attestation::IndexedAttestationBase, *};
|
||||
|
||||
type Result<T> = std::result::Result<T, BlockOperationError<Invalid>>;
|
||||
|
||||
@@ -11,11 +11,15 @@ pub fn get_indexed_attestation<E: EthSpec>(
|
||||
committee: &[usize],
|
||||
attestation: &Attestation<E>,
|
||||
) -> Result<IndexedAttestation<E>> {
|
||||
let attesting_indices = get_attesting_indices::<E>(committee, &attestation.aggregation_bits)?;
|
||||
let attesting_indices = match attestation {
|
||||
Attestation::Base(att) => get_attesting_indices::<E>(committee, &att.aggregation_bits)?,
|
||||
// TODO(electra) implement get_attesting_indices for electra
|
||||
Attestation::Electra(_) => todo!(),
|
||||
};
|
||||
|
||||
Ok(IndexedAttestation {
|
||||
Ok(IndexedAttestation::Base(IndexedAttestationBase {
|
||||
attesting_indices: VariableList::new(attesting_indices)?,
|
||||
data: attestation.data.clone(),
|
||||
signature: attestation.signature.clone(),
|
||||
})
|
||||
data: attestation.data().clone(),
|
||||
signature: attestation.signature().clone(),
|
||||
}))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user