-
Notifications
You must be signed in to change notification settings - Fork 796
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 subnet unsubscription time #6890
base: unstable
Are you sure you want to change the base?
Conversation
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.
Nice find!
The fix makes sense to me.
The testnet case is interesting, but I think a fix for that can wait for another PR. I guess we might want to special-case the VC's/BN's handling of the first ~2 slots of a network (feels kind of dumb), or remove the loud warnings for late subscriptions from the BN and just track them with a metric.
Looks like one of the tests is failing. It might actually be expecting the old behaviour 👀 |
I fixed the failing test according to my understanding. After the refactor, we decide to extend the unsubscription only in TL;DR: the test |
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.
Nice find! 👍
let current_slot = self.beacon_chain.slot_clock.now().unwrap_or_default(); | ||
if let Err(e) = self.subscribe_to_subnet_immediately(subnet, current_slot + 1) { | ||
let ExactSubnet { subnet, slot } = exact_subnet; | ||
if let Err(e) = self.subscribe_to_subnet_immediately(subnet, slot + 1) { |
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.
You should add some comments referencing the issue and the reason for slot + 1
in the code. Useful if we ever refactor this and git blame breaks
1f7c612
to
53fb5ea
Compare
Issue Addressed
Hopefully fixes #6732
Proposed Changes
In our
scheduled_subscriptions
, we were setting unsubscription slot to becurrent_slot + 1
. Given that we were subscribing to the subnet atduty.slot - 1
, the unsubscription slot ended up beingduty.slot
. So we were unsubscribing to the subnet at the beginning of the duty slot which is insane.Fixes the
scheduled_subscriptions
to unsubscribe atduty.slot + 1
.Additional Info
Running this on kurtosis made me realise that we do not send subscriptions for the first couple of slots because of https://github.com/sigp/lighthouse/blob/unstable/validator_client/validator_services/src/duties_service.rs#L79-L85
Not sure if we want to handle that.