Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: make rpc gas cap configurable #3458

Merged

Conversation

leovct
Copy link
Contributor

@leovct leovct commented Jun 28, 2023

Resolves #3309

  • New CLI arg rpc-gas-cap with default value set to ETHEREUM_BLOCK_GAS_LIMIT (= 30_000_000).
  • Gas limit cap applied here should use the value of the CLI arg.
  • New config parameter to set rpc-gas-cap in addition to the CLI arg

@codecov
Copy link

codecov bot commented Jun 28, 2023

Codecov Report

Merging #3458 (310ac8b) into main (9a00f04) will decrease coverage by 0.10%.
The diff coverage is 54.43%.

Impacted file tree graph

Impacted Files Coverage Δ
bin/reth/src/stage/drop.rs 2.00% <0.00%> (-0.13%) ⬇️
crates/primitives/src/transaction/access_list.rs 53.84% <0.00%> (-23.94%) ⬇️
crates/primitives/src/withdrawal.rs 82.35% <0.00%> (-17.65%) ⬇️
crates/rpc/rpc-builder/src/auth.rs 44.38% <0.00%> (-0.23%) ⬇️
crates/stages/src/metrics/listener.rs 0.00% <0.00%> (ø)
crates/transaction-pool/src/lib.rs 32.31% <0.00%> (-1.23%) ⬇️
crates/transaction-pool/src/noop.rs 11.02% <0.00%> (-0.51%) ⬇️
crates/transaction-pool/src/ordering.rs 0.00% <0.00%> (ø)
crates/transaction-pool/src/pool/best.rs 75.00% <0.00%> (-14.56%) ⬇️
crates/transaction-pool/src/pool/mod.rs 41.00% <0.00%> (-0.87%) ⬇️
... and 23 more

... and 9 files with indirect coverage changes

Flag Coverage Δ
integration-tests 15.68% <1.26%> (-0.07%) ⬇️
unit-tests 64.13% <54.11%> (-0.07%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
reth binary 26.49% <64.00%> (+0.16%) ⬆️
blockchain tree 83.02% <ø> (ø)
pipeline 87.04% <78.57%> (-0.10%) ⬇️
storage (db) 74.32% <ø> (+0.04%) ⬆️
trie 94.65% <ø> (ø)
txpool 46.85% <8.13%> (-0.98%) ⬇️
networking 77.66% <100.00%> (-0.05%) ⬇️
rpc 58.35% <77.77%> (+<0.01%) ⬆️
consensus 64.96% <ø> (ø)
revm 33.76% <ø> (ø)
payload builder 6.61% <ø> (ø)
primitives 88.06% <65.04%> (-0.27%) ⬇️

@onbjerg onbjerg added C-enhancement New feature or request A-rpc Related to the RPC implementation M-changelog This change should be included in the changelog labels Jun 29, 2023
@shekhirin shekhirin self-requested a review July 3, 2023 21:00
bin/reth/src/args/rpc_server_args.rs Outdated Show resolved Hide resolved
@@ -132,6 +135,10 @@ pub struct RpcServerArgs {
#[arg(long, value_name = "COUNT", default_value_t = RPC_DEFAULT_MAX_TRACING_REQUESTS)]
pub rpc_max_tracing_requests: u32,

/// Maximum gas limit for `eth_call` and call tracing RPC methods.
#[arg(long = "rpc.gascap", value_name = "GAS_CAP", default_value_t = RPC_DEFAULT_GAS_CAP)]
pub rpc_gas_cap: u64,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Next, to be able to use this parameter in EVM, we need to pass it to the RPC implementations in the same way as we do with max_log_per_response in EthFilter:

self.config.eth.max_logs_per_response,

So:

  1. Add rpc_gas_cap to EthConfig.
  2. Pass EthConfig.rpc_gas_cap to EthApi, DebugApi and TraceApi.
  3. Pass the gas cap to prepare_call_env via new function argument.

Copy link
Collaborator

@mattsse mattsse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added some finishing touches.

this PR only integrates a gascap value but doesn't use it yet.

will be done in followup, together with default to 50M

@mattsse mattsse force-pushed the leovct/feat-make-rpc-gas-cap-configurable branch from 73cc56f to 3930e81 Compare July 17, 2023 09:31
@mattsse mattsse marked this pull request as ready for review July 17, 2023 09:31
@mattsse mattsse force-pushed the leovct/feat-make-rpc-gas-cap-configurable branch from 3930e81 to 310ac8b Compare July 17, 2023 09:33
@mattsse mattsse added this pull request to the merge queue Jul 17, 2023
Merged via the queue into paradigmxyz:main with commit a0e125f Jul 17, 2023
merklefruit pushed a commit to merklefruit/op-reth-old that referenced this pull request Jul 26, 2023
Co-authored-by: Alexey Shekhirin <a.shekhirin@gmail.com>
Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
merklefruit pushed a commit to anton-rs/op-reth that referenced this pull request Jul 27, 2023
Co-authored-by: Alexey Shekhirin <a.shekhirin@gmail.com>
Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
@leovct leovct deleted the leovct/feat-make-rpc-gas-cap-configurable branch July 29, 2024 12:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-rpc Related to the RPC implementation C-enhancement New feature or request M-changelog This change should be included in the changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make RPC gas cap configurable
4 participants