From 78a7882e79d773bc93301d7d6c29870d2716ab43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartosz=20R=C3=B3=C5=BCa=C5=84ski?= Date: Wed, 17 Jul 2024 09:46:00 +0000 Subject: [PATCH] malfeasance syncer: count every error as a failed request (#6145) ## Motivation Treat every fetch error as a failed request in the malfeasance proofs syncer to avoid hanging if the fetcher returns an unrecognized error. --- syncer/malsync/syncer.go | 4 ++-- syncer/malsync/syncer_test.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/syncer/malsync/syncer.go b/syncer/malsync/syncer.go index 67a96ddc50..160f9bcbfc 100644 --- a/syncer/malsync/syncer.go +++ b/syncer/malsync/syncer.go @@ -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) } } } diff --git a/syncer/malsync/syncer_test.go b/syncer/malsync/syncer_test.go index f4297a7e87..09c0db9a0d 100644 --- a/syncer/malsync/syncer_test.go +++ b/syncer/malsync/syncer_test.go @@ -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)