Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions crypto/batchverifier_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,12 @@ import (
"testing"

"github.com/stretchr/testify/require"

"github.com/algorand/go-algorand/test/partitiontest"
)

func TestBatchVerifierSingle(t *testing.T) {
partitiontest.PartitionTest(t)
// test expected success
bv := MakeBatchVerifier(1)
msg := randString()
Expand All @@ -46,6 +49,7 @@ func TestBatchVerifierSingle(t *testing.T) {
}

func TestBatchVerifierBulk(t *testing.T) {
partitiontest.PartitionTest(t)
for i := 1; i < 64*2+3; i++ {
n := i
bv := MakeBatchVerifier(n)
Expand All @@ -65,6 +69,7 @@ func TestBatchVerifierBulk(t *testing.T) {
}

func TestBatchVerifierBulkWithExpand(t *testing.T) {
partitiontest.PartitionTest(t)
n := 64
bv := MakeBatchVerifier(1)
var s Seed
Expand All @@ -80,6 +85,7 @@ func TestBatchVerifierBulkWithExpand(t *testing.T) {
}

func TestBatchVerifierWithInvalidSiganture(t *testing.T) {
partitiontest.PartitionTest(t)
n := 64
bv := MakeBatchVerifier(1)
var s Seed
Expand Down Expand Up @@ -114,6 +120,7 @@ func BenchmarkBatchVerifier(b *testing.B) {
}

func TestEmpty(t *testing.T) {
partitiontest.PartitionTest(t)
bv := MakeBatchVerifierDefaultSize()
require.Error(t, bv.Verify())
}
1 change: 0 additions & 1 deletion crypto/cryptoerror.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ var (
errInvalidThreshold = errors.New("Invalid threshold")
errInvalidNumberOfSignature = errors.New("Invalid number of signatures")
errKeyNotExist = errors.New("Key does not exist")
errSubsigVerification = errors.New("Verification failure: subsignature")
errKeysNotMatch = errors.New("Public key lists do not match")
errInvalidDuplicates = errors.New("Invalid duplicates")
errInvalidNumberOfSig = errors.New("invalid number of signatures to add")
Expand Down
11 changes: 11 additions & 0 deletions crypto/multisig_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ import (
"testing"

"github.com/stretchr/testify/require"

"github.com/algorand/go-algorand/test/partitiontest"
)

func MultisigSigPrint(sig MultisigSig) {
Expand All @@ -39,6 +41,7 @@ func MultisigSigPrint(sig MultisigSig) {
// detect invalid threshold and versions
//
func TestMultisigAddr(t *testing.T) {
partitiontest.PartitionTest(t)
var s Seed
var secrets []*SecretKey
var pks []PublicKey
Expand Down Expand Up @@ -76,6 +79,7 @@ func TestMultisigAddr(t *testing.T) {
// signs with 3 keys to get 3 signatures
// assembles 3 signatures, verify the msig
func TestMultisig(t *testing.T) {
partitiontest.PartitionTest(t)
var msig MultisigSig
var sigs []MultisigSig

Expand Down Expand Up @@ -152,6 +156,7 @@ func TestMultisig(t *testing.T) {
// 4. merge msig1 and msig2
// 5. verify the merged one
func TestMultisigAddAndMerge(t *testing.T) {
partitiontest.PartitionTest(t)
var msig1 MultisigSig
var msig2 MultisigSig
var sigs []MultisigSig
Expand Down Expand Up @@ -233,6 +238,7 @@ func TestMultisigAddAndMerge(t *testing.T) {
}

func TestEmptyMultisig(t *testing.T) {
partitiontest.PartitionTest(t)
var s Seed
var secrets *SecretKey
var pks []PublicKey
Expand All @@ -258,6 +264,7 @@ func TestEmptyMultisig(t *testing.T) {
}

func TestIncorrectAddrresInMultisig(t *testing.T) {
partitiontest.PartitionTest(t)
var s Seed
var secrets *SecretKey
var pks []PublicKey
Expand Down Expand Up @@ -286,6 +293,7 @@ func TestIncorrectAddrresInMultisig(t *testing.T) {
}

func TestMoreThanMaxSigsInMultisig(t *testing.T) {
partitiontest.PartitionTest(t)
var s Seed
var secrets []*SecretKey
var pks []PublicKey
Expand Down Expand Up @@ -323,6 +331,7 @@ func TestMoreThanMaxSigsInMultisig(t *testing.T) {
}

func TestOneSignatureIsEmpty(t *testing.T) {
partitiontest.PartitionTest(t)
var s Seed
var secrets []*SecretKey
var pks []PublicKey
Expand Down Expand Up @@ -363,6 +372,7 @@ func TestOneSignatureIsEmpty(t *testing.T) {
// in this test we want to test what happen if one of the signatures are not valid.
// we create case where are enoguht valid signatures (that pass the thrashold). but since one is false. everything fails.
func TestOneSignatureIsInvalid(t *testing.T) {
partitiontest.PartitionTest(t)
var s Seed
var userkeypair []*SecretKey
var pks []PublicKey
Expand Down Expand Up @@ -404,6 +414,7 @@ func TestOneSignatureIsInvalid(t *testing.T) {
}

func TestMultisigLessThanTrashold(t *testing.T) {
partitiontest.PartitionTest(t)
var msig MultisigSig
var sigs []MultisigSig

Expand Down