From cbeff25ecbe3330cb3dc6effe065b1541c3bb77b Mon Sep 17 00:00:00 2001 From: Stephen Buttolph Date: Tue, 21 Feb 2023 18:20:08 -0500 Subject: [PATCH] Update to avalanchego@v1.9.9 (#7) --- README.md | 3 ++- api/client.go | 6 ++--- api/server.go | 8 +++---- cmd/chain/create/flags.go | 6 ++--- cmd/issue/export/flags.go | 6 ++--- cmd/issue/importtx/cmd.go | 8 +++---- cmd/issue/importtx/flags.go | 6 ++--- cmd/issue/transfer/flags.go | 6 ++--- cmd/run/cmd.go | 5 ++-- cmd/version/cmd.go | 14 ++++++++--- constants.go | 2 +- execute/tx.go | 6 ++--- go.mod | 20 +++++----------- go.sum | 48 ++++++++++--------------------------- state/storage.go | 8 +++---- tx/tx.go | 14 ++++++----- 16 files changed, 73 insertions(+), 93 deletions(-) diff --git a/README.md b/README.md index 253d0dd..1dd760d 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,8 @@ Avalanche is a network composed of multiple sub-networks (called [subnets][Subne ## AvalancheGo Compatibility ``` -[v1.0.2] AvalancheGo@v1.9.6-v1.9.7 +[v1.0.3] AvalancheGo@v1.9.9 +[v1.0.2] AvalancheGo@v1.9.6-v1.9.8 [v1.0.1] AvalancheGo@v1.9.5 [v1.0.0] AvalancheGo@v1.9.5 ``` diff --git a/api/client.go b/api/client.go index 60a2822..47d471b 100644 --- a/api/client.go +++ b/api/client.go @@ -10,7 +10,7 @@ import ( "github.com/ava-labs/avalanchego/ids" "github.com/ava-labs/avalanchego/utils/constants" "github.com/ava-labs/avalanchego/utils/rpc" - "github.com/ava-labs/avalanchego/vms/platformvm/teleporter" + "github.com/ava-labs/avalanchego/vms/platformvm/warp" "github.com/ava-labs/xsvm/block" "github.com/ava-labs/xsvm/genesis" @@ -61,7 +61,7 @@ type Client interface { ctx context.Context, txID ids.ID, options ...rpc.Option, - ) (*teleporter.UnsignedMessage, []byte, error) + ) (*warp.UnsignedMessage, []byte, error) } func NewClient(uri, chain string) Client { @@ -226,7 +226,7 @@ func (c *client) Message( ctx context.Context, txID ids.ID, options ...rpc.Option, -) (*teleporter.UnsignedMessage, []byte, error) { +) (*warp.UnsignedMessage, []byte, error) { resp := new(MessageReply) err := c.req.SendRequest( ctx, diff --git a/api/server.go b/api/server.go index 672e70f..5cd4fbd 100644 --- a/api/server.go +++ b/api/server.go @@ -9,7 +9,7 @@ import ( "github.com/ava-labs/avalanchego/database" "github.com/ava-labs/avalanchego/ids" "github.com/ava-labs/avalanchego/snow" - "github.com/ava-labs/avalanchego/vms/platformvm/teleporter" + "github.com/ava-labs/avalanchego/vms/platformvm/warp" "github.com/ava-labs/xsvm/block" "github.com/ava-labs/xsvm/builder" @@ -184,8 +184,8 @@ type MessageArgs struct { } type MessageReply struct { - Message *teleporter.UnsignedMessage `json:"message"` - Signature []byte `json:"signature"` + Message *warp.UnsignedMessage `json:"message"` + Signature []byte `json:"signature"` } func (s *server) Message(_ *http.Request, args *MessageArgs, reply *MessageReply) error { @@ -195,6 +195,6 @@ func (s *server) Message(_ *http.Request, args *MessageArgs, reply *MessageReply } reply.Message = message - reply.Signature, err = s.ctx.TeleporterSigner.Sign(message) + reply.Signature, err = s.ctx.WarpSigner.Sign(message) return err } diff --git a/cmd/chain/create/flags.go b/cmd/chain/create/flags.go index 608ba45..1072dcb 100644 --- a/cmd/chain/create/flags.go +++ b/cmd/chain/create/flags.go @@ -10,7 +10,7 @@ import ( "github.com/ava-labs/avalanchego/genesis" "github.com/ava-labs/avalanchego/ids" - "github.com/ava-labs/avalanchego/utils/crypto" + "github.com/ava-labs/avalanchego/utils/crypto/secp256k1" "github.com/ava-labs/avalanchego/wallet/subnet/primary" ) @@ -38,7 +38,7 @@ type Config struct { Address ids.ShortID Balance uint64 Name string - PrivateKey *crypto.PrivateKeySECP256K1R + PrivateKey *secp256k1.PrivateKey } func ParseFlags(flags *pflag.FlagSet, args []string) (*Config, error) { @@ -90,7 +90,7 @@ func ParseFlags(flags *pflag.FlagSet, args []string) (*Config, error) { return nil, err } - var sk crypto.PrivateKeySECP256K1R + var sk secp256k1.PrivateKey err = sk.UnmarshalText([]byte(`"` + skStr + `"`)) if err != nil { return nil, err diff --git a/cmd/issue/export/flags.go b/cmd/issue/export/flags.go index 279dc4b..e01d3df 100644 --- a/cmd/issue/export/flags.go +++ b/cmd/issue/export/flags.go @@ -8,7 +8,7 @@ import ( "github.com/ava-labs/avalanchego/genesis" "github.com/ava-labs/avalanchego/ids" - "github.com/ava-labs/avalanchego/utils/crypto" + "github.com/ava-labs/avalanchego/utils/crypto/secp256k1" "github.com/ava-labs/avalanchego/utils/units" "github.com/ava-labs/avalanchego/wallet/subnet/primary" ) @@ -43,7 +43,7 @@ type Config struct { IsReturn bool Amount uint64 To ids.ShortID - PrivateKey *crypto.PrivateKeySECP256K1R + PrivateKey *secp256k1.PrivateKey } func ParseFlags(flags *pflag.FlagSet, args []string) (*Config, error) { @@ -106,7 +106,7 @@ func ParseFlags(flags *pflag.FlagSet, args []string) (*Config, error) { return nil, err } - var sk crypto.PrivateKeySECP256K1R + var sk secp256k1.PrivateKey err = sk.UnmarshalText([]byte(`"` + skStr + `"`)) if err != nil { return nil, err diff --git a/cmd/issue/importtx/cmd.go b/cmd/issue/importtx/cmd.go index 759fdf5..2403a81 100644 --- a/cmd/issue/importtx/cmd.go +++ b/cmd/issue/importtx/cmd.go @@ -14,7 +14,7 @@ import ( "github.com/ava-labs/avalanchego/api/info" "github.com/ava-labs/avalanchego/utils/crypto/bls" "github.com/ava-labs/avalanchego/utils/set" - "github.com/ava-labs/avalanchego/vms/platformvm/teleporter" + "github.com/ava-labs/avalanchego/vms/platformvm/warp" "github.com/ava-labs/xsvm/api" "github.com/ava-labs/xsvm/tx" @@ -43,7 +43,7 @@ func importFunc(c *cobra.Command, args []string) error { var ( // Note: here we assume the unsigned message is correct from the last // URI in sourceURIs. In practice this shouldn't be done. - unsignedMessage *teleporter.UnsignedMessage + unsignedMessage *warp.UnsignedMessage // Note: assumes that sourceURIs are all of the validators of the subnet // and that they do not share public keys. signatures = make([]*bls.Signature, len(config.SourceURIs)) @@ -84,7 +84,7 @@ func importFunc(c *cobra.Command, args []string) error { for i := range signatures { signers.Add(i) } - signature := &teleporter.BitSetSignature{ + signature := &warp.BitSetSignature{ Signers: signers.Bytes(), } @@ -96,7 +96,7 @@ func importFunc(c *cobra.Command, args []string) error { aggSignatureBytes := bls.SignatureToBytes(aggSignature) copy(signature.Signature[:], aggSignatureBytes) - message, err := teleporter.NewMessage( + message, err := warp.NewMessage( unsignedMessage, signature, ) diff --git a/cmd/issue/importtx/flags.go b/cmd/issue/importtx/flags.go index 82616b3..617ecbf 100644 --- a/cmd/issue/importtx/flags.go +++ b/cmd/issue/importtx/flags.go @@ -8,7 +8,7 @@ import ( "github.com/ava-labs/avalanchego/genesis" "github.com/ava-labs/avalanchego/ids" - "github.com/ava-labs/avalanchego/utils/crypto" + "github.com/ava-labs/avalanchego/utils/crypto/secp256k1" "github.com/ava-labs/avalanchego/wallet/subnet/primary" ) @@ -39,7 +39,7 @@ type Config struct { DestinationChainID string TxID ids.ID MaxFee uint64 - PrivateKey *crypto.PrivateKeySECP256K1R + PrivateKey *secp256k1.PrivateKey } func ParseFlags(flags *pflag.FlagSet, args []string) (*Config, error) { @@ -87,7 +87,7 @@ func ParseFlags(flags *pflag.FlagSet, args []string) (*Config, error) { return nil, err } - var sk crypto.PrivateKeySECP256K1R + var sk secp256k1.PrivateKey err = sk.UnmarshalText([]byte(`"` + skStr + `"`)) if err != nil { return nil, err diff --git a/cmd/issue/transfer/flags.go b/cmd/issue/transfer/flags.go index 91471f1..47ed592 100644 --- a/cmd/issue/transfer/flags.go +++ b/cmd/issue/transfer/flags.go @@ -8,7 +8,7 @@ import ( "github.com/ava-labs/avalanchego/genesis" "github.com/ava-labs/avalanchego/ids" - "github.com/ava-labs/avalanchego/utils/crypto" + "github.com/ava-labs/avalanchego/utils/crypto/secp256k1" "github.com/ava-labs/avalanchego/utils/units" "github.com/ava-labs/avalanchego/wallet/subnet/primary" ) @@ -40,7 +40,7 @@ type Config struct { AssetID ids.ID Amount uint64 To ids.ShortID - PrivateKey *crypto.PrivateKeySECP256K1R + PrivateKey *secp256k1.PrivateKey } func ParseFlags(flags *pflag.FlagSet, args []string) (*Config, error) { @@ -101,7 +101,7 @@ func ParseFlags(flags *pflag.FlagSet, args []string) (*Config, error) { return nil, err } - var sk crypto.PrivateKeySECP256K1R + var sk secp256k1.PrivateKey err = sk.UnmarshalText([]byte(`"` + skStr + `"`)) if err != nil { return nil, err diff --git a/cmd/run/cmd.go b/cmd/run/cmd.go index 323cafc..07191bd 100644 --- a/cmd/run/cmd.go +++ b/cmd/run/cmd.go @@ -4,6 +4,8 @@ package run import ( + "context" + "github.com/spf13/cobra" "github.com/ava-labs/avalanchego/vms/rpcchainvm" @@ -20,6 +22,5 @@ func Command() *cobra.Command { } func runFunc(*cobra.Command, []string) error { - rpcchainvm.Serve(&xsvm.VM{}) - return nil + return rpcchainvm.Serve(context.Background(), &xsvm.VM{}) } diff --git a/cmd/version/cmd.go b/cmd/version/cmd.go index 0ef238d..a13c9cf 100644 --- a/cmd/version/cmd.go +++ b/cmd/version/cmd.go @@ -8,12 +8,14 @@ import ( "github.com/spf13/cobra" + "github.com/ava-labs/avalanchego/version" "github.com/ava-labs/xsvm" ) const format = `%s: - VMID: %s - Version: %s + VMID: %s + Version: %s + Plugin Version: %d ` func Command() *cobra.Command { @@ -25,6 +27,12 @@ func Command() *cobra.Command { } func versionFunc(*cobra.Command, []string) error { - fmt.Printf(format, xsvm.Name, xsvm.ID, xsvm.Version) + fmt.Printf( + format, + xsvm.Name, + xsvm.ID, + xsvm.Version, + version.RPCChainVMProtocol, + ) return nil } diff --git a/constants.go b/constants.go index 3244e1a..c0ec272 100644 --- a/constants.go +++ b/constants.go @@ -16,6 +16,6 @@ var ( Version = &version.Semantic{ Major: 1, Minor: 0, - Patch: 2, + Patch: 3, } ) diff --git a/execute/tx.go b/execute/tx.go index 7d407d8..5ee2fde 100644 --- a/execute/tx.go +++ b/execute/tx.go @@ -13,7 +13,7 @@ import ( "github.com/ava-labs/avalanchego/snow/engine/snowman/block" "github.com/ava-labs/avalanchego/utils/hashing" "github.com/ava-labs/avalanchego/utils/wrappers" - "github.com/ava-labs/avalanchego/vms/platformvm/teleporter" + "github.com/ava-labs/avalanchego/vms/platformvm/warp" "github.com/ava-labs/xsvm/state" "github.com/ava-labs/xsvm/tx" @@ -85,7 +85,7 @@ func (t *Tx) Export(e *tx.Export) error { return err } - message, err := teleporter.NewUnsignedMessage( + message, err := warp.NewUnsignedMessage( e.ChainID, e.PeerChainID, payload.Bytes(), @@ -125,7 +125,7 @@ func (t *Tx) Import(i *tx.Import) error { return errMissingBlockContext } - message, err := teleporter.ParseMessage(i.Message) + message, err := warp.ParseMessage(i.Message) if err != nil { return err } diff --git a/go.mod b/go.mod index 7b398e4..6c04fe2 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/ava-labs/xsvm go 1.18 require ( - github.com/ava-labs/avalanchego v1.9.7 + github.com/ava-labs/avalanchego v1.9.9 github.com/gorilla/rpc v1.2.0 github.com/spf13/cobra v1.5.0 github.com/spf13/pflag v1.0.5 @@ -18,7 +18,6 @@ require ( github.com/cespare/xxhash/v2 v2.1.2 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/decred/dcrd/dcrec/secp256k1/v3 v3.0.0-20200627015759-01fd2de07837 // indirect - github.com/fatih/color v1.13.0 // indirect github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/go-ole/go-ole v1.2.6 // indirect @@ -30,19 +29,12 @@ require ( github.com/gorilla/websocket v1.4.2 // indirect github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.12.0 // indirect - github.com/hashicorp/go-hclog v1.2.2 // indirect - github.com/hashicorp/go-plugin v1.4.4 // indirect - github.com/hashicorp/yamux v0.0.0-20200609203250-aecfd211c9ce // indirect github.com/holiman/bloomfilter/v2 v2.0.3 // indirect github.com/inconshreveable/mousetrap v1.0.0 // indirect - github.com/jhump/protoreflect v1.11.1-0.20220213155251-0c2aedc66cf4 // indirect - github.com/mattn/go-colorable v0.1.12 // indirect - github.com/mattn/go-isatty v0.0.14 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect - github.com/mitchellh/go-testing-interface v1.14.1 // indirect github.com/mr-tron/base58 v1.2.0 // indirect github.com/nbutton23/zxcvbn-go v0.0.0-20180912185939-ae427f1e4c1d // indirect - github.com/oklog/run v1.1.0 // indirect + github.com/pires/go-proxyproto v0.6.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/prometheus/client_golang v1.13.0 // indirect github.com/prometheus/client_model v0.2.0 // indirect @@ -69,11 +61,11 @@ require ( go.uber.org/multierr v1.8.0 // indirect golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d // indirect golang.org/x/exp v0.0.0-20220426173459-3bcf042a4bf5 // indirect - golang.org/x/net v0.1.0 // indirect + golang.org/x/net v0.7.0 // indirect golang.org/x/sync v0.1.0 // indirect - golang.org/x/sys v0.1.0 // indirect - golang.org/x/term v0.1.0 // indirect - golang.org/x/text v0.4.0 // indirect + golang.org/x/sys v0.5.0 // indirect + golang.org/x/term v0.5.0 // indirect + golang.org/x/text v0.7.0 // indirect golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac // indirect gonum.org/v1/gonum v0.11.0 // indirect google.golang.org/genproto v0.0.0-20221027153422-115e99e71e1c // indirect diff --git a/go.sum b/go.sum index fe30260..61df95d 100644 --- a/go.sum +++ b/go.sum @@ -44,8 +44,8 @@ github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRF github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= -github.com/ava-labs/avalanchego v1.9.7 h1:f2vS8jUBZmrqPcfU5NEa7dSHXbKfTB0EyjcCyvqxqPw= -github.com/ava-labs/avalanchego v1.9.7/go.mod h1:ckdSQHeoRN6PmQ3TLgWAe6Kh9tFpU4Lu6MgDW4GrU/Q= +github.com/ava-labs/avalanchego v1.9.9 h1:R7GBCjFBC/taZeJNJ4MtdniifC7j9eLwRezhCGa/wmc= +github.com/ava-labs/avalanchego v1.9.9/go.mod h1:mnM/wzJIaKXzLV323Yh0EbLtsicoaFSgaDESrED9dr0= github.com/benbjohnson/clock v1.3.0 h1:ip6w0uFQkncKQ979AypyG0ER7mqUSBdKLOgAle/AT8A= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= @@ -106,12 +106,9 @@ github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymF github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= -github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ= github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/fatih/color v1.13.0 h1:8LOYc1KYPPmyKMuN8QV2DNRWNbLo6LZ0iLs8+mlH53w= -github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/fsnotify/fsnotify v1.5.4/go.mod h1:OVB6XrOHzAwXMpEM7uPOzcehqUV2UqJxmVXmkdnm1bU= @@ -214,14 +211,8 @@ github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFb github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0/go.mod h1:hgWBS7lorOAVIJEQMi4ZsPv9hVvWI6+ch50m39Pf2Ks= github.com/grpc-ecosystem/grpc-gateway/v2 v2.12.0 h1:kr3j8iIMR4ywO/O0rvksXaJvauGGCMg2zAZIiNZ9uIQ= github.com/grpc-ecosystem/grpc-gateway/v2 v2.12.0/go.mod h1:ummNFgdgLhhX7aIiy35vVmQNS0rWXknfPE0qe6fmFXg= -github.com/hashicorp/go-hclog v1.2.2 h1:ihRI7YFwcZdiSD7SIenIhHfQH3OuDvWerAUBZbeQS3M= -github.com/hashicorp/go-hclog v1.2.2/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M= -github.com/hashicorp/go-plugin v1.4.4 h1:NVdrSdFRt3SkZtNckJ6tog7gbpRrcbOjQi/rgF7JYWQ= -github.com/hashicorp/go-plugin v1.4.4/go.mod h1:viDMjcLJuDui6pXb8U4HVfb8AamCWhHGUjr2IrTF67s= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hashicorp/yamux v0.0.0-20200609203250-aecfd211c9ce h1:7UnVY3T/ZnHUrfviiAgIUjg2PXxsQfs5bphsG8F7Keo= -github.com/hashicorp/yamux v0.0.0-20200609203250-aecfd211c9ce/go.mod h1:+NfK9FKeTrX5uv1uIXGdwYDTeHna2qgaIlx54MXqjAM= github.com/holiman/bloomfilter/v2 v2.0.3 h1:73e0e/V0tCydx14a0SCYS/EWCxgwLZ18CZcZKVu0fao= github.com/holiman/bloomfilter/v2 v2.0.3/go.mod h1:zpoh+gs7qcpqrHr3dB55AMiJwo0iURXE7ZOP9L9hSkA= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= @@ -231,8 +222,6 @@ github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NH github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= -github.com/jhump/protoreflect v1.11.1-0.20220213155251-0c2aedc66cf4 h1:E2CdxLXYSn6Zrj2+u8DWrwMJW3YZLSWtM/7kIL8OL18= -github.com/jhump/protoreflect v1.11.1-0.20220213155251-0c2aedc66cf4/go.mod h1:U7aMIjN0NWq9swDP7xDdoMfRHb35uiuTd3Z9nFXJf5E= github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= @@ -253,17 +242,9 @@ github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORN github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= -github.com/mattn/go-colorable v0.1.12 h1:jF+Du6AlPIjs2BiUiQlKOX0rt3SujHxPnksPKZbaA40= -github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= -github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= -github.com/mattn/go-isatty v0.0.14 h1:yVuAays6BHfxijgZPzw+3Zlu5yQgKGP2/hcQbHb7S9Y= -github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 h1:I0XW9+e1XWDxdcEniV4rQAIOPUGDq67JSCiRCgGCZLI= github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= -github.com/mitchellh/go-testing-interface v1.14.1 h1:jrgshOhYAUVNMAJiKbEu7EqAwgJJ2JqpQmpLJOu07cU= -github.com/mitchellh/go-testing-interface v1.14.1/go.mod h1:gfgS7OtZj6MA4U1UrDRp04twqAjfvlZyCfX3sDjEym8= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= @@ -278,8 +259,6 @@ github.com/nbutton23/zxcvbn-go v0.0.0-20180912185939-ae427f1e4c1d/go.mod h1:o96d 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= -github.com/oklog/run v1.1.0 h1:GEenZ1cK0+q0+wsJew9qUg/DyD8k3JzYsZAi5gYi2mA= -github.com/oklog/run v1.1.0/go.mod h1:sVPdnTZT1zYwAJeCMu2Th4T21pA3FPOQRfWjQlk7DVU= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= @@ -295,6 +274,8 @@ github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1y github.com/onsi/gomega v1.17.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAlGdZY= github.com/onsi/gomega v1.19.0/go.mod h1:LY+I3pBVzYsTBU1AnDwOSxaYi9WoWiqgwooUqq9yPro= github.com/onsi/gomega v1.24.0 h1:+0glovB9Jd6z3VR+ScSwQqXVTIfJcGA9UBM8yzQxhqg= +github.com/pires/go-proxyproto v0.6.2 h1:KAZ7UteSOt6urjme6ZldyFm4wDe/z0ZUP0Yv0Dos0d8= +github.com/pires/go-proxyproto v0.6.2/go.mod h1:Odh9VFOZJCf9G8cLW5o435Xf1J95Jw9Gw5rnCjcwzAY= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= @@ -484,8 +465,8 @@ golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qx golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220607020251-c690dde0001d/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.1.0 h1:hZ/3BUoy5aId7sCpA/Tc5lt8DkFgdVS2onTpJsZ/fl0= -golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= +golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g= +golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -529,7 +510,6 @@ golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -556,19 +536,16 @@ golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.1.0 h1:kunALQeHf1/185U1i0GOB/fy1IPRDDpuoOOqRReG57U= -golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 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.1.0 h1:g6Z6vPFA9dYBAF7DWcH6sCcOntplXsDKcliusYijMlw= -golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.5.0 h1:n2a8QNdAb0sZNpU9R1ALUXBbY+w51fCQDN+7EdxNBsY= +golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= 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= @@ -577,8 +554,8 @@ golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= 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.4.0 h1:BrVqGRd7+k1DiOgtnFvAkoQEWQvBc25ouMJM6429SFg= -golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo= +golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= 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= @@ -702,7 +679,6 @@ google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= -google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= google.golang.org/grpc v1.50.1 h1:DS/BukOZWp8s6p4Dt/tOaJaTQyPyOoCcrjroHuCeLzY= diff --git a/state/storage.go b/state/storage.go index e125a35..77a017d 100644 --- a/state/storage.go +++ b/state/storage.go @@ -9,7 +9,7 @@ import ( "github.com/ava-labs/avalanchego/database" "github.com/ava-labs/avalanchego/ids" "github.com/ava-labs/avalanchego/utils/math" - "github.com/ava-labs/avalanchego/vms/platformvm/teleporter" + "github.com/ava-labs/avalanchego/vms/platformvm/warp" ) var ( @@ -184,16 +184,16 @@ func IncreaseLoan(db database.KeyValueReaderWriterDeleter, chainID ids.ID, amoun // Message state -func GetMessage(db database.KeyValueReader, txID ids.ID) (*teleporter.UnsignedMessage, error) { +func GetMessage(db database.KeyValueReader, txID ids.ID) (*warp.UnsignedMessage, error) { key := Flatten(messagePrefix, txID[:]) bytes, err := db.Get(key) if err != nil { return nil, err } - return teleporter.ParseUnsignedMessage(bytes) + return warp.ParseUnsignedMessage(bytes) } -func SetMessage(db database.KeyValueWriter, txID ids.ID, message *teleporter.UnsignedMessage) error { +func SetMessage(db database.KeyValueWriter, txID ids.ID, message *warp.UnsignedMessage) error { key := Flatten(messagePrefix, txID[:]) bytes := message.Bytes() return db.Put(key, bytes) diff --git a/tx/tx.go b/tx/tx.go index 9142b82..10855c6 100644 --- a/tx/tx.go +++ b/tx/tx.go @@ -6,17 +6,19 @@ package tx import ( "github.com/ava-labs/avalanchego/cache" "github.com/ava-labs/avalanchego/ids" - "github.com/ava-labs/avalanchego/utils/crypto" + "github.com/ava-labs/avalanchego/utils/crypto/secp256k1" "github.com/ava-labs/avalanchego/utils/hashing" ) -var secp256k1r = crypto.FactorySECP256K1R{Cache: cache.LRU{ - Size: 2048, -}} +var secp256k1r = secp256k1.Factory{ + Cache: cache.LRU[ids.ID, *secp256k1.PublicKey]{ + Size: 2048, + }, +} type Tx struct { Unsigned `serialize:"true" json:"unsigned"` - Signature [crypto.SECP256K1RSigLen]byte `serialize:"true" json:"signature"` + Signature [secp256k1.SignatureLen]byte `serialize:"true" json:"signature"` } func Parse(bytes []byte) (*Tx, error) { @@ -25,7 +27,7 @@ func Parse(bytes []byte) (*Tx, error) { return tx, err } -func Sign(utx Unsigned, key *crypto.PrivateKeySECP256K1R) (*Tx, error) { +func Sign(utx Unsigned, key *secp256k1.PrivateKey) (*Tx, error) { unsignedBytes, err := Codec.Marshal(Version, &utx) if err != nil { return nil, err