diff --git a/cmd/cheqd-noded/cmd/configure.go b/cmd/cheqd-noded/cmd/configure.go deleted file mode 100644 index c17c282ce..000000000 --- a/cmd/cheqd-noded/cmd/configure.go +++ /dev/null @@ -1,337 +0,0 @@ -package cmd - -import ( - "strconv" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - cosmcfg "github.com/cosmos/cosmos-sdk/server/config" - "github.com/cosmos/cosmos-sdk/types/errors" - "github.com/spf13/cobra" - tmcfg "github.com/tendermint/tendermint/config" -) - -// configureCmd returns configure cobra Command. -func configureCmd(defaultNodeHome string) *cobra.Command { - cmd := &cobra.Command{ - Use: "configure", - Short: "Adjust node parameters", - } - - cmd.AddCommand( - minGasPricesCmd(defaultNodeHome), - p2pCmd(defaultNodeHome), - rpcLaddrCmd(defaultNodeHome), - createEmptyBlocksCmd(defaultNodeHome), - fastsyncVersionCmd(defaultNodeHome)) - - return cmd -} - -// p2pCmd returns configure cobra Command. -func p2pCmd(defaultNodeHome string) *cobra.Command { - cmd := &cobra.Command{ - Use: "p2p", - Short: "Adjust peer-to-peer (p2p) parameters", - } - - cmd.AddCommand( - seedModeCmd(defaultNodeHome), - seedsCmd(defaultNodeHome), - externalAddressCmd(defaultNodeHome), - persistentPeersCmd(defaultNodeHome), - sendRateCmd(defaultNodeHome), - recvRateCmd(defaultNodeHome), - maxPacketMsgPayloadSizeCmd(defaultNodeHome), - p2pLaddrCmd(defaultNodeHome)) - - return cmd -} - -// minGasPricesCmd returns configuration cobra Command. -func minGasPricesCmd(defaultNodeHome string) *cobra.Command { - cmd := &cobra.Command{ - Use: "min-gas-prices [value]", - Short: "The minimum gas prices a validator is willing to accept (default \"25ncheq\")", - Long: "The minimum gas prices a validator is willing to accept for processing a transaction. A transaction's " + - "fees must meet the minimum tokens in ncheq denomination (e.g. \"25ncheq\", \"50ncheq\").", - Example: "min-gas-prices 25cheq", - Args: cobra.ExactArgs(1), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx := client.GetClientContextFromCmd(cmd) - - return updateCosmConfig(clientCtx.HomeDir, func(config *cosmcfg.Config) { - config.MinGasPrices = args[0] - config.IAVLDisableFastNode = false - }) - }, - } - - cmd.Flags().String(flags.FlagHome, defaultNodeHome, "The application home directory") - - return cmd -} - -// seedModeCmd returns configuration cobra Command. -func seedModeCmd(defaultNodeHome string) *cobra.Command { - cmd := &cobra.Command{ - Use: "seed-mode (true|false)", - Short: "Seed mode, in which node constantly crawls the network and looks for peers.", - Long: "Seed mode, in which node constantly crawls the network and looks for peers. If another node asks " + - "it for addresses, it responds and disconnects.", - Example: "seed-mode true", - Args: cobra.ExactArgs(1), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx := client.GetClientContextFromCmd(cmd) - - value, err := strconv.ParseBool(args[0]) - if err != nil { - return errors.Wrap(err, "can't parse seed mode") - } - - return updateTmConfig(clientCtx.HomeDir, func(config *tmcfg.Config) { - config.P2P.SeedMode = value - }) - }, - } - - cmd.Flags().String(flags.FlagHome, defaultNodeHome, "The application home directory") - - return cmd -} - -// seedsCmd returns configuration cobra Command. -func seedsCmd(defaultNodeHome string) *cobra.Command { - cmd := &cobra.Command{ - Use: "seeds [value]", - Short: "Comma separated list of seed nodes to connect to in format", - Example: "seeds \"658453f9578d82f0897f13205ca2e7ad37279f95@seed1.eu.testnet.cheqd.network:26656," + - "eec97b12f7271116deb888a8d62e0739b4350fbd@seed1.us.testnet.cheqd.network:26656\"", - Args: cobra.ExactArgs(1), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx := client.GetClientContextFromCmd(cmd) - - return updateTmConfig(clientCtx.HomeDir, func(config *tmcfg.Config) { - config.P2P.Seeds = args[0] - }) - }, - } - - cmd.Flags().String(flags.FlagHome, defaultNodeHome, "The application home directory") - - return cmd -} - -// externalAddressCmd returns configuration cobra Command. -func externalAddressCmd(defaultNodeHome string) *cobra.Command { - cmd := &cobra.Command{ - Use: "external-address [value]", - Short: "Address to advertise to peers for them to connect to the node", - Long: "Address to advertise to peers for them to connect to the node. If empty, the node will use the same " + - "port as the laddr, and will attach it to the listener or use UPnP to figure out the address. IP " + - "address/DNS name P2P port are required.", - Example: "external-address 159.89.10.97:26656", - Args: cobra.ExactArgs(1), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx := client.GetClientContextFromCmd(cmd) - - return updateTmConfig(clientCtx.HomeDir, func(config *tmcfg.Config) { - config.P2P.ExternalAddress = args[0] - }) - }, - } - - cmd.Flags().String(flags.FlagHome, defaultNodeHome, "The application home directory") - - return cmd -} - -// persistentPeersCmd returns configuration cobra Command. -func persistentPeersCmd(defaultNodeHome string) *cobra.Command { - cmd := &cobra.Command{ - Use: "persistent-peers [value]", - Short: "Comma separated list of nodes to keep persistent connections to in " + - " format", - Example: "persistent-peers \"658453f9578d82f0897f13205ca2e7ad37279f95@seed1.eu.testnet.cheqd.network:26656," + - "eec97b12f7271116deb888a8d62e0739b4350fbd@seed1.us.testnet.cheqd.network:26656\"", - Args: cobra.ExactArgs(1), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx := client.GetClientContextFromCmd(cmd) - - return updateTmConfig(clientCtx.HomeDir, func(config *tmcfg.Config) { - config.P2P.PersistentPeers = args[0] - }) - }, - } - - cmd.Flags().String(flags.FlagHome, defaultNodeHome, "The application home directory") - - return cmd -} - -// sendRateCmd returns configuration cobra Command. -func sendRateCmd(defaultNodeHome string) *cobra.Command { - cmd := &cobra.Command{ - Use: "send-rate [value]", - Short: "Rate at which packets can be sent, in bytes/second", - Example: "send-rate 20000000", - Args: cobra.ExactArgs(1), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx := client.GetClientContextFromCmd(cmd) - - value, err := strconv.ParseInt(args[0], 10, 64) - if err != nil { - return errors.Wrap(err, "can't parse send rate") - } - - return updateTmConfig(clientCtx.HomeDir, func(config *tmcfg.Config) { - config.P2P.SendRate = value - }) - }, - } - - cmd.Flags().String(flags.FlagHome, defaultNodeHome, "The application home directory") - - return cmd -} - -// recvRateCmd returns configuration cobra Command. -func recvRateCmd(defaultNodeHome string) *cobra.Command { - cmd := &cobra.Command{ - Use: "recv-rate [value]", - Short: "Rate at which packets can be received, in bytes/second", - Example: "recv-rate 20000000", - Args: cobra.ExactArgs(1), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx := client.GetClientContextFromCmd(cmd) - - value, err := strconv.ParseInt(args[0], 10, 64) - if err != nil { - return errors.Wrap(err, "can't parse recv rate") - } - - return updateTmConfig(clientCtx.HomeDir, func(config *tmcfg.Config) { - config.P2P.RecvRate = value - }) - }, - } - - cmd.Flags().String(flags.FlagHome, defaultNodeHome, "The application home directory") - - return cmd -} - -// maxPacketMsgPayloadSizeCmd returns configuration cobra Command. -func maxPacketMsgPayloadSizeCmd(defaultNodeHome string) *cobra.Command { - cmd := &cobra.Command{ - Use: "max-packet-msg-payload-size [value]", - Short: "Maximum size of a message packet payload, in bytes", - Example: "max-packet-msg-payload-size 10240", - Args: cobra.ExactArgs(1), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx := client.GetClientContextFromCmd(cmd) - - value, err := strconv.ParseInt(args[0], 10, 32) - if err != nil { - return errors.Wrap(err, "can't parse max-packet-msg-payload-size") - } - - return updateTmConfig(clientCtx.HomeDir, func(config *tmcfg.Config) { - config.P2P.MaxPacketMsgPayloadSize = int(value) - }) - }, - } - - cmd.Flags().String(flags.FlagHome, defaultNodeHome, "The application home directory") - - return cmd -} - -// p2pLaddrCmd returns configuration cobra Command. -func p2pLaddrCmd(defaultNodeHome string) *cobra.Command { - cmd := &cobra.Command{ - Use: "laddr [value]", - Short: "Address to listen for incoming connections", - Example: "laddr \"tcp://0.0.0.0:26656\"", - Args: cobra.ExactArgs(1), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx := client.GetClientContextFromCmd(cmd) - - return updateTmConfig(clientCtx.HomeDir, func(config *tmcfg.Config) { - config.P2P.ListenAddress = args[0] - }) - }, - } - - cmd.Flags().String(flags.FlagHome, defaultNodeHome, "The application home directory") - - return cmd -} - -// createEmptyBlocksCmd returns configuration cobra Command. -func createEmptyBlocksCmd(defaultNodeHome string) *cobra.Command { - cmd := &cobra.Command{ - Use: "create-empty-blocks [value]", - Short: "EmptyBlocks mode (true|false)", - Example: "create-empty-blocks false", - Args: cobra.ExactArgs(1), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx := client.GetClientContextFromCmd(cmd) - - value, err := strconv.ParseBool(args[0]) - if err != nil { - return errors.Wrap(err, "can't parse create-empty-blocks") - } - - return updateTmConfig(clientCtx.HomeDir, func(config *tmcfg.Config) { - config.Consensus.CreateEmptyBlocks = value - }) - }, - } - - cmd.Flags().String(flags.FlagHome, defaultNodeHome, "The application home directory") - - return cmd -} - -// createEmptyBlocksCmd returns configuration cobra Command. -func rpcLaddrCmd(defaultNodeHome string) *cobra.Command { - cmd := &cobra.Command{ - Use: "rpc-laddr [value]", - Short: "TCP or UNIX socket address for the RPC server to listen on", - Example: "rpc-laddr \"tcp://127.0.0.1:26657\"", - Args: cobra.ExactArgs(1), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx := client.GetClientContextFromCmd(cmd) - - return updateTmConfig(clientCtx.HomeDir, func(config *tmcfg.Config) { - config.RPC.ListenAddress = args[0] - }) - }, - } - - cmd.Flags().String(flags.FlagHome, defaultNodeHome, "The application home directory") - - return cmd -} - -// fastsyncVersionCmd returns configuration cobra Command. -func fastsyncVersionCmd(defaultNodeHome string) *cobra.Command { - cmd := &cobra.Command{ - Use: "fastsync-version [value]", - Short: "Fast Sync version to use (v0|v1|v2)", - Example: "fastsync-version v2", - Args: cobra.ExactArgs(1), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx := client.GetClientContextFromCmd(cmd) - - return updateTmConfig(clientCtx.HomeDir, func(config *tmcfg.Config) { - config.FastSync.Version = args[0] - }) - }, - } - - cmd.Flags().String(flags.FlagHome, defaultNodeHome, "The application home directory") - - return cmd -} diff --git a/cmd/cheqd-noded/cmd/init_extensions.go b/cmd/cheqd-noded/cmd/init_extensions.go index cb4c32c45..1b7257cb9 100644 --- a/cmd/cheqd-noded/cmd/init_extensions.go +++ b/cmd/cheqd-noded/cmd/init_extensions.go @@ -31,12 +31,15 @@ func applyConfigDefaults(cmd *cobra.Command) error { clientCtx := client.GetClientContextFromCmd(cmd) err := updateTmConfig(clientCtx.HomeDir, func(config *tmcfg.Config) { + config.Consensus.CreateEmptyBlocks = false config.FastSync.Version = "v0" + config.LogFormat = "json" + config.LogLevel = "error" config.P2P.SendRate = 20000000 config.P2P.RecvRate = 20000000 config.P2P.MaxPacketMsgPayloadSize = 10240 - // Workaroud for Tendermint's bug + // Workaround for Tendermint's bug config.Storage = tmcfg.DefaultStorageConfig() }) if err != nil { @@ -44,7 +47,7 @@ func applyConfigDefaults(cmd *cobra.Command) error { } err = updateCosmConfig(clientCtx.HomeDir, func(config *cosmcfg.Config) { - config.BaseConfig.MinGasPrices = "25ncheq" + config.BaseConfig.MinGasPrices = "50ncheq" }) if err != nil { return err diff --git a/cmd/cheqd-noded/cmd/root.go b/cmd/cheqd-noded/cmd/root.go index dd57ee11a..a726bb24a 100644 --- a/cmd/cheqd-noded/cmd/root.go +++ b/cmd/cheqd-noded/cmd/root.go @@ -36,7 +36,7 @@ import ( dbm "github.com/tendermint/tm-db" ) -var ChainID = "cheqd" +var ChainID = "cheqd-mainnet-1" // NewRootCmd creates a new root command for simd. It is called once in the // main function. @@ -89,7 +89,6 @@ func initRootCmd(rootCmd *cobra.Command, encodingConfig params.EncodingConfig) { rootCmd.AddCommand( extendInit(genutilcli.InitCmd(app.ModuleBasics, app.DefaultNodeHome)), - configureCmd(app.DefaultNodeHome), genutilcli.CollectGenTxsCmd(banktypes.GenesisBalancesIterator{}, app.DefaultNodeHome), genutilcli.MigrateGenesisCmd(), genutilcli.GenTxCmd(app.ModuleBasics, encodingConfig.TxConfig, banktypes.GenesisBalancesIterator{}, app.DefaultNodeHome), @@ -135,7 +134,7 @@ func queryCommand() *cobra.Command { ) app.ModuleBasics.AddQueryCommands(cmd) - cmd.PersistentFlags().String(flags.FlagChainID, "", "The network chain ID") + cmd.PersistentFlags().String(flags.FlagChainID, "cheqd-mainnet-1", "The network chain ID") return cmd } @@ -163,7 +162,10 @@ func txCommand() *cobra.Command { ) app.ModuleBasics.AddTxCommands(cmd) - cmd.PersistentFlags().String(flags.FlagChainID, "", "The network chain ID") + cmd.PersistentFlags().String(flags.FlagChainID, "cheqd-mainnet-1", "The network chain ID") + cmd.PersistentFlags().String(flags.FlagGasPrices, "50ncheq", "Gas prices in decimal format") + cmd.PersistentFlags().Float64(flags.FlagGasAdjustment, 1.3, "Gas adjustment factor to be multiplied against estimated gas") + cmd.PersistentFlags().String(flags.FlagGas, flags.GasFlagAuto, "Gas limit to set per-transaction; set to 'auto' to calculate sufficient gas automatically") return cmd } diff --git a/docker/Dockerfile b/docker/Dockerfile index 15b0fc97b..0826fbf05 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -21,7 +21,7 @@ RUN make build ### STAGE 2: Build cheqd-node image ### ############################################################### -FROM alpine:3.16 AS runner +FROM alpine:3.17 AS runner # Install pre-requisites RUN apk update && apk add --no-cache bash ca-certificates