Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Changelog for NeoFS Node
## [Unreleased]

### Added
- `neofs-adm mainchain update-contract` command (#3799)

### Fixed

Expand Down
4 changes: 2 additions & 2 deletions cmd/neofs-adm/internal/modules/fschain/balance.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func balanceContainerPayment(cmd *cobra.Command, args []string) error {
}
}

c, err := getN3Client(viper.GetViper())
c, err := GetN3Client(viper.GetViper())
if err != nil {
return fmt.Errorf("can't create N3 client: %w", err)
}
Expand Down Expand Up @@ -155,7 +155,7 @@ func dumpBalances(cmd *cobra.Command, _ []string) error {
nmHash util.Uint160
)

c, err := getN3Client(viper.GetViper())
c, err := GetN3Client(viper.GetViper())
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/neofs-adm/internal/modules/fschain/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
const forceConfigSet = "force"

func dumpNetworkConfig(cmd *cobra.Command, _ []string) error {
c, err := getN3Client(viper.GetViper())
c, err := GetN3Client(viper.GetViper())
if err != nil {
return fmt.Errorf("can't create N3 client: %w", err)
}
Expand Down
4 changes: 2 additions & 2 deletions cmd/neofs-adm/internal/modules/fschain/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func dumpContainers(cmd *cobra.Command, _ []string) error {
return err
}

c, err := getN3Client(viper.GetViper())
c, err := GetN3Client(viper.GetViper())
if err != nil {
return fmt.Errorf("can't create N3 client: %w", err)
}
Expand Down Expand Up @@ -118,7 +118,7 @@ func dumpContainers(cmd *cobra.Command, _ []string) error {
}

func listContainers(cmd *cobra.Command, _ []string) error {
c, err := getN3Client(viper.GetViper())
c, err := GetN3Client(viper.GetViper())
if err != nil {
return fmt.Errorf("can't create N3 client: %w", err)
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/neofs-adm/internal/modules/fschain/dump_hashes.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ type contractDumpInfo struct {
}

func dumpContractHashes(cmd *cobra.Command, _ []string) error {
c, err := getN3Client(viper.GetViper())
c, err := GetN3Client(viper.GetViper())
if err != nil {
return fmt.Errorf("can't create N3 client: %w", err)
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/neofs-adm/internal/modules/fschain/dump_names.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ type nameExp struct {
}

func dumpNames(cmd *cobra.Command, _ []string) error {
c, err := getN3Client(viper.GetViper())
c, err := GetN3Client(viper.GetViper())
if err != nil {
return fmt.Errorf("can't create N3 client: %w", err)
}
Expand Down
11 changes: 6 additions & 5 deletions cmd/neofs-adm/internal/modules/fschain/initialize.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,17 +49,17 @@ func newInitializeContext(cmd *cobra.Command, v *viper.Viper) (*initializeContex
return nil, err
}

c, err := getN3Client(v)
c, err := GetN3Client(v)
if err != nil {
return nil, fmt.Errorf("can't create N3 client: %w", err)
}

committeeAcc, err := getWalletAccount(wallets[0], committeeAccountName)
committeeAcc, err := GetWalletAccount(wallets[0], committeeAccountName)
if err != nil {
return nil, fmt.Errorf("can't find committee account: %w", err)
}

consensusAcc, err := getWalletAccount(wallets[0], consensusAccountName)
consensusAcc, err := GetWalletAccount(wallets[0], consensusAccountName)
if err != nil {
return nil, fmt.Errorf("can't find consensus account: %w", err)
}
Expand All @@ -85,7 +85,7 @@ func newInitializeContext(cmd *cobra.Command, v *viper.Viper) (*initializeContex

accounts := make([]*wallet.Account, len(wallets))
for i, w := range wallets {
acc, err := getWalletAccount(w, singleAccountName)
acc, err := GetWalletAccount(w, singleAccountName)
if err != nil {
return nil, fmt.Errorf("wallet %s is invalid (no single account): %w", w.Path(), err)
}
Expand Down Expand Up @@ -346,7 +346,8 @@ func (c *initializeContext) sendMultiTx(script []byte, fancyScope bool, withCons
return c.sendTx(tx, c.Command, false)
}

func getWalletAccount(w *wallet.Wallet, typ string) (*wallet.Account, error) {
// GetWalletAccount returns account with the given label from the wallet.
func GetWalletAccount(w *wallet.Wallet, typ string) (*wallet.Account, error) {
for i := range w.Accounts {
if w.Accounts[i].Label == typ {
return w.Accounts[i], nil
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func (c *initializeContext) multiSign(tx *transaction.Transaction, accType strin
h = c.ConsensusAcc.Contract.ScriptHash()
}
for _, w := range c.Wallets {
acc, err := getWalletAccount(w, accType)
acc, err := GetWalletAccount(w, accType)
if err != nil {
return fmt.Errorf("can't find %s wallet account: %w", accType, err)
}
Expand Down
4 changes: 2 additions & 2 deletions cmd/neofs-adm/internal/modules/fschain/load.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func reportsFunc(cmd *cobra.Command, _ []string) error {
return fmt.Errorf("invalid container ID: %w", err)
}

c, err := getN3Client(viper.GetViper())
c, err := GetN3Client(viper.GetViper())
if err != nil {
return fmt.Errorf("can't create N3 client: %w", err)
}
Expand Down Expand Up @@ -122,7 +122,7 @@ func loadSummaryFunc(cmd *cobra.Command, args []string) error {
}
}

c, err := getN3Client(viper.GetViper())
c, err := GetN3Client(viper.GetViper())
if err != nil {
return fmt.Errorf("can't create N3 client: %w", err)
}
Expand Down
3 changes: 2 additions & 1 deletion cmd/neofs-adm/internal/modules/fschain/n3client.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ type clientContext struct {
SentTxs []hashVUBPair
}

func getN3Client(v *viper.Viper) (*rpcclient.Client, error) {
// GetN3Client creates and initializes neo-go RPC client using configuration from viper.
func GetN3Client(v *viper.Viper) (*rpcclient.Client, error) {
// number of opened connections
// by neo-go client per one host
const (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
)

func listNetmapCandidatesNodes(cmd *cobra.Command, _ []string) error {
c, err := getN3Client(viper.GetViper())
c, err := GetN3Client(viper.GetViper())
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/neofs-adm/internal/modules/fschain/nodes.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func nodesFunc(cmd *cobra.Command, _ []string) error {
return fmt.Errorf("invalid container ID: %w", err)
}

c, err := getN3Client(viper.GetViper())
c, err := GetN3Client(viper.GetViper())
if err != nil {
return fmt.Errorf("can't create N3 client: %w", err)
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/neofs-adm/internal/modules/fschain/notary.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ func depositNotary(cmd *cobra.Command, _ []string) error {
}
}

c, err := getN3Client(viper.GetViper())
c, err := GetN3Client(viper.GetViper())
if err != nil {
return err
}
Expand Down
4 changes: 2 additions & 2 deletions cmd/neofs-adm/internal/modules/fschain/quota.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func quotaContainerFunc(cmd *cobra.Command, args []string) error {
return fmt.Errorf("invalid container ID: %w", err)
}

c, err := getN3Client(viper.GetViper())
c, err := GetN3Client(viper.GetViper())
if err != nil {
return fmt.Errorf("can't create N3 client: %w", err)
}
Expand Down Expand Up @@ -171,7 +171,7 @@ func quotaUserFunc(cmd *cobra.Command, args []string) error {
return fmt.Errorf("invalid user account: %w", err)
}

c, err := getN3Client(viper.GetViper())
c, err := GetN3Client(viper.GetViper())
if err != nil {
return fmt.Errorf("can't create N3 client: %w", err)
}
Expand Down
4 changes: 2 additions & 2 deletions cmd/neofs-adm/internal/modules/fschain/verified_domains.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const tokenNotFound = "token not found"
func verifiedNodesDomainAccessList(cmd *cobra.Command, _ []string) error {
vpr := viper.GetViper()

n3Client, err := getN3Client(vpr)
n3Client, err := GetN3Client(vpr)
if err != nil {
return fmt.Errorf("open connection: %w", err)
}
Expand Down Expand Up @@ -150,7 +150,7 @@ func verifiedNodesDomainSetAccessList(cmd *cobra.Command, _ []string) error {
return fmt.Errorf("failed to unlock the account with password: %w", err)
}

n3Client, err := getN3Client(vpr)
n3Client, err := GetN3Client(vpr)
if err != nil {
return fmt.Errorf("open connection: %w", err)
}
Expand Down
17 changes: 17 additions & 0 deletions cmd/neofs-adm/internal/modules/mainchain/root.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package mainchain

import (
"github.com/spf13/cobra"
)

// RootCmd is the root command for mainchain operations.
var RootCmd = &cobra.Command{
Use: "mainchain",
Short: "Main chain network operations",
}

func init() {
RootCmd.AddCommand(updateContractCommand)

initUpdateContractCmd()
}
Loading
Loading