From 22c54206bdab29c01b87be2087ea9f79d1b036de Mon Sep 17 00:00:00 2001 From: "Mr.P" Date: Wed, 9 Oct 2024 04:28:24 +0300 Subject: [PATCH] add flag rpc-gascap and set RPCGasCap to 50M (#664) * add gas cap flag * default gas cap to 50m * rpc-gascap --- cmd/XDC/main.go | 1 + cmd/XDC/usage.go | 1 + cmd/utils/flags.go | 5 ++++- eth/ethconfig/config.go | 2 +- eth/peer.go | 2 +- 5 files changed, 8 insertions(+), 3 deletions(-) diff --git a/cmd/XDC/main.go b/cmd/XDC/main.go index 525c7bea93..864e5e1cd0 100644 --- a/cmd/XDC/main.go +++ b/cmd/XDC/main.go @@ -144,6 +144,7 @@ var ( rpcFlags = []cli.Flag{ utils.RPCEnabledFlag, + utils.RPCGlobalGasCapFlag, utils.RPCListenAddrFlag, utils.RPCPortFlag, utils.RPCHttpWriteTimeoutFlag, diff --git a/cmd/XDC/usage.go b/cmd/XDC/usage.go index a49da82bb5..b724155162 100644 --- a/cmd/XDC/usage.go +++ b/cmd/XDC/usage.go @@ -144,6 +144,7 @@ var AppHelpFlagGroups = []flagGroup{ Name: "API AND CONSOLE", Flags: []cli.Flag{ utils.RPCEnabledFlag, + utils.RPCGlobalGasCapFlag, utils.RPCListenAddrFlag, utils.RPCPortFlag, utils.RPCHttpWriteTimeoutFlag, diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index 38ce46222e..f964184954 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -374,7 +374,7 @@ var ( Usage: "Record information useful for VM and contract debugging", } RPCGlobalGasCapFlag = cli.Uint64Flag{ - Name: "rpc.gascap", + Name: "rpc-gascap", Usage: "Sets a cap on gas that can be used in eth_call/estimateGas (0=infinite)", Value: ethconfig.Defaults.RPCGasCap, } @@ -1245,6 +1245,9 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *ethconfig.Config) { if ctx.GlobalIsSet(RPCGlobalTxFeeCap.Name) { cfg.RPCTxFeeCap = ctx.GlobalFloat64(RPCGlobalTxFeeCap.Name) } + if ctx.GlobalIsSet(RPCGlobalGasCapFlag.Name) { + cfg.RPCGasCap = ctx.GlobalUint64(RPCGlobalGasCapFlag.Name) + } if ctx.GlobalIsSet(ExtraDataFlag.Name) { cfg.ExtraData = []byte(ctx.GlobalString(ExtraDataFlag.Name)) } diff --git a/eth/ethconfig/config.go b/eth/ethconfig/config.go index 73cc4e7cdd..efdd2197d9 100644 --- a/eth/ethconfig/config.go +++ b/eth/ethconfig/config.go @@ -69,7 +69,7 @@ var Defaults = Config{ GasPrice: big.NewInt(0.25 * params.Shannon), TxPool: core.DefaultTxPoolConfig, - RPCGasCap: 25000000, + RPCGasCap: 50000000, GPO: FullNodeGPO, RPCTxFeeCap: 1, // 1 ether } diff --git a/eth/peer.go b/eth/peer.go index aa846a797e..8035f2a9f0 100644 --- a/eth/peer.go +++ b/eth/peer.go @@ -77,7 +77,7 @@ type peer struct { knownVote mapset.Set // Set of BFT Vote known to be known by this peer knownTimeout mapset.Set // Set of BFT timeout known to be known by this peer - knownSyncInfo mapset.Set // Set of BFT Sync Info known to be known by this peer` + knownSyncInfo mapset.Set // Set of BFT Sync Info known to be known by this peer } func newPeer(version int, p *p2p.Peer, rw p2p.MsgReadWriter) *peer {