Some small changes (#5739)

This commit is contained in:
ethDreamer
2024-05-08 11:40:08 -05:00
committed by GitHub
parent 90179d4a88
commit f30246b9d4
2 changed files with 5 additions and 3 deletions

View File

@@ -560,6 +560,7 @@ impl<'a, T: BeaconChainTypes> IndexedAggregatedAttestation<'a, T> {
})?; })?;
if let Some(committee) = committee { if let Some(committee) = committee {
// TODO(electra):
// Note: this clones the signature which is known to be a relatively slow operation. // Note: this clones the signature which is known to be a relatively slow operation.
// //
// Future optimizations should remove this clone. // Future optimizations should remove this clone.
@@ -599,7 +600,7 @@ impl<'a, T: BeaconChainTypes> IndexedAggregatedAttestation<'a, T> {
let indexed_attestation = match map_attestation_committees( let indexed_attestation = match map_attestation_committees(
chain, chain,
&attestation, attestation,
get_indexed_attestation_with_committee, get_indexed_attestation_with_committee,
) { ) {
Ok(indexed_attestation) => indexed_attestation, Ok(indexed_attestation) => indexed_attestation,
@@ -1281,7 +1282,7 @@ pub fn obtain_indexed_attestation_and_committees_per_slot<T: BeaconChainTypes>(
chain: &BeaconChain<T>, chain: &BeaconChain<T>,
attestation: AttestationRef<T::EthSpec>, attestation: AttestationRef<T::EthSpec>,
) -> Result<(IndexedAttestation<T::EthSpec>, CommitteesPerSlot), Error> { ) -> Result<(IndexedAttestation<T::EthSpec>, CommitteesPerSlot), Error> {
map_attestation_committees(chain, &attestation, |(committees, committees_per_slot)| { map_attestation_committees(chain, attestation, |(committees, committees_per_slot)| {
match attestation { match attestation {
AttestationRef::Base(att) => { AttestationRef::Base(att) => {
let committee = committees let committee = committees
@@ -1335,7 +1336,7 @@ pub fn obtain_indexed_attestation_and_committees_per_slot<T: BeaconChainTypes>(
/// from disk and then update the `shuffling_cache`. /// from disk and then update the `shuffling_cache`.
fn map_attestation_committees<T, F, R>( fn map_attestation_committees<T, F, R>(
chain: &BeaconChain<T>, chain: &BeaconChain<T>,
attestation: &AttestationRef<T::EthSpec>, attestation: AttestationRef<T::EthSpec>,
map_fn: F, map_fn: F,
) -> Result<R, Error> ) -> Result<R, Error>
where where

View File

@@ -239,6 +239,7 @@ impl<E: EthSpec> AttestationMap<E> {
let attestation_map = self.checkpoint_map.entry(checkpoint).or_default(); let attestation_map = self.checkpoint_map.entry(checkpoint).or_default();
let attestations = attestation_map.attestations.entry(data).or_default(); let attestations = attestation_map.attestations.entry(data).or_default();
// TODO(electra):
// Greedily aggregate the attestation with all existing attestations. // Greedily aggregate the attestation with all existing attestations.
// NOTE: this is sub-optimal and in future we will remove this in favour of max-clique // NOTE: this is sub-optimal and in future we will remove this in favour of max-clique
// aggregation. // aggregation.