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: avoid lost attestations and sync committee messages with early subnet subscribe #1298

Merged
merged 9 commits into from
Sep 23, 2024

Conversation

rodrigo-o
Copy link
Collaborator

@rodrigo-o rodrigo-o commented Sep 19, 2024

Motivation

Some messages from sync committees and attestations weren't part of their aggregates due to late subscribes to the subnets, this PR address it

Description
This PR adds the subnets per slot to our shared duties and also adds a new key in the validator set struct to hold our last subnets subscribed to. On the first third of every slot, we check for the difference between the previous subnets and the new ones and do the appropriate unsubscribe/subscribe when needed. Apart from it this PR tackles an issue when receiving messages for non existing subnets crashed Libp2p.

Resolves #1300
Resolves #1301

@rodrigo-o rodrigo-o marked this pull request as ready for review September 20, 2024 02:40
@rodrigo-o rodrigo-o requested a review from a team as a code owner September 20, 2024 02:40
@rodrigo-o
Copy link
Collaborator Author

A 40 epoch run in the mainnet spec showing sync aggregate almost always at 100% after the early subscribe
image

Copy link
Collaborator

@Arkenan Arkenan left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -41,8 +41,16 @@ defmodule LambdaEthereumConsensus.Validator.Duties do
aggregation: [sync_committee_aggregator_duty()]
}

@type subnets :: MapSet.t(Types.uint64())
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: maybe add a comment on what a subnet is and what the uint is here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done!

@rodrigo-o rodrigo-o enabled auto-merge (squash) September 23, 2024 19:35
@rodrigo-o rodrigo-o merged commit cddb6c2 into main Sep 23, 2024
13 checks passed
@rodrigo-o rodrigo-o deleted the subscribe-early-to-subnet-topics branch September 23, 2024 19:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
2 participants