Skip to content

Commit

Permalink
malfeasance syncer: count every error as a failed request (#6145)
Browse files Browse the repository at this point in the history
## Motivation

Treat every fetch error as a failed request in the malfeasance proofs syncer to avoid hanging if the fetcher returns an unrecognized error.
  • Loading branch information
poszu committed Jul 17, 2024
1 parent dbf5c0b commit 78a7882
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions syncer/malsync/syncer.go
Original file line number Diff line number Diff line change
Expand Up @@ -428,10 +428,10 @@ func (s *Syncer) downloadMalfeasanceProofs(ctx context.Context, initial bool, up
switch {
case !sst.has(nodeID):
continue
case errors.Is(err, fetch.ErrExceedMaxRetries):
sst.failed(nodeID)
case errors.Is(err, pubsub.ErrValidationReject):
sst.rejected(nodeID)
default:
sst.failed(nodeID)
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion syncer/malsync/syncer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ func TestSyncer(t *testing.T) {
tester.expectPeers(tester.peers)
tester.expectGetMaliciousIDs()
tester.expectGetProofs(map[types.NodeID]error{
nid("2"): fetch.ErrExceedMaxRetries,
nid("2"): errors.New("fail"),
})
epochStart := tester.clock.Now().Truncate(time.Second)
epochEnd := epochStart.Add(10 * time.Minute)
Expand Down

0 comments on commit 78a7882

Please sign in to comment.