-
Notifications
You must be signed in to change notification settings - Fork 105
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
feat(validator): listen and get metadata only for committee validators #1787
Conversation
… validators belonging to own committee
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.
I know this pr is still immature. quoting the issue here to clarify my original intentions -
- Consider to pull metadata from beacon node only about validators that are part of your listened subnets.
- Reject/ignore all messages that are not part of your subnet validators (this might happen automatically since you won't have their status and duties)
So about first point I see you started it, but your using the ValidatorSubnet
calculation which is pre-alan way to find your subnets. We now use CommiteeSubnet
and have a different way of dividing our validators to subnets (according to committees).
About second point I don't see that you did anything about message validation, though if we don't have any metadata about this operator's validators than we might just naturally reject/ignore it? please make sure what happens in this case.
Added post-fork handling, please review again
In this case the message gets ignored: ErrNoShareMetadata = Error{text: "share has no metadata"} |
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.
- Remove prefork code, as I explained its not needed anymore
- to make this PR final we need to POC that it works on stage
- Compare cpu mem usage
- compare how this impacts the overload on beacon node
- We probably need to ignore messages that we don't have duties or its validator we don't see as active (because they're not ours). instead of rejecting them.
- @MatheusFranco99 can you chime in in terms of protocol and networking, other than more well spread messages, any reason why ignoring these message will impact us badly?
@y0sher But we must not do this if you meant ignoring messages about validators that we are not part of the committee. |
@nkryuchkov Great job! |
@MatheusFranco99 sorry for the confusion, I meant validators from topics we're not subscribed to |
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.
👍
operator/validator/controller.go
Outdated
for _, share := range shares { | ||
if c.operatorDataStore.GetOperatorID() != 0 && share.BelongsToOperator(c.operatorDataStore.GetOperatorID()) { | ||
ownShares = append(ownShares, share) | ||
} | ||
allPubKeys = append(allPubKeys, share.ValidatorPubKey[:]) | ||
committeeSubnet := byte(commons.CommitteeSubnet(share.CommitteeID())) | ||
if bytes.Contains(activeSubnets, []byte{committeeSubnet}) { |
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.
I believe we have SharedSubnets
and some other subnets utility functions. its best to use a function across the code to make changing and bug fixing easier.
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.
SharedSubnets
checks intersections between two subnet sets but we have a single value here, so I think it's not a good fit here. However, there was a bug in my implementation, I don't need bytes.Contains
, I can just check the index
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.
However, I think we need to refactor how we work with subnets in future PRs: Create a type for it and add methods
operator/validator/controller.go
Outdated
@@ -1139,6 +1148,12 @@ func (c *controller) UpdateValidatorMetaDataLoop() { | |||
if share.Liquidated { | |||
return true | |||
} | |||
|
|||
committeeSubnet := byte(commons.CommitteeSubnet(share.CommitteeID())) | |||
if !bytes.Contains(activeSubnets, []byte{committeeSubnet}) { |
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.
ditto
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.
LGTM 🔥
fixed a bug and pushed: ac49a96
is this the case now in message validation with this PR? if we receive a message with committee which check happens first? |
# Conflicts: # network/p2p/p2p_setup.go # operator/validator/mocks/controller.go
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.
check latest comment. we need to make sure we always update all our validators' non liquidated shares
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.
looks good. can you please reply my question
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.
gj.
please lets check the resource change for calling selfSubnets for every iteration of the metadata loop before merging this.
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.
LGTM
It seems there's an issue with the current implementation of this PR. While the logic correctly focuses on listening and getting metadata only for committee validators, it does not account for the exporter node. The exporter node requires metadata for all validators, not just the committee ones. This is a critical oversight, as it may cause incomplete data in the exporter node's operations. We need to update the logic to ensure that the exporter node retrieves metadata for all validators. |
Closes #1703
Note: each
selfSubnets
call takes approx. 300-900 µs