Skip to content

Commit

Permalink
all: normalize flag's name
Browse files Browse the repository at this point in the history
  • Loading branch information
gzliudan committed Nov 22, 2024
1 parent d07df63 commit 159be07
Show file tree
Hide file tree
Showing 14 changed files with 257 additions and 200 deletions.
14 changes: 7 additions & 7 deletions cicd/devnet/start-local-devnet.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
14 changes: 7 additions & 7 deletions cicd/devnet/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
14 changes: 7 additions & 7 deletions cicd/mainnet/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
14 changes: 7 additions & 7 deletions cicd/testnet/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
8 changes: 4 additions & 4 deletions cmd/XDC/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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)
}
}
Expand Down
16 changes: 8 additions & 8 deletions cmd/XDC/consolecmd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 })
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand Down
32 changes: 16 additions & 16 deletions cmd/XDC/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -327,7 +327,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)
}
Expand Down Expand Up @@ -369,7 +369,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)
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/XDC/run_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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]
}
Expand Down
20 changes: 10 additions & 10 deletions cmd/XDC/testdata/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions cmd/puppeth/module_node.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
`
Expand Down Expand Up @@ -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{}{
Expand Down
2 changes: 1 addition & 1 deletion cmd/puppeth/module_wallet.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 && \
Expand Down
Loading

0 comments on commit 159be07

Please sign in to comment.