Skip to content

Ensure /eth/v2/beacon/pool/attestations honors committee_index #7298

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

Merged
merged 11 commits into from
Apr 11, 2025

Conversation

eserilev
Copy link
Member

@eserilev eserilev commented Apr 9, 2025

Issue Addressed

#7294

Proposed Changes

Fix the filtering logic so that we actually filter by committee index for both Base and Electra attestations.

Added a tiny optimization when calculating committee_index to prevent unneeded memory allocations

Added a regression test

@eserilev eserilev changed the base branch from stable to release-v7.0.0 April 9, 2025 18:13
@eserilev eserilev added v7.0.0 New release c. Q1 2025 electra Required for the Electra/Prague fork bug Something isn't working HTTP-API labels Apr 9, 2025
@eserilev eserilev added the ready-for-review The code is ready for review label Apr 9, 2025
@eserilev eserilev mentioned this pull request Apr 9, 2025
@michaelsproul michaelsproul requested a review from Copilot April 9, 2025 23:46
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Comments suppressed due to low confidence (4)

consensus/types/src/attestation.rs:296

  • [nitpick] Ensure that returning only the first active committee bit is intentional. If multiple bits can be active, verify that using find to return only the first one matches the expected behavior.
.iter()

beacon_node/operation_pool/src/lib.rs:676

  • Ensure that all invocations of get_filtered_attestations have been updated to supply the additional committee_index parameter correctly to avoid potential runtime issues.
F: Fn(&AttestationData, Option<u64>) -> bool,

beacon_node/http_api/src/lib.rs:2005

  • [nitpick] Review the conditional logic for committee_index filtering to ensure that attestations with a None committee index are correctly excluded when a committee filter is provided; consider refactoring for improved clarity.
&& query.committee_index.is_none_or(|index| {

beacon_node/operation_pool/src/attestation_storage.rs:122

  • [nitpick] Verify that using self.data.index for Base attestations produces the intended committee index, aligning with the processing logic for Electra attestations to maintain consistency.
pub fn committee_index(&self) -> Option<u64> {

.committee_bits
.iter()
.enumerate()
.find(|&(_, bit)| bit)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need to account for aggregation here. Attestations in the op pool can cover multiple committee indices and if any of these match our query index, we should return that attestation.

The aggregation happens in aggregate_across_committees, which persists the aggregates in the attestation storage:

pub fn aggregate_across_committees(&mut self, checkpoint_key: CheckpointKey) {

We could use the committee_indices vec and check committee_indices.contains(&query.committee_index)? We should also add a test covering this case (might need to call aggregate_across_committees to prompt aggregation).

(We should maybe remove the committee_index methods here so we don't accidentally misuse them)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One of the issues with out test harness is that we only have attestations across a single committee. so the aggregation isnt doing much. I've added it anyways, but I had to make a field public which isnt the best solution

We should clean this up and get the test harness to create attestations across more than a single committee. I just didnt want to block v7 testing because of this. Let me know what you think

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh yeah good point. We can come back to test this more thoroughly, I've opened an issue:

@michaelsproul michaelsproul added waiting-on-author The reviewer has suggested changes and awaits thier implementation. and removed ready-for-review The code is ready for review labels Apr 9, 2025
@eserilev eserilev added the ready-for-review The code is ready for review label Apr 10, 2025
@macladson macladson added ready-for-merge This PR is ready to merge. and removed ready-for-review The code is ready for review waiting-on-author The reviewer has suggested changes and awaits thier implementation. labels Apr 11, 2025
mergify bot added a commit that referenced this pull request Apr 11, 2025
@mergify mergify bot merged commit af51d50 into sigp:release-v7.0.0 Apr 11, 2025
31 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working electra Required for the Electra/Prague fork HTTP-API ready-for-merge This PR is ready to merge. v7.0.0 New release c. Q1 2025
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants