From 64b2df39b5f182b86aa5ded461c2222adb1d15a0 Mon Sep 17 00:00:00 2001 From: Aaron Buchwald Date: Wed, 10 Jun 2020 16:47:31 -0400 Subject: [PATCH 1/7] Split admin api into admin and info apis --- api/admin/service.go | 96 +------------------------------- api/info/service.go | 130 +++++++++++++++++++++++++++++++++++++++++++ main/params.go | 1 + node/config.go | 1 + node/node.go | 12 +++- 5 files changed, 144 insertions(+), 96 deletions(-) create mode 100644 api/info/service.go diff --git a/api/admin/service.go b/api/admin/service.go index e05a440..baf8fe7 100644 --- a/api/admin/service.go +++ b/api/admin/service.go @@ -10,129 +10,35 @@ import ( "github.com/ava-labs/gecko/api" "github.com/ava-labs/gecko/chains" - "github.com/ava-labs/gecko/genesis" - "github.com/ava-labs/gecko/ids" "github.com/ava-labs/gecko/network" "github.com/ava-labs/gecko/snow/engine/common" "github.com/ava-labs/gecko/utils/logging" - "github.com/ava-labs/gecko/version" cjson "github.com/ava-labs/gecko/utils/json" ) // Admin is the API service for node admin management type Admin struct { - version version.Version - nodeID ids.ShortID - networkID uint32 log logging.Logger - networking network.Network performance Performance chainManager chains.Manager httpServer *api.Server } // NewService returns a new admin API service -func NewService(version version.Version, nodeID ids.ShortID, networkID uint32, log logging.Logger, chainManager chains.Manager, peers network.Network, httpServer *api.Server) *common.HTTPHandler { +func NewService(log logging.Logger, chainManager chains.Manager, peers network.Network, httpServer *api.Server) *common.HTTPHandler { newServer := rpc.NewServer() codec := cjson.NewCodec() newServer.RegisterCodec(codec, "application/json") newServer.RegisterCodec(codec, "application/json;charset=UTF-8") newServer.RegisterService(&Admin{ - version: version, - nodeID: nodeID, - networkID: networkID, log: log, chainManager: chainManager, - networking: peers, httpServer: httpServer, }, "admin") return &common.HTTPHandler{Handler: newServer} } -// GetNodeVersionReply are the results from calling GetNodeVersion -type GetNodeVersionReply struct { - Version string `json:"version"` -} - -// GetNodeVersion returns the version this node is running -func (service *Admin) GetNodeVersion(_ *http.Request, _ *struct{}, reply *GetNodeVersionReply) error { - service.log.Debug("Admin: GetNodeVersion called") - - reply.Version = service.version.String() - return nil -} - -// GetNodeIDReply are the results from calling GetNodeID -type GetNodeIDReply struct { - NodeID ids.ShortID `json:"nodeID"` -} - -// GetNodeID returns the node ID of this node -func (service *Admin) GetNodeID(_ *http.Request, _ *struct{}, reply *GetNodeIDReply) error { - service.log.Debug("Admin: GetNodeID called") - - reply.NodeID = service.nodeID - return nil -} - -// GetNetworkIDReply are the results from calling GetNetworkID -type GetNetworkIDReply struct { - NetworkID cjson.Uint32 `json:"networkID"` -} - -// GetNetworkID returns the network ID this node is running on -func (service *Admin) GetNetworkID(_ *http.Request, _ *struct{}, reply *GetNetworkIDReply) error { - service.log.Debug("Admin: GetNetworkID called") - - reply.NetworkID = cjson.Uint32(service.networkID) - return nil -} - -// GetNetworkNameReply is the result from calling GetNetworkName -type GetNetworkNameReply struct { - NetworkName string `json:"networkName"` -} - -// GetNetworkName returns the network name this node is running on -func (service *Admin) GetNetworkName(_ *http.Request, _ *struct{}, reply *GetNetworkNameReply) error { - service.log.Debug("Admin: GetNetworkName called") - - reply.NetworkName = genesis.NetworkName(service.networkID) - return nil -} - -// GetBlockchainIDArgs are the arguments for calling GetBlockchainID -type GetBlockchainIDArgs struct { - Alias string `json:"alias"` -} - -// GetBlockchainIDReply are the results from calling GetBlockchainID -type GetBlockchainIDReply struct { - BlockchainID string `json:"blockchainID"` -} - -// GetBlockchainID returns the blockchain ID that resolves the alias that was supplied -func (service *Admin) GetBlockchainID(_ *http.Request, args *GetBlockchainIDArgs, reply *GetBlockchainIDReply) error { - service.log.Debug("Admin: GetBlockchainID called") - - bID, err := service.chainManager.Lookup(args.Alias) - reply.BlockchainID = bID.String() - return err -} - -// PeersReply are the results from calling Peers -type PeersReply struct { - Peers []network.PeerID `json:"peers"` -} - -// Peers returns the list of current validators -func (service *Admin) Peers(_ *http.Request, _ *struct{}, reply *PeersReply) error { - service.log.Debug("Admin: Peers called") - reply.Peers = service.networking.Peers() - return nil -} - // StartCPUProfilerArgs are the arguments for calling StartCPUProfiler type StartCPUProfilerArgs struct { Filename string `json:"filename"` diff --git a/api/info/service.go b/api/info/service.go new file mode 100644 index 0000000..a1e1937 --- /dev/null +++ b/api/info/service.go @@ -0,0 +1,130 @@ +// (c) 2019-2020, Ava Labs, Inc. All rights reserved. +// See the file LICENSE for licensing terms. + +package info + +import ( + "net/http" + + "github.com/gorilla/rpc/v2" + + "github.com/ava-labs/gecko/chains" + "github.com/ava-labs/gecko/genesis" + "github.com/ava-labs/gecko/ids" + "github.com/ava-labs/gecko/network" + "github.com/ava-labs/gecko/snow/engine/common" + "github.com/ava-labs/gecko/utils/logging" + "github.com/ava-labs/gecko/version" + + cjson "github.com/ava-labs/gecko/utils/json" +) + +// Info is the API service for unprivileged info on a node +type Info struct { + version version.Version + nodeID ids.ShortID + networkID uint32 + log logging.Logger + networking network.Network + chainManager chains.Manager +} + +// NewService returns a new admin API service +func NewService(log logging.Logger, version version.Version, nodeID ids.ShortID, networkID uint32, chainManager chains.Manager, peers network.Network) *common.HTTPHandler { + newServer := rpc.NewServer() + codec := cjson.NewCodec() + newServer.RegisterCodec(codec, "application/json") + newServer.RegisterCodec(codec, "application/json;charset=UTF-8") + newServer.RegisterService(&Info{ + version: version, + nodeID: nodeID, + networkID: networkID, + log: log, + chainManager: chainManager, + networking: peers, + }, "info") + return &common.HTTPHandler{Handler: newServer} +} + +// GetNodeVersionReply are the results from calling GetNodeVersion +type GetNodeVersionReply struct { + Version string `json:"version"` +} + +// GetNodeVersion returns the version this node is running +func (service *Info) GetNodeVersion(_ *http.Request, _ *struct{}, reply *GetNodeVersionReply) error { + service.log.Debug("Info: GetNodeVersion called") + + reply.Version = service.version.String() + return nil +} + +// GetNodeIDReply are the results from calling GetNodeID +type GetNodeIDReply struct { + NodeID ids.ShortID `json:"nodeID"` +} + +// GetNodeID returns the node ID of this node +func (service *Info) GetNodeID(_ *http.Request, _ *struct{}, reply *GetNodeIDReply) error { + service.log.Debug("Info: GetNodeID called") + + reply.NodeID = service.nodeID + return nil +} + +// GetNetworkIDReply are the results from calling GetNetworkID +type GetNetworkIDReply struct { + NetworkID cjson.Uint32 `json:"networkID"` +} + +// GetNetworkID returns the network ID this node is running on +func (service *Info) GetNetworkID(_ *http.Request, _ *struct{}, reply *GetNetworkIDReply) error { + service.log.Debug("Info: GetNetworkID called") + + reply.NetworkID = cjson.Uint32(service.networkID) + return nil +} + +// GetNetworkNameReply is the result from calling GetNetworkName +type GetNetworkNameReply struct { + NetworkName string `json:"networkName"` +} + +// GetNetworkName returns the network name this node is running on +func (service *Info) GetNetworkName(_ *http.Request, _ *struct{}, reply *GetNetworkNameReply) error { + service.log.Debug("Info: GetNetworkName called") + + reply.NetworkName = genesis.NetworkName(service.networkID) + return nil +} + +// GetBlockchainIDArgs are the arguments for calling GetBlockchainID +type GetBlockchainIDArgs struct { + Alias string `json:"alias"` +} + +// GetBlockchainIDReply are the results from calling GetBlockchainID +type GetBlockchainIDReply struct { + BlockchainID string `json:"blockchainID"` +} + +// GetBlockchainID returns the blockchain ID that resolves the alias that was supplied +func (service *Info) GetBlockchainID(_ *http.Request, args *GetBlockchainIDArgs, reply *GetBlockchainIDReply) error { + service.log.Debug("Info: GetBlockchainID called") + + bID, err := service.chainManager.Lookup(args.Alias) + reply.BlockchainID = bID.String() + return err +} + +// PeersReply are the results from calling Peers +type PeersReply struct { + Peers []network.PeerID `json:"peers"` +} + +// Peers returns the list of current validators +func (service *Info) Peers(_ *http.Request, _ *struct{}, reply *PeersReply) error { + service.log.Debug("Info: Peers called") + reply.Peers = service.networking.Peers() + return nil +} diff --git a/main/params.go b/main/params.go index eef8e60..74383bd 100644 --- a/main/params.go +++ b/main/params.go @@ -222,6 +222,7 @@ func init() { // Enable/Disable APIs: fs.BoolVar(&Config.AdminAPIEnabled, "api-admin-enabled", true, "If true, this node exposes the Admin API") + fs.BoolVar(&Config.InfoAPIEnabled, "api-info-enabled", true, "If true, this node exposes the Info API") fs.BoolVar(&Config.KeystoreAPIEnabled, "api-keystore-enabled", true, "If true, this node exposes the Keystore API") fs.BoolVar(&Config.MetricsAPIEnabled, "api-metrics-enabled", true, "If true, this node exposes the Metrics API") fs.BoolVar(&Config.HealthAPIEnabled, "api-health-enabled", true, "If true, this node exposes the Health API") diff --git a/node/config.go b/node/config.go index 74ff491..29e79b9 100644 --- a/node/config.go +++ b/node/config.go @@ -50,6 +50,7 @@ type Config struct { // Enable/Disable APIs AdminAPIEnabled bool + InfoAPIEnabled bool KeystoreAPIEnabled bool MetricsAPIEnabled bool HealthAPIEnabled bool diff --git a/node/node.go b/node/node.go index ea0e8fc..0bb2c24 100644 --- a/node/node.go +++ b/node/node.go @@ -18,6 +18,7 @@ import ( "github.com/ava-labs/gecko/api" "github.com/ava-labs/gecko/api/admin" "github.com/ava-labs/gecko/api/health" + "github.com/ava-labs/gecko/api/info" "github.com/ava-labs/gecko/api/ipcs" "github.com/ava-labs/gecko/api/keystore" "github.com/ava-labs/gecko/api/metrics" @@ -461,11 +462,19 @@ func (n *Node) initMetricsAPI() { func (n *Node) initAdminAPI() { if n.Config.AdminAPIEnabled { n.Log.Info("initializing Admin API") - service := admin.NewService(Version, n.ID, n.Config.NetworkID, n.Log, n.chainManager, n.Net, &n.APIServer) + service := admin.NewService(n.Log, n.chainManager, n.Net, &n.APIServer) n.APIServer.AddRoute(service, &sync.RWMutex{}, "admin", "", n.HTTPLog) } } +func (n *Node) initInfoAPI() { + if n.Config.InfoAPIEnabled { + n.Log.Info("initializing Info API") + service := info.NewService(n.Log, Version, n.ID, n.Config.NetworkID, n.chainManager, n.Net) + n.APIServer.AddRoute(service, &sync.RWMutex{}, "info", "", n.HTTPLog) + } +} + // initHealthAPI initializes the Health API service // Assumes n.Log, n.ConsensusAPI, and n.ValidatorAPI already initialized func (n *Node) initHealthAPI() { @@ -562,6 +571,7 @@ func (n *Node) Initialize(Config *Config, logger logging.Logger, logFactory logg n.initChainManager() // Set up the chain manager n.initAdminAPI() // Start the Admin API + n.initInfoAPI() // Start the Info API n.initHealthAPI() // Start the Health API n.initIPCAPI() // Start the IPC API From 3d60db3a05a7f9e5dcd8ff821c7f16270d2d9848 Mon Sep 17 00:00:00 2001 From: Gabriel Cardona Date: Thu, 11 Jun 2020 13:14:02 -0700 Subject: [PATCH 2/7] Subtract from balance when adding a default subnet delegator. --- vms/platformvm/add_default_subnet_delegator_tx.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vms/platformvm/add_default_subnet_delegator_tx.go b/vms/platformvm/add_default_subnet_delegator_tx.go index 3012d84..9881652 100644 --- a/vms/platformvm/add_default_subnet_delegator_tx.go +++ b/vms/platformvm/add_default_subnet_delegator_tx.go @@ -128,7 +128,7 @@ func (tx *addDefaultSubnetDelegatorTx) SemanticVerify(db database.Database) (*ve // The account if this block's proposal is committed and the validator is // added to the pending validator set. (Increase the account's nonce; // decrease its balance.) - newAccount, err := account.Remove(0, tx.Nonce) // Remove also removes the fee + newAccount, err := account.Remove(tx.Wght, tx.Nonce) // Remove also removes the fee if err != nil { return nil, nil, nil, nil, permError{err} } From 4223e1f9d53bf769aada5a9ee0e2703d7029b23d Mon Sep 17 00:00:00 2001 From: Dan Laine Date: Tue, 16 Jun 2020 17:51:49 -0400 Subject: [PATCH 3/7] remove unnecessary call to Has --- vms/components/state/state.go | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/vms/components/state/state.go b/vms/components/state/state.go index d4d0da8..24b50e3 100644 --- a/vms/components/state/state.go +++ b/vms/components/state/state.go @@ -128,19 +128,10 @@ func (s *state) Get(db database.Database, typeID uint64, key ids.ID) (interface{ // The unique ID of this key/typeID pair uID := s.uniqueID(key, typeID) - // See if exists in database - exists, err := db.Has(uID.Bytes()) - if err != nil { - return nil, err - } - if !exists { - return nil, database.ErrNotFound - } - // Get the value from the database valueBytes, err := db.Get(uID.Bytes()) if err != nil { - return nil, fmt.Errorf("problem getting value from database: %w", err) + return nil, err } // Unmarshal the value from bytes and return it From ddcc2d73a2022c260f0d0b24906435e46ae29765 Mon Sep 17 00:00:00 2001 From: Dan Laine Date: Tue, 16 Jun 2020 18:14:16 -0400 Subject: [PATCH 4/7] lazily fetch block status --- vms/components/core/block.go | 4 +-- vms/components/core/block_test.go | 48 +++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+), 3 deletions(-) create mode 100644 vms/components/core/block_test.go diff --git a/vms/components/core/block.go b/vms/components/core/block.go index 3609477..6d1d37b 100644 --- a/vms/components/core/block.go +++ b/vms/components/core/block.go @@ -34,8 +34,7 @@ type Block struct { func (b *Block) Initialize(bytes []byte, vm *SnowmanVM) { b.VM = vm b.Metadata.Initialize(bytes) - status := b.VM.State.GetStatus(vm.DB, b.ID()) - b.SetStatus(status) + b.SetStatus(choices.Unknown) // don't set status until it is queried } // ParentID returns [b]'s parent's ID @@ -55,7 +54,6 @@ func (b *Block) Parent() snowman.Block { // Recall that b.vm.DB.Commit() must be called to persist to the DB func (b *Block) Accept() error { b.SetStatus(choices.Accepted) // Change state of this block - blkID := b.ID() // Persist data diff --git a/vms/components/core/block_test.go b/vms/components/core/block_test.go new file mode 100644 index 0000000..d9d30bc --- /dev/null +++ b/vms/components/core/block_test.go @@ -0,0 +1,48 @@ +package core + +import ( + "testing" + + "github.com/ava-labs/gecko/snow/choices" + "github.com/ava-labs/gecko/snow/consensus/snowman" + + "github.com/ava-labs/gecko/ids" + + "github.com/ava-labs/gecko/database/memdb" + "github.com/ava-labs/gecko/database/versiondb" +) + +func TestBlock(t *testing.T) { + parentID := ids.NewID([32]byte{1, 2, 3, 4, 5}) + db := versiondb.New(memdb.New()) + state, err := NewSnowmanState(func([]byte) (snowman.Block, error) { return nil, nil }) + if err != nil { + t.Fatal(err) + } + b := NewBlock(parentID) + + b.Initialize([]byte{1, 2, 3}, &SnowmanVM{ + DB: db, + State: state, + }) + + // should be unknown until someone queries for it + if status := b.Metadata.status; status != choices.Unknown { + t.Fatalf("status should be unknown but is %s", status) + } + + // querying should change status to processing + if status := b.Status(); status != choices.Processing { + t.Fatalf("status should be processing but is %s", status) + } + + b.Accept() + if status := b.Status(); status != choices.Accepted { + t.Fatalf("status should be accepted but is %s", status) + } + + b.Reject() + if status := b.Status(); status != choices.Rejected { + t.Fatalf("status should be rejected but is %s", status) + } +} From 82b91e52445149d642d25906e92a656082ac407d Mon Sep 17 00:00:00 2001 From: Gabriel Cardona Date: Wed, 17 Jun 2020 10:00:41 -0700 Subject: [PATCH 5/7] Add tests for platform.addDefaultSubnetDelegator for confirming tx fails when attempting to delegate too much as well as confirming balance is correct after delegating. --- .../add_default_subnet_delegator_tx_test.go | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/vms/platformvm/add_default_subnet_delegator_tx_test.go b/vms/platformvm/add_default_subnet_delegator_tx_test.go index 65a0a71..0dcdd7b 100644 --- a/vms/platformvm/add_default_subnet_delegator_tx_test.go +++ b/vms/platformvm/add_default_subnet_delegator_tx_test.go @@ -386,4 +386,52 @@ func TestAddDefaultSubnetDelegatorTxSemanticVerify(t *testing.T) { t.Fatal("should have failed verification because payer account has no $AVA to pay fee") } txFee = txFeeSaved // Reset tx fee + + // Case 8: fail verification for spending more funds than it has + tx, err = vm.newAddDefaultSubnetDelegatorTx( + 1, // nonce (new account has nonce 0 so use nonce 1) + defaultBalance*2, // weight + uint64(defaultValidateStartTime.Unix()), // start time + uint64(defaultValidateEndTime.Unix()), // end time + defaultKey.PublicKey().Address(), // node ID + defaultKey.PublicKey().Address(), // destination + testNetworkID, // network ID + newAcctKey.(*crypto.PrivateKeySECP256K1R), // tx fee payer + ) + if err != nil { + t.Fatal(err) + } + _, _, _, _, err = tx.SemanticVerify(vm.DB) + if err == nil { + t.Fatal("should have failed verification because payer account spent twice the default balance") + } + + // Case 9: Confirm balance is correct + tx, err = vm.newAddDefaultSubnetDelegatorTx( + 1, // nonce (new account has nonce 0 so use nonce 1) + defaultStakeAmount, // weight + uint64(defaultValidateStartTime.Unix()), // start time + uint64(defaultValidateEndTime.Unix()), // end time + defaultKey.PublicKey().Address(), // node ID + defaultKey.PublicKey().Address(), // destination + testNetworkID, // network ID + newAcctKey.(*crypto.PrivateKeySECP256K1R), // tx fee payer + ) + if err != nil { + t.Fatal(err) + } + + onCommitDB, _, _, _, err := tx.SemanticVerify(vm.DB) + if err != nil { + t.Fatal(err) + } + account, err := tx.vm.getAccount(onCommitDB, defaultKey.PublicKey().Address()) + if err != nil { + t.Fatal(err) + } + balance := account.Balance + + if balance == defaultBalance-(defaultStakeAmount+txFee) { + t.Fatal("") + } } From 077afc20e73367b0b91570a38de44f89bc788b7e Mon Sep 17 00:00:00 2001 From: Aaron Buchwald Date: Wed, 17 Jun 2020 13:16:37 -0400 Subject: [PATCH 6/7] Adjust delegator test cases --- .../add_default_subnet_delegator_tx_test.go | 44 +++++++++---------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/vms/platformvm/add_default_subnet_delegator_tx_test.go b/vms/platformvm/add_default_subnet_delegator_tx_test.go index 0dcdd7b..99bdc11 100644 --- a/vms/platformvm/add_default_subnet_delegator_tx_test.go +++ b/vms/platformvm/add_default_subnet_delegator_tx_test.go @@ -335,9 +335,9 @@ func TestAddDefaultSubnetDelegatorTxSemanticVerify(t *testing.T) { } tx, err = vm.newAddDefaultSubnetDelegatorTx( - defaultNonce+1, // nonce - defaultStakeAmount, // weight - uint64(newTimestamp.Unix()), // start time + defaultNonce+1, // nonce + defaultStakeAmount, // weight + uint64(newTimestamp.Unix()), // start time uint64(newTimestamp.Add(MinimumStakingDuration).Unix()), // end time defaultKey.PublicKey().Address(), // node ID defaultKey.PublicKey().Address(), // destination @@ -389,33 +389,33 @@ func TestAddDefaultSubnetDelegatorTxSemanticVerify(t *testing.T) { // Case 8: fail verification for spending more funds than it has tx, err = vm.newAddDefaultSubnetDelegatorTx( - 1, // nonce (new account has nonce 0 so use nonce 1) - defaultBalance*2, // weight - uint64(defaultValidateStartTime.Unix()), // start time - uint64(defaultValidateEndTime.Unix()), // end time - defaultKey.PublicKey().Address(), // node ID - defaultKey.PublicKey().Address(), // destination - testNetworkID, // network ID - newAcctKey.(*crypto.PrivateKeySECP256K1R), // tx fee payer + defaultNonce+1, + defaultBalance*2, // weight + uint64(defaultValidateStartTime.Unix()), // start time + uint64(defaultValidateEndTime.Unix()), // end time + defaultKey.PublicKey().Address(), // node ID + defaultKey.PublicKey().Address(), // destination + testNetworkID, // network ID + defaultKey, // tx fee payer ) if err != nil { t.Fatal(err) } _, _, _, _, err = tx.SemanticVerify(vm.DB) if err == nil { - t.Fatal("should have failed verification because payer account spent twice the default balance") + t.Fatal("should have failed verification because payer account spent twice the account's balance") } // Case 9: Confirm balance is correct tx, err = vm.newAddDefaultSubnetDelegatorTx( - 1, // nonce (new account has nonce 0 so use nonce 1) - defaultStakeAmount, // weight - uint64(defaultValidateStartTime.Unix()), // start time - uint64(defaultValidateEndTime.Unix()), // end time - defaultKey.PublicKey().Address(), // node ID - defaultKey.PublicKey().Address(), // destination - testNetworkID, // network ID - newAcctKey.(*crypto.PrivateKeySECP256K1R), // tx fee payer + defaultNonce+1, + defaultStakeAmount, // weight + uint64(defaultValidateStartTime.Unix()), // start time + uint64(defaultValidateEndTime.Unix()), // end time + defaultKey.PublicKey().Address(), // node ID + defaultKey.PublicKey().Address(), // destination + testNetworkID, // network ID + defaultKey, // tx fee payer ) if err != nil { t.Fatal(err) @@ -431,7 +431,7 @@ func TestAddDefaultSubnetDelegatorTxSemanticVerify(t *testing.T) { } balance := account.Balance - if balance == defaultBalance-(defaultStakeAmount+txFee) { - t.Fatal("") + if balance != defaultBalance-(defaultStakeAmount+txFee) { + t.Fatalf("balance was not updated correctly after subnet delegator tx") } } From f40fa7d7e6a5aec02bcddd8dc749257dcbc2fa04 Mon Sep 17 00:00:00 2001 From: Gabriel Cardona Date: Wed, 17 Jun 2020 10:21:11 -0700 Subject: [PATCH 7/7] Formatting. --- vms/platformvm/add_default_subnet_delegator_tx_test.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/vms/platformvm/add_default_subnet_delegator_tx_test.go b/vms/platformvm/add_default_subnet_delegator_tx_test.go index 99bdc11..9380001 100644 --- a/vms/platformvm/add_default_subnet_delegator_tx_test.go +++ b/vms/platformvm/add_default_subnet_delegator_tx_test.go @@ -335,9 +335,9 @@ func TestAddDefaultSubnetDelegatorTxSemanticVerify(t *testing.T) { } tx, err = vm.newAddDefaultSubnetDelegatorTx( - defaultNonce+1, // nonce - defaultStakeAmount, // weight - uint64(newTimestamp.Unix()), // start time + defaultNonce+1, // nonce + defaultStakeAmount, // weight + uint64(newTimestamp.Unix()), // start time uint64(newTimestamp.Add(MinimumStakingDuration).Unix()), // end time defaultKey.PublicKey().Address(), // node ID defaultKey.PublicKey().Address(), // destination