Skip to content

Commit d847ea9

Browse files
authored
update crypto library to use partitiontest (algorand#2721)
1 parent 175b786 commit d847ea9

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

batchverifier_test.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,12 @@ import (
2020
"testing"
2121

2222
"github.com/stretchr/testify/require"
23+
24+
"github.com/algorand/go-algorand/test/partitiontest"
2325
)
2426

2527
func TestBatchVerifierSingle(t *testing.T) {
28+
partitiontest.PartitionTest(t)
2629
// test expected success
2730
bv := MakeBatchVerifier(1)
2831
msg := randString()
@@ -46,6 +49,7 @@ func TestBatchVerifierSingle(t *testing.T) {
4649
}
4750

4851
func TestBatchVerifierBulk(t *testing.T) {
52+
partitiontest.PartitionTest(t)
4953
for i := 1; i < 64*2+3; i++ {
5054
n := i
5155
bv := MakeBatchVerifier(n)
@@ -65,6 +69,7 @@ func TestBatchVerifierBulk(t *testing.T) {
6569
}
6670

6771
func TestBatchVerifierBulkWithExpand(t *testing.T) {
72+
partitiontest.PartitionTest(t)
6873
n := 64
6974
bv := MakeBatchVerifier(1)
7075
var s Seed
@@ -80,6 +85,7 @@ func TestBatchVerifierBulkWithExpand(t *testing.T) {
8085
}
8186

8287
func TestBatchVerifierWithInvalidSiganture(t *testing.T) {
88+
partitiontest.PartitionTest(t)
8389
n := 64
8490
bv := MakeBatchVerifier(1)
8591
var s Seed
@@ -114,6 +120,7 @@ func BenchmarkBatchVerifier(b *testing.B) {
114120
}
115121

116122
func TestEmpty(t *testing.T) {
123+
partitiontest.PartitionTest(t)
117124
bv := MakeBatchVerifierDefaultSize()
118125
require.Error(t, bv.Verify())
119126
}

cryptoerror.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ var (
2424
errInvalidThreshold = errors.New("Invalid threshold")
2525
errInvalidNumberOfSignature = errors.New("Invalid number of signatures")
2626
errKeyNotExist = errors.New("Key does not exist")
27-
errSubsigVerification = errors.New("Verification failure: subsignature")
2827
errKeysNotMatch = errors.New("Public key lists do not match")
2928
errInvalidDuplicates = errors.New("Invalid duplicates")
3029
errInvalidNumberOfSig = errors.New("invalid number of signatures to add")

multisig_test.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ import (
2121
"testing"
2222

2323
"github.com/stretchr/testify/require"
24+
25+
"github.com/algorand/go-algorand/test/partitiontest"
2426
)
2527

2628
func MultisigSigPrint(sig MultisigSig) {
@@ -39,6 +41,7 @@ func MultisigSigPrint(sig MultisigSig) {
3941
// detect invalid threshold and versions
4042
//
4143
func TestMultisigAddr(t *testing.T) {
44+
partitiontest.PartitionTest(t)
4245
var s Seed
4346
var secrets []*SecretKey
4447
var pks []PublicKey
@@ -76,6 +79,7 @@ func TestMultisigAddr(t *testing.T) {
7679
// signs with 3 keys to get 3 signatures
7780
// assembles 3 signatures, verify the msig
7881
func TestMultisig(t *testing.T) {
82+
partitiontest.PartitionTest(t)
7983
var msig MultisigSig
8084
var sigs []MultisigSig
8185

@@ -152,6 +156,7 @@ func TestMultisig(t *testing.T) {
152156
// 4. merge msig1 and msig2
153157
// 5. verify the merged one
154158
func TestMultisigAddAndMerge(t *testing.T) {
159+
partitiontest.PartitionTest(t)
155160
var msig1 MultisigSig
156161
var msig2 MultisigSig
157162
var sigs []MultisigSig
@@ -233,6 +238,7 @@ func TestMultisigAddAndMerge(t *testing.T) {
233238
}
234239

235240
func TestEmptyMultisig(t *testing.T) {
241+
partitiontest.PartitionTest(t)
236242
var s Seed
237243
var secrets *SecretKey
238244
var pks []PublicKey
@@ -258,6 +264,7 @@ func TestEmptyMultisig(t *testing.T) {
258264
}
259265

260266
func TestIncorrectAddrresInMultisig(t *testing.T) {
267+
partitiontest.PartitionTest(t)
261268
var s Seed
262269
var secrets *SecretKey
263270
var pks []PublicKey
@@ -286,6 +293,7 @@ func TestIncorrectAddrresInMultisig(t *testing.T) {
286293
}
287294

288295
func TestMoreThanMaxSigsInMultisig(t *testing.T) {
296+
partitiontest.PartitionTest(t)
289297
var s Seed
290298
var secrets []*SecretKey
291299
var pks []PublicKey
@@ -323,6 +331,7 @@ func TestMoreThanMaxSigsInMultisig(t *testing.T) {
323331
}
324332

325333
func TestOneSignatureIsEmpty(t *testing.T) {
334+
partitiontest.PartitionTest(t)
326335
var s Seed
327336
var secrets []*SecretKey
328337
var pks []PublicKey
@@ -363,6 +372,7 @@ func TestOneSignatureIsEmpty(t *testing.T) {
363372
// in this test we want to test what happen if one of the signatures are not valid.
364373
// we create case where are enoguht valid signatures (that pass the thrashold). but since one is false. everything fails.
365374
func TestOneSignatureIsInvalid(t *testing.T) {
375+
partitiontest.PartitionTest(t)
366376
var s Seed
367377
var userkeypair []*SecretKey
368378
var pks []PublicKey
@@ -404,6 +414,7 @@ func TestOneSignatureIsInvalid(t *testing.T) {
404414
}
405415

406416
func TestMultisigLessThanTrashold(t *testing.T) {
417+
partitiontest.PartitionTest(t)
407418
var msig MultisigSig
408419
var sigs []MultisigSig
409420

0 commit comments

Comments
 (0)