Skip to content

Commit

Permalink
bump avalanchego to master (updates x/crypto) (#1410)
Browse files Browse the repository at this point in the history
* bump avalanchego to master (updates x/crypto)

* fix

* Encapsulate Signer (#693)

* Remove the bls dependency
---------
Co-authored-by: Darioush Jalali <darioush.jalali@avalabs.org>

* bump to v1.12.1

---------

Co-authored-by: Richard Pringle <richard.pringle@avalabs.org>
  • Loading branch information
darioush and richardpringle authored Dec 18, 2024
1 parent 665486f commit b465ad5
Show file tree
Hide file tree
Showing 11 changed files with 73 additions and 73 deletions.
14 changes: 7 additions & 7 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ go 1.22.8
require (
github.com/VictoriaMetrics/fastcache v1.12.1
github.com/antithesishq/antithesis-sdk-go v0.3.8
github.com/ava-labs/avalanchego v1.12.0-config-pebble-sync
github.com/ava-labs/avalanchego v1.12.1
github.com/cespare/cp v0.1.0
github.com/crate-crypto/go-ipa v0.0.0-20231025140028-3c0104f4b233
github.com/davecgh/go-spew v1.1.1
Expand Down Expand Up @@ -42,11 +42,11 @@ require (
go.uber.org/goleak v1.3.0
go.uber.org/mock v0.4.0
go.uber.org/zap v1.26.0
golang.org/x/crypto v0.26.0
golang.org/x/crypto v0.31.0
golang.org/x/exp v0.0.0-20231127185646-65229373498e
golang.org/x/sync v0.8.0
golang.org/x/sys v0.24.0
golang.org/x/text v0.17.0
golang.org/x/sync v0.10.0
golang.org/x/sys v0.28.0
golang.org/x/text v0.21.0
golang.org/x/time v0.3.0
google.golang.org/protobuf v1.34.2
gopkg.in/natefinch/lumberjack.v2 v2.0.0
Expand All @@ -55,7 +55,7 @@ require (
require (
github.com/DataDog/zstd v1.5.2 // indirect
github.com/NYTimes/gziphandler v1.1.1 // indirect
github.com/ava-labs/coreth v0.13.9-rc.1 // indirect
github.com/ava-labs/coreth v0.13.9-rc.2-encapsulate-signer // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/bits-and-blooms/bitset v1.10.0 // indirect
github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect
Expand Down Expand Up @@ -156,7 +156,7 @@ require (
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/net v0.28.0 // indirect
golang.org/x/oauth2 v0.21.0 // indirect
golang.org/x/term v0.23.0 // indirect
golang.org/x/term v0.27.0 // indirect
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect
gonum.org/v1/gonum v0.11.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240604185151-ef581f913117 // indirect
Expand Down
28 changes: 14 additions & 14 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,10 @@ github.com/antithesishq/antithesis-sdk-go v0.3.8/go.mod h1:IUpT2DPAKh6i/YhSbt6Gl
github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8=
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio=
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs=
github.com/ava-labs/avalanchego v1.12.0-config-pebble-sync h1:HvtadR1VLxsOe7Y2PSnNmLUXPvp1RnTgeWtk5cOuGYA=
github.com/ava-labs/avalanchego v1.12.0-config-pebble-sync/go.mod h1:yhD5dpZyStIVbxQ550EDi5w5SL7DQ/xGE6TIxosb7U0=
github.com/ava-labs/coreth v0.13.9-rc.1 h1:qIICpC/OZGYUP37QnLgIqqwGmxnLwLpZaUlqJNI85vU=
github.com/ava-labs/coreth v0.13.9-rc.1/go.mod h1:7aMsRIo/3GBE44qWZMjnfqdqfcfZ5yShTTm2LObLaYo=
github.com/ava-labs/avalanchego v1.12.1 h1:NL04K5+gciC2XqGZbDcIu0nuVApEddzc6YyujRBv+u8=
github.com/ava-labs/avalanchego v1.12.1/go.mod h1:xnVvN86jhxndxfS8e0U7v/0woyfx9BhX/feld7XDjDE=
github.com/ava-labs/coreth v0.13.9-rc.2-encapsulate-signer h1:mRB03tLPUvgNko4nP4VwWQdiHeHaLHtdwsnqwxrsGec=
github.com/ava-labs/coreth v0.13.9-rc.2-encapsulate-signer/go.mod h1:tqRAe+7bGLo2Rq/Ph4iYMSch72ag/Jn0DiDMDz1Xa9E=
github.com/aymerick/raymond v2.0.3-0.20180322193309-b565731e1464+incompatible/go.mod h1:osfaiScAUVup+UC9Nfq76eWqDhXlp+4UYaA8uhTBO6g=
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
Expand Down Expand Up @@ -679,8 +679,8 @@ golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm
golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.26.0 h1:RrRspgV4mU+YwB4FYnuBoKsUapNIL5cohGAmSH3azsw=
golang.org/x/crypto v0.26.0/go.mod h1:GY7jblb9wI+FOo5y8/S2oY4zWP07AkOJ4+jxCqdqn54=
golang.org/x/crypto v0.31.0 h1:ihbySMvVjLAeSH1IbfcRTkD/iNscyz8rGzjF/E5hV6U=
golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
Expand Down Expand Up @@ -788,8 +788,8 @@ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJ
golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ=
golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sync v0.10.0 h1:3NQrjDixjgGwUOCaF8w2+VYHv0Ve/vGYSbdkTa98gmQ=
golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
Expand Down Expand Up @@ -857,12 +857,12 @@ golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg=
golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA=
golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.23.0 h1:F6D4vR+EHoL9/sWAWgAR1H2DcHr4PareCbAaCo1RpuU=
golang.org/x/term v0.23.0/go.mod h1:DgV24QBUrK6jhZXl+20l6UWznPlwAHm1Q1mGHtydmSk=
golang.org/x/term v0.27.0 h1:WP60Sv1nlK1T6SupCHbXzSaN0b9wUmsPoRS9b61A23Q=
golang.org/x/term v0.27.0/go.mod h1:iMsnZpn0cago0GOrHO2+Y7u7JPn5AylBrcoWkElMTSM=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
Expand All @@ -873,8 +873,8 @@ golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ=
golang.org/x/text v0.17.0 h1:XtiM5bkSOt+ewxlOE/aE/AKEHibwj/6gvWMl9Rsh0Qc=
golang.org/x/text v0.17.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY=
golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo=
golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ=
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
Expand Down
20 changes: 10 additions & 10 deletions plugin/evm/vm_warp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -280,16 +280,16 @@ func testWarpVMTransaction(t *testing.T, unsignedMessage *avalancheWarp.Unsigned
defer logsSub.Unsubscribe()

nodeID1 := ids.GenerateTestNodeID()
blsSecretKey1, err := bls.NewSecretKey()
blsSecretKey1, err := bls.NewSigner()
require.NoError(err)
blsPublicKey1 := bls.PublicFromSecretKey(blsSecretKey1)
blsSignature1 := bls.Sign(blsSecretKey1, unsignedMessage.Bytes())
blsPublicKey1 := blsSecretKey1.PublicKey()
blsSignature1 := blsSecretKey1.Sign(unsignedMessage.Bytes())

nodeID2 := ids.GenerateTestNodeID()
blsSecretKey2, err := bls.NewSecretKey()
blsSecretKey2, err := bls.NewSigner()
require.NoError(err)
blsPublicKey2 := bls.PublicFromSecretKey(blsSecretKey2)
blsSignature2 := bls.Sign(blsSecretKey2, unsignedMessage.Bytes())
blsPublicKey2 := blsSecretKey2.PublicKey()
blsSignature2 := blsSecretKey2.Sign(unsignedMessage.Bytes())

blsAggregatedSignature, err := bls.AggregateSignatures([]*bls.Signature{blsSignature1, blsSignature2})
require.NoError(err)
Expand Down Expand Up @@ -545,18 +545,18 @@ func testReceiveWarpMessage(
type signer struct {
networkID ids.ID
nodeID ids.NodeID
secret *bls.SecretKey
secret bls.Signer
signature *bls.Signature
weight uint64
}
newSigner := func(networkID ids.ID, weight uint64) signer {
secret, err := bls.NewSecretKey()
secret, err := bls.NewSigner()
require.NoError(err)
return signer{
networkID: networkID,
nodeID: ids.GenerateTestNodeID(),
secret: secret,
signature: bls.Sign(secret, unsignedMessage.Bytes()),
signature: secret.Sign(unsignedMessage.Bytes()),
weight: weight,
}
}
Expand Down Expand Up @@ -604,7 +604,7 @@ func testReceiveWarpMessage(
for _, s := range signers {
vdrOutput[s.nodeID] = &validators.GetValidatorOutput{
NodeID: s.nodeID,
PublicKey: bls.PublicFromSecretKey(s.secret),
PublicKey: s.secret.PublicKey(),
Weight: s.weight,
}
}
Expand Down
10 changes: 5 additions & 5 deletions precompile/contracts/warp/predicate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ func init() {
}

for _, testVdr := range testVdrs {
blsSignature := bls.Sign(testVdr.sk, unsignedMsg.Bytes())
blsSignature := testVdr.sk.Sign(unsignedMsg.Bytes())
blsSignatures = append(blsSignatures, blsSignature)
}

Expand All @@ -102,7 +102,7 @@ func init() {

type testValidator struct {
nodeID ids.NodeID
sk *bls.SecretKey
sk bls.Signer
vdr *avalancheWarp.Validator
}

Expand All @@ -111,13 +111,13 @@ func (v *testValidator) Compare(o *testValidator) int {
}

func newTestValidator() *testValidator {
sk, err := bls.NewSecretKey()
sk, err := bls.NewSigner()
if err != nil {
panic(err)
}

nodeID := ids.GenerateTestNodeID()
pk := bls.PublicFromSecretKey(sk)
pk := sk.PublicKey()
return &testValidator{
nodeID: nodeID,
sk: sk,
Expand Down Expand Up @@ -240,7 +240,7 @@ func testWarpMessageFromPrimaryNetwork(t *testing.T, requirePrimaryNetworkSigner
PublicKey: testVdrs[i].vdr.PublicKey,
}
getValidatorsOutput[testVdrs[i].nodeID] = validatorOutput
blsSignatures = append(blsSignatures, bls.Sign(testVdrs[i].sk, unsignedMsg.Bytes()))
blsSignatures = append(blsSignatures, testVdrs[i].sk.Sign(unsignedMsg.Bytes()))
}
aggregateSignature, err := bls.AggregateSignatures(blsSignatures)
require.NoError(err)
Expand Down
32 changes: 16 additions & 16 deletions precompile/contracts/warp/signature_verification_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,8 @@ func TestSignatureVerification(t *testing.T) {
signers.Add(1)

unsignedBytes := unsignedMsg.Bytes()
vdr0Sig := bls.Sign(testVdrs[0].sk, unsignedBytes)
vdr1Sig := bls.Sign(testVdrs[1].sk, unsignedBytes)
vdr0Sig := testVdrs[0].sk.Sign(unsignedBytes)
vdr1Sig := testVdrs[1].sk.Sign(unsignedBytes)
aggSig, err := bls.AggregateSignatures([]*bls.Signature{vdr0Sig, vdr1Sig})
require.NoError(err)
aggSigBytes := [bls.SignatureLen]byte{}
Expand Down Expand Up @@ -284,7 +284,7 @@ func TestSignatureVerification(t *testing.T) {
require.NoError(err)

unsignedBytes := unsignedMsg.Bytes()
vdr0Sig := bls.Sign(testVdrs[0].sk, unsignedBytes)
vdr0Sig := testVdrs[0].sk.Sign(unsignedBytes)
aggSigBytes := [bls.SignatureLen]byte{}
copy(aggSigBytes[:], bls.SignatureToBytes(vdr0Sig))

Expand Down Expand Up @@ -323,10 +323,10 @@ func TestSignatureVerification(t *testing.T) {
signers.Add(1)

unsignedBytes := unsignedMsg.Bytes()
vdr0Sig := bls.Sign(testVdrs[0].sk, unsignedBytes)
vdr0Sig := testVdrs[0].sk.Sign(unsignedBytes)
// Give sig from vdr[2] even though the bit vector says it
// should be from vdr[1]
vdr2Sig := bls.Sign(testVdrs[2].sk, unsignedBytes)
vdr2Sig := testVdrs[2].sk.Sign(unsignedBytes)
aggSig, err := bls.AggregateSignatures([]*bls.Signature{vdr0Sig, vdr2Sig})
require.NoError(err)
aggSigBytes := [bls.SignatureLen]byte{}
Expand Down Expand Up @@ -367,7 +367,7 @@ func TestSignatureVerification(t *testing.T) {
signers.Add(1)

unsignedBytes := unsignedMsg.Bytes()
vdr0Sig := bls.Sign(testVdrs[0].sk, unsignedBytes)
vdr0Sig := testVdrs[0].sk.Sign(unsignedBytes)
// Don't give the sig from vdr[1]
aggSigBytes := [bls.SignatureLen]byte{}
copy(aggSigBytes[:], bls.SignatureToBytes(vdr0Sig))
Expand Down Expand Up @@ -407,11 +407,11 @@ func TestSignatureVerification(t *testing.T) {
signers.Add(1)

unsignedBytes := unsignedMsg.Bytes()
vdr0Sig := bls.Sign(testVdrs[0].sk, unsignedBytes)
vdr1Sig := bls.Sign(testVdrs[1].sk, unsignedBytes)
vdr0Sig := testVdrs[0].sk.Sign(unsignedBytes)
vdr1Sig := testVdrs[1].sk.Sign(unsignedBytes)
// Give sig from vdr[2] even though the bit vector doesn't have
// it
vdr2Sig := bls.Sign(testVdrs[2].sk, unsignedBytes)
vdr2Sig := testVdrs[2].sk.Sign(unsignedBytes)
aggSig, err := bls.AggregateSignatures([]*bls.Signature{vdr0Sig, vdr1Sig, vdr2Sig})
require.NoError(err)
aggSigBytes := [bls.SignatureLen]byte{}
Expand Down Expand Up @@ -454,8 +454,8 @@ func TestSignatureVerification(t *testing.T) {
signers.Add(2)

unsignedBytes := unsignedMsg.Bytes()
vdr1Sig := bls.Sign(testVdrs[1].sk, unsignedBytes)
vdr2Sig := bls.Sign(testVdrs[2].sk, unsignedBytes)
vdr1Sig := testVdrs[1].sk.Sign(unsignedBytes)
vdr2Sig := testVdrs[2].sk.Sign(unsignedBytes)
aggSig, err := bls.AggregateSignatures([]*bls.Signature{vdr1Sig, vdr2Sig})
require.NoError(err)
aggSigBytes := [bls.SignatureLen]byte{}
Expand Down Expand Up @@ -498,8 +498,8 @@ func TestSignatureVerification(t *testing.T) {
signers.Add(2)

unsignedBytes := unsignedMsg.Bytes()
vdr1Sig := bls.Sign(testVdrs[1].sk, unsignedBytes)
vdr2Sig := bls.Sign(testVdrs[2].sk, unsignedBytes)
vdr1Sig := testVdrs[1].sk.Sign(unsignedBytes)
vdr2Sig := testVdrs[2].sk.Sign(unsignedBytes)
aggSig, err := bls.AggregateSignatures([]*bls.Signature{vdr1Sig, vdr2Sig})
require.NoError(err)
aggSigBytes := [bls.SignatureLen]byte{}
Expand Down Expand Up @@ -559,8 +559,8 @@ func TestSignatureVerification(t *testing.T) {
signers.Add(1) // vdr[2]

unsignedBytes := unsignedMsg.Bytes()
vdr1Sig := bls.Sign(testVdrs[1].sk, unsignedBytes)
vdr2Sig := bls.Sign(testVdrs[2].sk, unsignedBytes)
vdr1Sig := testVdrs[1].sk.Sign(unsignedBytes)
vdr2Sig := testVdrs[2].sk.Sign(unsignedBytes)
aggSig, err := bls.AggregateSignatures([]*bls.Signature{vdr1Sig, vdr2Sig})
require.NoError(err)
aggSigBytes := [bls.SignatureLen]byte{}
Expand Down Expand Up @@ -621,7 +621,7 @@ func TestSignatureVerification(t *testing.T) {

unsignedBytes := unsignedMsg.Bytes()
// Because vdr[1] and vdr[2] share a key, only one of them sign.
vdr2Sig := bls.Sign(testVdrs[2].sk, unsignedBytes)
vdr2Sig := testVdrs[2].sk.Sign(unsignedBytes)
aggSigBytes := [bls.SignatureLen]byte{}
copy(aggSigBytes[:], bls.SignatureToBytes(vdr2Sig))

Expand Down
2 changes: 1 addition & 1 deletion scripts/versions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
# shellcheck disable=SC2034

# Don't export them as they're used in the context of other calls
AVALANCHE_VERSION=${AVALANCHE_VERSION:-'v1.12.0-config-pebble-sync'}
AVALANCHE_VERSION=${AVALANCHE_VERSION:-'v1.12.1'}
GINKGO_VERSION=${GINKGO_VERSION:-'v2.2.0'}
4 changes: 2 additions & 2 deletions utils/snow.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ var (
)

func TestSnowContext() *snow.Context {
sk, err := bls.NewSecretKey()
sk, err := bls.NewSigner()
if err != nil {
panic(err)
}
pk := bls.PublicFromSecretKey(sk)
pk := sk.PublicKey()
networkID := constants.UnitTestID
chainID := testChainID

Expand Down
16 changes: 8 additions & 8 deletions warp/aggregator/aggregator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ import (
avalancheWarp "github.com/ava-labs/avalanchego/vms/platformvm/warp"
)

func newValidator(t testing.TB, weight uint64) (*bls.SecretKey, *avalancheWarp.Validator) {
sk, err := bls.NewSecretKey()
func newValidator(t testing.TB, weight uint64) (bls.Signer, *avalancheWarp.Validator) {
sk, err := bls.NewSigner()
require.NoError(t, err)
pk := bls.PublicFromSecretKey(sk)
pk := sk.PublicKey()
return sk, &avalancheWarp.Validator{
PublicKey: pk,
PublicKeyBytes: bls.PublicKeyToCompressedBytes(pk),
Expand All @@ -43,17 +43,17 @@ func TestAggregateSignatures(t *testing.T) {
vdr1sk, vdr1 := newValidator(t, vdrWeight)
vdr2sk, vdr2 := newValidator(t, vdrWeight+1)
vdr3sk, vdr3 := newValidator(t, vdrWeight-1)
sig1 := bls.Sign(vdr1sk, unsignedMsg.Bytes())
sig2 := bls.Sign(vdr2sk, unsignedMsg.Bytes())
sig3 := bls.Sign(vdr3sk, unsignedMsg.Bytes())
sig1 := vdr1sk.Sign(unsignedMsg.Bytes())
sig2 := vdr2sk.Sign(unsignedMsg.Bytes())
sig3 := vdr3sk.Sign(unsignedMsg.Bytes())
vdrToSig := map[*avalancheWarp.Validator]*bls.Signature{
vdr1: sig1,
vdr2: sig2,
vdr3: sig3,
}
nonVdrSk, err := bls.NewSecretKey()
nonVdrSk, err := bls.NewSigner()
require.NoError(t, err)
nonVdrSig := bls.Sign(nonVdrSk, unsignedMsg.Bytes())
nonVdrSig := nonVdrSk.Sign(unsignedMsg.Bytes())
vdrs := []*avalancheWarp.Validator{
{
PublicKey: vdr1.PublicKey,
Expand Down
Loading

0 comments on commit b465ad5

Please sign in to comment.