From 369d69649f64355f02d8461f6eb3cd70afeeca4b Mon Sep 17 00:00:00 2001 From: Daniel Liu Date: Mon, 25 Nov 2024 16:39:29 +0800 Subject: [PATCH] all: normalize flag's name --- cicd/devnet/start-local-devnet.sh | 14 +- cicd/devnet/start.sh | 14 +- cicd/mainnet/start.sh | 14 +- cicd/testnet/start.sh | 14 +- cmd/XDC/config.go | 8 +- cmd/XDC/consolecmd_test.go | 16 +- cmd/XDC/main.go | 32 ++-- cmd/XDC/run_test.go | 2 +- cmd/XDC/testdata/config.toml | 20 +-- cmd/puppeth/module_node.go | 4 +- cmd/puppeth/module_wallet.go | 2 +- cmd/utils/flags.go | 276 ++++++++++++++++++------------ docker/XDPoSChain/entrypoint.sh | 26 +-- internal/debug/flags.go | 15 +- 14 files changed, 257 insertions(+), 200 deletions(-) diff --git a/cicd/devnet/start-local-devnet.sh b/cicd/devnet/start-local-devnet.sh index c0a9448a86..230e09f821 100755 --- a/cicd/devnet/start-local-devnet.sh +++ b/cicd/devnet/start-local-devnet.sh @@ -53,10 +53,10 @@ echo "Running a node with wallet: ${wallet} at local" ../../build/bin/XDC --ethstats ${netstats} --gcmode=archive \ --bootnodes ${bootnodes} --syncmode full \ --datadir ./tmp/xdcchain --networkid 551 \ --port 30303 --rpc --rpccorsdomain "*" --rpcaddr 0.0.0.0 \ ---rpcport 8545 \ ---rpcapi db,eth,debug,miner,net,shh,txpool,personal,web3,XDPoS \ ---rpcvhosts "*" --unlock "${wallet}" --password ./tmp/.pwd --mine \ ---gasprice "1" --targetgaslimit "420000000" --verbosity ${log_level} \ ---ws --wsaddr=0.0.0.0 --wsport 8555 \ ---wsorigins "*" 2>&1 >>./tmp/xdc.log +--port 30303 --http --http-corsdomain "*" --http-addr 0.0.0.0 \ +--http-port 8545 \ +--http-api db,eth,debug,miner,net,shh,txpool,personal,web3,XDPoS \ +--http-vhosts "*" --unlock "${wallet}" --password ./tmp/.pwd --mine \ +--miner-gasprice "1" --miner-gaslimit "420000000" --verbosity ${log_level} \ +--ws --ws-addr=0.0.0.0 --ws-port 8555 \ +--ws-origins "*" 2>&1 >>./tmp/xdc.log diff --git a/cicd/devnet/start.sh b/cicd/devnet/start.sh index 707b8b32a5..dcc6e86ee7 100755 --- a/cicd/devnet/start.sh +++ b/cicd/devnet/start.sh @@ -75,11 +75,11 @@ XDC --ethstats ${netstats} --gcmode archive \ --nat extip:${INSTANCE_IP} \ --bootnodes ${bootnodes} --syncmode full \ --datadir /work/xdcchain --networkid 551 \ --port $port --rpc --rpccorsdomain "*" --rpcaddr 0.0.0.0 \ ---rpcport $rpc_port \ ---rpcapi db,eth,debug,net,shh,txpool,personal,web3,XDPoS \ ---rpcvhosts "*" --unlock "${wallet}" --password /work/.pwd --mine \ ---gasprice "1" --targetgaslimit "420000000" --verbosity ${log_level} \ +--port $port --http --http-corsdomain "*" --http-addr 0.0.0.0 \ +--http-port $rpc_port \ +--http-api db,eth,debug,net,shh,txpool,personal,web3,XDPoS \ +--http-vhosts "*" --unlock "${wallet}" --password /work/.pwd --mine \ +--miner-gasprice "1" --miner-gaslimit "420000000" --verbosity ${log_level} \ --debugdatadir /work/xdcchain \ ---ws --wsaddr=0.0.0.0 --wsport $ws_port \ ---wsorigins "*" 2>&1 >>/work/xdcchain/xdc.log | tee -a /work/xdcchain/xdc.log +--ws --ws-addr=0.0.0.0 --ws-port $ws_port \ +--ws-origins "*" 2>&1 >>/work/xdcchain/xdc.log | tee -a /work/xdcchain/xdc.log diff --git a/cicd/mainnet/start.sh b/cicd/mainnet/start.sh index 0cfbe26e27..b6bca08f79 100755 --- a/cicd/mainnet/start.sh +++ b/cicd/mainnet/start.sh @@ -74,11 +74,11 @@ XDC --ethstats ${netstats} --gcmode archive \ --nat extip:${INSTANCE_IP} \ --bootnodes ${bootnodes} --syncmode full \ --datadir /work/xdcchain --networkid 50 \ --port $port --rpc --rpccorsdomain "*" --rpcaddr 0.0.0.0 \ ---rpcport $rpc_port \ ---rpcapi db,eth,debug,net,shh,txpool,personal,web3,XDPoS \ ---rpcvhosts "*" --unlock "${wallet}" --password /work/.pwd --mine \ ---gasprice "1" --targetgaslimit "420000000" --verbosity ${log_level} \ +--port $port --http --http-corsdomain "*" --http-addr 0.0.0.0 \ +--http-port $rpc_port \ +--http-api db,eth,debug,net,shh,txpool,personal,web3,XDPoS \ +--http-vhosts "*" --unlock "${wallet}" --password /work/.pwd --mine \ +--miner-gasprice "1" --miner-gaslimit "420000000" --verbosity ${log_level} \ --debugdatadir /work/xdcchain \ ---ws --wsaddr=0.0.0.0 --wsport $ws_port \ ---wsorigins "*" 2>&1 >>/work/xdcchain/xdc.log | tee -a /work/xdcchain/xdc.log +--ws --ws-addr=0.0.0.0 --ws-port $ws_port \ +--ws-origins "*" 2>&1 >>/work/xdcchain/xdc.log | tee -a /work/xdcchain/xdc.log diff --git a/cicd/testnet/start.sh b/cicd/testnet/start.sh index abfd91cadf..e506d1df45 100755 --- a/cicd/testnet/start.sh +++ b/cicd/testnet/start.sh @@ -76,11 +76,11 @@ XDC --ethstats ${netstats} --gcmode archive \ --nat extip:${INSTANCE_IP} \ --bootnodes ${bootnodes} --syncmode full \ --datadir /work/xdcchain --networkid 51 \ --port $port --rpc --rpccorsdomain "*" --rpcaddr 0.0.0.0 \ ---rpcport $rpc_port \ ---rpcapi db,eth,debug,net,shh,txpool,personal,web3,XDPoS \ ---rpcvhosts "*" --unlock "${wallet}" --password /work/.pwd --mine \ ---gasprice "1" --targetgaslimit "420000000" --verbosity ${log_level} \ +--port $port --http --http-corsdomain "*" --http-addr 0.0.0.0 \ +--http-port $rpc_port \ +--http-api db,eth,debug,net,shh,txpool,personal,web3,XDPoS \ +--http-vhosts "*" --unlock "${wallet}" --password /work/.pwd --mine \ +--miner-gasprice "1" --miner-gaslimit "420000000" --verbosity ${log_level} \ --debugdatadir /work/xdcchain \ ---ws --wsaddr=0.0.0.0 --wsport $ws_port \ ---wsorigins "*" 2>&1 >>/work/xdcchain/xdc.log | tee -a /work/xdcchain/xdc.log +--ws --ws-addr=0.0.0.0 --ws-port $ws_port \ +--ws-origins "*" 2>&1 >>/work/xdcchain/xdc.log | tee -a /work/xdcchain/xdc.log diff --git a/cmd/XDC/config.go b/cmd/XDC/config.go index 5f9cbab571..d5e60c9321 100644 --- a/cmd/XDC/config.go +++ b/cmd/XDC/config.go @@ -138,8 +138,8 @@ func makeConfigNode(ctx *cli.Context) (*node.Node, XDCConfig) { utils.Fatalf("%v", err) } } - if ctx.IsSet(utils.StakingEnabledFlag.Name) { - cfg.StakeEnable = ctx.Bool(utils.StakingEnabledFlag.Name) + if ctx.IsSet(utils.MiningEnabledFlag.Name) { + cfg.StakeEnable = ctx.Bool(utils.MiningEnabledFlag.Name) } // if !ctx.IsSet(debug.VerbosityFlag.Name) { // debug.Verbosity(log.Lvl(cfg.Verbosity)) @@ -175,8 +175,8 @@ func makeConfigNode(ctx *cli.Context) (*node.Node, XDCConfig) { // Check GasPrice common.MinGasPrice = big.NewInt(common.DefaultMinGasPrice) - if ctx.IsSet(utils.GasPriceFlag.Name) { - if gasPrice := int64(ctx.Int(utils.GasPriceFlag.Name)); gasPrice > common.DefaultMinGasPrice { + if ctx.IsSet(utils.MinerGasPriceFlag.Name) { + if gasPrice := int64(ctx.Int(utils.MinerGasPriceFlag.Name)); gasPrice > common.DefaultMinGasPrice { common.MinGasPrice = big.NewInt(gasPrice) } } diff --git a/cmd/XDC/consolecmd_test.go b/cmd/XDC/consolecmd_test.go index 9ca2e0b73e..23988bc2c2 100644 --- a/cmd/XDC/consolecmd_test.go +++ b/cmd/XDC/consolecmd_test.go @@ -44,9 +44,9 @@ func TestConsoleWelcome(t *testing.T) { // Start a XDC console, make sure it's cleaned up and terminate the console XDC := runXDC(t, - "console", "--datadir", datadir, "--XDCx.datadir", datadir+"/XDCx/"+time.Now().String(), + "console", "--datadir", datadir, "--XDCx-datadir", datadir+"/XDCx/"+time.Now().String(), "--port", "0", "--maxpeers", "0", "--nodiscover", "--nat", "none", - "--etherbase", coinbase) + "--miner-etherbase", coinbase) // Gather all the infos the welcome message needs to contain XDC.SetTemplateFunc("goos", func() string { return runtime.GOOS }) @@ -86,9 +86,9 @@ func TestIPCAttachWelcome(t *testing.T) { ipc = filepath.Join(datadir, "XDC.ipc") } XDC := runXDC(t, - "--datadir", datadir, "--XDCx.datadir", datadir+"/XDCx/"+time.Now().String(), + "--datadir", datadir, "--XDCx-datadir", datadir+"/XDCx/"+time.Now().String(), "--port", "0", "--maxpeers", "0", "--nodiscover", "--nat", "none", - "--etherbase", coinbase, "--ipcpath", ipc) + "--miner-etherbase", coinbase, "--ipcpath", ipc) time.Sleep(2 * time.Second) // Simple way to wait for the RPC endpoint to open testAttachWelcome(t, XDC, "ipc:"+ipc, ipcAPIs) @@ -103,9 +103,9 @@ func TestHTTPAttachWelcome(t *testing.T) { datadir := tmpdir(t) defer os.RemoveAll(datadir) XDC := runXDC(t, - "--datadir", datadir, "--XDCx.datadir", datadir+"/XDCx/"+time.Now().String(), + "--datadir", datadir, "--XDCx-datadir", datadir+"/XDCx/"+time.Now().String(), "--port", "0", "--maxpeers", "0", "--nodiscover", "--nat", "none", - "--etherbase", coinbase, "--rpc", "--rpcport", port) + "--miner-etherbase", coinbase, "--http", "--http-port", port) time.Sleep(2 * time.Second) // Simple way to wait for the RPC endpoint to open testAttachWelcome(t, XDC, "http://localhost:"+port, httpAPIs) @@ -120,9 +120,9 @@ func TestWSAttachWelcome(t *testing.T) { datadir := tmpdir(t) defer os.RemoveAll(datadir) XDC := runXDC(t, - "--datadir", datadir, "--XDCx.datadir", datadir+"/XDCx/"+time.Now().String(), + "--datadir", datadir, "--XDCx-datadir", datadir+"/XDCx/"+time.Now().String(), "--port", "0", "--maxpeers", "0", "--nodiscover", "--nat", "none", - "--etherbase", coinbase, "--ws", "--wsport", port) + "--miner-etherbase", coinbase, "--ws", "--ws-port", port) time.Sleep(2 * time.Second) // Simple way to wait for the RPC endpoint to open testAttachWelcome(t, XDC, "ws://localhost:"+port, httpAPIs) diff --git a/cmd/XDC/main.go b/cmd/XDC/main.go index a736c81e27..0ba6fc781b 100644 --- a/cmd/XDC/main.go +++ b/cmd/XDC/main.go @@ -101,11 +101,11 @@ var ( utils.ListenPortFlag, utils.MaxPeersFlag, utils.MaxPendingPeersFlag, - utils.EtherbaseFlag, - utils.GasPriceFlag, - utils.StakerThreadsFlag, - utils.StakingEnabledFlag, - utils.TargetGasLimitFlag, + utils.MinerEtherbaseFlag, + utils.MinerGasPriceFlag, + utils.MinerThreadsFlag, + utils.MiningEnabledFlag, + utils.MinerGasLimitFlag, utils.NATFlag, utils.NoDiscoverFlag, //utils.DiscoveryV5Flag, @@ -122,8 +122,8 @@ var ( utils.EnableXDCPrefixFlag, utils.RewoundFlag, utils.NetworkIdFlag, - utils.RPCCORSDomainFlag, - utils.RPCVirtualHostsFlag, + utils.HTTPCORSDomainFlag, + utils.HTTPVirtualHostsFlag, utils.EthStatsURLFlag, utils.MetricsEnabledFlag, utils.MetricsHTTPFlag, @@ -145,14 +145,14 @@ var ( } rpcFlags = []cli.Flag{ - utils.RPCEnabledFlag, + utils.HTTPEnabledFlag, utils.RPCGlobalGasCapFlag, - utils.RPCListenAddrFlag, - utils.RPCPortFlag, - utils.RPCHttpReadTimeoutFlag, - utils.RPCHttpWriteTimeoutFlag, - utils.RPCHttpIdleTimeoutFlag, - utils.RPCApiFlag, + utils.HTTPListenAddrFlag, + utils.HTTPPortFlag, + utils.HTTPReadTimeoutFlag, + utils.HTTPWriteTimeoutFlag, + utils.HTTPIdleTimeoutFlag, + utils.HTTPApiFlag, utils.WSEnabledFlag, utils.WSListenAddrFlag, utils.WSPortFlag, @@ -329,7 +329,7 @@ func startNode(ctx *cli.Context, stack *node.Node, cfg XDCConfig) { } else { log.Info("Masternode found. Enabling staking mode...") // Use a reduced number of threads if requested - if threads := ctx.Int(utils.StakerThreadsFlag.Name); threads > 0 { + if threads := ctx.Int(utils.MinerThreadsFlag.Name); threads > 0 { type threaded interface { SetThreads(threads int) } @@ -371,7 +371,7 @@ func startNode(ctx *cli.Context, stack *node.Node, cfg XDCConfig) { } else { log.Info("Masternode found. Enabling staking mode...") // Use a reduced number of threads if requested - if threads := ctx.Int(utils.StakerThreadsFlag.Name); threads > 0 { + if threads := ctx.Int(utils.MinerThreadsFlag.Name); threads > 0 { type threaded interface { SetThreads(threads int) } diff --git a/cmd/XDC/run_test.go b/cmd/XDC/run_test.go index 231385e1ac..98f6092fed 100644 --- a/cmd/XDC/run_test.go +++ b/cmd/XDC/run_test.go @@ -71,7 +71,7 @@ func runXDC(t *testing.T, args ...string) *testXDC { if i < len(args)-1 { tt.Datadir = args[i+1] } - case "--etherbase": + case "--miner-etherbase": if i < len(args)-1 { tt.Etherbase = args[i+1] } diff --git a/cmd/XDC/testdata/config.toml b/cmd/XDC/testdata/config.toml index 939c87c12c..b94576dddb 100644 --- a/cmd/XDC/testdata/config.toml +++ b/cmd/XDC/testdata/config.toml @@ -5,24 +5,24 @@ NAT = "" # flag --nat [Eth] NetworkId = 89 # flag --networkid SyncMode = "full" # flag --syncmode -GasPrice = 1 # flag --gasprice +GasPrice = 1 # flag --miner-gasprice [Shh] [Node] DataDir = "node1/" # flag --datadir -HTTPPort = 8501 # flag --rpcport -HTTPHost = "localhost" # flags --rpcaddr & --rpc +HTTPPort = 8501 # flag --http-port +HTTPHost = "localhost" # flags --http-addr & --http # in 3 cases : - # HTTPHost is "" == --rpc & --rpcaddr is not set - # HTTPHost is "localhost" or "127.0.0.1" == only set --rpc - # HTTPHost is other IP (ex : 192.168.1.1) = set 2 flags --rpc & --rpcaddr -WSHost = "localhost" # flags --wsaddr & --ws . same option HTTPHost -WSPort = 8546 # flag --wsport -WSModules = ["eth","ssh"] #flag --wsapi + # HTTPHost is "" == --http & --http-addr is not set + # HTTPHost is "localhost" or "127.0.0.1" == only set --http + # HTTPHost is other IP (ex : 192.168.1.1) = set 2 flags --http & --http-addr +WSHost = "localhost" # flags --ws-addr & --ws . same option HTTPHost +WSPort = 8546 # flag --ws-port +WSModules = ["eth","ssh"] #flag --ws-api -HTTPModules = ["personal","db","eth","net","web3","txpool","miner"] # flag --rpcapi +HTTPModules = ["personal","db","eth","net","web3","txpool","miner"] # flag --http-api KeyStoreDir = "" # flag --keystore UserIdent = "" # flag --identity diff --git a/cmd/puppeth/module_node.go b/cmd/puppeth/module_node.go index a52a959ced..c592e59d31 100644 --- a/cmd/puppeth/module_node.go +++ b/cmd/puppeth/module_node.go @@ -42,7 +42,7 @@ ADD genesis.json /genesis.json RUN \ echo 'XDC --cache 512 init /genesis.json' > XDC.sh && \{{if .Unlock}} echo 'mkdir -p /root/.ethereum/keystore/ && cp /signer.json /root/.ethereum/keystore/' >> XDC.sh && \{{end}} - echo $'XDC --networkid {{.NetworkID}} --cache 512 --port {{.Port}} --maxpeers {{.Peers}} {{.LightFlag}} --ethstats \'{{.Ethstats}}\' {{if .Bootnodes}}--bootnodes {{.Bootnodes}}{{end}} {{if .Etherbase}}--etherbase {{.Etherbase}} --mine --minerthreads 1{{end}} {{if .Unlock}}--unlock 0 --password /signer.pass --mine{{end}} --targetgaslimit {{.GasTarget}} --gasprice {{.GasPrice}}' >> XDC.sh + echo $'XDC --networkid {{.NetworkID}} --cache 512 --port {{.Port}} --maxpeers {{.Peers}} {{.LightFlag}} --ethstats \'{{.Ethstats}}\' {{if .Bootnodes}}--bootnodes {{.Bootnodes}}{{end}} {{if .Etherbase}}--miner-etherbase {{.Etherbase}} --mine --miner-threads 1{{end}} {{if .Unlock}}--unlock 0 --password /signer.pass --mine{{end}} --miner-gaslimit {{.GasTarget}} --miner-gasprice {{.GasPrice}}' >> XDC.sh ENTRYPOINT ["/bin/sh", "XDC.sh"] ` @@ -92,7 +92,7 @@ func deployNode(client *sshClient, network string, bootnodes []string, config *n lightFlag := "" if config.peersLight > 0 { - lightFlag = fmt.Sprintf("--lightpeers=%d --lightserv=50", config.peersLight) + lightFlag = fmt.Sprintf("--light-peers=%d --light-serv=50", config.peersLight) } dockerfile := new(bytes.Buffer) template.Must(template.New("").Parse(nodeDockerfile)).Execute(dockerfile, map[string]interface{}{ diff --git a/cmd/puppeth/module_wallet.go b/cmd/puppeth/module_wallet.go index 6dcbdfbec5..c714072e6e 100644 --- a/cmd/puppeth/module_wallet.go +++ b/cmd/puppeth/module_wallet.go @@ -37,7 +37,7 @@ ADD genesis.json /genesis.json RUN \ echo 'node server.js &' > wallet.sh && \ echo 'XDC --cache 512 init /genesis.json' >> wallet.sh && \ - echo $'XDC --networkid {{.NetworkID}} --port {{.NodePort}} --bootnodes {{.Bootnodes}} --ethstats \'{{.Ethstats}}\' --cache=512 --rpc --rpcaddr=0.0.0.0 --rpccorsdomain "*" --rpcvhosts "*"' >> wallet.sh + echo $'XDC --networkid {{.NetworkID}} --port {{.NodePort}} --bootnodes {{.Bootnodes}} --ethstats \'{{.Ethstats}}\' --cache=512 --http --http-addr=0.0.0.0 --http-corsdomain "*" --http-vhosts "*"' >> wallet.sh RUN \ sed -i 's/PuppethNetworkID/{{.NetworkID}}/g' dist/js/etherwallet-master.js && \ diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index db42606da5..a6b54f9644 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -113,6 +113,7 @@ var ( } DeveloperPeriodFlag = &cli.IntFlag{ Name: "dev-period", + Aliases: []string{"dev.period"}, Usage: "Block period to use in developer mode (0 = mine only if transaction pending)", Category: flags.DevCategory, } @@ -149,13 +150,15 @@ var ( // Light server and client settings LightServFlag = &cli.IntFlag{ - Name: "lightserv", + Name: "light-serv", + Aliases: []string{"lightserv"}, Usage: "Maximum percentage of time allowed for serving LES requests (0-90)", Value: ethconfig.Defaults.LightServ, Category: flags.LightCategory, } LightPeersFlag = &cli.IntFlag{ - Name: "lightpeers", + Name: "light-peers", + Aliases: []string{"lightpeers"}, Usage: "Maximum number of LES client peers", Value: ethconfig.Defaults.LightPeers, Category: flags.LightCategory, @@ -163,36 +166,42 @@ var ( // Ethash settings EthashCacheDirFlag = &flags.DirectoryFlag{ - Name: "ethash.cachedir", + Name: "ethash-cachedir", + Aliases: []string{"ethash.cachedir"}, Usage: "Directory to store the ethash verification caches (default = inside the datadir)", Category: flags.EthashCategory, } EthashCachesInMemoryFlag = &cli.IntFlag{ - Name: "ethash.cachesinmem", + Name: "ethash-cachesinmem", + Aliases: []string{"ethash.cachesinmem"}, Usage: "Number of recent ethash caches to keep in memory (16MB each)", Value: ethconfig.Defaults.Ethash.CachesInMem, Category: flags.EthashCategory, } EthashCachesOnDiskFlag = &cli.IntFlag{ - Name: "ethash.cachesondisk", + Name: "ethash-cachesondisk", + Aliases: []string{"ethash.cachesondisk"}, Usage: "Number of recent ethash caches to keep on disk (16MB each)", Value: ethconfig.Defaults.Ethash.CachesOnDisk, Category: flags.EthashCategory, } EthashDatasetDirFlag = &flags.DirectoryFlag{ - Name: "ethash.dagdir", + Name: "ethash-dagdir", + Aliases: []string{"ethash.dagdir"}, Usage: "Directory to store the ethash mining DAGs (default = inside home folder)", Value: flags.DirectoryString(ethconfig.Defaults.Ethash.DatasetDir), Category: flags.EthashCategory, } EthashDatasetsInMemoryFlag = &cli.IntFlag{ - Name: "ethash.dagsinmem", + Name: "ethash-dagsinmem", + Aliases: []string{"ethash.dagsinmem"}, Usage: "Number of recent ethash mining DAGs to keep in memory (1+GB each)", Value: ethconfig.Defaults.Ethash.DatasetsInMem, Category: flags.EthashCategory, } EthashDatasetsOnDiskFlag = &cli.IntFlag{ - Name: "ethash.dagsondisk", + Name: "ethash-dagsondisk", + Aliases: []string{"ethash.dagsondisk"}, Usage: "Number of recent ethash mining DAGs to keep on disk (1+GB each)", Value: ethconfig.Defaults.Ethash.DatasetsOnDisk, Category: flags.EthashCategory, @@ -200,60 +209,70 @@ var ( // Transaction pool settings TxPoolNoLocalsFlag = &cli.BoolFlag{ - Name: "txpool.nolocals", + Name: "txpool-nolocals", + Aliases: []string{"txpool.nolocals"}, Usage: "Disables price exemptions for locally submitted transactions", Category: flags.TxPoolCategory, } TxPoolJournalFlag = &cli.StringFlag{ - Name: "txpool.journal", + Name: "txpool-journal", + Aliases: []string{"txpool.journal"}, Usage: "Disk journal for local transaction to survive node restarts", Value: txpool.DefaultConfig.Journal, Category: flags.TxPoolCategory, } TxPoolRejournalFlag = &cli.DurationFlag{ - Name: "txpool.rejournal", + Name: "txpool-rejournal", + Aliases: []string{"txpool.rejournal"}, Usage: "Time interval to regenerate the local transaction journal", Value: txpool.DefaultConfig.Rejournal, Category: flags.TxPoolCategory, } TxPoolPriceLimitFlag = &cli.Uint64Flag{ - Name: "txpool.pricelimit", + Name: "txpool-pricelimit", + Aliases: []string{"txpool.pricelimit"}, Usage: "Minimum gas price limit to enforce for acceptance into the pool", Value: ethconfig.Defaults.TxPool.PriceLimit, Category: flags.TxPoolCategory, } TxPoolPriceBumpFlag = &cli.Uint64Flag{ - Name: "txpool.pricebump", + Name: "txpool-pricebump", + Aliases: []string{"txpool.pricebump"}, Usage: "Price bump percentage to replace an already existing transaction", Value: ethconfig.Defaults.TxPool.PriceBump, Category: flags.TxPoolCategory, } TxPoolAccountSlotsFlag = &cli.Uint64Flag{ - Name: "txpool.accountslots", + Name: "txpool-accountslots", + Aliases: []string{"txpool.accountslots"}, Usage: "Minimum number of executable transaction slots guaranteed per account", Value: ethconfig.Defaults.TxPool.AccountSlots, Category: flags.TxPoolCategory, } TxPoolGlobalSlotsFlag = &cli.Uint64Flag{ - Name: "txpool.globalslots", + Name: "txpool-globalslots", + Aliases: []string{"txpool.globalslots"}, Usage: "Maximum number of executable transaction slots for all accounts", Value: ethconfig.Defaults.TxPool.GlobalSlots, Category: flags.TxPoolCategory, } TxPoolAccountQueueFlag = &cli.Uint64Flag{ - Name: "txpool.accountqueue", + Name: "txpool-accountqueue", + Aliases: []string{"txpool.accountqueue"}, Usage: "Maximum number of non-executable transaction slots permitted per account", Value: ethconfig.Defaults.TxPool.AccountQueue, Category: flags.TxPoolCategory, } TxPoolGlobalQueueFlag = &cli.Uint64Flag{ - Name: "txpool.globalqueue", + Name: "txpool-globalqueue", + Aliases: []string{"txpool.globalqueue"}, Usage: "Maximum number of non-executable transaction slots for all accounts", Value: ethconfig.Defaults.TxPool.GlobalQueue, Category: flags.TxPoolCategory, } TxPoolLifetimeFlag = &cli.DurationFlag{ - Name: "txpool.lifetime", + Name: "txpool-lifetime", + Aliases: []string{"txpool.lifetime"}, Usage: "Maximum amount of time non-executable transaction are queued", Value: ethconfig.Defaults.TxPool.Lifetime, Category: flags.TxPoolCategory, @@ -267,19 +286,22 @@ var ( Category: flags.PerfCategory, } CacheDatabaseFlag = &cli.IntFlag{ - Name: "cache.database", + Name: "cache-database", + Aliases: []string{"cache.database"}, Usage: "Percentage of cache memory allowance to use for database io", Value: 50, Category: flags.PerfCategory, } CacheGCFlag = &cli.IntFlag{ - Name: "cache.gc", + Name: "cache-gc", + Aliases: []string{"cache.gc"}, Usage: "Percentage of cache memory allowance to use for trie pruning", Value: 25, Category: flags.PerfCategory, } CacheLogSizeFlag = &cli.IntFlag{ - Name: "cache.blocklogs", + Name: "cache-blocklogs", + Aliases: []string{"cache.blocklogs"}, Usage: "Size (in number of blocks) of the log cache for filtering", Value: ethconfig.Defaults.FilterLogCacheSize, Category: flags.PerfCategory, @@ -291,37 +313,42 @@ var ( } // Miner settings - StakingEnabledFlag = &cli.BoolFlag{ + MiningEnabledFlag = &cli.BoolFlag{ Name: "mine", - Usage: "Enable staking", + Usage: "Enable mining", Category: flags.MinerCategory, } - StakerThreadsFlag = &cli.IntFlag{ - Name: "minerthreads", - Usage: "Number of CPU threads to use for staking", + MinerThreadsFlag = &cli.IntFlag{ + Name: "miner-threads", + Aliases: []string{"minerthreads"}, + Usage: "Number of CPU threads to use for mining", Value: runtime.NumCPU(), Category: flags.MinerCategory, } - TargetGasLimitFlag = &cli.Uint64Flag{ - Name: "targetgaslimit", + MinerGasLimitFlag = &cli.Uint64Flag{ + Name: "miner-gaslimit", + Aliases: []string{"targetgaslimit"}, Usage: "Target gas limit sets the artificial target gas floor for the blocks to mine", Value: params.XDCGenesisGasLimit, Category: flags.MinerCategory, } - EtherbaseFlag = &cli.StringFlag{ - Name: "etherbase", - Usage: "Public address for block mining rewards (default = first account created)", - Value: "0", - Category: flags.MinerCategory, - } - GasPriceFlag = &flags.BigFlag{ - Name: "gasprice", + MinerGasPriceFlag = &flags.BigFlag{ + Name: "miner-gasprice", + Aliases: []string{"gasprice"}, Usage: "Minimal gas price to accept for mining a transactions", Value: ethconfig.Defaults.GasPrice, Category: flags.MinerCategory, } - ExtraDataFlag = &cli.StringFlag{ - Name: "extradata", + MinerEtherbaseFlag = &cli.StringFlag{ + Name: "miner-etherbase", + Aliases: []string{"etherbase"}, + Usage: "Public address for block mining rewards (default = first account created)", + Value: "0", + Category: flags.MinerCategory, + } + MinerExtraDataFlag = &cli.StringFlag{ + Name: "miner-extradata", + Aliases: []string{"extradata"}, Usage: "Block extra data set by the miner (default = client version)", Category: flags.MinerCategory, } @@ -355,7 +382,8 @@ var ( Category: flags.APICategory, } RPCGlobalTxFeeCap = &cli.Float64Flag{ - Name: "rpc.txfeecap", + Name: "rpc-txfeecap", + Aliases: []string{"rpc.txfeecap"}, Usage: "Sets a cap on transaction fee (in ether) that can be sent via the RPC APIs (0 = no cap)", Value: ethconfig.Defaults.RPCTxFeeCap, Category: flags.APICategory, @@ -389,66 +417,97 @@ var ( Usage: "Filename for IPC socket/pipe within the datadir (explicit paths escape it)", Category: flags.APICategory, } - RPCEnabledFlag = &cli.BoolFlag{ - Name: "rpc", + HTTPEnabledFlag = &cli.BoolFlag{ + Name: "http", + Aliases: []string{"rpc"}, Usage: "Enable the HTTP-RPC server", Category: flags.APICategory, } - RPCListenAddrFlag = &cli.StringFlag{ - Name: "rpcaddr", + HTTPListenAddrFlag = &cli.StringFlag{ + Name: "http-addr", + Aliases: []string{"rpcaddr"}, Usage: "HTTP-RPC server listening interface", Value: node.DefaultHTTPHost, Category: flags.APICategory, } - RPCPortFlag = &cli.IntFlag{ - Name: "rpcport", + HTTPPortFlag = &cli.IntFlag{ + Name: "http-port", + Aliases: []string{"rpcport"}, Usage: "HTTP-RPC server listening port", Value: node.DefaultHTTPPort, Category: flags.APICategory, } - RPCCORSDomainFlag = &cli.StringFlag{ - Name: "rpccorsdomain", + HTTPCORSDomainFlag = &cli.StringFlag{ + Name: "http-corsdomain", + Aliases: []string{"rpccorsdomain"}, Usage: "Comma separated list of domains from which to accept cross origin requests (browser enforced)", Value: "", Category: flags.APICategory, } - RPCVirtualHostsFlag = &cli.StringFlag{ - Name: "rpcvhosts", + HTTPVirtualHostsFlag = &cli.StringFlag{ + Name: "http-vhosts", + Aliases: []string{"rpcvhosts"}, Usage: "Comma separated list of virtual hostnames from which to accept requests (server enforced). Accepts '*' wildcard.", Value: strings.Join(node.DefaultConfig.HTTPVirtualHosts, ","), Category: flags.APICategory, } - RPCApiFlag = &cli.StringFlag{ - Name: "rpcapi", + HTTPApiFlag = &cli.StringFlag{ + Name: "http-api", + Aliases: []string{"rpcapi"}, Usage: "API's offered over the HTTP-RPC interface", Value: "", Category: flags.APICategory, } + HTTPReadTimeoutFlag = &cli.DurationFlag{ + Name: "http-readtimeout", + Aliases: []string{"rpcreadtimeout"}, + Usage: "HTTP-RPC server read timeout", + Value: rpc.DefaultHTTPTimeouts.ReadTimeout, + Category: flags.APICategory, + } + HTTPWriteTimeoutFlag = &cli.DurationFlag{ + Name: "http-writetimeout", + Aliases: []string{"rpcwritetimeout"}, + Usage: "HTTP-RPC server write timeout", + Value: rpc.DefaultHTTPTimeouts.WriteTimeout, + Category: flags.APICategory, + } + HTTPIdleTimeoutFlag = &cli.DurationFlag{ + Name: "http-idletimeout", + Aliases: []string{"rpcidletimeout"}, + Usage: "HTTP-RPC server idle timeout", + Value: rpc.DefaultHTTPTimeouts.IdleTimeout, + Category: flags.APICategory, + } WSEnabledFlag = &cli.BoolFlag{ Name: "ws", Usage: "Enable the WS-RPC server", Category: flags.APICategory, } WSListenAddrFlag = &cli.StringFlag{ - Name: "wsaddr", + Name: "ws-addr", + Aliases: []string{"wsaddr"}, Usage: "WS-RPC server listening interface", Value: node.DefaultWSHost, Category: flags.APICategory, } WSPortFlag = &cli.IntFlag{ - Name: "wsport", + Name: "ws-port", + Aliases: []string{"wsport"}, Usage: "WS-RPC server listening port", Value: node.DefaultWSPort, Category: flags.APICategory, } WSApiFlag = &cli.StringFlag{ - Name: "wsapi", + Name: "ws-api", + Aliases: []string{"wsapi"}, Usage: "API's offered over the WS-RPC interface", Value: "", Category: flags.APICategory, } WSAllowedOriginsFlag = &cli.StringFlag{ - Name: "wsorigins", + Name: "ws-origins", + Aliases: []string{"wsorigins"}, Usage: "Origins from which to accept websockets requests", Value: "", Category: flags.APICategory, @@ -463,24 +522,6 @@ var ( Usage: "Comma separated list of JavaScript files to preload into the console", Category: flags.APICategory, } - RPCHttpReadTimeoutFlag = &cli.DurationFlag{ - Name: "rpcreadtimeout", - Usage: "HTTP-RPC server read timeout", - Value: rpc.DefaultHTTPTimeouts.ReadTimeout, - Category: flags.APICategory, - } - RPCHttpWriteTimeoutFlag = &cli.DurationFlag{ - Name: "rpcwritetimeout", - Usage: "HTTP-RPC server write timeout", - Value: rpc.DefaultHTTPTimeouts.WriteTimeout, - Category: flags.APICategory, - } - RPCHttpIdleTimeoutFlag = &cli.DurationFlag{ - Name: "rpcidletimeout", - Usage: "HTTP-RPC server idle timeout", - Value: rpc.DefaultHTTPTimeouts.IdleTimeout, - Category: flags.APICategory, - } // Network Settings MaxPeersFlag = &cli.IntFlag{ @@ -561,25 +602,29 @@ var ( // Gas price oracle settings GpoBlocksFlag = &cli.IntFlag{ - Name: "gpoblocks", + Name: "gpo-blocks", + Aliases: []string{"gpoblocks"}, Usage: "Number of recent blocks to check for gas prices", Value: ethconfig.Defaults.GPO.Blocks, Category: flags.GasPriceCategory, } GpoPercentileFlag = &cli.IntFlag{ - Name: "gpopercentile", + Name: "gpo-percentile", + Aliases: []string{"gpopercentile"}, Usage: "Suggested gas price is the given percentile of a set of recent transaction gas prices", Value: ethconfig.Defaults.GPO.Percentile, Category: flags.GasPriceCategory, } GpoMaxGasPriceFlag = &cli.Int64Flag{ - Name: "gpo.maxprice", + Name: "gpo-maxprice", + Aliases: []string{"gpo.maxprice"}, Usage: "Maximum gas price will be recommended by gpo", Value: ethconfig.Defaults.GPO.MaxPrice.Int64(), Category: flags.GasPriceCategory, } GpoIgnoreGasPriceFlag = &cli.Int64Flag{ - Name: "gpo.ignoreprice", + Name: "gpo-ignoreprice", + Aliases: []string{"gpo.ignoreprice"}, Usage: "Gas price below which gpo will ignore transactions", Value: ethconfig.Defaults.GPO.IgnorePrice.Int64(), Category: flags.GasPriceCategory, @@ -597,13 +642,15 @@ var ( // to enable a public-OK metrics endpoint without having to worry about ALSO exposing // other profiling behavior or information. MetricsHTTPFlag = &cli.StringFlag{ - Name: "metrics.addr", + Name: "metrics-addr", + Aliases: []string{"metrics.addr"}, Usage: "Enable stand-alone metrics HTTP server listening interface", Value: metrics.DefaultConfig.HTTP, Category: flags.MetricsCategory, } MetricsPortFlag = &cli.IntFlag{ - Name: "metrics.port", + Name: "metrics-port", + Aliases: []string{"metrics.port"}, Usage: "Metrics HTTP server listening port", Value: metrics.DefaultConfig.Port, Category: flags.MetricsCategory, @@ -661,31 +708,36 @@ var ( Category: flags.XdcxCategory, } XDCXDataDirFlag = &flags.DirectoryFlag{ - Name: "XDCx.datadir", + Name: "XDCx-datadir", + Aliases: []string{"XDCx.datadir"}, Usage: "Data directory for the XDCX databases", Value: flags.DirectoryString(filepath.Join(DataDirFlag.Value.String(), "XDCx")), Category: flags.XdcxCategory, } XDCXDBEngineFlag = &cli.StringFlag{ - Name: "XDCx.dbengine", + Name: "XDCx-dbengine", + Aliases: []string{"XDCx.dbengine"}, Usage: "Database engine for XDCX (leveldb, mongodb)", Value: "leveldb", Category: flags.XdcxCategory, } XDCXDBNameFlag = &cli.StringFlag{ - Name: "XDCx.dbName", + Name: "XDCx-dbName", + Aliases: []string{"XDCx.dbName"}, Usage: "Database name for XDCX", Value: "XDCdex", Category: flags.XdcxCategory, } XDCXDBConnectionUrlFlag = &cli.StringFlag{ - Name: "XDCx.dbConnectionUrl", + Name: "XDCx-dbConnectionUrl", + Aliases: []string{"XDCx.dbConnectionUrl"}, Usage: "ConnectionUrl to database if dbEngine is mongodb. Host:port. If there are multiple instances, separated by comma. Eg: localhost:27017,localhost:27018", Value: "localhost:27017", Category: flags.XdcxCategory, } XDCXDBReplicaSetNameFlag = &cli.StringFlag{ - Name: "XDCx.dbReplicaSetName", + Name: "XDCx-dbReplicaSetName", + Aliases: []string{"XDCx.dbReplicaSetName"}, Usage: "ReplicaSetName if Master-Slave is setup", Category: flags.XdcxCategory, } @@ -847,33 +899,33 @@ func splitAndTrim(input string) (ret []string) { // setHTTP creates the HTTP RPC listener interface string from the set // command line flags, returning empty if the HTTP endpoint is disabled. func setHTTP(ctx *cli.Context, cfg *node.Config) { - if ctx.Bool(RPCEnabledFlag.Name) && cfg.HTTPHost == "" { + if ctx.Bool(HTTPEnabledFlag.Name) && cfg.HTTPHost == "" { cfg.HTTPHost = "127.0.0.1" - if ctx.IsSet(RPCListenAddrFlag.Name) { - cfg.HTTPHost = ctx.String(RPCListenAddrFlag.Name) + if ctx.IsSet(HTTPListenAddrFlag.Name) { + cfg.HTTPHost = ctx.String(HTTPListenAddrFlag.Name) } } - if ctx.IsSet(RPCPortFlag.Name) { - cfg.HTTPPort = ctx.Int(RPCPortFlag.Name) + if ctx.IsSet(HTTPPortFlag.Name) { + cfg.HTTPPort = ctx.Int(HTTPPortFlag.Name) } - if ctx.IsSet(RPCHttpReadTimeoutFlag.Name) { - cfg.HTTPTimeouts.ReadTimeout = ctx.Duration(RPCHttpReadTimeoutFlag.Name) + if ctx.IsSet(HTTPReadTimeoutFlag.Name) { + cfg.HTTPTimeouts.ReadTimeout = ctx.Duration(HTTPReadTimeoutFlag.Name) } - if ctx.IsSet(RPCHttpWriteTimeoutFlag.Name) { - cfg.HTTPTimeouts.WriteTimeout = ctx.Duration(RPCHttpWriteTimeoutFlag.Name) + if ctx.IsSet(HTTPWriteTimeoutFlag.Name) { + cfg.HTTPTimeouts.WriteTimeout = ctx.Duration(HTTPWriteTimeoutFlag.Name) } - if ctx.IsSet(RPCHttpIdleTimeoutFlag.Name) { - cfg.HTTPTimeouts.IdleTimeout = ctx.Duration(RPCHttpIdleTimeoutFlag.Name) + if ctx.IsSet(HTTPIdleTimeoutFlag.Name) { + cfg.HTTPTimeouts.IdleTimeout = ctx.Duration(HTTPIdleTimeoutFlag.Name) } - if ctx.IsSet(RPCCORSDomainFlag.Name) { - cfg.HTTPCors = splitAndTrim(ctx.String(RPCCORSDomainFlag.Name)) + if ctx.IsSet(HTTPCORSDomainFlag.Name) { + cfg.HTTPCors = splitAndTrim(ctx.String(HTTPCORSDomainFlag.Name)) } - if ctx.IsSet(RPCApiFlag.Name) { - cfg.HTTPModules = splitAndTrim(ctx.String(RPCApiFlag.Name)) + if ctx.IsSet(HTTPApiFlag.Name) { + cfg.HTTPModules = splitAndTrim(ctx.String(HTTPApiFlag.Name)) } - if ctx.IsSet(RPCVirtualHostsFlag.Name) { - cfg.HTTPVirtualHosts = splitAndTrim(ctx.String(RPCVirtualHostsFlag.Name)) + if ctx.IsSet(HTTPVirtualHostsFlag.Name) { + cfg.HTTPVirtualHosts = splitAndTrim(ctx.String(HTTPVirtualHostsFlag.Name)) } } @@ -969,10 +1021,10 @@ func MakeAddress(ks *keystore.KeyStore, account string) (accounts.Account, error // setEtherbase retrieves the etherbase either from the directly specified // command line flags or from the keystore if CLI indexed. func setEtherbase(ctx *cli.Context, ks *keystore.KeyStore, cfg *ethconfig.Config) { - if ctx.IsSet(EtherbaseFlag.Name) { - account, err := MakeAddress(ks, ctx.String(EtherbaseFlag.Name)) + if ctx.IsSet(MinerEtherbaseFlag.Name) { + account, err := MakeAddress(ks, ctx.String(MinerEtherbaseFlag.Name)) if err != nil { - Fatalf("Option %q: %v", EtherbaseFlag.Name, err) + Fatalf("Option %q: %v", MinerEtherbaseFlag.Name, err) } cfg.Etherbase = account.Address } @@ -1317,8 +1369,8 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *ethconfig.Config) { if ctx.IsSet(CacheFlag.Name) || ctx.IsSet(CacheGCFlag.Name) { cfg.TrieCache = ctx.Int(CacheFlag.Name) * ctx.Int(CacheGCFlag.Name) / 100 } - if ctx.IsSet(StakerThreadsFlag.Name) { - cfg.MinerThreads = ctx.Int(StakerThreadsFlag.Name) + if ctx.IsSet(MinerThreadsFlag.Name) { + cfg.MinerThreads = ctx.Int(MinerThreadsFlag.Name) } if ctx.IsSet(DocRootFlag.Name) { cfg.DocRoot = ctx.String(DocRootFlag.Name) @@ -1332,11 +1384,11 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *ethconfig.Config) { if ctx.IsSet(RPCGlobalGasCapFlag.Name) { cfg.RPCGasCap = ctx.Uint64(RPCGlobalGasCapFlag.Name) } - if ctx.IsSet(ExtraDataFlag.Name) { - cfg.ExtraData = []byte(ctx.String(ExtraDataFlag.Name)) + if ctx.IsSet(MinerExtraDataFlag.Name) { + cfg.ExtraData = []byte(ctx.String(MinerExtraDataFlag.Name)) } - if ctx.IsSet(GasPriceFlag.Name) { - cfg.GasPrice = flags.GlobalBig(ctx, GasPriceFlag.Name) + if ctx.IsSet(MinerGasPriceFlag.Name) { + cfg.GasPrice = flags.GlobalBig(ctx, MinerGasPriceFlag.Name) } if ctx.IsSet(CacheLogSizeFlag.Name) { cfg.FilterLogCacheSize = ctx.Int(CacheLogSizeFlag.Name) @@ -1388,7 +1440,7 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *ethconfig.Config) { log.Info("Using developer account", "address", developer.Address) cfg.Genesis = core.DeveloperGenesisBlock(uint64(ctx.Int(DeveloperPeriodFlag.Name)), developer.Address) - if !ctx.IsSet(GasPriceFlag.Name) { + if !ctx.IsSet(MinerGasPriceFlag.Name) { cfg.GasPrice = big.NewInt(1) } } @@ -1398,7 +1450,7 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *ethconfig.Config) { // SetupNetwork configures the system for either the main net or some test network. func SetupNetwork(ctx *cli.Context) { // TODO(fjl): move target gas limit into config - params.TargetGasLimit = ctx.Uint64(TargetGasLimitFlag.Name) + params.TargetGasLimit = ctx.Uint64(MinerGasLimitFlag.Name) } // MakeChainDatabase open an LevelDB using the flags passed to the client and will hard crash if it fails. diff --git a/docker/XDPoSChain/entrypoint.sh b/docker/XDPoSChain/entrypoint.sh index 3ce0db757c..d080d1fb79 100755 --- a/docker/XDPoSChain/entrypoint.sh +++ b/docker/XDPoSChain/entrypoint.sh @@ -56,7 +56,7 @@ if [[ ! -z $NETWORK_ID ]]; then ;; 89 ) genesisPath="testnet.json" - params="$params --apothem --gcmode archive --rpcapi db,eth,net,web3,debug,XDPoS" + params="$params --apothem --gcmode archive --http-api db,eth,net,web3,debug,XDPoS" ;; 90 ) genesisPath="devnet.json" @@ -158,7 +158,7 @@ fi # debug mode if [[ ! -z $DEBUG_MODE ]]; then - params="$params --gcmode archive --rpcapi db,eth,net,web3,debug,XDPoS" + params="$params --gcmode archive --http-api db,eth,net,web3,debug,XDPoS" fi # maxpeers @@ -179,18 +179,18 @@ exec XDC $params \ --maxpeers $MAXPEERS \ --password ./password \ --port 30303 \ - --txpool.globalqueue 5000 \ - --txpool.globalslots 5000 \ - --rpc \ - --rpccorsdomain "*" \ - --rpcaddr 0.0.0.0 \ - --rpcport 8545 \ - --rpcvhosts "*" \ + --txpool-globalqueue 5000 \ + --txpool-globalslots 5000 \ + --http \ + --http-corsdomain "*" \ + --http-addr 0.0.0.0 \ + --http-port 8545 \ + --http-vhosts "*" \ --ws \ - --wsaddr 0.0.0.0 \ - --wsport 8546 \ - --wsorigins "*" \ + --ws-addr 0.0.0.0 \ + --ws-port 8546 \ + --ws-origins "*" \ --mine \ --gasprice "250000000" \ - --targetgaslimit "84000000" \ + --miner-gaslimit "84000000" \ "$@" diff --git a/internal/debug/flags.go b/internal/debug/flags.go index 6a366778c1..de8d587f08 100644 --- a/internal/debug/flags.go +++ b/internal/debug/flags.go @@ -106,30 +106,35 @@ var ( Category: flags.LoggingCategory, } pprofPortFlag = &cli.IntFlag{ - Name: "pprofport", + Name: "pprof-port", + Aliases: []string{"pprofport"}, Usage: "pprof HTTP server listening port", Value: 6060, Category: flags.LoggingCategory, } pprofAddrFlag = &cli.StringFlag{ - Name: "pprofaddr", + Name: "pprof-addr", + Aliases: []string{"pprofaddr"}, Usage: "pprof HTTP server listening interface", Value: "127.0.0.1", Category: flags.LoggingCategory, } memprofilerateFlag = &cli.IntFlag{ - Name: "memprofilerate", + Name: "pprof-memprofilerate", + Aliases: []string{"memprofilerate"}, Usage: "Turn on memory profiling with the given rate", Value: runtime.MemProfileRate, Category: flags.LoggingCategory, } blockprofilerateFlag = &cli.IntFlag{ - Name: "blockprofilerate", + Name: "pprof-blockprofilerate", + Aliases: []string{"blockprofilerate"}, Usage: "Turn on block profiling with the given rate", Category: flags.LoggingCategory, } cpuprofileFlag = &cli.StringFlag{ - Name: "cpuprofile", + Name: "pprof-cpuprofile", + Aliases: []string{"cpuprofile"}, Usage: "Write CPU profile to the given file", Category: flags.LoggingCategory, }