2021-07-09 09:53:10 +00:00
|
|
|
package morph
|
|
|
|
|
|
|
|
import (
|
2024-02-01 07:20:17 +00:00
|
|
|
"git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-adm/internal/modules/morph/ape"
|
2024-01-31 14:26:26 +00:00
|
|
|
"git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-adm/internal/modules/morph/util"
|
2021-07-09 09:53:10 +00:00
|
|
|
"github.com/spf13/cobra"
|
|
|
|
"github.com/spf13/viper"
|
|
|
|
)
|
|
|
|
|
|
|
|
const (
|
2024-02-01 12:21:51 +00:00
|
|
|
alphabetSizeFlag = "size"
|
|
|
|
storageWalletFlag = "storage-wallet"
|
|
|
|
storageWalletLabelFlag = "label"
|
|
|
|
storageGasCLIFlag = "initial-gas"
|
|
|
|
storageGasConfigFlag = "storage.initial_gas"
|
|
|
|
|
|
|
|
maxObjectSizeCLIFlag = "max-object-size"
|
|
|
|
|
2022-05-05 18:28:11 +00:00
|
|
|
epochDurationCLIFlag = "epoch-duration"
|
|
|
|
containerFeeInitFlag = "network.fee.container"
|
|
|
|
containerAliasFeeInitFlag = "network.fee.container_alias"
|
|
|
|
containerFeeCLIFlag = "container-fee"
|
|
|
|
containerAliasFeeCLIFlag = "container-alias-fee"
|
|
|
|
candidateFeeInitFlag = "network.fee.candidate"
|
|
|
|
candidateFeeCLIFlag = "candidate-fee"
|
|
|
|
homomorphicHashDisabledInitFlag = "network.homomorphic_hash_disabled"
|
2022-10-13 12:11:53 +00:00
|
|
|
maintenanceModeAllowedInitFlag = "network.maintenance_mode_allowed"
|
2022-05-05 18:28:11 +00:00
|
|
|
homomorphicHashDisabledCLIFlag = "homomorphic-disabled"
|
|
|
|
withdrawFeeInitFlag = "network.fee.withdraw"
|
|
|
|
withdrawFeeCLIFlag = "withdraw-fee"
|
|
|
|
containerDumpFlag = "dump"
|
|
|
|
containerContractFlag = "container-contract"
|
|
|
|
containerIDsFlag = "cid"
|
|
|
|
refillGasAmountFlag = "gas"
|
|
|
|
walletAccountFlag = "account"
|
|
|
|
notaryDepositTillFlag = "till"
|
2024-01-31 14:26:26 +00:00
|
|
|
|
|
|
|
walletAddressFlag = "wallet-address"
|
2021-07-09 09:53:10 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
var (
|
|
|
|
// RootCmd is a root command of config section.
|
|
|
|
RootCmd = &cobra.Command{
|
|
|
|
Use: "morph",
|
2022-06-28 06:03:52 +00:00
|
|
|
Short: "Section for morph network configuration commands",
|
2021-07-09 09:53:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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
|
2024-02-01 06:51:24 +00:00
|
|
|
_ = viper.BindPFlag(util.AlphabetWalletsFlag, cmd.Flags().Lookup(util.AlphabetWalletsFlag))
|
2021-07-09 09:53:10 +00:00
|
|
|
},
|
|
|
|
RunE: generateAlphabetCreds,
|
|
|
|
}
|
|
|
|
|
|
|
|
initCmd = &cobra.Command{
|
|
|
|
Use: "init",
|
|
|
|
Short: "Initialize side chain network with smart-contracts and network settings",
|
|
|
|
PreRun: func(cmd *cobra.Command, _ []string) {
|
2024-02-01 06:51:24 +00:00
|
|
|
_ = viper.BindPFlag(util.AlphabetWalletsFlag, cmd.Flags().Lookup(util.AlphabetWalletsFlag))
|
2024-01-31 14:26:26 +00:00
|
|
|
_ = viper.BindPFlag(util.EndpointFlag, cmd.Flags().Lookup(util.EndpointFlag))
|
2024-02-01 12:21:51 +00:00
|
|
|
_ = viper.BindPFlag(util.EpochDurationInitFlag, cmd.Flags().Lookup(epochDurationCLIFlag))
|
|
|
|
_ = viper.BindPFlag(util.MaxObjectSizeInitFlag, cmd.Flags().Lookup(maxObjectSizeCLIFlag))
|
2022-05-05 18:28:11 +00:00
|
|
|
_ = viper.BindPFlag(homomorphicHashDisabledInitFlag, cmd.Flags().Lookup(homomorphicHashDisabledCLIFlag))
|
2021-08-03 12:05:10 +00:00
|
|
|
_ = viper.BindPFlag(candidateFeeInitFlag, cmd.Flags().Lookup(candidateFeeCLIFlag))
|
|
|
|
_ = viper.BindPFlag(containerFeeInitFlag, cmd.Flags().Lookup(containerFeeCLIFlag))
|
2021-10-18 12:01:38 +00:00
|
|
|
_ = viper.BindPFlag(containerAliasFeeInitFlag, cmd.Flags().Lookup(containerAliasFeeCLIFlag))
|
2021-08-03 12:05:10 +00:00
|
|
|
_ = viper.BindPFlag(withdrawFeeInitFlag, cmd.Flags().Lookup(withdrawFeeCLIFlag))
|
2024-01-31 14:26:26 +00:00
|
|
|
_ = viper.BindPFlag(util.ProtoConfigPath, cmd.Flags().Lookup(util.ProtoConfigPath))
|
2021-07-09 09:53:10 +00:00
|
|
|
},
|
|
|
|
RunE: initializeSideChainCmd,
|
|
|
|
}
|
|
|
|
|
|
|
|
generateStorageCmd = &cobra.Command{
|
|
|
|
Use: "generate-storage-wallet",
|
|
|
|
Short: "Generate storage node wallet for the morph network",
|
|
|
|
PreRun: func(cmd *cobra.Command, _ []string) {
|
2024-02-01 06:51:24 +00:00
|
|
|
_ = viper.BindPFlag(util.AlphabetWalletsFlag, cmd.Flags().Lookup(util.AlphabetWalletsFlag))
|
2024-01-31 14:26:26 +00:00
|
|
|
_ = viper.BindPFlag(util.EndpointFlag, cmd.Flags().Lookup(util.EndpointFlag))
|
2021-07-26 08:01:53 +00:00
|
|
|
_ = viper.BindPFlag(storageGasConfigFlag, cmd.Flags().Lookup(storageGasCLIFlag))
|
2021-07-09 09:53:10 +00:00
|
|
|
},
|
|
|
|
RunE: generateStorageCreds,
|
|
|
|
}
|
|
|
|
|
2021-08-25 07:35:16 +00:00
|
|
|
refillGasCmd = &cobra.Command{
|
|
|
|
Use: "refill-gas",
|
|
|
|
Short: "Refill GAS of storage node's wallet in the morph network",
|
|
|
|
PreRun: func(cmd *cobra.Command, _ []string) {
|
2024-02-01 06:51:24 +00:00
|
|
|
_ = viper.BindPFlag(util.AlphabetWalletsFlag, cmd.Flags().Lookup(util.AlphabetWalletsFlag))
|
2024-01-31 14:26:26 +00:00
|
|
|
_ = viper.BindPFlag(util.EndpointFlag, cmd.Flags().Lookup(util.EndpointFlag))
|
2021-08-25 07:35:16 +00:00
|
|
|
_ = viper.BindPFlag(refillGasAmountFlag, cmd.Flags().Lookup(refillGasAmountFlag))
|
|
|
|
},
|
|
|
|
RunE: func(cmd *cobra.Command, args []string) error {
|
|
|
|
return refillGas(cmd, refillGasAmountFlag, false)
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
2021-07-09 09:53:10 +00:00
|
|
|
forceNewEpoch = &cobra.Command{
|
|
|
|
Use: "force-new-epoch",
|
2023-01-27 10:47:14 +00:00
|
|
|
Short: "Create new FrostFS epoch event in the side chain",
|
2021-07-09 09:53:10 +00:00
|
|
|
PreRun: func(cmd *cobra.Command, _ []string) {
|
2024-02-01 06:51:24 +00:00
|
|
|
_ = viper.BindPFlag(util.AlphabetWalletsFlag, cmd.Flags().Lookup(util.AlphabetWalletsFlag))
|
2024-01-31 14:26:26 +00:00
|
|
|
_ = viper.BindPFlag(util.EndpointFlag, cmd.Flags().Lookup(util.EndpointFlag))
|
2021-07-09 09:53:10 +00:00
|
|
|
},
|
|
|
|
RunE: forceNewEpochCmd,
|
|
|
|
}
|
2021-07-28 14:10:02 +00:00
|
|
|
|
2022-06-27 14:47:13 +00:00
|
|
|
removeNodes = &cobra.Command{
|
|
|
|
Use: "remove-nodes key1 [key2 [...]]",
|
|
|
|
Short: "Remove storage nodes from the netmap",
|
|
|
|
Long: `Move nodes to the Offline state in the candidates list and tick an epoch to update the netmap`,
|
|
|
|
PreRun: func(cmd *cobra.Command, _ []string) {
|
2024-02-01 06:51:24 +00:00
|
|
|
_ = viper.BindPFlag(util.AlphabetWalletsFlag, cmd.Flags().Lookup(util.AlphabetWalletsFlag))
|
2024-01-31 14:26:26 +00:00
|
|
|
_ = viper.BindPFlag(util.EndpointFlag, cmd.Flags().Lookup(util.EndpointFlag))
|
2022-06-27 14:47:13 +00:00
|
|
|
},
|
|
|
|
RunE: removeNodesCmd,
|
|
|
|
}
|
|
|
|
|
2022-05-11 18:35:49 +00:00
|
|
|
setConfig = &cobra.Command{
|
|
|
|
Use: "set-config key1=val1 [key2=val2 ...]",
|
|
|
|
DisableFlagsInUseLine: true,
|
2023-01-27 10:47:14 +00:00
|
|
|
Short: "Add/update global config value in the FrostFS network",
|
2022-05-11 18:35:49 +00:00
|
|
|
PreRun: func(cmd *cobra.Command, _ []string) {
|
2024-02-01 06:51:24 +00:00
|
|
|
_ = viper.BindPFlag(util.AlphabetWalletsFlag, cmd.Flags().Lookup(util.AlphabetWalletsFlag))
|
2024-01-31 14:26:26 +00:00
|
|
|
_ = viper.BindPFlag(util.EndpointFlag, cmd.Flags().Lookup(util.EndpointFlag))
|
2022-05-11 18:35:49 +00:00
|
|
|
},
|
|
|
|
Args: cobra.MinimumNArgs(1),
|
|
|
|
RunE: setConfigCmd,
|
|
|
|
}
|
|
|
|
|
2022-04-04 15:36:10 +00:00
|
|
|
setPolicy = &cobra.Command{
|
|
|
|
Use: "set-policy [ExecFeeFactor=<n1>] [StoragePrice=<n2>] [FeePerByte=<n3>]",
|
|
|
|
DisableFlagsInUseLine: true,
|
|
|
|
Short: "Set global policy values",
|
|
|
|
PreRun: func(cmd *cobra.Command, _ []string) {
|
2024-02-01 06:51:24 +00:00
|
|
|
_ = viper.BindPFlag(util.AlphabetWalletsFlag, cmd.Flags().Lookup(util.AlphabetWalletsFlag))
|
2024-01-31 14:26:26 +00:00
|
|
|
_ = viper.BindPFlag(util.EndpointFlag, cmd.Flags().Lookup(util.EndpointFlag))
|
2022-04-04 15:36:10 +00:00
|
|
|
},
|
|
|
|
RunE: setPolicyCmd,
|
2022-07-08 13:12:47 +00:00
|
|
|
ValidArgsFunction: func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
|
|
|
return []string{"ExecFeeFactor=", "StoragePrice=", "FeePerByte="}, cobra.ShellCompDirectiveNoSpace
|
|
|
|
},
|
2022-04-04 15:36:10 +00:00
|
|
|
}
|
|
|
|
|
2023-11-02 13:20:37 +00:00
|
|
|
dumpPolicy = &cobra.Command{
|
|
|
|
Use: "dump-policy",
|
|
|
|
Short: "Dump FrostFS policy",
|
|
|
|
PreRun: func(cmd *cobra.Command, _ []string) {
|
2024-01-31 14:26:26 +00:00
|
|
|
_ = viper.BindPFlag(util.EndpointFlag, cmd.Flags().Lookup(util.EndpointFlag))
|
2023-11-02 13:20:37 +00:00
|
|
|
},
|
|
|
|
RunE: dumpPolicyCmd,
|
|
|
|
}
|
|
|
|
|
2021-07-28 14:10:02 +00:00
|
|
|
dumpContractHashesCmd = &cobra.Command{
|
|
|
|
Use: "dump-hashes",
|
2022-06-28 06:03:52 +00:00
|
|
|
Short: "Dump deployed contract hashes",
|
2021-07-28 14:10:02 +00:00
|
|
|
PreRun: func(cmd *cobra.Command, _ []string) {
|
2024-01-31 14:26:26 +00:00
|
|
|
_ = viper.BindPFlag(util.EndpointFlag, cmd.Flags().Lookup(util.EndpointFlag))
|
2021-07-28 14:10:02 +00:00
|
|
|
},
|
|
|
|
RunE: dumpContractHashes,
|
|
|
|
}
|
2021-08-03 12:05:10 +00:00
|
|
|
|
|
|
|
dumpNetworkConfigCmd = &cobra.Command{
|
|
|
|
Use: "dump-config",
|
2023-01-27 10:47:14 +00:00
|
|
|
Short: "Dump FrostFS network config",
|
2021-08-03 12:05:10 +00:00
|
|
|
PreRun: func(cmd *cobra.Command, _ []string) {
|
2024-01-31 14:26:26 +00:00
|
|
|
_ = viper.BindPFlag(util.EndpointFlag, cmd.Flags().Lookup(util.EndpointFlag))
|
2021-08-03 12:05:10 +00:00
|
|
|
},
|
|
|
|
RunE: dumpNetworkConfig,
|
|
|
|
}
|
2021-08-06 11:28:07 +00:00
|
|
|
|
2022-04-11 14:25:58 +00:00
|
|
|
dumpBalancesCmd = &cobra.Command{
|
|
|
|
Use: "dump-balances",
|
|
|
|
Short: "Dump GAS balances",
|
|
|
|
PreRun: func(cmd *cobra.Command, _ []string) {
|
2024-01-31 14:26:26 +00:00
|
|
|
_ = viper.BindPFlag(util.EndpointFlag, cmd.Flags().Lookup(util.EndpointFlag))
|
2022-04-11 14:25:58 +00:00
|
|
|
},
|
|
|
|
RunE: dumpBalances,
|
|
|
|
}
|
|
|
|
|
2021-08-06 11:28:07 +00:00
|
|
|
updateContractsCmd = &cobra.Command{
|
|
|
|
Use: "update-contracts",
|
2023-01-27 10:47:14 +00:00
|
|
|
Short: "Update FrostFS contracts",
|
2021-08-06 11:28:07 +00:00
|
|
|
PreRun: func(cmd *cobra.Command, _ []string) {
|
2024-02-01 06:51:24 +00:00
|
|
|
_ = viper.BindPFlag(util.AlphabetWalletsFlag, cmd.Flags().Lookup(util.AlphabetWalletsFlag))
|
2024-01-31 14:26:26 +00:00
|
|
|
_ = viper.BindPFlag(util.EndpointFlag, cmd.Flags().Lookup(util.EndpointFlag))
|
2021-08-06 11:28:07 +00:00
|
|
|
},
|
|
|
|
RunE: updateContracts,
|
|
|
|
}
|
2021-08-10 08:45:01 +00:00
|
|
|
|
|
|
|
dumpContainersCmd = &cobra.Command{
|
|
|
|
Use: "dump-containers",
|
2023-01-27 10:47:14 +00:00
|
|
|
Short: "Dump FrostFS containers to file",
|
2021-08-10 08:45:01 +00:00
|
|
|
PreRun: func(cmd *cobra.Command, _ []string) {
|
2024-01-31 14:26:26 +00:00
|
|
|
_ = viper.BindPFlag(util.EndpointFlag, cmd.Flags().Lookup(util.EndpointFlag))
|
2021-08-10 08:45:01 +00:00
|
|
|
},
|
|
|
|
RunE: dumpContainers,
|
|
|
|
}
|
2021-08-10 08:46:06 +00:00
|
|
|
|
|
|
|
restoreContainersCmd = &cobra.Command{
|
|
|
|
Use: "restore-containers",
|
2023-01-27 10:47:14 +00:00
|
|
|
Short: "Restore FrostFS containers from file",
|
2021-08-10 08:46:06 +00:00
|
|
|
PreRun: func(cmd *cobra.Command, _ []string) {
|
2024-02-01 06:51:24 +00:00
|
|
|
_ = viper.BindPFlag(util.AlphabetWalletsFlag, cmd.Flags().Lookup(util.AlphabetWalletsFlag))
|
2024-01-31 14:26:26 +00:00
|
|
|
_ = viper.BindPFlag(util.EndpointFlag, cmd.Flags().Lookup(util.EndpointFlag))
|
2021-08-10 08:46:06 +00:00
|
|
|
},
|
|
|
|
RunE: restoreContainers,
|
|
|
|
}
|
2021-11-30 11:57:58 +00:00
|
|
|
|
2022-10-26 10:58:11 +00:00
|
|
|
listContainersCmd = &cobra.Command{
|
|
|
|
Use: "list-containers",
|
2023-01-27 10:47:14 +00:00
|
|
|
Short: "List FrostFS containers",
|
2022-10-26 10:58:11 +00:00
|
|
|
PreRun: func(cmd *cobra.Command, _ []string) {
|
2024-01-31 14:26:26 +00:00
|
|
|
_ = viper.BindPFlag(util.EndpointFlag, cmd.Flags().Lookup(util.EndpointFlag))
|
2022-10-26 10:58:11 +00:00
|
|
|
},
|
|
|
|
RunE: listContainers,
|
|
|
|
}
|
|
|
|
|
2021-11-30 11:57:58 +00:00
|
|
|
depositNotaryCmd = &cobra.Command{
|
|
|
|
Use: "deposit-notary",
|
2022-06-28 06:03:52 +00:00
|
|
|
Short: "Deposit GAS for notary service",
|
2021-11-30 11:57:58 +00:00
|
|
|
PreRun: func(cmd *cobra.Command, _ []string) {
|
2024-01-31 14:26:26 +00:00
|
|
|
_ = viper.BindPFlag(util.EndpointFlag, cmd.Flags().Lookup(util.EndpointFlag))
|
2021-11-30 11:57:58 +00:00
|
|
|
},
|
|
|
|
RunE: depositNotary,
|
|
|
|
}
|
2023-01-31 10:33:33 +00:00
|
|
|
|
|
|
|
netmapCandidatesCmd = &cobra.Command{
|
|
|
|
Use: "netmap-candidates",
|
|
|
|
Short: "List netmap candidates nodes",
|
|
|
|
PreRun: func(cmd *cobra.Command, _ []string) {
|
2024-01-31 14:26:26 +00:00
|
|
|
_ = viper.BindPFlag(util.EndpointFlag, cmd.Flags().Lookup(util.EndpointFlag))
|
2024-02-01 06:51:24 +00:00
|
|
|
_ = viper.BindPFlag(util.AlphabetWalletsFlag, cmd.Flags().Lookup(util.AlphabetWalletsFlag))
|
2023-01-31 10:33:33 +00:00
|
|
|
},
|
|
|
|
Run: listNetmapCandidatesNodes,
|
|
|
|
}
|
2023-12-21 09:26:47 +00:00
|
|
|
|
|
|
|
proxyAddAccountCmd = &cobra.Command{
|
|
|
|
Use: "proxy-add-account",
|
|
|
|
Short: "Adds account to proxy contract",
|
|
|
|
PreRun: func(cmd *cobra.Command, _ []string) {
|
2024-02-01 06:51:24 +00:00
|
|
|
_ = viper.BindPFlag(util.AlphabetWalletsFlag, cmd.Flags().Lookup(util.AlphabetWalletsFlag))
|
2024-01-31 14:26:26 +00:00
|
|
|
_ = viper.BindPFlag(util.EndpointFlag, cmd.Flags().Lookup(util.EndpointFlag))
|
2023-12-21 09:26:47 +00:00
|
|
|
},
|
|
|
|
Run: addProxyAccount,
|
|
|
|
}
|
|
|
|
|
|
|
|
proxyRemoveAccountCmd = &cobra.Command{
|
|
|
|
Use: "proxy-remove-account",
|
|
|
|
Short: "Remove from proxy contract",
|
|
|
|
PreRun: func(cmd *cobra.Command, _ []string) {
|
2024-02-01 06:51:24 +00:00
|
|
|
_ = viper.BindPFlag(util.AlphabetWalletsFlag, cmd.Flags().Lookup(util.AlphabetWalletsFlag))
|
2024-01-31 14:26:26 +00:00
|
|
|
_ = viper.BindPFlag(util.EndpointFlag, cmd.Flags().Lookup(util.EndpointFlag))
|
2023-12-21 09:26:47 +00:00
|
|
|
},
|
|
|
|
Run: removeProxyAccount,
|
|
|
|
}
|
2021-07-09 09:53:10 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func init() {
|
2023-03-23 06:55:26 +00:00
|
|
|
initGenerateAlphabetCmd()
|
|
|
|
initInitCmd()
|
|
|
|
initDeployCmd()
|
|
|
|
initGenerateStorageCmd()
|
|
|
|
initForceNewEpochCmd()
|
|
|
|
initRemoveNodesCmd()
|
|
|
|
initSetPolicyCmd()
|
2023-11-02 13:20:37 +00:00
|
|
|
initDumpPolicyCmd()
|
2023-03-23 06:55:26 +00:00
|
|
|
initDumpContractHashesCmd()
|
|
|
|
initDumpNetworkConfigCmd()
|
|
|
|
initSetConfigCmd()
|
|
|
|
initDumpBalancesCmd()
|
|
|
|
initUpdateContractsCmd()
|
|
|
|
initDumpContainersCmd()
|
|
|
|
initRestoreContainersCmd()
|
|
|
|
initListContainersCmd()
|
|
|
|
initRefillGasCmd()
|
|
|
|
initDepositoryNotaryCmd()
|
|
|
|
initNetmapCandidatesCmd()
|
2023-12-21 13:33:37 +00:00
|
|
|
|
2024-02-01 07:20:17 +00:00
|
|
|
RootCmd.AddCommand(ape.Cmd)
|
2023-12-21 13:33:37 +00:00
|
|
|
|
2023-12-21 09:26:47 +00:00
|
|
|
initProxyAddAccount()
|
|
|
|
initProxyRemoveAccount()
|
2024-01-12 10:54:00 +00:00
|
|
|
|
|
|
|
RootCmd.AddCommand(frostfsidCmd)
|
|
|
|
initFrostfsIDCreateNamespaceCmd()
|
|
|
|
initFrostfsIDListNamespacesCmd()
|
|
|
|
initFrostfsIDCreateSubjectCmd()
|
|
|
|
initFrostfsIDDeleteSubjectCmd()
|
|
|
|
initFrostfsIDListSubjectsCmd()
|
|
|
|
initFrostfsIDCreateGroupCmd()
|
|
|
|
initFrostfsIDDeleteGroupCmd()
|
|
|
|
initFrostfsIDListGroupsCmd()
|
2024-01-12 15:03:18 +00:00
|
|
|
initFrostfsIDAddSubjectToGroupCmd()
|
|
|
|
initFrostfsIDRemoveSubjectFromGroupCmd()
|
|
|
|
initFrostfsIDListGroupSubjectsCmd()
|
2023-12-21 09:26:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func initProxyAddAccount() {
|
|
|
|
RootCmd.AddCommand(proxyAddAccountCmd)
|
2024-01-31 14:26:26 +00:00
|
|
|
proxyAddAccountCmd.Flags().StringP(util.EndpointFlag, util.EndpointFlagShort, "", util.EndpointFlagDesc)
|
2023-12-21 09:26:47 +00:00
|
|
|
proxyAddAccountCmd.Flags().String(accountAddressFlag, "", "Wallet address string")
|
|
|
|
}
|
|
|
|
|
|
|
|
func initProxyRemoveAccount() {
|
|
|
|
RootCmd.AddCommand(proxyRemoveAccountCmd)
|
2024-01-31 14:26:26 +00:00
|
|
|
proxyRemoveAccountCmd.Flags().StringP(util.EndpointFlag, util.EndpointFlagShort, "", util.EndpointFlagDesc)
|
2023-12-21 09:26:47 +00:00
|
|
|
proxyRemoveAccountCmd.Flags().String(accountAddressFlag, "", "Wallet address string")
|
2023-03-23 06:55:26 +00:00
|
|
|
}
|
2021-07-09 09:53:10 +00:00
|
|
|
|
2023-03-23 06:55:26 +00:00
|
|
|
func initNetmapCandidatesCmd() {
|
|
|
|
RootCmd.AddCommand(netmapCandidatesCmd)
|
2024-01-31 14:26:26 +00:00
|
|
|
netmapCandidatesCmd.Flags().StringP(util.EndpointFlag, util.EndpointFlagShort, "", util.EndpointFlagDesc)
|
2023-03-23 06:55:26 +00:00
|
|
|
}
|
2022-07-27 14:57:30 +00:00
|
|
|
|
2023-03-23 06:55:26 +00:00
|
|
|
func initDepositoryNotaryCmd() {
|
|
|
|
RootCmd.AddCommand(depositNotaryCmd)
|
2024-01-31 14:26:26 +00:00
|
|
|
depositNotaryCmd.Flags().StringP(util.EndpointFlag, util.EndpointFlagShort, "", util.EndpointFlagDesc)
|
2023-03-23 06:55:26 +00:00
|
|
|
depositNotaryCmd.Flags().String(storageWalletFlag, "", "Path to storage node wallet")
|
|
|
|
depositNotaryCmd.Flags().String(walletAccountFlag, "", "Wallet account address")
|
|
|
|
depositNotaryCmd.Flags().String(refillGasAmountFlag, "", "Amount of GAS to deposit")
|
|
|
|
depositNotaryCmd.Flags().String(notaryDepositTillFlag, "", "Notary deposit duration in blocks")
|
|
|
|
}
|
2021-07-09 09:53:10 +00:00
|
|
|
|
2023-03-23 06:55:26 +00:00
|
|
|
func initRefillGasCmd() {
|
|
|
|
RootCmd.AddCommand(refillGasCmd)
|
2024-02-01 06:51:24 +00:00
|
|
|
refillGasCmd.Flags().String(util.AlphabetWalletsFlag, "", util.AlphabetWalletsFlagDesc)
|
2024-01-31 14:26:26 +00:00
|
|
|
refillGasCmd.Flags().StringP(util.EndpointFlag, util.EndpointFlagShort, "", util.EndpointFlagDesc)
|
2023-03-23 06:55:26 +00:00
|
|
|
refillGasCmd.Flags().String(storageWalletFlag, "", "Path to storage node wallet")
|
|
|
|
refillGasCmd.Flags().String(walletAddressFlag, "", "Address of wallet")
|
|
|
|
refillGasCmd.Flags().String(refillGasAmountFlag, "", "Additional amount of GAS to transfer")
|
|
|
|
refillGasCmd.MarkFlagsMutuallyExclusive(walletAddressFlag, storageWalletFlag)
|
|
|
|
}
|
2022-06-27 14:47:13 +00:00
|
|
|
|
2023-03-23 06:55:26 +00:00
|
|
|
func initListContainersCmd() {
|
|
|
|
RootCmd.AddCommand(listContainersCmd)
|
2024-01-31 14:26:26 +00:00
|
|
|
listContainersCmd.Flags().StringP(util.EndpointFlag, util.EndpointFlagShort, "", util.EndpointFlagDesc)
|
2023-03-23 06:55:26 +00:00
|
|
|
listContainersCmd.Flags().String(containerContractFlag, "", "Container contract hash (for networks without NNS)")
|
|
|
|
}
|
2022-04-04 15:36:10 +00:00
|
|
|
|
2023-03-23 06:55:26 +00:00
|
|
|
func initRestoreContainersCmd() {
|
|
|
|
RootCmd.AddCommand(restoreContainersCmd)
|
2024-02-01 06:51:24 +00:00
|
|
|
restoreContainersCmd.Flags().String(util.AlphabetWalletsFlag, "", util.AlphabetWalletsFlagDesc)
|
2024-01-31 14:26:26 +00:00
|
|
|
restoreContainersCmd.Flags().StringP(util.EndpointFlag, util.EndpointFlagShort, "", util.EndpointFlagDesc)
|
2023-03-23 06:55:26 +00:00
|
|
|
restoreContainersCmd.Flags().String(containerDumpFlag, "", "File to restore containers from")
|
|
|
|
restoreContainersCmd.Flags().StringSlice(containerIDsFlag, nil, "Containers to restore")
|
|
|
|
}
|
2021-08-03 12:05:10 +00:00
|
|
|
|
2023-03-23 06:55:26 +00:00
|
|
|
func initDumpContainersCmd() {
|
|
|
|
RootCmd.AddCommand(dumpContainersCmd)
|
2024-01-31 14:26:26 +00:00
|
|
|
dumpContainersCmd.Flags().StringP(util.EndpointFlag, util.EndpointFlagShort, "", util.EndpointFlagDesc)
|
2023-03-23 06:55:26 +00:00
|
|
|
dumpContainersCmd.Flags().String(containerDumpFlag, "", "File where to save dumped containers")
|
|
|
|
dumpContainersCmd.Flags().String(containerContractFlag, "", "Container contract hash (for networks without NNS)")
|
|
|
|
dumpContainersCmd.Flags().StringSlice(containerIDsFlag, nil, "Containers to dump")
|
|
|
|
}
|
2021-08-06 11:28:07 +00:00
|
|
|
|
2023-03-23 06:55:26 +00:00
|
|
|
func initUpdateContractsCmd() {
|
|
|
|
RootCmd.AddCommand(updateContractsCmd)
|
2024-02-01 06:51:24 +00:00
|
|
|
updateContractsCmd.Flags().String(util.AlphabetWalletsFlag, "", util.AlphabetWalletsFlagDesc)
|
2024-01-31 14:26:26 +00:00
|
|
|
updateContractsCmd.Flags().StringP(util.EndpointFlag, util.EndpointFlagShort, "", util.EndpointFlagDesc)
|
2024-02-01 12:21:51 +00:00
|
|
|
updateContractsCmd.Flags().String(util.ContractsInitFlag, "", util.ContractsInitFlagDesc)
|
|
|
|
updateContractsCmd.Flags().String(util.ContractsURLFlag, "", util.ContractsURLFlagDesc)
|
|
|
|
updateContractsCmd.MarkFlagsMutuallyExclusive(util.ContractsInitFlag, util.ContractsURLFlag)
|
2023-03-23 06:55:26 +00:00
|
|
|
}
|
2022-05-11 18:35:49 +00:00
|
|
|
|
2023-03-23 06:55:26 +00:00
|
|
|
func initDumpBalancesCmd() {
|
2022-04-11 14:25:58 +00:00
|
|
|
RootCmd.AddCommand(dumpBalancesCmd)
|
2024-01-31 14:26:26 +00:00
|
|
|
dumpBalancesCmd.Flags().StringP(util.EndpointFlag, util.EndpointFlagShort, "", util.EndpointFlagDesc)
|
2022-10-11 14:02:03 +00:00
|
|
|
dumpBalancesCmd.Flags().BoolP(dumpBalancesStorageFlag, "s", false, "Dump balances of storage nodes from the current netmap")
|
|
|
|
dumpBalancesCmd.Flags().BoolP(dumpBalancesAlphabetFlag, "a", false, "Dump balances of alphabet contracts")
|
|
|
|
dumpBalancesCmd.Flags().BoolP(dumpBalancesProxyFlag, "p", false, "Dump balances of the proxy contract")
|
|
|
|
dumpBalancesCmd.Flags().Bool(dumpBalancesUseScriptHashFlag, false, "Use script-hash format for addresses")
|
2023-03-23 06:55:26 +00:00
|
|
|
}
|
2022-04-11 14:25:58 +00:00
|
|
|
|
2023-03-23 06:55:26 +00:00
|
|
|
func initSetConfigCmd() {
|
|
|
|
RootCmd.AddCommand(setConfig)
|
2024-02-01 06:51:24 +00:00
|
|
|
setConfig.Flags().String(util.AlphabetWalletsFlag, "", util.AlphabetWalletsFlagDesc)
|
2024-01-31 14:26:26 +00:00
|
|
|
setConfig.Flags().StringP(util.EndpointFlag, util.EndpointFlagShort, "", util.EndpointFlagDesc)
|
2023-03-23 06:55:26 +00:00
|
|
|
setConfig.Flags().Bool(forceConfigSet, false, "Force setting not well-known configuration key")
|
2024-02-01 12:21:51 +00:00
|
|
|
setConfig.Flags().String(util.LocalDumpFlag, "", "Path to the blocks dump file")
|
2023-03-23 06:55:26 +00:00
|
|
|
}
|
2021-08-10 08:45:01 +00:00
|
|
|
|
2023-03-23 06:55:26 +00:00
|
|
|
func initDumpNetworkConfigCmd() {
|
|
|
|
RootCmd.AddCommand(dumpNetworkConfigCmd)
|
2024-01-31 14:26:26 +00:00
|
|
|
dumpNetworkConfigCmd.Flags().StringP(util.EndpointFlag, util.EndpointFlagShort, "", util.EndpointFlagDesc)
|
2023-03-23 06:55:26 +00:00
|
|
|
}
|
2021-08-10 08:46:06 +00:00
|
|
|
|
2023-03-23 06:55:26 +00:00
|
|
|
func initDumpContractHashesCmd() {
|
|
|
|
RootCmd.AddCommand(dumpContractHashesCmd)
|
2024-01-31 14:26:26 +00:00
|
|
|
dumpContractHashesCmd.Flags().StringP(util.EndpointFlag, util.EndpointFlagShort, "", util.EndpointFlagDesc)
|
2023-03-23 06:55:26 +00:00
|
|
|
dumpContractHashesCmd.Flags().String(customZoneFlag, "", "Custom zone to search.")
|
|
|
|
}
|
2021-08-25 07:35:16 +00:00
|
|
|
|
2023-03-23 06:55:26 +00:00
|
|
|
func initSetPolicyCmd() {
|
|
|
|
RootCmd.AddCommand(setPolicy)
|
2024-02-01 06:51:24 +00:00
|
|
|
setPolicy.Flags().String(util.AlphabetWalletsFlag, "", util.AlphabetWalletsFlagDesc)
|
2024-01-31 14:26:26 +00:00
|
|
|
setPolicy.Flags().StringP(util.EndpointFlag, util.EndpointFlagShort, "", util.EndpointFlagDesc)
|
2024-02-01 12:21:51 +00:00
|
|
|
setPolicy.Flags().String(util.LocalDumpFlag, "", "Path to the blocks dump file")
|
2023-03-23 06:55:26 +00:00
|
|
|
}
|
2022-10-26 10:58:11 +00:00
|
|
|
|
2023-11-02 13:20:37 +00:00
|
|
|
func initDumpPolicyCmd() {
|
|
|
|
RootCmd.AddCommand(dumpPolicy)
|
2024-01-31 14:26:26 +00:00
|
|
|
dumpPolicy.Flags().StringP(util.EndpointFlag, util.EndpointFlagShort, "", util.EndpointFlagDesc)
|
2023-11-02 13:20:37 +00:00
|
|
|
}
|
|
|
|
|
2023-03-23 06:55:26 +00:00
|
|
|
func initRemoveNodesCmd() {
|
|
|
|
RootCmd.AddCommand(removeNodes)
|
2024-02-01 06:51:24 +00:00
|
|
|
removeNodes.Flags().String(util.AlphabetWalletsFlag, "", util.AlphabetWalletsFlagDesc)
|
2024-01-31 14:26:26 +00:00
|
|
|
removeNodes.Flags().StringP(util.EndpointFlag, util.EndpointFlagShort, "", util.EndpointFlagDesc)
|
2024-02-01 12:21:51 +00:00
|
|
|
removeNodes.Flags().String(util.LocalDumpFlag, "", "Path to the blocks dump file")
|
2023-03-23 06:55:26 +00:00
|
|
|
}
|
2021-11-28 15:48:32 +00:00
|
|
|
|
2023-03-23 06:55:26 +00:00
|
|
|
func initForceNewEpochCmd() {
|
|
|
|
RootCmd.AddCommand(forceNewEpoch)
|
2024-02-01 06:51:24 +00:00
|
|
|
forceNewEpoch.Flags().String(util.AlphabetWalletsFlag, "", util.AlphabetWalletsFlagDesc)
|
2024-01-31 14:26:26 +00:00
|
|
|
forceNewEpoch.Flags().StringP(util.EndpointFlag, util.EndpointFlagShort, "", util.EndpointFlagDesc)
|
2024-02-01 12:21:51 +00:00
|
|
|
forceNewEpoch.Flags().String(util.LocalDumpFlag, "", "Path to the blocks dump file")
|
2023-03-23 06:55:26 +00:00
|
|
|
}
|
2021-11-30 11:57:58 +00:00
|
|
|
|
2023-03-23 06:55:26 +00:00
|
|
|
func initGenerateStorageCmd() {
|
|
|
|
RootCmd.AddCommand(generateStorageCmd)
|
2024-02-01 06:51:24 +00:00
|
|
|
generateStorageCmd.Flags().String(util.AlphabetWalletsFlag, "", util.AlphabetWalletsFlagDesc)
|
2024-01-31 14:26:26 +00:00
|
|
|
generateStorageCmd.Flags().StringP(util.EndpointFlag, util.EndpointFlagShort, "", util.EndpointFlagDesc)
|
2023-03-23 06:55:26 +00:00
|
|
|
generateStorageCmd.Flags().String(storageWalletFlag, "", "Path to new storage node wallet")
|
|
|
|
generateStorageCmd.Flags().String(storageGasCLIFlag, "", "Initial amount of GAS to transfer")
|
|
|
|
generateStorageCmd.Flags().StringP(storageWalletLabelFlag, "l", "", "Wallet label")
|
|
|
|
}
|
2023-01-31 10:33:33 +00:00
|
|
|
|
2023-03-23 06:55:26 +00:00
|
|
|
func initInitCmd() {
|
|
|
|
RootCmd.AddCommand(initCmd)
|
2024-02-01 06:51:24 +00:00
|
|
|
initCmd.Flags().String(util.AlphabetWalletsFlag, "", util.AlphabetWalletsFlagDesc)
|
2024-01-31 14:26:26 +00:00
|
|
|
initCmd.Flags().StringP(util.EndpointFlag, util.EndpointFlagShort, "", util.EndpointFlagDesc)
|
2024-02-01 12:21:51 +00:00
|
|
|
initCmd.Flags().String(util.ContractsInitFlag, "", util.ContractsInitFlagDesc)
|
|
|
|
initCmd.Flags().String(util.ContractsURLFlag, "", util.ContractsURLFlagDesc)
|
2023-03-23 06:55:26 +00:00
|
|
|
initCmd.Flags().Uint(epochDurationCLIFlag, 240, "Amount of side chain blocks in one FrostFS epoch")
|
|
|
|
initCmd.Flags().Uint(maxObjectSizeCLIFlag, 67108864, "Max single object size in bytes")
|
|
|
|
initCmd.Flags().Bool(homomorphicHashDisabledCLIFlag, false, "Disable object homomorphic hashing")
|
|
|
|
// Defaults are taken from neo-preodolenie.
|
|
|
|
initCmd.Flags().Uint64(containerFeeCLIFlag, 1000, "Container registration fee")
|
|
|
|
initCmd.Flags().Uint64(containerAliasFeeCLIFlag, 500, "Container alias fee")
|
2024-01-31 14:26:26 +00:00
|
|
|
initCmd.Flags().String(util.ProtoConfigPath, "", "Path to the consensus node configuration")
|
2024-02-01 12:21:51 +00:00
|
|
|
initCmd.Flags().String(util.LocalDumpFlag, "", "Path to the blocks dump file")
|
|
|
|
initCmd.MarkFlagsMutuallyExclusive(util.ContractsInitFlag, util.ContractsURLFlag)
|
2023-03-23 06:55:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func initGenerateAlphabetCmd() {
|
|
|
|
RootCmd.AddCommand(generateAlphabetCmd)
|
2024-02-01 06:51:24 +00:00
|
|
|
generateAlphabetCmd.Flags().String(util.AlphabetWalletsFlag, "", util.AlphabetWalletsFlagDesc)
|
2023-03-23 06:55:26 +00:00
|
|
|
generateAlphabetCmd.Flags().Uint(alphabetSizeFlag, 7, "Amount of alphabet wallets to generate")
|
|
|
|
}
|
|
|
|
|
|
|
|
func initDeployCmd() {
|
|
|
|
RootCmd.AddCommand(deployCmd)
|
2021-07-09 09:53:10 +00:00
|
|
|
}
|