Skip to content

Commit

Permalink
Update to [email protected] (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
StephenButtolph authored Feb 21, 2023
1 parent 30849fc commit cbeff25
Show file tree
Hide file tree
Showing 16 changed files with 73 additions and 93 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ Avalanche is a network composed of multiple sub-networks (called [subnets][Subne
## AvalancheGo Compatibility

```
[v1.0.2] [email protected]
[v1.0.3] [email protected]
[v1.0.2] [email protected]
[v1.0.1] [email protected]
[v1.0.0] [email protected]
```
Expand Down
6 changes: 3 additions & 3 deletions api/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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,
Expand Down
8 changes: 4 additions & 4 deletions api/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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 {
Expand All @@ -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
}
6 changes: 3 additions & 3 deletions cmd/chain/create/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions cmd/issue/export/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions cmd/issue/importtx/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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))
Expand Down Expand Up @@ -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(),
}

Expand All @@ -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,
)
Expand Down
6 changes: 3 additions & 3 deletions cmd/issue/importtx/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions cmd/issue/transfer/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions cmd/run/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
package run

import (
"context"

"github.com/spf13/cobra"

"github.com/ava-labs/avalanchego/vms/rpcchainvm"
Expand All @@ -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{})
}
14 changes: 11 additions & 3 deletions cmd/version/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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
}
2 changes: 1 addition & 1 deletion constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ var (
Version = &version.Semantic{
Major: 1,
Minor: 0,
Patch: 2,
Patch: 3,
}
)
6 changes: 3 additions & 3 deletions execute/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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(),
Expand Down Expand Up @@ -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
}
Expand Down
20 changes: 6 additions & 14 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
Loading

0 comments on commit cbeff25

Please sign in to comment.