add flag rpc-gascap and set RPCGasCap to 50M (#664)

* add gas cap flag

* default gas cap to 50m

* rpc-gascap
This commit is contained in:
Mr.P 2024-10-09 04:28:24 +03:00 committed by GitHub
parent 47d27fed3b
commit 22c54206bd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 8 additions and 3 deletions

View file

@ -144,6 +144,7 @@ var (
rpcFlags = []cli.Flag{
utils.RPCEnabledFlag,
utils.RPCGlobalGasCapFlag,
utils.RPCListenAddrFlag,
utils.RPCPortFlag,
utils.RPCHttpWriteTimeoutFlag,

View file

@ -144,6 +144,7 @@ var AppHelpFlagGroups = []flagGroup{
Name: "API AND CONSOLE",
Flags: []cli.Flag{
utils.RPCEnabledFlag,
utils.RPCGlobalGasCapFlag,
utils.RPCListenAddrFlag,
utils.RPCPortFlag,
utils.RPCHttpWriteTimeoutFlag,

View file

@ -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))
}

View file

@ -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
}

View file

@ -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 {