From a430e2e01f2df530332ba3fdccf0f164f722a956 Mon Sep 17 00:00:00 2001 From: weiihann Date: Fri, 24 Nov 2023 10:58:00 +0800 Subject: [PATCH 1/2] cmd/utils: exit process if txlookuplimit flag is set amend amend --- README.md | 6 +++--- cmd/utils/flags.go | 6 ++---- tests/truffle/scripts/bsc-rpc.sh | 2 +- tests/truffle/scripts/bsc-validator.sh | 2 +- 4 files changed, 7 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 67099092db..381303ba2d 100644 --- a/README.md +++ b/README.md @@ -160,15 +160,15 @@ geth --datadir --state.scheme path init ./genesis.json ``` #### 4. Start a full node ```shell -./geth --config ./config.toml --datadir ./node --cache 8000 --rpc.allow-unprotected-txs --txlookuplimit 0 +./geth --config ./config.toml --datadir ./node --cache 8000 --rpc.allow-unprotected-txs --history.transactions 0 ## It is recommand to run fullnode with `--tries-verify-mode none` if you want high performance and care little about state consistency ## It will run with Hash-Base Storage Scheme by default -./geth --config ./config.toml --datadir ./node --cache 8000 --rpc.allow-unprotected-txs --txlookuplimit 0 --tries-verify-mode none +./geth --config ./config.toml --datadir ./node --cache 8000 --rpc.allow-unprotected-txs --history.transactions 0 --tries-verify-mode none ## It runs fullnode with Path-Base Storage Scheme. ## It will enable inline state prune, keeping the latest 90000 blocks' history state by default. -./geth --config ./config.toml --datadir ./node --cache 8000 --rpc.allow-unprotected-txs --txlookuplimit 0 --tries-verify-mode none --state.scheme path +./geth --config ./config.toml --datadir ./node --cache 8000 --rpc.allow-unprotected-txs --history.transactions 0 --tries-verify-mode none --state.scheme path ``` #### 5. Monitor node status diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index 7c6ce0e6cb..406c5f7072 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -1948,14 +1948,12 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *ethconfig.Config) { // Parse transaction history flag, if user is still using legacy config // file with 'TxLookupLimit' configured, copy the value to 'TransactionHistory'. if cfg.TransactionHistory == ethconfig.Defaults.TransactionHistory && cfg.TxLookupLimit != ethconfig.Defaults.TxLookupLimit { - log.Warn("The config option 'TxLookupLimit' is deprecated and will be removed, please use 'TransactionHistory'") - cfg.TransactionHistory = cfg.TxLookupLimit + log.Crit("The config option 'TxLookupLimit' is deprecated and may cause unexpected performance degradation issues, please use 'TransactionHistory' instead") } if ctx.IsSet(TransactionHistoryFlag.Name) { cfg.TransactionHistory = ctx.Uint64(TransactionHistoryFlag.Name) } else if ctx.IsSet(TxLookupLimitFlag.Name) { - log.Warn("The flag --txlookuplimit is deprecated and will be removed, please use --history.transactions") - cfg.TransactionHistory = ctx.Uint64(TransactionHistoryFlag.Name) + log.Crit("The flag --txlookuplimit is deprecated and may cause unexpected performance degradation issues. Please use --history.transactions instead") } if ctx.IsSet(PathDBSyncFlag.Name) { cfg.PathSyncFlush = true diff --git a/tests/truffle/scripts/bsc-rpc.sh b/tests/truffle/scripts/bsc-rpc.sh index 5367b807c1..43c811c787 100755 --- a/tests/truffle/scripts/bsc-rpc.sh +++ b/tests/truffle/scripts/bsc-rpc.sh @@ -12,5 +12,5 @@ done geth --config ${DATA_DIR}/config.toml --datadir ${DATA_DIR} --netrestrict ${CLUSTER_CIDR} \ --verbosity ${VERBOSE} --nousb \ - --rpc.allow-unprotected-txs --txlookuplimit 15768000 \ + --rpc.allow-unprotected-txs --history.transactions 15768000 \ -unlock ${unlock_sequences} --password /dev/null diff --git a/tests/truffle/scripts/bsc-validator.sh b/tests/truffle/scripts/bsc-validator.sh index 4605a867a7..16b8c2ed57 100755 --- a/tests/truffle/scripts/bsc-validator.sh +++ b/tests/truffle/scripts/bsc-validator.sh @@ -15,4 +15,4 @@ geth --config ${DATA_DIR}/config.toml --datadir ${DATA_DIR} --netrestrict ${CLUS --bootnodes enode://${BOOTSTRAP_PUB_KEY}@${BOOTSTRAP_IP}:${BOOTSTRAP_TCP_PORT} \ --mine -unlock ${VALIDATOR_ADDR} --miner.etherbase ${VALIDATOR_ADDR} --password /dev/null \ --light.serve 50 \ - --rpc.allow-unprotected-txs --txlookuplimit 15768000 + --rpc.allow-unprotected-txs --history.transactions 15768000 From 898e90394afab5465280a8f176ea2f2b0cb9d1f9 Mon Sep 17 00:00:00 2001 From: weiihann Date: Fri, 24 Nov 2023 16:02:35 +0800 Subject: [PATCH 2/2] log: ensure crit msg is logged before process exit --- log/root.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/log/root.go b/log/root.go index 5a41723c3e..c8893bf80c 100644 --- a/log/root.go +++ b/log/root.go @@ -2,6 +2,7 @@ package log import ( "os" + "time" ) var ( @@ -105,6 +106,7 @@ func Error(msg string, ctx ...interface{}) { // log.Crit("msg", "key1", val1, "key2", val2) func Crit(msg string, ctx ...interface{}) { root.write(msg, LvlCrit, ctx, skipLevel) + time.Sleep(3 * time.Second) os.Exit(1) }