Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update the naive agg pool interface #5760

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions beacon_node/beacon_chain/src/beacon_chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1625,14 +1625,17 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
}
}

// TODO(electra): call this function from the new beacon API method
pub fn get_aggregated_attestation_electra(
&self,
data: &AttestationData,
slot: Slot,
attestation_data_root: &Hash256,
committee_index: CommitteeIndex,
) -> Result<Option<Attestation<T::EthSpec>>, Error> {
let attestation_key =
crate::naive_aggregation_pool::AttestationKey::new_electra(data, committee_index);
let attestation_key = crate::naive_aggregation_pool::AttestationKey::new_electra(
slot,
*attestation_data_root,
committee_index,
);
if let Some(attestation) = self.naive_aggregation_pool.read().get(&attestation_key) {
self.filter_optimistic_attestation(attestation)
.map(Option::Some)
Expand Down
10 changes: 5 additions & 5 deletions beacon_node/beacon_chain/src/naive_aggregation_pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ use types::consts::altair::SYNC_COMMITTEE_SUBNET_COUNT;
use types::slot_data::SlotData;
use types::sync_committee_contribution::SyncContributionData;
use types::{
Attestation, AttestationData, AttestationRef, EthSpec, Hash256, Slot, SyncCommitteeContribution,
Attestation, AttestationData, AttestationRef, CommitteeIndex, EthSpec, Hash256, Slot,
SyncCommitteeContribution,
};

type AttestationKeyRoot = Hash256;
Expand All @@ -18,7 +19,7 @@ type SyncDataRoot = Hash256;
#[derive(Debug, Clone, PartialEq)]
pub struct AttestationKey {
data_root: Hash256,
committee_index: Option<u64>,
committee_index: Option<CommitteeIndex>,
slot: Slot,
}

Expand Down Expand Up @@ -95,10 +96,9 @@ impl AttestationKey {
}
}

pub fn new_electra(data: &AttestationData, committee_index: u64) -> Self {
let slot = data.slot;
pub fn new_electra(slot: Slot, data_root: Hash256, committee_index: CommitteeIndex) -> Self {
Self {
data_root: data.tree_hash_root(),
data_root,
committee_index: Some(committee_index),
slot,
}
Expand Down
Loading