reth icon indicating copy to clipboard operation
reth copied to clipboard

Make RPC gas cap configurable

Open shekhirin opened this issue 2 years ago • 2 comments

Describe the feature

In https://github.com/paradigmxyz/reth/pull/3260 we started limiting the eth_call and call tracing RPC methods' gas limits using the constant value of 30_000_000 gas. This value should be configurable via both the CLI and config options rpc_gas_cap with the default value of 30_000_000.

Additional context

No response

shekhirin avatar Jun 21 '23 19:06 shekhirin

Hi, I'd like to work on this :)

You said the default value should be 50_000_000 but it is set to 30_000_000 in the code. Should we update the value?

pub const ETHEREUM_BLOCK_GAS_LIMIT: u64 = 30_000_000;

leovct avatar Jun 22 '23 08:06 leovct

@leovct oops, that's my typo, changed to 30_000_000. Assigned you, thanks!

shekhirin avatar Jun 22 '23 09:06 shekhirin

While working on it, I noticed that there's a similar issue already opened: https://github.com/paradigmxyz/reth/issues/3233. Is this the case or am I mistaken?

leovct avatar Jun 23 '23 19:06 leovct

While working on it, I noticed that there's a similar issue already opened: #3233. Is this the case or am I mistaken?

It is related, but not the same. We may want to set the default value for rpc_gas_cap via the ChainSpec mentioned in #3233, but as it's not ready now, you can proceed with just using the ETHEREUM_BLOCK_GAS_LIMIT constant.

shekhirin avatar Jun 26 '23 11:06 shekhirin

@leovct any help needed on that issue? Don't hesitate to ask any questions.

shekhirin avatar Jun 28 '23 19:06 shekhirin

@leovct any help needed on that issue? Don't hesitate to ask any questions.

Yeah, I'm a bit stuck at the moment... I managed to add a new argument called rpc-gas-cap in bin/reth/src/args/rpc_server_args.rs and I updated the reth node book reference.

$ cargo run -- node --help
Start the node

Usage: reth node [OPTIONS]

...

RPC:
      ...
      --rpc-gas-cap <RPC_GAS_CAP>
          Maximum gas limit for `eth_call` and call tracing RPC methods
          
          [default: 30000000]

But I can't figure out how to use this value in crates/rpc/rpc/src/eth/revm_utils.rs. I'm not familiar enough with the repository at the moment (and I'm still learning Rust) so I don't know where to look at... Any hints or doc that might help me? :)

edit: also related to the config, I'm wondering where I should add the new rpc_gas_cap field. HeadersConfig? ExecutionConfig? or somewhere else entirely?

leovct avatar Jun 28 '23 23:06 leovct