From 60761f8c9d0870203bdfd89d09b913c82a9293c7 Mon Sep 17 00:00:00 2001 From: Joshua Kim <20001595+joshua-kim@users.noreply.github.com> Date: Tue, 22 Oct 2024 16:14:13 -0400 Subject: [PATCH] nit Signed-off-by: Joshua Kim <20001595+joshua-kim@users.noreply.github.com> --- network/p2p/acp118/aggregator.go | 4 +++- network/p2p/acp118/aggregator_test.go | 14 ++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/network/p2p/acp118/aggregator.go b/network/p2p/acp118/aggregator.go index 9cbc10a9442c..20999f225578 100644 --- a/network/p2p/acp118/aggregator.go +++ b/network/p2p/acp118/aggregator.go @@ -23,7 +23,9 @@ import ( ) var ( - ErrDuplicateValidator = errors.New("duplicate validator") + ErrDuplicateValidator = errors.New("duplicate validator") + // ErrInsufficientSignatures is returned if it's not possible for us to + // generate a signature due to too many unsuccessful requests to peers ErrInsufficientSignatures = errors.New("failed to aggregate sufficient stake weight of signatures") ) diff --git a/network/p2p/acp118/aggregator_test.go b/network/p2p/acp118/aggregator_test.go index 50622fc4ac99..13d40ce9297f 100644 --- a/network/p2p/acp118/aggregator_test.go +++ b/network/p2p/acp118/aggregator_test.go @@ -5,7 +5,6 @@ package acp118 import ( "context" - "errors" "testing" "github.com/stretchr/testify/require" @@ -13,6 +12,7 @@ import ( "github.com/ava-labs/avalanchego/ids" "github.com/ava-labs/avalanchego/network/p2p" "github.com/ava-labs/avalanchego/network/p2p/p2ptest" + "github.com/ava-labs/avalanchego/snow/engine/common" "github.com/ava-labs/avalanchego/snow/validators" "github.com/ava-labs/avalanchego/snow/validators/validatorstest" "github.com/ava-labs/avalanchego/utils/crypto/bls" @@ -54,8 +54,8 @@ func TestVerifier_Verify(t *testing.T) { wantVerifyErr error }{ { - name: "passes attestation and verification", - handler: NewHandler(&testAttestor{}, signer, networkID, chainID), + name: "pass - gets signatures from sufficient stake", + handler: NewHandler(&testVerifier{}, signer), ctx: context.Background(), validators: []Validator{ { @@ -84,8 +84,8 @@ func TestVerifier_Verify(t *testing.T) { quorumDen: 1, }, { - name: "passes attestation and fails verification - insufficient stake", - handler: NewHandler(&testAttestor{}, signer, networkID, chainID), + name: "fail - gets signatures from insufficient stake", + handler: NewHandler(&testVerifier{}, signer), ctx: context.Background(), validators: []Validator{ { @@ -122,10 +122,8 @@ func TestVerifier_Verify(t *testing.T) { { name: "fails attestation", handler: NewHandler( - &testAttestor{Err: errors.New("foobar")}, + &testVerifier{Errs: []*common.AppError{common.ErrUndefined}}, signer, - networkID, - chainID, ), ctx: context.Background(), validators: []Validator{