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

Optimise and refine SingleAttestation conversion #6934

Merged
merged 2 commits into from
Feb 7, 2025

Conversation

michaelsproul
Copy link
Member

Issue Addressed

Closes

Proposed Changes

  • Use a new WorkEvent::GossipAttestationToConvert to handle the conversion from SingleAttestation to Attestation on the beacon processor (prevents a Tokio thread being blocked).
  • Improve the error handling for single attestations. I think previously we had no ability to reprocess single attestations for unknown blocks -- we would just error. This seemed to be the case in both gossip processing and processing of SingleAttestations from the HTTP API.
  • Move the SingleAttestation -> Attestation conversion function into beacon_chain so that it can return the attestation_verification::Error type, which has well-defined error handling and peer penalties. The now-unused variants of types::Attestation::Error have been removed.

Additional Info

The names of variables and variants are quasi-generic so that we can switch around the conversion direction, i.e. Attestation<E> -> SingleAttestation, and run the whole attestation pipeline on SingleAttestation only. This will be more efficient for SingleAttestations as we can postpone the expensive committee lookup until after signature verification (which is the whole point of SingleAttestation). I made a start on this here, but it needs more work:

See also:

@michaelsproul michaelsproul added ready-for-review The code is ready for review optimization Something to make Lighthouse run more efficiently. electra Required for the Electra/Prague fork v7.0.0-beta.0 New release c. Q1 2025 labels Feb 7, 2025
@michaelsproul michaelsproul requested a review from jxs as a code owner February 7, 2025 02:58
michaelsproul added a commit that referenced this pull request Feb 7, 2025
Squashed commit of the following:

commit 3f113e5
Merge: 4334687 59afe41
Author: Michael Sproul <[email protected]>
Date:   Fri Feb 7 16:53:17 2025 +1100

    Merge branch 'unstable' into single-attestation-take-3

commit 4334687
Author: Michael Sproul <[email protected]>
Date:   Fri Feb 7 13:51:13 2025 +1100

    Optimise and refine SingleAttestation conversion
Copy link
Collaborator

@eserilev eserilev left a comment

Choose a reason for hiding this comment

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

LGTM!

Would be nice to get a second set of eyes on the review though

Copy link
Member

@pawanjay176 pawanjay176 left a comment

Choose a reason for hiding this comment

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

Nice and tidy! Tested this on devnet 6 and mainnet, logs and metrics looks good

@michaelsproul michaelsproul added ready-for-merge This PR is ready to merge. and removed ready-for-review The code is ready for review labels Feb 7, 2025
mergify bot added a commit that referenced this pull request Feb 7, 2025
@mergify mergify bot merged commit 2bd5bbd into sigp:unstable Feb 7, 2025
31 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
electra Required for the Electra/Prague fork optimization Something to make Lighthouse run more efficiently. ready-for-merge This PR is ready to merge. v7.0.0-beta.0 New release c. Q1 2025
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants