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

Fix attestations not getting added to the aggregation pool #5863

Merged
merged 2 commits into from
May 31, 2024

Conversation

pawanjay176
Copy link
Member

Issue Addressed

N/A

Proposed Changes

On receiving unaggregated attestations from the network, lighthouse sets the should_process variable on attestations depending on if we have a connected validator having aggregation duties for the same slot .
For should_process == false, we only validate and forward the attestation, otherwise, we add it to the naive_aggregation_pool so that we can aggregate them.

The should_process calculation happens in the subnet service where it checks if the duty slot and subnet exists in a delay map.

tracked_vals.contains_key(&ExactSubnet {
subnet_id: subnet,
slot: attestation.data.slot,
})

The bug is that during insertion into the delay map, we use the default expiration delay of a single slot duration(12s).

Since we implemented #4806 to reduce subscription spam, we don't send subscriptions every slot before the duty, so we get a situation where an entry into the delay map gets evicted before it has been read.

Hence, the should_process_attestation function almost always returns false unless import-all-attestations flag is turned on, leading to Lighthouse producing bad quality aggregate attestations.

@pawanjay176 pawanjay176 added the ready-for-review The code is ready for review label May 29, 2024
@michaelsproul michaelsproul added the v5.2.0 Q2 2024 label May 29, 2024
Copy link
Member

@michaelsproul michaelsproul left a comment

Choose a reason for hiding this comment

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

Fix looks good to me. I will add this to v5.2.0 for testing!

@michaelsproul michaelsproul added ready-for-merge This PR is ready to merge. and removed ready-for-review The code is ready for review labels May 29, 2024
michaelsproul added a commit that referenced this pull request May 30, 2024
Squashed commit of the following:

commit aa9998e
Author: Pawan Dhananjay <pawandhananjay@gmail.com>
Date:   Wed May 29 22:01:44 2024 +0530

    Cleanup

commit 7d3e57d
Author: Pawan Dhananjay <pawandhananjay@gmail.com>
Date:   Wed May 29 20:12:21 2024 +0530

    Remove from delay_map 2 slots after duty
@michaelsproul michaelsproul mentioned this pull request May 30, 2024
@pawanjay176
Copy link
Member Author

@michaelsproul do you think it would be worth it to run a few testnet nodes without --import-all-attestations to observe the beacon_processor_unaggregated_attestation_verified_total metric?
I checked a holesky node(with validators attached) running without import-all-attestations and the metric was flat at 0 even when gossip_attestation work events were hovering around 500.

image

@michaelsproul
Copy link
Member

Yeah I'm down to try running some nodes with --import-all-attestations.

Copy link
Member

@AgeManning AgeManning left a comment

Choose a reason for hiding this comment

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

Yep, nice find. Looks good to me.

The duration is likely to be updated multiple times, but it should do what we expect here.

michaelsproul added a commit that referenced this pull request May 31, 2024
Squashed commit of the following:

commit aa9998e
Author: Pawan Dhananjay <pawandhananjay@gmail.com>
Date:   Wed May 29 22:01:44 2024 +0530

    Cleanup

commit 7d3e57d
Author: Pawan Dhananjay <pawandhananjay@gmail.com>
Date:   Wed May 29 20:12:21 2024 +0530

    Remove from delay_map 2 slots after duty
@michaelsproul
Copy link
Member

@Mergifyio queue

Copy link

mergify bot commented May 31, 2024

queue

✅ The pull request has been merged automatically

The pull request has been merged automatically at fb790de

mergify bot added a commit that referenced this pull request May 31, 2024
@mergify mergify bot merged commit fb790de into sigp:unstable May 31, 2024
28 checks passed
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready-for-merge This PR is ready to merge. v5.2.0 Q2 2024
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants