Skip to content

Commit

Permalink
Fix build failure
Browse files Browse the repository at this point in the history
  • Loading branch information
dyng committed Dec 20, 2022
1 parent e921882 commit fdab347
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
2 changes: 1 addition & 1 deletion beacon-chain/core/transition/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ go_library(
"//beacon-chain/state:go_default_library",
"//beacon-chain/state/state-native:go_default_library",
"//beacon-chain/state/stateutil:go_default_library",
"//config/features:go_default_library",
"//config/fieldparams:go_default_library",
"//config/params:go_default_library",
"//config/features:go_default_library",
"//consensus-types/blocks:go_default_library",
"//consensus-types/interfaces:go_default_library",
"//consensus-types/primitives:go_default_library",
Expand Down
21 changes: 12 additions & 9 deletions crypto/bls/signature_batch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (

"github.com/prysmaticlabs/prysm/v3/crypto/bls/common"
"github.com/prysmaticlabs/prysm/v3/testing/assert"
"github.com/prysmaticlabs/prysm/v3/testing/require"
)

const TestSignature = "test signature"
Expand Down Expand Up @@ -56,15 +57,15 @@ func TestCopySignatureSet(t *testing.T) {
}

func TestVerifyVerbosely_AllSignaturesValid(t *testing.T) {
set := NewValidSignatureSet("good", 3)
set := NewValidSignatureSet(t, "good", 3)
valid, err := set.VerifyVerbosely()
assert.NoError(t, err)
assert.Equal(t, true, valid, "SignatureSet is expected to be valid")
}

func TestVerifyVerbosely_SomeSignaturesInvalid(t *testing.T) {
goodSet := NewValidSignatureSet("good", 3)
badSet := NewInvalidSignatureSet("bad", 3, false)
goodSet := NewValidSignatureSet(t, "good", 3)
badSet := NewInvalidSignatureSet(t, "bad", 3, false)
set := NewSet().Join(goodSet).Join(badSet)
valid, err := set.VerifyVerbosely()
assert.Equal(t, false, valid, "SignatureSet is expected to be invalid")
Expand All @@ -77,8 +78,8 @@ func TestVerifyVerbosely_SomeSignaturesInvalid(t *testing.T) {
}

func TestVerifyVerbosely_VerificationThrowsError(t *testing.T) {
goodSet := NewValidSignatureSet("good", 1)
badSet := NewInvalidSignatureSet("bad", 1, true)
goodSet := NewValidSignatureSet(t, "good", 1)
badSet := NewInvalidSignatureSet(t, "bad", 1, true)
set := NewSet().Join(goodSet).Join(badSet)
valid, err := set.VerifyVerbosely()
assert.Equal(t, false, valid, "SignatureSet is expected to be invalid")
Expand Down Expand Up @@ -645,7 +646,7 @@ func TestSignatureBatch_AggregateBatch(t *testing.T) {
}
}

func NewValidSignatureSet(msgBody string, num int) *SignatureBatch {
func NewValidSignatureSet(t *testing.T, msgBody string, num int) *SignatureBatch {
set := &SignatureBatch{
Signatures: make([][]byte, num),
PublicKeys: make([]common.PublicKey, num),
Expand All @@ -654,7 +655,8 @@ func NewValidSignatureSet(msgBody string, num int) *SignatureBatch {
}

for i := 0; i < num; i++ {
priv, _ := RandKey()
priv, err := RandKey()
require.NoError(t, err)
pubkey := priv.PublicKey()
msg := messageBytes(fmt.Sprintf("%s%d", msgBody, i))
sig := priv.Sign(msg[:]).Marshal()
Expand All @@ -669,7 +671,7 @@ func NewValidSignatureSet(msgBody string, num int) *SignatureBatch {
return set
}

func NewInvalidSignatureSet(msgBody string, num int, throwErr bool) *SignatureBatch {
func NewInvalidSignatureSet(t *testing.T, msgBody string, num int, throwErr bool) *SignatureBatch {
set := &SignatureBatch{
Signatures: make([][]byte, num),
PublicKeys: make([]common.PublicKey, num),
Expand All @@ -678,7 +680,8 @@ func NewInvalidSignatureSet(msgBody string, num int, throwErr bool) *SignatureBa
}

for i := 0; i < num; i++ {
priv, _ := RandKey()
priv, err := RandKey()
require.NoError(t, err)
pubkey := priv.PublicKey()
msg := messageBytes(fmt.Sprintf("%s%d", msgBody, i))
var sig []byte
Expand Down

0 comments on commit fdab347

Please sign in to comment.