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: eth_simulateV1 support #10829

Merged
merged 16 commits into from
Sep 18, 2024
82 changes: 28 additions & 54 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 28 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -583,3 +583,31 @@ test-fuzz = "5"
tikv-jemalloc-ctl = "0.6"
tikv-jemallocator = "0.6"
tracy-client = "0.17.3"

[patch.crates-io]
alloy-consensus = { git = "https://github.com/alloy-rs/alloy", rev = "8c499409"}
alloy-eips = { git = "https://github.com/alloy-rs/alloy", rev = "8c499409"}
alloy-genesis = { git = "https://github.com/alloy-rs/alloy", rev = "8c499409"}
alloy-json-rpc = { git = "https://github.com/alloy-rs/alloy", rev = "8c499409"}
alloy-network = { git = "https://github.com/alloy-rs/alloy", rev = "8c499409"}
alloy-node-bindings = { git = "https://github.com/alloy-rs/alloy", rev = "8c499409"}
alloy-provider = { git = "https://github.com/alloy-rs/alloy", rev = "8c499409"}
alloy-pubsub = { git = "https://github.com/alloy-rs/alloy", rev = "8c499409"}
alloy-rpc-client = { git = "https://github.com/alloy-rs/alloy", rev = "8c499409"}
alloy-rpc-types = { git = "https://github.com/alloy-rs/alloy", rev = "8c499409"}
alloy-rpc-types-admin = { git = "https://github.com/alloy-rs/alloy", rev = "8c499409"}
alloy-rpc-types-anvil = { git = "https://github.com/alloy-rs/alloy", rev = "8c499409"}
alloy-rpc-types-beacon = { git = "https://github.com/alloy-rs/alloy", rev = "8c499409"}
alloy-rpc-types-debug = { git = "https://github.com/alloy-rs/alloy", rev = "8c499409"}
alloy-rpc-types-engine = { git = "https://github.com/alloy-rs/alloy", rev = "8c499409"}
alloy-rpc-types-eth = { git = "https://github.com/alloy-rs/alloy", rev = "8c499409"}
alloy-rpc-types-mev = { git = "https://github.com/alloy-rs/alloy", rev = "8c499409"}
alloy-rpc-types-trace = { git = "https://github.com/alloy-rs/alloy", rev = "8c499409"}
alloy-rpc-types-txpool = { git = "https://github.com/alloy-rs/alloy", rev = "8c499409"}
alloy-serde = { git = "https://github.com/alloy-rs/alloy", rev = "8c499409"}
alloy-signer = { git = "https://github.com/alloy-rs/alloy", rev = "8c499409"}
alloy-signer-local = { git = "https://github.com/alloy-rs/alloy", rev = "8c499409"}
alloy-transport = { git = "https://github.com/alloy-rs/alloy", rev = "8c499409"}
alloy-transport-http = { git = "https://github.com/alloy-rs/alloy", rev = "8c499409"}
alloy-transport-ipc = { git = "https://github.com/alloy-rs/alloy", rev = "8c499409"}
alloy-transport-ws = { git = "https://github.com/alloy-rs/alloy", rev = "8c499409"}
5 changes: 5 additions & 0 deletions book/cli/reth/node.md
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,11 @@ RPC:

[default: 50000000]

--rpc.max-simulate-blocks <BLOCKS_COUNT>
Maximum number of blocks for `eth_simulateV1` call

[default: 256]

--rpc.eth-proof-window <RPC_ETH_PROOF_WINDOW>
The maximum proof window for historical proof generation. This value allows for generating historical proofs up to configured number of blocks from current tip (up to `tip - window`)

Expand Down
9 changes: 9 additions & 0 deletions crates/node/core/src/args/rpc_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,14 @@ pub struct RpcServerArgs {
)]
pub rpc_gas_cap: u64,

/// Maximum number of blocks for `eth_simulateV1` call.
#[arg(
long = "rpc.max-simulate-blocks",
value_name = "BLOCKS_COUNT",
default_value_t = constants::DEFAULT_MAX_SIMULATE_BLOCKS
)]
pub rpc_max_simulate_blocks: u64,

/// The maximum proof window for historical proof generation.
/// This value allows for generating historical proofs up to
/// configured number of blocks from current tip (up to `tip - window`).
Expand Down Expand Up @@ -300,6 +308,7 @@ impl Default for RpcServerArgs {
rpc_max_blocks_per_filter: constants::DEFAULT_MAX_BLOCKS_PER_FILTER.into(),
rpc_max_logs_per_response: (constants::DEFAULT_MAX_LOGS_PER_RESPONSE as u64).into(),
rpc_gas_cap: constants::gas_oracle::RPC_DEFAULT_GAS_CAP,
rpc_max_simulate_blocks: constants::DEFAULT_MAX_SIMULATE_BLOCKS,
rpc_eth_proof_window: constants::DEFAULT_ETH_PROOF_WINDOW,
gas_price_oracle: GasPriceOracleArgs::default(),
rpc_state_cache: RpcStateCacheArgs::default(),
Expand Down
5 changes: 5 additions & 0 deletions crates/optimism/rpc/src/eth/call.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ where
self.inner.gas_cap()
}

#[inline]
fn max_simulate_blocks(&self) -> u64 {
self.inner.max_simulate_blocks()
}

#[inline]
fn evm_config(&self) -> &impl ConfigureEvm<Header = Header> {
self.inner.evm_config()
Expand Down
1 change: 1 addition & 0 deletions crates/optimism/rpc/src/eth/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ where
ctx.cache.clone(),
ctx.new_gas_price_oracle(),
ctx.config.rpc_gas_cap,
ctx.config.rpc_max_simulate_blocks,
ctx.config.eth_proof_window,
blocking_task_pool,
ctx.new_fee_history_cache(),
Expand Down
1 change: 1 addition & 0 deletions crates/rpc/rpc-builder/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ impl RethRpcServerConfig for RpcServerArgs {
.max_logs_per_response(self.rpc_max_logs_per_response.unwrap_or_max() as usize)
.eth_proof_window(self.rpc_eth_proof_window)
.rpc_gas_cap(self.rpc_gas_cap)
.rpc_max_simulate_blocks(self.rpc_max_simulate_blocks)
.state_cache(self.state_cache_config())
.gpo_config(self.gas_price_oracle_config())
.proof_permits(self.rpc_proof_permits)
Expand Down
Loading
Loading