From 77664c8313b66ee518f76a9eeebdfc61d56db5b6 Mon Sep 17 00:00:00 2001 From: Stephen Buttolph Date: Tue, 20 Aug 2024 16:00:39 -0400 Subject: [PATCH 1/5] Allow P-chain wallet to be used by the platformvm --- wallet/chain/p/builder_test.go | 23 +++---- wallet/chain/p/client.go | 60 +++++++++++++++++++ wallet/chain/p/{ => wallet}/backend.go | 2 +- .../chain/p/{ => wallet}/backend_visitor.go | 0 wallet/chain/p/{ => wallet}/wallet.go | 56 +++++------------ .../p/{ => wallet}/wallet_with_options.go | 44 +++++++------- .../examples/get-p-chain-balance/main.go | 4 +- wallet/subnet/primary/wallet.go | 16 ++--- 8 files changed, 121 insertions(+), 84 deletions(-) create mode 100644 wallet/chain/p/client.go rename wallet/chain/p/{ => wallet}/backend.go (99%) rename wallet/chain/p/{ => wallet}/backend_visitor.go (100%) rename wallet/chain/p/{ => wallet}/wallet.go (95%) rename wallet/chain/p/{ => wallet}/wallet_with_options.go (82%) diff --git a/wallet/chain/p/builder_test.go b/wallet/chain/p/builder_test.go index 6885a3b4fc9e..69168e463b2e 100644 --- a/wallet/chain/p/builder_test.go +++ b/wallet/chain/p/builder_test.go @@ -25,6 +25,7 @@ import ( "github.com/ava-labs/avalanchego/vms/secp256k1fx" "github.com/ava-labs/avalanchego/vms/types" "github.com/ava-labs/avalanchego/wallet/chain/p/builder" + "github.com/ava-labs/avalanchego/wallet/chain/p/wallet" "github.com/ava-labs/avalanchego/wallet/subnet/primary/common" "github.com/ava-labs/avalanchego/wallet/subnet/primary/common/utxotest" @@ -174,7 +175,7 @@ func TestBaseTx(t *testing.T) { chainUTXOs = utxotest.NewDeterministicChainUTXOs(t, map[ids.ID][]*avax.UTXO{ constants.PlatformChainID: utxos, }) - backend = NewBackend(e.context, chainUTXOs, nil) + backend = wallet.NewBackend(e.context, chainUTXOs, nil) builder = builder.New(set.Of(utxoAddr), e.context, backend) ) @@ -214,7 +215,7 @@ func TestAddSubnetValidatorTx(t *testing.T) { chainUTXOs = utxotest.NewDeterministicChainUTXOs(t, map[ids.ID][]*avax.UTXO{ constants.PlatformChainID: utxos, }) - backend = NewBackend(e.context, chainUTXOs, subnetOwners) + backend = wallet.NewBackend(e.context, chainUTXOs, subnetOwners) builder = builder.New(set.Of(utxoAddr, subnetAuthAddr), e.context, backend) ) @@ -246,7 +247,7 @@ func TestRemoveSubnetValidatorTx(t *testing.T) { chainUTXOs = utxotest.NewDeterministicChainUTXOs(t, map[ids.ID][]*avax.UTXO{ constants.PlatformChainID: utxos, }) - backend = NewBackend(e.context, chainUTXOs, subnetOwners) + backend = wallet.NewBackend(e.context, chainUTXOs, subnetOwners) builder = builder.New(set.Of(utxoAddr, subnetAuthAddr), e.context, backend) ) @@ -287,7 +288,7 @@ func TestCreateChainTx(t *testing.T) { chainUTXOs = utxotest.NewDeterministicChainUTXOs(t, map[ids.ID][]*avax.UTXO{ constants.PlatformChainID: utxos, }) - backend = NewBackend(e.context, chainUTXOs, subnetOwners) + backend = wallet.NewBackend(e.context, chainUTXOs, subnetOwners) builder = builder.New(set.Of(utxoAddr, subnetAuthAddr), e.context, backend) ) @@ -327,7 +328,7 @@ func TestCreateSubnetTx(t *testing.T) { chainUTXOs = utxotest.NewDeterministicChainUTXOs(t, map[ids.ID][]*avax.UTXO{ constants.PlatformChainID: utxos, }) - backend = NewBackend(e.context, chainUTXOs, subnetOwners) + backend = wallet.NewBackend(e.context, chainUTXOs, subnetOwners) builder = builder.New(set.Of(utxoAddr, subnetAuthAddr), e.context, backend) ) @@ -359,7 +360,7 @@ func TestTransferSubnetOwnershipTx(t *testing.T) { chainUTXOs = utxotest.NewDeterministicChainUTXOs(t, map[ids.ID][]*avax.UTXO{ constants.PlatformChainID: utxos, }) - backend = NewBackend(e.context, chainUTXOs, subnetOwners) + backend = wallet.NewBackend(e.context, chainUTXOs, subnetOwners) builder = builder.New(set.Of(utxoAddr, subnetAuthAddr), e.context, backend) ) @@ -399,7 +400,7 @@ func TestImportTx(t *testing.T) { constants.PlatformChainID: utxos, sourceChainID: importedUTXOs, }) - backend = NewBackend(e.context, chainUTXOs, nil) + backend = wallet.NewBackend(e.context, chainUTXOs, nil) builder = builder.New(set.Of(utxoAddr), e.context, backend) ) @@ -436,7 +437,7 @@ func TestExportTx(t *testing.T) { chainUTXOs = utxotest.NewDeterministicChainUTXOs(t, map[ids.ID][]*avax.UTXO{ constants.PlatformChainID: utxos, }) - backend = NewBackend(e.context, chainUTXOs, nil) + backend = wallet.NewBackend(e.context, chainUTXOs, nil) builder = builder.New(set.Of(utxoAddr), e.context, backend) ) @@ -486,7 +487,7 @@ func TestTransformSubnetTx(t *testing.T) { chainUTXOs = utxotest.NewDeterministicChainUTXOs(t, map[ids.ID][]*avax.UTXO{ constants.PlatformChainID: utxos, }) - backend = NewBackend(e.context, chainUTXOs, subnetOwners) + backend = wallet.NewBackend(e.context, chainUTXOs, subnetOwners) builder = builder.New(set.Of(utxoAddr, subnetAuthAddr), e.context, backend) ) @@ -578,7 +579,7 @@ func TestAddPermissionlessValidatorTx(t *testing.T) { chainUTXOs = utxotest.NewDeterministicChainUTXOs(t, map[ids.ID][]*avax.UTXO{ constants.PlatformChainID: utxos, }) - backend = NewBackend(e.context, chainUTXOs, nil) + backend = wallet.NewBackend(e.context, chainUTXOs, nil) builder = builder.New(set.Of(utxoAddr, rewardAddr), e.context, backend) ) @@ -631,7 +632,7 @@ func TestAddPermissionlessDelegatorTx(t *testing.T) { chainUTXOs = utxotest.NewDeterministicChainUTXOs(t, map[ids.ID][]*avax.UTXO{ constants.PlatformChainID: utxos, }) - backend = NewBackend(e.context, chainUTXOs, nil) + backend = wallet.NewBackend(e.context, chainUTXOs, nil) builder = builder.New(set.Of(utxoAddr, rewardAddr), e.context, backend) ) diff --git a/wallet/chain/p/client.go b/wallet/chain/p/client.go new file mode 100644 index 000000000000..190bfbddf281 --- /dev/null +++ b/wallet/chain/p/client.go @@ -0,0 +1,60 @@ +// Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved. +// See the file LICENSE for licensing terms. + +package p + +import ( + "errors" + + "github.com/ava-labs/avalanchego/vms/platformvm" + "github.com/ava-labs/avalanchego/vms/platformvm/txs" + "github.com/ava-labs/avalanchego/wallet/chain/p/wallet" + "github.com/ava-labs/avalanchego/wallet/subnet/primary/common" +) + +var ( + ErrNotCommitted = errors.New("not committed") + + _ wallet.Client = (*client)(nil) +) + +func NewClient( + c platformvm.Client, + b wallet.Backend, +) wallet.Client { + return &client{ + client: c, + backend: b, + } +} + +type client struct { + client platformvm.Client + backend wallet.Backend +} + +func (c *client) IssueTx( + tx *txs.Tx, + options ...common.Option, +) error { + ops := common.NewOptions(options) + ctx := ops.Context() + txID, err := c.client.IssueTx(ctx, tx.Bytes()) + if err != nil { + return err + } + + if f := ops.PostIssuanceFunc(); f != nil { + f(txID) + } + + if ops.AssumeDecided() { + return c.backend.AcceptTx(ctx, tx) + } + + if err := platformvm.AwaitTxAccepted(c.client, ctx, txID, ops.PollFrequency()); err != nil { + return err + } + + return c.backend.AcceptTx(ctx, tx) +} diff --git a/wallet/chain/p/backend.go b/wallet/chain/p/wallet/backend.go similarity index 99% rename from wallet/chain/p/backend.go rename to wallet/chain/p/wallet/backend.go index 8a1cd6b7806c..f46902fa8a51 100644 --- a/wallet/chain/p/backend.go +++ b/wallet/chain/p/wallet/backend.go @@ -1,7 +1,7 @@ // Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved. // See the file LICENSE for licensing terms. -package p +package wallet import ( "context" diff --git a/wallet/chain/p/backend_visitor.go b/wallet/chain/p/wallet/backend_visitor.go similarity index 100% rename from wallet/chain/p/backend_visitor.go rename to wallet/chain/p/wallet/backend_visitor.go diff --git a/wallet/chain/p/wallet.go b/wallet/chain/p/wallet/wallet.go similarity index 95% rename from wallet/chain/p/wallet.go rename to wallet/chain/p/wallet/wallet.go index 631553431ef7..1892defe505d 100644 --- a/wallet/chain/p/wallet.go +++ b/wallet/chain/p/wallet/wallet.go @@ -1,7 +1,7 @@ // Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved. // See the file LICENSE for licensing terms. -package p +package wallet import ( "errors" @@ -9,7 +9,6 @@ import ( "github.com/ava-labs/avalanchego/ids" "github.com/ava-labs/avalanchego/vms/components/avax" - "github.com/ava-labs/avalanchego/vms/platformvm" "github.com/ava-labs/avalanchego/vms/platformvm/txs" "github.com/ava-labs/avalanchego/vms/secp256k1fx" "github.com/ava-labs/avalanchego/wallet/chain/p/builder" @@ -25,7 +24,17 @@ var ( _ Wallet = (*wallet)(nil) ) +type Client interface { + // IssueTx issues the signed tx. + IssueTx( + tx *txs.Tx, + options ...common.Option, + ) error +} + type Wallet interface { + Client + // Builder returns the builder that will be used to create the transactions. Builder() builder.Builder @@ -246,33 +255,24 @@ type Wallet interface { utx txs.UnsignedTx, options ...common.Option, ) (*txs.Tx, error) - - // IssueTx issues the signed tx. - IssueTx( - tx *txs.Tx, - options ...common.Option, - ) error } -func NewWallet( +func New( + client Client, builder builder.Builder, signer walletsigner.Signer, - client platformvm.Client, - backend Backend, ) Wallet { return &wallet{ - Backend: backend, + Client: client, builder: builder, signer: signer, - client: client, } } type wallet struct { - Backend + Client builder builder.Builder signer walletsigner.Signer - client platformvm.Client } func (w *wallet) Builder() builder.Builder { @@ -499,29 +499,3 @@ func (w *wallet) IssueUnsignedTx( return tx, w.IssueTx(tx, options...) } - -func (w *wallet) IssueTx( - tx *txs.Tx, - options ...common.Option, -) error { - ops := common.NewOptions(options) - ctx := ops.Context() - txID, err := w.client.IssueTx(ctx, tx.Bytes()) - if err != nil { - return err - } - - if f := ops.PostIssuanceFunc(); f != nil { - f(txID) - } - - if ops.AssumeDecided() { - return w.Backend.AcceptTx(ctx, tx) - } - - if err := platformvm.AwaitTxAccepted(w.client, ctx, txID, ops.PollFrequency()); err != nil { - return err - } - - return w.Backend.AcceptTx(ctx, tx) -} diff --git a/wallet/chain/p/wallet_with_options.go b/wallet/chain/p/wallet/wallet_with_options.go similarity index 82% rename from wallet/chain/p/wallet_with_options.go rename to wallet/chain/p/wallet/wallet_with_options.go index 92965f2e4f1f..64b22050a953 100644 --- a/wallet/chain/p/wallet_with_options.go +++ b/wallet/chain/p/wallet/wallet_with_options.go @@ -1,7 +1,7 @@ // Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved. // See the file LICENSE for licensing terms. -package p +package wallet import ( "time" @@ -17,35 +17,35 @@ import ( walletsigner "github.com/ava-labs/avalanchego/wallet/chain/p/signer" ) -var _ Wallet = (*walletWithOptions)(nil) +var _ Wallet = (*withOptions)(nil) -func NewWalletWithOptions( +func WithOptions( wallet Wallet, options ...common.Option, ) Wallet { - return &walletWithOptions{ + return &withOptions{ wallet: wallet, options: options, } } -type walletWithOptions struct { +type withOptions struct { wallet Wallet options []common.Option } -func (w *walletWithOptions) Builder() builder.Builder { +func (w *withOptions) Builder() builder.Builder { return builder.NewWithOptions( w.wallet.Builder(), w.options..., ) } -func (w *walletWithOptions) Signer() walletsigner.Signer { +func (w *withOptions) Signer() walletsigner.Signer { return w.wallet.Signer() } -func (w *walletWithOptions) IssueBaseTx( +func (w *withOptions) IssueBaseTx( outputs []*avax.TransferableOutput, options ...common.Option, ) (*txs.Tx, error) { @@ -55,7 +55,7 @@ func (w *walletWithOptions) IssueBaseTx( ) } -func (w *walletWithOptions) IssueAddValidatorTx( +func (w *withOptions) IssueAddValidatorTx( vdr *txs.Validator, rewardsOwner *secp256k1fx.OutputOwners, shares uint32, @@ -69,7 +69,7 @@ func (w *walletWithOptions) IssueAddValidatorTx( ) } -func (w *walletWithOptions) IssueAddSubnetValidatorTx( +func (w *withOptions) IssueAddSubnetValidatorTx( vdr *txs.SubnetValidator, options ...common.Option, ) (*txs.Tx, error) { @@ -79,7 +79,7 @@ func (w *walletWithOptions) IssueAddSubnetValidatorTx( ) } -func (w *walletWithOptions) IssueRemoveSubnetValidatorTx( +func (w *withOptions) IssueRemoveSubnetValidatorTx( nodeID ids.NodeID, subnetID ids.ID, options ...common.Option, @@ -91,7 +91,7 @@ func (w *walletWithOptions) IssueRemoveSubnetValidatorTx( ) } -func (w *walletWithOptions) IssueAddDelegatorTx( +func (w *withOptions) IssueAddDelegatorTx( vdr *txs.Validator, rewardsOwner *secp256k1fx.OutputOwners, options ...common.Option, @@ -103,7 +103,7 @@ func (w *walletWithOptions) IssueAddDelegatorTx( ) } -func (w *walletWithOptions) IssueCreateChainTx( +func (w *withOptions) IssueCreateChainTx( subnetID ids.ID, genesis []byte, vmID ids.ID, @@ -121,7 +121,7 @@ func (w *walletWithOptions) IssueCreateChainTx( ) } -func (w *walletWithOptions) IssueCreateSubnetTx( +func (w *withOptions) IssueCreateSubnetTx( owner *secp256k1fx.OutputOwners, options ...common.Option, ) (*txs.Tx, error) { @@ -131,7 +131,7 @@ func (w *walletWithOptions) IssueCreateSubnetTx( ) } -func (w *walletWithOptions) IssueTransferSubnetOwnershipTx( +func (w *withOptions) IssueTransferSubnetOwnershipTx( subnetID ids.ID, owner *secp256k1fx.OutputOwners, options ...common.Option, @@ -143,7 +143,7 @@ func (w *walletWithOptions) IssueTransferSubnetOwnershipTx( ) } -func (w *walletWithOptions) IssueImportTx( +func (w *withOptions) IssueImportTx( sourceChainID ids.ID, to *secp256k1fx.OutputOwners, options ...common.Option, @@ -155,7 +155,7 @@ func (w *walletWithOptions) IssueImportTx( ) } -func (w *walletWithOptions) IssueExportTx( +func (w *withOptions) IssueExportTx( chainID ids.ID, outputs []*avax.TransferableOutput, options ...common.Option, @@ -167,7 +167,7 @@ func (w *walletWithOptions) IssueExportTx( ) } -func (w *walletWithOptions) IssueTransformSubnetTx( +func (w *withOptions) IssueTransformSubnetTx( subnetID ids.ID, assetID ids.ID, initialSupply uint64, @@ -203,7 +203,7 @@ func (w *walletWithOptions) IssueTransformSubnetTx( ) } -func (w *walletWithOptions) IssueAddPermissionlessValidatorTx( +func (w *withOptions) IssueAddPermissionlessValidatorTx( vdr *txs.SubnetValidator, signer vmsigner.Signer, assetID ids.ID, @@ -223,7 +223,7 @@ func (w *walletWithOptions) IssueAddPermissionlessValidatorTx( ) } -func (w *walletWithOptions) IssueAddPermissionlessDelegatorTx( +func (w *withOptions) IssueAddPermissionlessDelegatorTx( vdr *txs.SubnetValidator, assetID ids.ID, rewardsOwner *secp256k1fx.OutputOwners, @@ -237,7 +237,7 @@ func (w *walletWithOptions) IssueAddPermissionlessDelegatorTx( ) } -func (w *walletWithOptions) IssueUnsignedTx( +func (w *withOptions) IssueUnsignedTx( utx txs.UnsignedTx, options ...common.Option, ) (*txs.Tx, error) { @@ -247,7 +247,7 @@ func (w *walletWithOptions) IssueUnsignedTx( ) } -func (w *walletWithOptions) IssueTx( +func (w *withOptions) IssueTx( tx *txs.Tx, options ...common.Option, ) error { diff --git a/wallet/subnet/primary/examples/get-p-chain-balance/main.go b/wallet/subnet/primary/examples/get-p-chain-balance/main.go index e190247515bf..a23c4c9b8e81 100644 --- a/wallet/subnet/primary/examples/get-p-chain-balance/main.go +++ b/wallet/subnet/primary/examples/get-p-chain-balance/main.go @@ -11,8 +11,8 @@ import ( "github.com/ava-labs/avalanchego/utils/constants" "github.com/ava-labs/avalanchego/utils/formatting/address" "github.com/ava-labs/avalanchego/utils/set" - "github.com/ava-labs/avalanchego/wallet/chain/p" "github.com/ava-labs/avalanchego/wallet/chain/p/builder" + "github.com/ava-labs/avalanchego/wallet/chain/p/wallet" "github.com/ava-labs/avalanchego/wallet/subnet/primary" "github.com/ava-labs/avalanchego/wallet/subnet/primary/common" ) @@ -38,7 +38,7 @@ func main() { log.Printf("fetched state of %s in %s\n", addrStr, time.Since(fetchStartTime)) pUTXOs := common.NewChainUTXOs(constants.PlatformChainID, state.UTXOs) - pBackend := p.NewBackend(state.PCTX, pUTXOs, nil) + pBackend := wallet.NewBackend(state.PCTX, pUTXOs, nil) pBuilder := builder.New(addresses, state.PCTX, pBackend) currentBalances, err := pBuilder.GetBalance() diff --git a/wallet/subnet/primary/wallet.go b/wallet/subnet/primary/wallet.go index d2c9f4d45050..2b35c944c39c 100644 --- a/wallet/subnet/primary/wallet.go +++ b/wallet/subnet/primary/wallet.go @@ -17,6 +17,7 @@ import ( pbuilder "github.com/ava-labs/avalanchego/wallet/chain/p/builder" psigner "github.com/ava-labs/avalanchego/wallet/chain/p/signer" + pwallet "github.com/ava-labs/avalanchego/wallet/chain/p/wallet" xbuilder "github.com/ava-labs/avalanchego/wallet/chain/x/builder" xsigner "github.com/ava-labs/avalanchego/wallet/chain/x/signer" ) @@ -25,18 +26,18 @@ var _ Wallet = (*wallet)(nil) // Wallet provides chain wallets for the primary network. type Wallet interface { - P() p.Wallet + P() pwallet.Wallet X() x.Wallet C() c.Wallet } type wallet struct { - p p.Wallet + p pwallet.Wallet x x.Wallet c c.Wallet } -func (w *wallet) P() p.Wallet { +func (w *wallet) P() pwallet.Wallet { return w.p } @@ -49,7 +50,7 @@ func (w *wallet) C() c.Wallet { } // Creates a new default wallet -func NewWallet(p p.Wallet, x x.Wallet, c c.Wallet) Wallet { +func NewWallet(p pwallet.Wallet, x x.Wallet, c c.Wallet) Wallet { return &wallet{ p: p, x: x, @@ -60,7 +61,7 @@ func NewWallet(p p.Wallet, x x.Wallet, c c.Wallet) Wallet { // Creates a Wallet with the given set of options func NewWalletWithOptions(w Wallet, options ...common.Option) Wallet { return NewWallet( - p.NewWalletWithOptions(w.P(), options...), + pwallet.WithOptions(w.P(), options...), x.NewWalletWithOptions(w.X(), options...), c.NewWalletWithOptions(w.C(), options...), ) @@ -105,7 +106,8 @@ func MakeWallet(ctx context.Context, config *WalletConfig) (Wallet, error) { return nil, err } pUTXOs := common.NewChainUTXOs(constants.PlatformChainID, avaxState.UTXOs) - pBackend := p.NewBackend(avaxState.PCTX, pUTXOs, subnetOwners) + pBackend := pwallet.NewBackend(avaxState.PCTX, pUTXOs, subnetOwners) + pClient := p.NewClient(avaxState.PClient, pBackend) pBuilder := pbuilder.New(avaxAddrs, avaxState.PCTX, pBackend) pSigner := psigner.New(config.AVAXKeychain, pBackend) @@ -122,7 +124,7 @@ func MakeWallet(ctx context.Context, config *WalletConfig) (Wallet, error) { cSigner := c.NewSigner(config.AVAXKeychain, config.EthKeychain, cBackend) return NewWallet( - p.NewWallet(pBuilder, pSigner, avaxState.PClient, pBackend), + pwallet.New(pClient, pBuilder, pSigner), x.NewWallet(xBuilder, xSigner, avaxState.XClient, xBackend), c.NewWallet(cBuilder, cSigner, avaxState.CClient, ethState.Client, cBackend), ), nil From eefd6c3053c95899b8180d286f53b285234555a2 Mon Sep 17 00:00:00 2001 From: Stephen Buttolph Date: Tue, 20 Aug 2024 16:05:15 -0400 Subject: [PATCH 2/5] save --- wallet/chain/p/wallet/backend_visitor.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wallet/chain/p/wallet/backend_visitor.go b/wallet/chain/p/wallet/backend_visitor.go index c7cec9544da1..61dc3e231da7 100644 --- a/wallet/chain/p/wallet/backend_visitor.go +++ b/wallet/chain/p/wallet/backend_visitor.go @@ -1,7 +1,7 @@ // Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved. // See the file LICENSE for licensing terms. -package p +package wallet import ( "context" From 3e27a8e58064518a2d5ca822988502f30a98679f Mon Sep 17 00:00:00 2001 From: Stephen Buttolph Date: Tue, 20 Aug 2024 16:08:15 -0400 Subject: [PATCH 3/5] nit --- wallet/chain/p/client.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/wallet/chain/p/client.go b/wallet/chain/p/client.go index 190bfbddf281..62378eb1dd2f 100644 --- a/wallet/chain/p/client.go +++ b/wallet/chain/p/client.go @@ -15,25 +15,25 @@ import ( var ( ErrNotCommitted = errors.New("not committed") - _ wallet.Client = (*client)(nil) + _ wallet.Client = (*Client)(nil) ) func NewClient( c platformvm.Client, b wallet.Backend, -) wallet.Client { - return &client{ +) *Client { + return &Client{ client: c, backend: b, } } -type client struct { +type Client struct { client platformvm.Client backend wallet.Backend } -func (c *client) IssueTx( +func (c *Client) IssueTx( tx *txs.Tx, options ...common.Option, ) error { From 9db6d873058e3ea8a0b06d1bad598f24516a687c Mon Sep 17 00:00:00 2001 From: Stephen Buttolph Date: Tue, 20 Aug 2024 16:09:15 -0400 Subject: [PATCH 4/5] deadcode --- wallet/chain/p/client.go | 8 +------- wallet/chain/p/wallet/wallet.go | 7 +------ 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/wallet/chain/p/client.go b/wallet/chain/p/client.go index 62378eb1dd2f..6575f5deed75 100644 --- a/wallet/chain/p/client.go +++ b/wallet/chain/p/client.go @@ -4,19 +4,13 @@ package p import ( - "errors" - "github.com/ava-labs/avalanchego/vms/platformvm" "github.com/ava-labs/avalanchego/vms/platformvm/txs" "github.com/ava-labs/avalanchego/wallet/chain/p/wallet" "github.com/ava-labs/avalanchego/wallet/subnet/primary/common" ) -var ( - ErrNotCommitted = errors.New("not committed") - - _ wallet.Client = (*Client)(nil) -) +var _ wallet.Client = (*Client)(nil) func NewClient( c platformvm.Client, diff --git a/wallet/chain/p/wallet/wallet.go b/wallet/chain/p/wallet/wallet.go index 1892defe505d..d7414f1b3e28 100644 --- a/wallet/chain/p/wallet/wallet.go +++ b/wallet/chain/p/wallet/wallet.go @@ -4,7 +4,6 @@ package wallet import ( - "errors" "time" "github.com/ava-labs/avalanchego/ids" @@ -18,11 +17,7 @@ import ( walletsigner "github.com/ava-labs/avalanchego/wallet/chain/p/signer" ) -var ( - ErrNotCommitted = errors.New("not committed") - - _ Wallet = (*wallet)(nil) -) +var _ Wallet = (*wallet)(nil) type Client interface { // IssueTx issues the signed tx. From 348be199941b4403129d8fc854f791bbe9681279 Mon Sep 17 00:00:00 2001 From: Stephen Buttolph Date: Tue, 20 Aug 2024 16:15:53 -0400 Subject: [PATCH 5/5] nit --- wallet/chain/p/wallet/{wallet_with_options.go => with_options.go} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename wallet/chain/p/wallet/{wallet_with_options.go => with_options.go} (100%) diff --git a/wallet/chain/p/wallet/wallet_with_options.go b/wallet/chain/p/wallet/with_options.go similarity index 100% rename from wallet/chain/p/wallet/wallet_with_options.go rename to wallet/chain/p/wallet/with_options.go