From b81271de3dbd8ae4ff5f1296012fcc2ff318b8da Mon Sep 17 00:00:00 2001 From: ethDreamer <37123614+ethDreamer@users.noreply.github.com> Date: Thu, 9 May 2024 16:59:39 -0500 Subject: [PATCH] Get `electra_op_pool` up to date (#5756) * fix get attesting indices (#5742) * fix get attesting indices * better errors * fix compile * only get committee index once * Ef test fixes (#5753) * attestation related ef test fixes * delete commented out stuff * Fix Aggregation Pool for Electra (#5754) * Fix Aggregation Pool for Electra * Remove Outdated Interface * fix ssz (#5755) --------- Co-authored-by: realbigsean --- beacon_node/beacon_chain/src/beacon_chain.rs | 11 ++++------- .../beacon_chain/src/naive_aggregation_pool.rs | 7 ++++--- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/beacon_node/beacon_chain/src/beacon_chain.rs b/beacon_node/beacon_chain/src/beacon_chain.rs index ca0dcbb80bb..719b5df76be 100644 --- a/beacon_node/beacon_chain/src/beacon_chain.rs +++ b/beacon_node/beacon_chain/src/beacon_chain.rs @@ -1677,17 +1677,14 @@ impl BeaconChain { } } + // TODO(electra): call this function from the new beacon API method pub fn get_aggregated_attestation_electra( &self, - slot: Slot, - attestation_data_root: &Hash256, + data: &AttestationData, committee_index: CommitteeIndex, ) -> Result>, Error> { - let attestation_key = crate::naive_aggregation_pool::AttestationKey::new_electra( - slot, - *attestation_data_root, - committee_index, - ); + let attestation_key = + crate::naive_aggregation_pool::AttestationKey::new_electra(data, committee_index); if let Some(attestation) = self.naive_aggregation_pool.read().get(&attestation_key) { self.filter_optimistic_attestation(attestation) .map(Option::Some) diff --git a/beacon_node/beacon_chain/src/naive_aggregation_pool.rs b/beacon_node/beacon_chain/src/naive_aggregation_pool.rs index a1c736cd0ef..af3f6c8ed18 100644 --- a/beacon_node/beacon_chain/src/naive_aggregation_pool.rs +++ b/beacon_node/beacon_chain/src/naive_aggregation_pool.rs @@ -19,7 +19,7 @@ type SyncDataRoot = Hash256; #[derive(Debug, Clone, PartialEq)] pub struct AttestationKey { data_root: Hash256, - committee_index: Option, + committee_index: Option, slot: Slot, } @@ -96,9 +96,10 @@ impl AttestationKey { } } - pub fn new_electra(slot: Slot, data_root: Hash256, committee_index: CommitteeIndex) -> Self { + pub fn new_electra(data: &AttestationData, committee_index: u64) -> Self { + let slot = data.slot; Self { - data_root, + data_root: data.tree_hash_root(), committee_index: Some(committee_index), slot, }