Fix historical detection for the slasher (#5831)

* Fix historical detection for the slasher
* More fixes
* Fix
* Run historical detection sequentially
* Add context err handler
* Add return
* Fixes
* Merge branch 'master' into slasher-fixes
This commit is contained in:
Ivan Martinez
2020-05-12 14:32:42 -04:00
committed by GitHub
parent 9ffc6b71d6
commit cd1a4f18f4
3 changed files with 11 additions and 2 deletions

View File

@@ -159,7 +159,7 @@ func (bs *Server) ListIndexedAttestations(
if err != nil {
return nil, status.Errorf(
codes.Internal,
"Could not retrieve state for attestation data block root %v: %v",
"Could not retrieve state for attestation data block root %#x: %v",
targetRoot,
err,
)

View File

@@ -104,7 +104,7 @@ func (bs *Service) receiveAttestations(ctx context.Context) {
break
default:
log.WithError(err).Errorf("Could not receive attestations from beacon node. rpc status: %v", e.Code())
return
break
}
} else {
log.WithError(err).Error("Could not receive attestations from beacon node")

View File

@@ -132,11 +132,20 @@ func (ds *Service) detectHistoricalChainData(ctx context.Context) {
)
for _, att := range indexedAtts {
if ctx.Err() == context.Canceled {
log.WithError(ctx.Err()).Error("context has been canceled, ending detection")
return
}
slashings, err := ds.DetectAttesterSlashings(ctx, att)
if err != nil {
log.WithError(err).Error("Could not detect attester slashings")
continue
}
if len(slashings) < 1 {
if err := ds.minMaxSpanDetector.UpdateSpans(ctx, att); err != nil {
log.WithError(err).Error("Could not update spans")
}
}
ds.submitAttesterSlashings(ctx, slashings)
}
latestStoredHead = &ethpb.ChainHead{HeadEpoch: epoch}