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

Prepare Slasher for Production #5020

Merged
merged 34 commits into from Mar 8, 2020
Merged

Prepare Slasher for Production #5020

merged 34 commits into from Mar 8, 2020

Conversation

rauljordan
Copy link
Contributor

@rauljordan rauljordan commented Mar 6, 2020

Part of #4836


Description

Write why you are making the changes in this pull request

We have now confirmed slasher functions in production, albeit it struggles a lot with intense processing of incoming attestations. This PR cleans up aspects of slasher to ensure we have naming consistency, good tracing, and general tidyness.

slasher/detection/attestations/spanner.go Outdated Show resolved Hide resolved
@@ -177,6 +187,9 @@ func (s *SpanDetector) updateMinSpan(ctx context.Context, source uint64, target
} else {
break
}
if epoch == 0 {
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice

@shayzluf
Copy link
Contributor

shayzluf commented Mar 6, 2020

We should be careful not to merge it IMO . We can miss detecting an attack on ths network if old epoch spans are not populated

@codecov
Copy link

codecov bot commented Mar 6, 2020

Codecov Report

Merging #5020 into master will decrease coverage by 28.06%.
The diff coverage is 79.82%.

@@             Coverage Diff             @@
##           master    #5020       +/-   ##
===========================================
- Coverage   42.99%   14.93%   -28.07%     
===========================================
  Files         267       97      -170     
  Lines       20111     7407    -12704     
===========================================
- Hits         8647     1106     -7541     
+ Misses       9987     6171     -3816     
+ Partials     1477      130     -1347

@rauljordan rauljordan changed the title Add Lookback for Slashing Span Updates Prepare Slasher for Production Mar 6, 2020
@rauljordan rauljordan marked this pull request as ready for review March 6, 2020 23:23
@rauljordan
Copy link
Contributor Author

We should be careful not to merge it IMO . We can miss detecting an attack on ths network if old epoch spans are not populated

@shayzluf what's the alternative here? Make the number a configurable flag with a default of 128? I feel like this is a parameter that depends on how comfortable you are with the resource requirements of your slasher instance, but making it way too big will make it prohibitively slow to run slasher at all.

return err
}
} else {
break
Copy link
Contributor

Choose a reason for hiding this comment

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

I made this change because I thought it could cause an issue and not properly update spans, wdyt?

@@ -31,10 +35,12 @@ func (ds *Service) detectAttesterSlashings(
switch result.Kind {
case types.DoubleVote:
slashing, err = ds.detectDoubleVote(ctx, att, result)
logrus.Debugf("Detected a possible double vote for val idx %d", valIdx)
Copy link
Contributor

Choose a reason for hiding this comment

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

Are we gonna keep this logs? Maybe we should remove them since we know detection works now.

slashings, err := ds.detectAttesterSlashings(ctx, indexedAtt)
if err != nil {
log.WithError(err).Error("Could not detect attester slashings")
continue
}
if len(slashings) < 1 {
log.Debug("Updating spans for incoming attestation")
Copy link
Contributor

Choose a reason for hiding this comment

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

These logs are gonna be really spammy, maybe we should just log out the updating spans log?

0xKiwi
0xKiwi previously approved these changes Mar 8, 2020
0xKiwi
0xKiwi previously approved these changes Mar 8, 2020
@prylabs-bulldozer prylabs-bulldozer bot merged commit eddaea8 into master Mar 8, 2020
@delete-merged-branch delete-merged-branch bot deleted the cleanup-slasher branch March 8, 2020 17:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants