mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-07 00:42:42 +00:00
Merge branch 'beacon-api-electra' into p2p-electra
This commit is contained in:
@@ -14,11 +14,11 @@ use std::ops::Deref;
|
|||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use tokio::time::{sleep, sleep_until, Duration, Instant};
|
use tokio::time::{sleep, sleep_until, Duration, Instant};
|
||||||
use tree_hash::TreeHash;
|
use tree_hash::TreeHash;
|
||||||
use types::ForkName;
|
|
||||||
use types::{
|
use types::{
|
||||||
attestation::AttestationBase, AggregateSignature, Attestation, AttestationData, BitList,
|
attestation::AttestationBase, AggregateSignature, Attestation, AttestationData, BitList,
|
||||||
ChainSpec, CommitteeIndex, EthSpec, Slot,
|
ChainSpec, CommitteeIndex, EthSpec, Slot,
|
||||||
};
|
};
|
||||||
|
use types::{AttestationElectra, BitVector, ForkName};
|
||||||
|
|
||||||
/// Builds an `AttestationService`.
|
/// Builds an `AttestationService`.
|
||||||
pub struct AttestationServiceBuilder<T: SlotClock + 'static, E: EthSpec> {
|
pub struct AttestationServiceBuilder<T: SlotClock + 'static, E: EthSpec> {
|
||||||
@@ -383,11 +383,32 @@ impl<T: SlotClock + 'static, E: EthSpec> AttestationService<T, E> {
|
|||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut attestation = Attestation::Base(AttestationBase {
|
let fork_name = self
|
||||||
aggregation_bits: BitList::with_capacity(duty.committee_length as usize).unwrap(),
|
.context
|
||||||
data: attestation_data.clone(),
|
.eth2_config
|
||||||
signature: AggregateSignature::infinity(),
|
.spec
|
||||||
});
|
.fork_name_at_slot::<E>(attestation_data.slot);
|
||||||
|
|
||||||
|
let mut attestation = if fork_name >= ForkName::Electra {
|
||||||
|
let mut committee_bits: BitVector<E::MaxCommitteesPerSlot> = BitVector::default();
|
||||||
|
committee_bits
|
||||||
|
.set(duty.committee_index as usize, true)
|
||||||
|
.unwrap();
|
||||||
|
Attestation::Electra(AttestationElectra {
|
||||||
|
aggregation_bits: BitList::with_capacity(duty.committee_length as usize)
|
||||||
|
.unwrap(),
|
||||||
|
data: attestation_data.clone(),
|
||||||
|
committee_bits,
|
||||||
|
signature: AggregateSignature::infinity(),
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
Attestation::Base(AttestationBase {
|
||||||
|
aggregation_bits: BitList::with_capacity(duty.committee_length as usize)
|
||||||
|
.unwrap(),
|
||||||
|
data: attestation_data.clone(),
|
||||||
|
signature: AggregateSignature::infinity(),
|
||||||
|
})
|
||||||
|
};
|
||||||
|
|
||||||
match self
|
match self
|
||||||
.validator_store
|
.validator_store
|
||||||
|
|||||||
Reference in New Issue
Block a user