2024-02-02 07:25:04 +00:00
|
|
|
package initialize
|
|
|
|
|
|
|
|
import (
|
2024-02-02 12:04:48 +00:00
|
|
|
"git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-adm/internal/commonflags"
|
2024-02-02 07:25:04 +00:00
|
|
|
"git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-adm/internal/modules/morph/util"
|
|
|
|
"github.com/spf13/cobra"
|
|
|
|
"github.com/spf13/viper"
|
|
|
|
)
|
|
|
|
|
|
|
|
const (
|
|
|
|
maxObjectSizeCLIFlag = "max-object-size"
|
|
|
|
epochDurationCLIFlag = "epoch-duration"
|
|
|
|
containerFeeCLIFlag = "container-fee"
|
|
|
|
containerAliasFeeCLIFlag = "container-alias-fee"
|
|
|
|
candidateFeeCLIFlag = "candidate-fee"
|
|
|
|
homomorphicHashDisabledCLIFlag = "homomorphic-disabled"
|
|
|
|
withdrawFeeCLIFlag = "withdraw-fee"
|
|
|
|
)
|
|
|
|
|
|
|
|
var Cmd = &cobra.Command{
|
|
|
|
Use: "init",
|
|
|
|
Short: "Initialize side chain network with smart-contracts and network settings",
|
|
|
|
PreRun: func(cmd *cobra.Command, _ []string) {
|
2024-02-02 12:04:48 +00:00
|
|
|
_ = viper.BindPFlag(commonflags.AlphabetWalletsFlag, cmd.Flags().Lookup(commonflags.AlphabetWalletsFlag))
|
|
|
|
_ = viper.BindPFlag(commonflags.EndpointFlag, cmd.Flags().Lookup(commonflags.EndpointFlag))
|
|
|
|
_ = viper.BindPFlag(commonflags.EpochDurationInitFlag, cmd.Flags().Lookup(epochDurationCLIFlag))
|
|
|
|
_ = viper.BindPFlag(commonflags.MaxObjectSizeInitFlag, cmd.Flags().Lookup(maxObjectSizeCLIFlag))
|
|
|
|
_ = viper.BindPFlag(commonflags.HomomorphicHashDisabledInitFlag, cmd.Flags().Lookup(homomorphicHashDisabledCLIFlag))
|
|
|
|
_ = viper.BindPFlag(commonflags.CandidateFeeInitFlag, cmd.Flags().Lookup(candidateFeeCLIFlag))
|
|
|
|
_ = viper.BindPFlag(commonflags.ContainerFeeInitFlag, cmd.Flags().Lookup(containerFeeCLIFlag))
|
|
|
|
_ = viper.BindPFlag(commonflags.ContainerAliasFeeInitFlag, cmd.Flags().Lookup(containerAliasFeeCLIFlag))
|
|
|
|
_ = viper.BindPFlag(commonflags.WithdrawFeeInitFlag, cmd.Flags().Lookup(withdrawFeeCLIFlag))
|
2024-02-02 07:25:04 +00:00
|
|
|
_ = viper.BindPFlag(util.ProtoConfigPath, cmd.Flags().Lookup(util.ProtoConfigPath))
|
|
|
|
},
|
|
|
|
RunE: initializeSideChainCmd,
|
|
|
|
}
|
|
|
|
|
|
|
|
func initInitCmd() {
|
2024-02-02 12:04:48 +00:00
|
|
|
Cmd.Flags().String(commonflags.AlphabetWalletsFlag, "", commonflags.AlphabetWalletsFlagDesc)
|
|
|
|
Cmd.Flags().StringP(commonflags.EndpointFlag, commonflags.EndpointFlagShort, "", commonflags.EndpointFlagDesc)
|
|
|
|
Cmd.Flags().String(commonflags.ContractsInitFlag, "", commonflags.ContractsInitFlagDesc)
|
|
|
|
Cmd.Flags().String(commonflags.ContractsURLFlag, "", commonflags.ContractsURLFlagDesc)
|
2024-02-02 07:25:04 +00:00
|
|
|
Cmd.Flags().Uint(epochDurationCLIFlag, 240, "Amount of side chain blocks in one FrostFS epoch")
|
|
|
|
Cmd.Flags().Uint(maxObjectSizeCLIFlag, 67108864, "Max single object size in bytes")
|
|
|
|
Cmd.Flags().Bool(homomorphicHashDisabledCLIFlag, false, "Disable object homomorphic hashing")
|
|
|
|
// Defaults are taken from neo-preodolenie.
|
|
|
|
Cmd.Flags().Uint64(containerFeeCLIFlag, 1000, "Container registration fee")
|
|
|
|
Cmd.Flags().Uint64(containerAliasFeeCLIFlag, 500, "Container alias fee")
|
|
|
|
Cmd.Flags().String(util.ProtoConfigPath, "", "Path to the consensus node configuration")
|
2024-02-02 12:04:48 +00:00
|
|
|
Cmd.Flags().String(commonflags.LocalDumpFlag, "", "Path to the blocks dump file")
|
|
|
|
Cmd.MarkFlagsMutuallyExclusive(commonflags.ContractsInitFlag, commonflags.ContractsURLFlag)
|
2024-02-02 07:25:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
initInitCmd()
|
|
|
|
}
|