Skip to content

Conversation

@michaelsproul
Copy link
Member

Issue Addressed

Closes:

Proposed Changes

Sign attestations prior to checking them against the slashing protection DB. This allows us to avoid the sequential DB checks which are observed in traces here:

Additional Info

This PR builds on:

This is a rework of Eitan's PR:

I started by trying to resolve merge conflicts, but there were so many breakages I ended up redoing it. I also left out some of the other changes (like the AttestationDataService) as we are probably going to introduce a new version of that in the course of implementing the head monitor + consensus service, see:

@michaelsproul michaelsproul added val-client Relates to the validator client binary optimization Something to make Lighthouse run more efficiently. labels Dec 2, 2025
@eserilev eserilev self-requested a review December 2, 2025 16:17
@michaelsproul michaelsproul added the v8.1.0 Post-Fulu release label Jan 11, 2026
@michaelsproul michaelsproul mentioned this pull request Jan 20, 2026
5 tasks
@michaelsproul
Copy link
Member Author

This isn't really cutting it in terms of performance, even with the change to prune more frequently.

I think we might need Rayon to cut the signing times:

The previous branch with this + Rayon was working well.

@michaelsproul michaelsproul added the ready-for-review The code is ready for review label Jan 22, 2026
@michaelsproul
Copy link
Member Author

Self-review complete. This is ready for review and hopefully merge 🤞

let single_attestations = safe_attestations
.iter()
.zip(validator_indices)
.zip(validator_indices_ref)
Copy link
Member

Choose a reason for hiding this comment

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

validator_indices_ref contains all the attestations to sign, while safe_attestations contains only the safe ones to publish (could be less if there is slashable ones), I think this may not work correctly if the vec sizes don't match?

Copy link
Member

Choose a reason for hiding this comment

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

maybe the sign_attestations function can return a tuple of attestations and validator_indices? similar to the join_all return values before

) -> Result<(), Error> {
// Make sure the target epoch is not higher than the current epoch to avoid potential attacks.
if attestation.data().target.epoch > current_epoch {
return Err(Error::GreaterThanCurrentEpoch {
Copy link
Member

Choose a reason for hiding this comment

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

Looks like we no longer need this error variant and cna be deleted

@jimmygchen jimmygchen 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 Jan 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

optimization Something to make Lighthouse run more efficiently. v8.1.0 Post-Fulu release val-client Relates to the validator client binary waiting-on-author The reviewer has suggested changes and awaits thier implementation.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants