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

doppelganger detection walltime refactor #2656

Merged
merged 4 commits into from
Jun 17, 2021
Merged

doppelganger detection walltime refactor #2656

merged 4 commits into from
Jun 17, 2021

Conversation

tersec
Copy link
Contributor

@tersec tersec commented Jun 16, 2021

In response to #2650

@tersec tersec marked this pull request as draft June 16, 2021 21:50
@github-actions
Copy link

github-actions bot commented Jun 16, 2021

Unit Test Results

     28 files  ±0     328 suites  ±0   57m 4s ⏱️ ±0s
   628 tests ±0     610 ✔️ ±0    18 💤 ±0  0 ❌ ±0 
3 440 runs  ±0  3 336 ✔️ ±0  104 💤 ±0  0 ❌ ±0 

Results for commit 87ed9e6. ± Comparison against base commit 87ed9e6.

♻️ This comment has been updated with latest results.

@@ -472,6 +472,7 @@ type

DoppelgangerProtection* = object
broadcastStartEpoch*: Epoch
nodeLaunchSlot*: Slot
Copy link
Member

Choose a reason for hiding this comment

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

with this change, we can remove broadcastStartEpoch and simply use nodeLaunchSlot.epoch + 2 - this also appropriately moves the init logic to eth2_processor, rather than the main beacon node file, which also means it's easier to write tests for the doppelganger code.

also, the object type itself can be moved to eth2_processor, I'm not sure why it's here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This accommodates gossip turning on and off due, e.g,. to sufficiently long network outages. broadcastStartEpoch is set during gossip setup, while nodeLaunchSlot is set up during node initialization. This is, in principle, the correct distinction to make: when one node isn't gossiping, it's okay for another node to gossip instead, and interleave. It might be worth using the simplified nodeLaunchSlot.epoch + 2 model, but it is less flexible.

As far as the object type, 556d06f.

Copy link
Member

Choose a reason for hiding this comment

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

fair enough - I suspect this will need revisiting when incorporating the slashing protection scheme, let's document this flow here for now?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, 309d72b

attesterIndices: openArray[ValidatorIndex]) =
# Only check for attestations after node launch, not potential attestations
# bouncing around from up to several minutes prior.
if attestation.data.slot <= self.doppelgangerDetection.nodeLaunchSlot:
Copy link
Member

Choose a reason for hiding this comment

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

actually, this comparison achieves the same thing as the rounding suggested in per #2650 (comment) - the comment could be more precise however, in that we're aiming to allow any attestation that this instance created (ie it's not about minutes)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@tersec tersec marked this pull request as ready for review June 17, 2021 09:38
…nd allow for one-slot overlap to avoid false positives on intra-slot restarts
@tersec tersec changed the title strawman doppelganger detection walltime refactor doppelganger detection walltime refactor Jun 17, 2021
@tersec tersec merged commit 87ed9e6 into unstable Jun 17, 2021
@tersec tersec deleted the nis branch June 17, 2021 11:51
arnetheduck pushed a commit that referenced this pull request Jun 17, 2021
* strawman doppelganger detection walltime refactor

* move DoppelgangerProtection to Eth2Processor

* increase comment precision

* document difference between broadcastStartEpoch and nodeLaunchSlot, and allow for one-slot overlap to avoid false positives on intra-slot restarts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants