Skip to content

Commit

Permalink
Update localsigner constructor api
Browse files Browse the repository at this point in the history
  • Loading branch information
richardpringle committed Jan 28, 2025
1 parent 18d2d8c commit 9ccd798
Show file tree
Hide file tree
Showing 10 changed files with 20 additions and 23 deletions.
3 changes: 1 addition & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.22.8

require (
github.com/VictoriaMetrics/fastcache v1.12.1
github.com/ava-labs/avalanchego v1.12.2-0.20250120213131-55b6a3fa9082
github.com/ava-labs/avalanchego v1.12.3-0.20250128181353-62b26c5e8b51
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 @@ -92,7 +92,6 @@ require (
github.com/mitchellh/pointerstructure v1.2.0 // indirect
github.com/mmcloughlin/addchain v0.4.0 // indirect
github.com/mr-tron/base58 v1.2.0 // indirect
github.com/nbutton23/zxcvbn-go v0.0.0-20180912185939-ae427f1e4c1d // indirect
github.com/pelletier/go-toml v1.9.5 // indirect
github.com/pelletier/go-toml/v2 v2.0.5 // indirect
github.com/pkg/errors v0.9.1 // indirect
Expand Down
6 changes: 2 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ github.com/ajg/form v1.5.1/go.mod h1:uL1WgH+h2mgNtvBq0339dVnzXdBETtL2LeUXaIv25UY
github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156 h1:eMwmnE/GDgah4HI848JfFxHt+iPb26b4zyfspmqY0/8=
github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156/go.mod h1:Cb/ax3seSYIx7SuZdm2G2xzfwmv3TPSk2ucNfQESPXM=
github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8=
github.com/ava-labs/avalanchego v1.12.2-0.20250120213131-55b6a3fa9082 h1:Mo76P2EVp9b6TQBLHHE8pIceKw5/XPg9GDXbic81Lto=
github.com/ava-labs/avalanchego v1.12.2-0.20250120213131-55b6a3fa9082/go.mod h1:Rn5mDrWuTfriC13xa3jLr4eEli3A9sCOs1SAjiRKuqM=
github.com/ava-labs/avalanchego v1.12.3-0.20250128181353-62b26c5e8b51 h1:X+mE5ASxrNcGYkHRowJwkmgZiradaUxRJwbf/DYpr+M=
github.com/ava-labs/avalanchego v1.12.3-0.20250128181353-62b26c5e8b51/go.mod h1:cLrTk63do01VazucbUA6mK0o2OuPnU+/o6WZ1NGL8Gg=
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 @@ -416,8 +416,6 @@ github.com/nats-io/jwt v0.3.0/go.mod h1:fRYCDE99xlTsqUzISS1Bi75UBJ6ljOJQOAAu5Vgl
github.com/nats-io/nats.go v1.9.1/go.mod h1:ZjDU1L/7fJ09jvUSRVBR2e7+RnLiiIQyqyzEE/Zbp4w=
github.com/nats-io/nkeys v0.1.0/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w=
github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c=
github.com/nbutton23/zxcvbn-go v0.0.0-20180912185939-ae427f1e4c1d h1:AREM5mwr4u1ORQBMvzfzBgpsctsbQikCVpvC+tX285E=
github.com/nbutton23/zxcvbn-go v0.0.0-20180912185939-ae427f1e4c1d/go.mod h1:o96djdrsSGy3AWPyBgZMAGfxZNfgntdJG+11KU4QvbU=
github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A=
github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE=
github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU=
Expand Down
2 changes: 1 addition & 1 deletion plugin/evm/vm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ func NewContext() *snow.Context {
return subnetID, nil
},
}
blsSecretKey, err := localsigner.NewSigner()
blsSecretKey, err := localsigner.New()
if err != nil {
panic(err)
}
Expand Down
6 changes: 3 additions & 3 deletions plugin/evm/vm_warp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -266,13 +266,13 @@ func testWarpVMTransaction(t *testing.T, unsignedMessage *avalancheWarp.Unsigned
defer logsSub.Unsubscribe()

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

nodeID2 := ids.GenerateTestNodeID()
blsSecretKey2, err := localsigner.NewSigner()
blsSecretKey2, err := localsigner.New()
require.NoError(err)
blsPublicKey2 := blsSecretKey2.PublicKey()
blsSignature2 := blsSecretKey2.Sign(unsignedMessage.Bytes())
Expand Down Expand Up @@ -529,7 +529,7 @@ func testReceiveWarpMessage(
weight uint64
}
newSigner := func(networkID ids.ID, weight uint64) signer {
secret, err := localsigner.NewSigner()
secret, err := localsigner.New()
require.NoError(err)
return signer{
networkID: networkID,
Expand Down
2 changes: 1 addition & 1 deletion precompile/contracts/warp/predicate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ func (v *testValidator) Compare(o *testValidator) int {
}

func newTestValidator() *testValidator {
sk, err := localsigner.NewSigner()
sk, err := localsigner.New()
if err != nil {
panic(err)
}
Expand Down
2 changes: 1 addition & 1 deletion utils/snow.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ var (
)

func TestSnowContext() *snow.Context {
sk, err := localsigner.NewSigner()
sk, err := localsigner.New()
if err != nil {
panic(err)
}
Expand Down
4 changes: 2 additions & 2 deletions warp/aggregator/aggregator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
)

func newValidator(t testing.TB, weight uint64) (bls.Signer, *avalancheWarp.Validator) {
sk, err := localsigner.NewSigner()
sk, err := localsigner.New()
require.NoError(t, err)
pk := sk.PublicKey()
return sk, &avalancheWarp.Validator{
Expand Down Expand Up @@ -52,7 +52,7 @@ func TestAggregateSignatures(t *testing.T) {
vdr2: sig2,
vdr3: sig3,
}
nonVdrSk, err := localsigner.NewSigner()
nonVdrSk, err := localsigner.New()
require.NoError(t, err)
nonVdrSig := nonVdrSk.Sign(unsignedMsg.Bytes())
vdrs := []*avalancheWarp.Validator{
Expand Down
10 changes: 5 additions & 5 deletions warp/backend_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func init() {
func TestAddAndGetValidMessage(t *testing.T) {
db := memdb.New()

sk, err := localsigner.NewSigner()
sk, err := localsigner.New()
require.NoError(t, err)
warpSigner := avalancheWarp.NewSigner(sk, networkID, sourceChainID)
messageSignatureCache := &cache.LRU[ids.ID, []byte]{Size: 500}
Expand All @@ -64,7 +64,7 @@ func TestAddAndGetValidMessage(t *testing.T) {
func TestAddAndGetUnknownMessage(t *testing.T) {
db := memdb.New()

sk, err := localsigner.NewSigner()
sk, err := localsigner.New()
require.NoError(t, err)
warpSigner := avalancheWarp.NewSigner(sk, networkID, sourceChainID)
messageSignatureCache := &cache.LRU[ids.ID, []byte]{Size: 500}
Expand All @@ -83,7 +83,7 @@ func TestGetBlockSignature(t *testing.T) {
blockClient := warptest.MakeBlockClient(blkID)
db := memdb.New()

sk, err := localsigner.NewSigner()
sk, err := localsigner.New()
require.NoError(err)
warpSigner := avalancheWarp.NewSigner(sk, networkID, sourceChainID)
messageSignatureCache := &cache.LRU[ids.ID, []byte]{Size: 500}
Expand All @@ -108,7 +108,7 @@ func TestGetBlockSignature(t *testing.T) {
func TestZeroSizedCache(t *testing.T) {
db := memdb.New()

sk, err := localsigner.NewSigner()
sk, err := localsigner.New()
require.NoError(t, err)
warpSigner := avalancheWarp.NewSigner(sk, networkID, sourceChainID)

Expand Down Expand Up @@ -136,7 +136,7 @@ func TestOffChainMessages(t *testing.T) {
check func(require *require.Assertions, b Backend)
err error
}
sk, err := localsigner.NewSigner()
sk, err := localsigner.New()
require.NoError(t, err)
warpSigner := avalancheWarp.NewSigner(sk, networkID, sourceChainID)

Expand Down
4 changes: 2 additions & 2 deletions warp/handlers/signature_request_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
func TestMessageSignatureHandler(t *testing.T) {
database := memdb.New()
snowCtx := utils.TestSnowContext()
blsSecretKey, err := localsigner.NewSigner()
blsSecretKey, err := localsigner.New()
require.NoError(t, err)
warpSigner := avalancheWarp.NewSigner(blsSecretKey, snowCtx.NetworkID, snowCtx.ChainID)

Expand Down Expand Up @@ -128,7 +128,7 @@ func TestMessageSignatureHandler(t *testing.T) {
func TestBlockSignatureHandler(t *testing.T) {
database := memdb.New()
snowCtx := utils.TestSnowContext()
blsSecretKey, err := localsigner.NewSigner()
blsSecretKey, err := localsigner.New()
require.NoError(t, err)

warpSigner := avalancheWarp.NewSigner(blsSecretKey, snowCtx.NetworkID, snowCtx.ChainID)
Expand Down
4 changes: 2 additions & 2 deletions warp/verifier_backend_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (
func TestAddressedCallSignatures(t *testing.T) {
database := memdb.New()
snowCtx := utils.TestSnowContext()
blsSecretKey, err := localsigner.NewSigner()
blsSecretKey, err := localsigner.New()
require.NoError(t, err)
warpSigner := avalancheWarp.NewSigner(blsSecretKey, snowCtx.NetworkID, snowCtx.ChainID)

Expand Down Expand Up @@ -140,7 +140,7 @@ func TestAddressedCallSignatures(t *testing.T) {
func TestBlockSignatures(t *testing.T) {
database := memdb.New()
snowCtx := utils.TestSnowContext()
blsSecretKey, err := localsigner.NewSigner()
blsSecretKey, err := localsigner.New()
require.NoError(t, err)

warpSigner := avalancheWarp.NewSigner(blsSecretKey, snowCtx.NetworkID, snowCtx.ChainID)
Expand Down

0 comments on commit 9ccd798

Please sign in to comment.