-
Notifications
You must be signed in to change notification settings - Fork 33
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: duplicate and old attestations aggregates #1303
Conversation
defp process_attestations(attestations) do | ||
attestations | ||
|> Enum.group_by(& &1.data.index) | ||
|> Enum.map(fn {_, attestations} -> | ||
Enum.max_by( | ||
attestations, | ||
&(&1.aggregation_bits |> BitVector.count()) | ||
) | ||
end) | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: maybe "filter_latest_attestations" or something more descriptive? or deduplicate_attestations
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Modified it to select_best_aggregates/1
to convey the actual functionality, selecting between aggregates the one with the most set bits
Motivation
Right now we are publishing old aggregates (slot -2) instead of the current (slot -1), also we publish several aggregates for the same subcommittee, this will be solved by this PR.
Description
This PR solves both issues explained in 1254, on one hand the old attestation (being slot - 2 the most recen attestation always) was due to picking the slot on
ignore/2
from the store (slot - 1) instead of taking it from the current block (slot). For the second issue, duplications was due to a lacking of filtering in the block builder steps, as with sync committees, we need to group attestations by committee index and just keep the ones with the greatest pop count (the most amount of set bits)Resolves #1254