-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgblsminsig_test.go
53 lines (42 loc) · 1.49 KB
/
gblsminsig_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
// The gblsminsig package requires cgo,
// therefore this file also requires cgo.
//go:build cgo
package tmsqlite_test
import (
"testing"
"github.com/gordian-engine/gordian/gcrypto/gblsminsig"
"github.com/gordian-engine/gordian/gcrypto/gblsminsig/gblsminsigtest"
"github.com/gordian-engine/gordian/tm/tmconsensus"
"github.com/gordian-engine/gordian/tm/tmconsensus/tmconsensustest"
)
func init() {
// Share the same registry as used in store_test.go.
gblsminsig.Register(®)
}
func blsFixtureFactory(nVals int) *tmconsensustest.Fixture {
privVals := make(tmconsensustest.PrivVals, nVals)
signers := gblsminsigtest.DeterministicSigners(nVals)
for i := range privVals {
privVals[i] = tmconsensustest.PrivVal{
Val: tmconsensus.Validator{
PubKey: signers[i].PubKey().(gblsminsig.PubKey),
// Order by power descending,
// with the power difference being negligible,
// so that the validator order matches the default deterministic key order.
// (Without this power adjustment, the validators would be ordered
// by public key or by ID, which is unlikely to match their order
// as defined in fixtures or other uses of determinsitic validators.
Power: uint64(100_000 - i),
},
Signer: signers[i],
}
}
fx := tmconsensustest.NewBareFixture()
fx.PrivVals = privVals
fx.Registry = reg
fx.CommonMessageSignatureProofScheme = gblsminsig.SignatureProofScheme{}
return fx
}
func TestBLSStoreCompliance(t *testing.T) {
testStoreCompliance(t, blsFixtureFactory)
}