forked from TrueCloudLab/frostfs-node
[#1019] adm: Fetch subnet
SH from NNS
Also, delete `-a` (`--contract`) flag. Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
This commit is contained in:
parent
f9bcb6f5e3
commit
b4c36a109d
1 changed files with 6 additions and 11 deletions
|
@ -8,7 +8,6 @@ import (
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"github.com/nspcc-dev/neo-go/pkg/crypto/keys"
|
"github.com/nspcc-dev/neo-go/pkg/crypto/keys"
|
||||||
"github.com/nspcc-dev/neo-go/pkg/util"
|
|
||||||
"github.com/nspcc-dev/neofs-node/cmd/neofs-adm/internal/modules/morph/internal"
|
"github.com/nspcc-dev/neofs-node/cmd/neofs-adm/internal/modules/morph/internal"
|
||||||
"github.com/nspcc-dev/neofs-node/pkg/morph/client"
|
"github.com/nspcc-dev/neofs-node/pkg/morph/client"
|
||||||
morphsubnet "github.com/nspcc-dev/neofs-node/pkg/morph/client/subnet"
|
morphsubnet "github.com/nspcc-dev/neofs-node/pkg/morph/client/subnet"
|
||||||
|
@ -26,8 +25,6 @@ const (
|
||||||
flagSubnetEndpoint = endpointFlag
|
flagSubnetEndpoint = endpointFlag
|
||||||
// filepath to private key
|
// filepath to private key
|
||||||
flagSubnetKey = "key"
|
flagSubnetKey = "key"
|
||||||
// contract address
|
|
||||||
flagSubnetContract = "contract"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func viperBindFlags(cmd *cobra.Command, flags ...string) {
|
func viperBindFlags(cmd *cobra.Command, flags ...string) {
|
||||||
|
@ -44,7 +41,6 @@ var cmdSubnet = &cobra.Command{
|
||||||
viperBindFlags(cmd,
|
viperBindFlags(cmd,
|
||||||
flagSubnetEndpoint,
|
flagSubnetEndpoint,
|
||||||
flagSubnetKey,
|
flagSubnetKey,
|
||||||
flagSubnetContract,
|
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -105,18 +101,18 @@ func initSubnetClientCheckNotary(c *morphsubnet.Client, key *keys.PrivateKey, ch
|
||||||
return errors.New("missing endpoint")
|
return errors.New("missing endpoint")
|
||||||
}
|
}
|
||||||
|
|
||||||
// read contract address
|
|
||||||
contractAddr, err := util.Uint160DecodeStringLE(viper.GetString(flagSubnetContract))
|
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("subnet contract address: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
// create base morph client
|
// create base morph client
|
||||||
cMorph, err := client.New(key, endpoint)
|
cMorph, err := client.New(key, endpoint)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// read contract address
|
||||||
|
contractAddr, err := cMorph.NNSContractAddress(client.NNSSubnetworkContractName)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("read subnet contract address in NNS: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
// calc client mode
|
// calc client mode
|
||||||
cMode := morphsubnet.NonNotary
|
cMode := morphsubnet.NonNotary
|
||||||
|
|
||||||
|
@ -856,7 +852,6 @@ func init() {
|
||||||
_ = cmdSubnet.MarkFlagRequired(flagSubnetEndpoint)
|
_ = cmdSubnet.MarkFlagRequired(flagSubnetEndpoint)
|
||||||
cmdSubnetFlags.StringP(flagSubnetKey, "k", "", "Path to file with private key")
|
cmdSubnetFlags.StringP(flagSubnetKey, "k", "", "Path to file with private key")
|
||||||
_ = cmdSubnet.MarkFlagRequired(flagSubnetKey)
|
_ = cmdSubnet.MarkFlagRequired(flagSubnetKey)
|
||||||
cmdSubnetFlags.StringP(flagSubnetContract, "a", "", "Subnet contract address (string LE)")
|
|
||||||
|
|
||||||
// add all subnet commands to corresponding command section
|
// add all subnet commands to corresponding command section
|
||||||
addCommandInheritPreRun(cmdSubnet,
|
addCommandInheritPreRun(cmdSubnet,
|
||||||
|
|
Loading…
Reference in a new issue