forked from TrueCloudLab/frostfs-node
[#932] adm: Move generate.go
to package generate
Signed-off-by: Anton Nikiforov <an.nikiforov@yadro.com>
This commit is contained in:
parent
b8cf0a6b88
commit
86b2515744
6 changed files with 104 additions and 92 deletions
|
@ -1,4 +1,4 @@
|
||||||
package morph
|
package generate
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
|
@ -24,9 +24,9 @@ import (
|
||||||
"golang.org/x/sync/errgroup"
|
"golang.org/x/sync/errgroup"
|
||||||
)
|
)
|
||||||
|
|
||||||
func generateAlphabetCreds(cmd *cobra.Command, _ []string) error {
|
func AlphabetCreds(cmd *cobra.Command, _ []string) error {
|
||||||
// alphabet size is not part of the config
|
// alphabet size is not part of the config
|
||||||
size, err := cmd.Flags().GetUint(alphabetSizeFlag)
|
size, err := cmd.Flags().GetUint(morphUtil.AlphabetSizeFlag)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package morph
|
package generate
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
@ -21,57 +21,55 @@ import (
|
||||||
"golang.org/x/term"
|
"golang.org/x/term"
|
||||||
)
|
)
|
||||||
|
|
||||||
const testContractPassword = "grouppass"
|
|
||||||
|
|
||||||
func TestGenerateAlphabet(t *testing.T) {
|
func TestGenerateAlphabet(t *testing.T) {
|
||||||
const size = 4
|
const size = 4
|
||||||
|
|
||||||
walletDir := t.TempDir()
|
walletDir := t.TempDir()
|
||||||
buf := setupTestTerminal(t)
|
buf := setupTestTerminal(t)
|
||||||
|
|
||||||
cmd := generateAlphabetCmd
|
cmd := GenerateAlphabetCmd
|
||||||
v := viper.GetViper()
|
v := viper.GetViper()
|
||||||
|
|
||||||
t.Run("zero size", func(t *testing.T) {
|
t.Run("zero size", func(t *testing.T) {
|
||||||
buf.Reset()
|
buf.Reset()
|
||||||
v.Set(util.AlphabetWalletsFlag, walletDir)
|
v.Set(util.AlphabetWalletsFlag, walletDir)
|
||||||
require.NoError(t, cmd.Flags().Set(alphabetSizeFlag, "0"))
|
require.NoError(t, cmd.Flags().Set(util.AlphabetSizeFlag, "0"))
|
||||||
buf.WriteString("pass\r")
|
buf.WriteString("pass\r")
|
||||||
require.Error(t, generateAlphabetCreds(cmd, nil))
|
require.Error(t, AlphabetCreds(cmd, nil))
|
||||||
})
|
})
|
||||||
t.Run("no password provided", func(t *testing.T) {
|
t.Run("no password provided", func(t *testing.T) {
|
||||||
buf.Reset()
|
buf.Reset()
|
||||||
v.Set(util.AlphabetWalletsFlag, walletDir)
|
v.Set(util.AlphabetWalletsFlag, walletDir)
|
||||||
require.NoError(t, cmd.Flags().Set(alphabetSizeFlag, "1"))
|
require.NoError(t, cmd.Flags().Set(util.AlphabetSizeFlag, "1"))
|
||||||
require.Error(t, generateAlphabetCreds(cmd, nil))
|
require.Error(t, AlphabetCreds(cmd, nil))
|
||||||
})
|
})
|
||||||
t.Run("missing directory", func(t *testing.T) {
|
t.Run("missing directory", func(t *testing.T) {
|
||||||
buf.Reset()
|
buf.Reset()
|
||||||
dir := filepath.Join(os.TempDir(), "notexist."+strconv.FormatUint(rand.Uint64(), 10))
|
dir := filepath.Join(os.TempDir(), "notexist."+strconv.FormatUint(rand.Uint64(), 10))
|
||||||
v.Set(util.AlphabetWalletsFlag, dir)
|
v.Set(util.AlphabetWalletsFlag, dir)
|
||||||
require.NoError(t, cmd.Flags().Set(alphabetSizeFlag, "1"))
|
require.NoError(t, cmd.Flags().Set(util.AlphabetSizeFlag, "1"))
|
||||||
buf.WriteString("pass\r")
|
buf.WriteString("pass\r")
|
||||||
require.Error(t, generateAlphabetCreds(cmd, nil))
|
require.Error(t, AlphabetCreds(cmd, nil))
|
||||||
})
|
})
|
||||||
t.Run("no password for contract group wallet", func(t *testing.T) {
|
t.Run("no password for contract group wallet", func(t *testing.T) {
|
||||||
buf.Reset()
|
buf.Reset()
|
||||||
v.Set(util.AlphabetWalletsFlag, walletDir)
|
v.Set(util.AlphabetWalletsFlag, walletDir)
|
||||||
require.NoError(t, cmd.Flags().Set(alphabetSizeFlag, strconv.FormatUint(size, 10)))
|
require.NoError(t, cmd.Flags().Set(util.AlphabetSizeFlag, strconv.FormatUint(size, 10)))
|
||||||
for i := uint64(0); i < size; i++ {
|
for i := uint64(0); i < size; i++ {
|
||||||
buf.WriteString(strconv.FormatUint(i, 10) + "\r")
|
buf.WriteString(strconv.FormatUint(i, 10) + "\r")
|
||||||
}
|
}
|
||||||
require.Error(t, generateAlphabetCreds(cmd, nil))
|
require.Error(t, AlphabetCreds(cmd, nil))
|
||||||
})
|
})
|
||||||
|
|
||||||
buf.Reset()
|
buf.Reset()
|
||||||
v.Set(util.AlphabetWalletsFlag, walletDir)
|
v.Set(util.AlphabetWalletsFlag, walletDir)
|
||||||
require.NoError(t, generateAlphabetCmd.Flags().Set(alphabetSizeFlag, strconv.FormatUint(size, 10)))
|
require.NoError(t, GenerateAlphabetCmd.Flags().Set(util.AlphabetSizeFlag, strconv.FormatUint(size, 10)))
|
||||||
for i := uint64(0); i < size; i++ {
|
for i := uint64(0); i < size; i++ {
|
||||||
buf.WriteString(strconv.FormatUint(i, 10) + "\r")
|
buf.WriteString(strconv.FormatUint(i, 10) + "\r")
|
||||||
}
|
}
|
||||||
|
|
||||||
buf.WriteString(testContractPassword + "\r")
|
buf.WriteString(util.TestContractPassword + "\r")
|
||||||
require.NoError(t, generateAlphabetCreds(generateAlphabetCmd, nil))
|
require.NoError(t, AlphabetCreds(GenerateAlphabetCmd, nil))
|
||||||
|
|
||||||
var wg sync.WaitGroup
|
var wg sync.WaitGroup
|
||||||
for i := uint64(0); i < size; i++ {
|
for i := uint64(0); i < size; i++ {
|
||||||
|
@ -105,7 +103,7 @@ func TestGenerateAlphabet(t *testing.T) {
|
||||||
w, err := wallet.NewWalletFromFile(p)
|
w, err := wallet.NewWalletFromFile(p)
|
||||||
require.NoError(t, err, "contract wallet doesn't exist")
|
require.NoError(t, err, "contract wallet doesn't exist")
|
||||||
require.Equal(t, 1, len(w.Accounts), "contract wallet must have 1 accout")
|
require.Equal(t, 1, len(w.Accounts), "contract wallet must have 1 accout")
|
||||||
require.NoError(t, w.Accounts[0].Decrypt(testContractPassword, keys.NEP2ScryptParams()))
|
require.NoError(t, w.Accounts[0].Decrypt(util.TestContractPassword, keys.NEP2ScryptParams()))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
76
cmd/frostfs-adm/internal/modules/morph/generate/root.go
Normal file
76
cmd/frostfs-adm/internal/modules/morph/generate/root.go
Normal file
|
@ -0,0 +1,76 @@
|
||||||
|
package generate
|
||||||
|
|
||||||
|
import (
|
||||||
|
"git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-adm/internal/modules/morph/util"
|
||||||
|
"github.com/spf13/cobra"
|
||||||
|
"github.com/spf13/viper"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
storageWalletLabelFlag = "label"
|
||||||
|
storageGasCLIFlag = "initial-gas"
|
||||||
|
storageGasConfigFlag = "storage.initial_gas"
|
||||||
|
walletAddressFlag = "wallet-address"
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
GenerateStorageCmd = &cobra.Command{
|
||||||
|
Use: "generate-storage-wallet",
|
||||||
|
Short: "Generate storage node wallet for the morph network",
|
||||||
|
PreRun: func(cmd *cobra.Command, _ []string) {
|
||||||
|
_ = viper.BindPFlag(util.AlphabetWalletsFlag, cmd.Flags().Lookup(util.AlphabetWalletsFlag))
|
||||||
|
_ = viper.BindPFlag(util.EndpointFlag, cmd.Flags().Lookup(util.EndpointFlag))
|
||||||
|
_ = viper.BindPFlag(storageGasConfigFlag, cmd.Flags().Lookup(storageGasCLIFlag))
|
||||||
|
},
|
||||||
|
RunE: generateStorageCreds,
|
||||||
|
}
|
||||||
|
RefillGasCmd = &cobra.Command{
|
||||||
|
Use: "refill-gas",
|
||||||
|
Short: "Refill GAS of storage node's wallet in the morph network",
|
||||||
|
PreRun: func(cmd *cobra.Command, _ []string) {
|
||||||
|
_ = viper.BindPFlag(util.AlphabetWalletsFlag, cmd.Flags().Lookup(util.AlphabetWalletsFlag))
|
||||||
|
_ = viper.BindPFlag(util.EndpointFlag, cmd.Flags().Lookup(util.EndpointFlag))
|
||||||
|
_ = viper.BindPFlag(util.RefillGasAmountFlag, cmd.Flags().Lookup(util.RefillGasAmountFlag))
|
||||||
|
},
|
||||||
|
RunE: func(cmd *cobra.Command, args []string) error {
|
||||||
|
return refillGas(cmd, util.RefillGasAmountFlag, false)
|
||||||
|
},
|
||||||
|
}
|
||||||
|
GenerateAlphabetCmd = &cobra.Command{
|
||||||
|
Use: "generate-alphabet",
|
||||||
|
Short: "Generate alphabet wallets for consensus nodes of the morph network",
|
||||||
|
PreRun: func(cmd *cobra.Command, _ []string) {
|
||||||
|
// PreRun fixes https://github.com/spf13/viper/issues/233
|
||||||
|
_ = viper.BindPFlag(util.AlphabetWalletsFlag, cmd.Flags().Lookup(util.AlphabetWalletsFlag))
|
||||||
|
},
|
||||||
|
RunE: AlphabetCreds,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
func initRefillGasCmd() {
|
||||||
|
RefillGasCmd.Flags().String(util.AlphabetWalletsFlag, "", util.AlphabetWalletsFlagDesc)
|
||||||
|
RefillGasCmd.Flags().StringP(util.EndpointFlag, util.EndpointFlagShort, "", util.EndpointFlagDesc)
|
||||||
|
RefillGasCmd.Flags().String(util.StorageWalletFlag, "", "Path to storage node wallet")
|
||||||
|
RefillGasCmd.Flags().String(walletAddressFlag, "", "Address of wallet")
|
||||||
|
RefillGasCmd.Flags().String(util.RefillGasAmountFlag, "", "Additional amount of GAS to transfer")
|
||||||
|
RefillGasCmd.MarkFlagsMutuallyExclusive(walletAddressFlag, util.StorageWalletFlag)
|
||||||
|
}
|
||||||
|
|
||||||
|
func initGenerateStorageCmd() {
|
||||||
|
GenerateStorageCmd.Flags().String(util.AlphabetWalletsFlag, "", util.AlphabetWalletsFlagDesc)
|
||||||
|
GenerateStorageCmd.Flags().StringP(util.EndpointFlag, util.EndpointFlagShort, "", util.EndpointFlagDesc)
|
||||||
|
GenerateStorageCmd.Flags().String(util.StorageWalletFlag, "", "Path to new storage node wallet")
|
||||||
|
GenerateStorageCmd.Flags().String(storageGasCLIFlag, "", "Initial amount of GAS to transfer")
|
||||||
|
GenerateStorageCmd.Flags().StringP(storageWalletLabelFlag, "l", "", "Wallet label")
|
||||||
|
}
|
||||||
|
|
||||||
|
func initGenerateAlphabetCmd() {
|
||||||
|
GenerateAlphabetCmd.Flags().String(util.AlphabetWalletsFlag, "", util.AlphabetWalletsFlagDesc)
|
||||||
|
GenerateAlphabetCmd.Flags().Uint(util.AlphabetSizeFlag, 7, "Amount of alphabet wallets to generate")
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
initRefillGasCmd()
|
||||||
|
initGenerateStorageCmd()
|
||||||
|
initGenerateAlphabetCmd()
|
||||||
|
}
|
|
@ -10,6 +10,7 @@ import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
cmdConfig "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-adm/internal/modules/morph/config"
|
cmdConfig "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-adm/internal/modules/morph/config"
|
||||||
|
"git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-adm/internal/modules/morph/generate"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-adm/internal/modules/morph/netmap"
|
"git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-adm/internal/modules/morph/netmap"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-adm/internal/modules/morph/node"
|
"git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-adm/internal/modules/morph/node"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-adm/internal/modules/morph/policy"
|
"git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-adm/internal/modules/morph/policy"
|
||||||
|
@ -100,12 +101,12 @@ func generateTestData(t *testing.T, dir string, size int) error {
|
||||||
v.Set(util.AlphabetWalletsFlag, dir)
|
v.Set(util.AlphabetWalletsFlag, dir)
|
||||||
|
|
||||||
sizeStr := strconv.FormatUint(uint64(size), 10)
|
sizeStr := strconv.FormatUint(uint64(size), 10)
|
||||||
if err := generateAlphabetCmd.Flags().Set(alphabetSizeFlag, sizeStr); err != nil {
|
if err := generate.GenerateAlphabetCmd.Flags().Set(util.AlphabetSizeFlag, sizeStr); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
setTestCredentials(v, size)
|
setTestCredentials(v, size)
|
||||||
if err := generateAlphabetCreds(generateAlphabetCmd, nil); err != nil {
|
if err := generate.AlphabetCreds(generate.GenerateAlphabetCmd, nil); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -148,7 +149,7 @@ func setTestCredentials(v *viper.Viper, size int) {
|
||||||
for i := 0; i < size; i++ {
|
for i := 0; i < size; i++ {
|
||||||
v.Set("credentials."+innerring.GlagoliticLetter(i).String(), strconv.FormatUint(uint64(i), 10))
|
v.Set("credentials."+innerring.GlagoliticLetter(i).String(), strconv.FormatUint(uint64(i), 10))
|
||||||
}
|
}
|
||||||
v.Set("credentials.contract", testContractPassword)
|
v.Set("credentials.contract", util.TestContractPassword)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestNextPollInterval(t *testing.T) {
|
func TestNextPollInterval(t *testing.T) {
|
||||||
|
|
|
@ -7,6 +7,7 @@ import (
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-adm/internal/modules/morph/container"
|
"git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-adm/internal/modules/morph/container"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-adm/internal/modules/morph/contract"
|
"git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-adm/internal/modules/morph/contract"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-adm/internal/modules/morph/frostfsid"
|
"git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-adm/internal/modules/morph/frostfsid"
|
||||||
|
"git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-adm/internal/modules/morph/generate"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-adm/internal/modules/morph/netmap"
|
"git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-adm/internal/modules/morph/netmap"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-adm/internal/modules/morph/node"
|
"git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-adm/internal/modules/morph/node"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-adm/internal/modules/morph/notary"
|
"git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-adm/internal/modules/morph/notary"
|
||||||
|
@ -18,12 +19,6 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
alphabetSizeFlag = "size"
|
|
||||||
|
|
||||||
storageWalletLabelFlag = "label"
|
|
||||||
storageGasCLIFlag = "initial-gas"
|
|
||||||
storageGasConfigFlag = "storage.initial_gas"
|
|
||||||
|
|
||||||
maxObjectSizeCLIFlag = "max-object-size"
|
maxObjectSizeCLIFlag = "max-object-size"
|
||||||
|
|
||||||
epochDurationCLIFlag = "epoch-duration"
|
epochDurationCLIFlag = "epoch-duration"
|
||||||
|
@ -36,8 +31,6 @@ const (
|
||||||
homomorphicHashDisabledCLIFlag = "homomorphic-disabled"
|
homomorphicHashDisabledCLIFlag = "homomorphic-disabled"
|
||||||
|
|
||||||
withdrawFeeCLIFlag = "withdraw-fee"
|
withdrawFeeCLIFlag = "withdraw-fee"
|
||||||
|
|
||||||
walletAddressFlag = "wallet-address"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -47,16 +40,6 @@ var (
|
||||||
Short: "Section for morph network configuration commands",
|
Short: "Section for morph network configuration commands",
|
||||||
}
|
}
|
||||||
|
|
||||||
generateAlphabetCmd = &cobra.Command{
|
|
||||||
Use: "generate-alphabet",
|
|
||||||
Short: "Generate alphabet wallets for consensus nodes of the morph network",
|
|
||||||
PreRun: func(cmd *cobra.Command, _ []string) {
|
|
||||||
// PreRun fixes https://github.com/spf13/viper/issues/233
|
|
||||||
_ = viper.BindPFlag(util.AlphabetWalletsFlag, cmd.Flags().Lookup(util.AlphabetWalletsFlag))
|
|
||||||
},
|
|
||||||
RunE: generateAlphabetCreds,
|
|
||||||
}
|
|
||||||
|
|
||||||
initCmd = &cobra.Command{
|
initCmd = &cobra.Command{
|
||||||
Use: "init",
|
Use: "init",
|
||||||
Short: "Initialize side chain network with smart-contracts and network settings",
|
Short: "Initialize side chain network with smart-contracts and network settings",
|
||||||
|
@ -74,37 +57,13 @@ var (
|
||||||
},
|
},
|
||||||
RunE: initializeSideChainCmd,
|
RunE: initializeSideChainCmd,
|
||||||
}
|
}
|
||||||
|
|
||||||
generateStorageCmd = &cobra.Command{
|
|
||||||
Use: "generate-storage-wallet",
|
|
||||||
Short: "Generate storage node wallet for the morph network",
|
|
||||||
PreRun: func(cmd *cobra.Command, _ []string) {
|
|
||||||
_ = viper.BindPFlag(util.AlphabetWalletsFlag, cmd.Flags().Lookup(util.AlphabetWalletsFlag))
|
|
||||||
_ = viper.BindPFlag(util.EndpointFlag, cmd.Flags().Lookup(util.EndpointFlag))
|
|
||||||
_ = viper.BindPFlag(storageGasConfigFlag, cmd.Flags().Lookup(storageGasCLIFlag))
|
|
||||||
},
|
|
||||||
RunE: generateStorageCreds,
|
|
||||||
}
|
|
||||||
|
|
||||||
refillGasCmd = &cobra.Command{
|
|
||||||
Use: "refill-gas",
|
|
||||||
Short: "Refill GAS of storage node's wallet in the morph network",
|
|
||||||
PreRun: func(cmd *cobra.Command, _ []string) {
|
|
||||||
_ = viper.BindPFlag(util.AlphabetWalletsFlag, cmd.Flags().Lookup(util.AlphabetWalletsFlag))
|
|
||||||
_ = viper.BindPFlag(util.EndpointFlag, cmd.Flags().Lookup(util.EndpointFlag))
|
|
||||||
_ = viper.BindPFlag(util.RefillGasAmountFlag, cmd.Flags().Lookup(util.RefillGasAmountFlag))
|
|
||||||
},
|
|
||||||
RunE: func(cmd *cobra.Command, args []string) error {
|
|
||||||
return refillGas(cmd, util.RefillGasAmountFlag, false)
|
|
||||||
},
|
|
||||||
}
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
initGenerateAlphabetCmd()
|
RootCmd.AddCommand(generate.RefillGasCmd)
|
||||||
initInitCmd()
|
initInitCmd()
|
||||||
RootCmd.AddCommand(contract.DeployCmd)
|
RootCmd.AddCommand(contract.DeployCmd)
|
||||||
initGenerateStorageCmd()
|
RootCmd.AddCommand(generate.GenerateStorageCmd)
|
||||||
RootCmd.AddCommand(netmap.ForceNewEpoch)
|
RootCmd.AddCommand(netmap.ForceNewEpoch)
|
||||||
RootCmd.AddCommand(node.RemoveCmd)
|
RootCmd.AddCommand(node.RemoveCmd)
|
||||||
RootCmd.AddCommand(policy.Set)
|
RootCmd.AddCommand(policy.Set)
|
||||||
|
@ -117,7 +76,7 @@ func init() {
|
||||||
RootCmd.AddCommand(container.ListCmd)
|
RootCmd.AddCommand(container.ListCmd)
|
||||||
RootCmd.AddCommand(container.RestoreCmd)
|
RootCmd.AddCommand(container.RestoreCmd)
|
||||||
RootCmd.AddCommand(container.DumpCmd)
|
RootCmd.AddCommand(container.DumpCmd)
|
||||||
initRefillGasCmd()
|
RootCmd.AddCommand(generate.GenerateAlphabetCmd)
|
||||||
RootCmd.AddCommand(notary.DepositCmd)
|
RootCmd.AddCommand(notary.DepositCmd)
|
||||||
RootCmd.AddCommand(netmap.CandidatesCmd)
|
RootCmd.AddCommand(netmap.CandidatesCmd)
|
||||||
|
|
||||||
|
@ -128,25 +87,6 @@ func init() {
|
||||||
RootCmd.AddCommand(frostfsid.Cmd)
|
RootCmd.AddCommand(frostfsid.Cmd)
|
||||||
}
|
}
|
||||||
|
|
||||||
func initRefillGasCmd() {
|
|
||||||
RootCmd.AddCommand(refillGasCmd)
|
|
||||||
refillGasCmd.Flags().String(util.AlphabetWalletsFlag, "", util.AlphabetWalletsFlagDesc)
|
|
||||||
refillGasCmd.Flags().StringP(util.EndpointFlag, util.EndpointFlagShort, "", util.EndpointFlagDesc)
|
|
||||||
refillGasCmd.Flags().String(util.StorageWalletFlag, "", "Path to storage node wallet")
|
|
||||||
refillGasCmd.Flags().String(walletAddressFlag, "", "Address of wallet")
|
|
||||||
refillGasCmd.Flags().String(util.RefillGasAmountFlag, "", "Additional amount of GAS to transfer")
|
|
||||||
refillGasCmd.MarkFlagsMutuallyExclusive(walletAddressFlag, util.StorageWalletFlag)
|
|
||||||
}
|
|
||||||
|
|
||||||
func initGenerateStorageCmd() {
|
|
||||||
RootCmd.AddCommand(generateStorageCmd)
|
|
||||||
generateStorageCmd.Flags().String(util.AlphabetWalletsFlag, "", util.AlphabetWalletsFlagDesc)
|
|
||||||
generateStorageCmd.Flags().StringP(util.EndpointFlag, util.EndpointFlagShort, "", util.EndpointFlagDesc)
|
|
||||||
generateStorageCmd.Flags().String(util.StorageWalletFlag, "", "Path to new storage node wallet")
|
|
||||||
generateStorageCmd.Flags().String(storageGasCLIFlag, "", "Initial amount of GAS to transfer")
|
|
||||||
generateStorageCmd.Flags().StringP(storageWalletLabelFlag, "l", "", "Wallet label")
|
|
||||||
}
|
|
||||||
|
|
||||||
func initInitCmd() {
|
func initInitCmd() {
|
||||||
RootCmd.AddCommand(initCmd)
|
RootCmd.AddCommand(initCmd)
|
||||||
initCmd.Flags().String(util.AlphabetWalletsFlag, "", util.AlphabetWalletsFlagDesc)
|
initCmd.Flags().String(util.AlphabetWalletsFlag, "", util.AlphabetWalletsFlagDesc)
|
||||||
|
@ -163,9 +103,3 @@ func initInitCmd() {
|
||||||
initCmd.Flags().String(util.LocalDumpFlag, "", "Path to the blocks dump file")
|
initCmd.Flags().String(util.LocalDumpFlag, "", "Path to the blocks dump file")
|
||||||
initCmd.MarkFlagsMutuallyExclusive(util.ContractsInitFlag, util.ContractsURLFlag)
|
initCmd.MarkFlagsMutuallyExclusive(util.ContractsInitFlag, util.ContractsURLFlag)
|
||||||
}
|
}
|
||||||
|
|
||||||
func initGenerateAlphabetCmd() {
|
|
||||||
RootCmd.AddCommand(generateAlphabetCmd)
|
|
||||||
generateAlphabetCmd.Flags().String(util.AlphabetWalletsFlag, "", util.AlphabetWalletsFlagDesc)
|
|
||||||
generateAlphabetCmd.Flags().Uint(alphabetSizeFlag, 7, "Amount of alphabet wallets to generate")
|
|
||||||
}
|
|
||||||
|
|
|
@ -32,6 +32,7 @@ const (
|
||||||
MaintenanceModeAllowedInitFlag = "network.maintenance_mode_allowed"
|
MaintenanceModeAllowedInitFlag = "network.maintenance_mode_allowed"
|
||||||
HomomorphicHashDisabledInitFlag = "network.homomorphic_hash_disabled"
|
HomomorphicHashDisabledInitFlag = "network.homomorphic_hash_disabled"
|
||||||
CustomZoneFlag = "domain"
|
CustomZoneFlag = "domain"
|
||||||
|
AlphabetSizeFlag = "size"
|
||||||
|
|
||||||
SingleAccountName = "single"
|
SingleAccountName = "single"
|
||||||
CommitteeAccountName = "committee"
|
CommitteeAccountName = "committee"
|
||||||
|
@ -56,6 +57,8 @@ const (
|
||||||
|
|
||||||
DeployMethodName = "deploy"
|
DeployMethodName = "deploy"
|
||||||
UpdateMethodName = "update"
|
UpdateMethodName = "update"
|
||||||
|
|
||||||
|
TestContractPassword = "grouppass"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|
Loading…
Reference in a new issue