From 5540420cf6aa2be768f9a09407b982e59fc8f3e7 Mon Sep 17 00:00:00 2001 From: Dhruv Bodani Date: Tue, 19 Jul 2022 19:53:41 +0530 Subject: [PATCH] add nimbus error --- core/bcast/bcast.go | 5 +++-- core/bcast/bcast_test.go | 9 +++++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/core/bcast/bcast.go b/core/bcast/bcast.go index 2b73d83ef..bada505eb 100644 --- a/core/bcast/bcast.go +++ b/core/bcast/bcast.go @@ -82,8 +82,9 @@ func (b Broadcaster) Broadcast(ctx context.Context, duty core.Duty, } err = b.eth2Cl.SubmitAttestations(ctx, []*eth2p0.Attestation{&att.Attestation}) - if err != nil && strings.Contains(err.Error(), "PriorAttestationKnown") { - // Lighthouse isn't idempotent, so just swallow this non-issue. + if err != nil && (strings.Contains(err.Error(), "PriorAttestationKnown") || + strings.Contains(err.Error(), "No peers on libp2p topic")) { + // Lighthouse and Nimbus aren't idempotent, so just swallow this non-issue. // See reference github.com/attestantio/go-eth2-client@v0.11.7/multi/submitattestations.go:38 err = nil } diff --git a/core/bcast/bcast_test.go b/core/bcast/bcast_test.go index fd0eff062..2f5a56a44 100644 --- a/core/bcast/bcast_test.go +++ b/core/bcast/bcast_test.go @@ -39,16 +39,19 @@ func TestBroadcastAttestation(t *testing.T) { aggData := core.Attestation{Attestation: *testutil.RandomAttestation()} - // Assert output and return lighthouse known error on duplicates + // Assert output and return lighthouse and nimbus known error on duplicates var submitted int mock.SubmitAttestationsFunc = func(ctx context.Context, attestations []*eth2p0.Attestation) error { require.Len(t, attestations, 1) require.Equal(t, aggData.Attestation, *attestations[0]) submitted++ - if submitted > 1 { + if submitted > 2 { // Non-idempotent error returned by lighthouse but swallowed by bcast. return errors.New("Verification: PriorAttestationKnown") + } else if submitted > 1 { + // Non-idempotent error returned by nimbus but swallowed by bcast. + return errors.New(`"message":"No peers on libp2p topic"`) } return nil @@ -61,6 +64,8 @@ func TestBroadcastAttestation(t *testing.T) { require.NoError(t, err) err = bcaster.Broadcast(ctx, core.Duty{Type: core.DutyAttester}, "", aggData) require.NoError(t, err) + err = bcaster.Broadcast(ctx, core.Duty{Type: core.DutyAttester}, "", aggData) + require.NoError(t, err) } func TestBroadcastBeaconBlock(t *testing.T) {