Skip to content

Commit

Permalink
Revert "Get electra_op_pool up to date (sigp#5756)" (sigp#5757)
Browse files Browse the repository at this point in the history
This reverts commit ab9e58a.
  • Loading branch information
ethDreamer authored and realbigsean committed Jun 25, 2024
1 parent 7e21f6a commit 35563ad
Show file tree
Hide file tree
Showing 12 changed files with 108 additions and 307 deletions.
5 changes: 2 additions & 3 deletions beacon_node/beacon_chain/src/attestation_verification.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1358,11 +1358,10 @@ pub fn obtain_indexed_attestation_and_committees_per_slot<T: BeaconChainTypes>(
attesting_indices_electra::get_indexed_attestation(&committees, att)
.map(|attestation| (attestation, committees_per_slot))
.map_err(|e| {
let index = att.committee_index();
if e == BlockOperationError::BeaconStateError(NoCommitteeFound(index)) {
if e == BlockOperationError::BeaconStateError(NoCommitteeFound) {
Error::NoCommitteeForSlotAndIndex {
slot: att.data.slot,
index,
index: att.committee_index(),
}
} else {
Error::Invalid(e)
Expand Down
38 changes: 8 additions & 30 deletions beacon_node/beacon_chain/src/beacon_chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1664,28 +1664,11 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
/// Returns an aggregated `Attestation`, if any, that has a matching `attestation.data`.
///
/// The attestation will be obtained from `self.naive_aggregation_pool`.
pub fn get_aggregated_attestation_base(
&self,
data: &AttestationData,
) -> Result<Option<Attestation<T::EthSpec>>, Error> {
let attestation_key = crate::naive_aggregation_pool::AttestationKey::new_base(data);
if let Some(attestation) = self.naive_aggregation_pool.read().get(&attestation_key) {
self.filter_optimistic_attestation(attestation)
.map(Option::Some)
} else {
Ok(None)
}
}

// TODO(electra): call this function from the new beacon API method
pub fn get_aggregated_attestation_electra(
pub fn get_aggregated_attestation(
&self,
data: &AttestationData,
committee_index: CommitteeIndex,
) -> Result<Option<Attestation<T::EthSpec>>, Error> {
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) {
if let Some(attestation) = self.naive_aggregation_pool.read().get(data) {
self.filter_optimistic_attestation(attestation)
.map(Option::Some)
} else {
Expand All @@ -1697,21 +1680,16 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
/// `attestation.data.tree_hash_root()`.
///
/// The attestation will be obtained from `self.naive_aggregation_pool`.
///
/// NOTE: This function will *only* work with pre-electra attestations and it only
/// exists to support the pre-electra validator API method.
pub fn get_pre_electra_aggregated_attestation_by_slot_and_root(
pub fn get_aggregated_attestation_by_slot_and_root(
&self,
slot: Slot,
attestation_data_root: &Hash256,
) -> Result<Option<Attestation<T::EthSpec>>, Error> {
let attestation_key =
crate::naive_aggregation_pool::AttestationKey::new_base_from_slot_and_root(
slot,
*attestation_data_root,
);

if let Some(attestation) = self.naive_aggregation_pool.read().get(&attestation_key) {
if let Some(attestation) = self
.naive_aggregation_pool
.read()
.get_by_slot_and_root(slot, attestation_data_root)
{
self.filter_optimistic_attestation(attestation)
.map(Option::Some)
} else {
Expand Down
Loading

0 comments on commit 35563ad

Please sign in to comment.