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

Remove lookback and properly handle min span updates in Slasher #5040

Closed
3 tasks done
0xKiwi opened this issue Mar 8, 2020 · 7 comments · Fixed by #5591
Closed
3 tasks done

Remove lookback and properly handle min span updates in Slasher #5040

0xKiwi opened this issue Mar 8, 2020 · 7 comments · Fixed by #5591
Assignees
Labels
Enhancement New feature or request Tracking Gotta Catch 'Em All
Milestone

Comments

@0xKiwi
Copy link
Contributor

0xKiwi commented Mar 8, 2020

This is an issue for handling min span updates in the slasher, since currently they require going to epoch 0 on a first run, we need a better way to handle them as using the lookback sacrifices security.

following the initial design doc: https://hackmd.prylabs.network/s/H1jO_H9wL

Starting to resolve this issue:

@0xKiwi 0xKiwi added the Enhancement New feature or request label Mar 15, 2020
@prestonvanloon
Copy link
Member

@0xKiwi Please add more context. I am not sure how to triage this issue or what action needs to be taken.

@0xKiwi
Copy link
Contributor Author

0xKiwi commented Mar 31, 2020

The strategy we use for catching double and surround votes is referred to as min-max spans. This strategy involves maintaining every validators information on a per-epoch basis for the full validator set.

Say we receive an aggregated attestation of 16 validators, spanning from source epoch 2 to target epoch 8. We update the min max spans representing epoch 0 to epoch 8 for each of those 16 validators. Currently, we chunk up the min max spans for the full validator set into per-epoch buckets, so if we want to change epoch 3, we need to load that epoch into the cache to perform an update on it.

Every attestation we receive needs to have its min spans updated which means updating the spans from the source epoch, all the way to 0. This is troublesome to handle for validators that haven't attested until epoch 10,000, because it means we need to update the min spans from epoch 0, all the way to epoch 10,000. Processing such an attestation would normally load all of the existing validator history into memory for 10,000 epochs.

This wouldn't be a huge problem to do once, but we would need to do it for every new validator index received in the network.

Our current workaround is to only "lookback" 128 epochs. Say we get an attestation for epoch 1000, we only update the spans to epoch 872, instead of epoch 0. This allows us to keep the full 128 epochs of lookback in a cache to prevent unneeded database checks and edited.

So the goal of this issue is to find a solution that will allow us to properly handle attestations with min man spans that are larger than the lookback distance of 128 epochs.

@prestonvanloon prestonvanloon added this to the Diamond milestone Mar 31, 2020
@shayzluf
Copy link
Contributor

started a design doc to resolve this issue
https://hackmd.prylabs.network/s/H1jO_H9wL

@rauljordan
Copy link
Contributor

Keep us posted on your progress on this @shayzluf, maybe we can have a quick design review session over voice chat - let's talk on discord about this

@shayzluf
Copy link
Contributor

starting to resolve this issue:
[ ] add validators activation epoch to cache
[ ] use validator activation for detection & update
[ ] batch load validators spans from db
[ ] batch write validators spans to db

@alonmuroch
Copy link
Contributor

@shayzluf I couldn't open the hackmd doc, any chance you have a newer link?

@alonmuroch
Copy link
Contributor

@0xKiwi where did we take the lookback value (128)?
I see a var called WeakSubjectivityPeriod.. is that it? does it appear in the spec?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement New feature or request Tracking Gotta Catch 'Em All
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants