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(rpc): Add coinbase support to eth_callBundle; limit gas #12687

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion crates/rpc/rpc/src/eth/bundle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ where
let EthCallBundle {
txs,
block_number,
coinbase,
state_block_number,
timeout: _,
timestamp,
gas_limit,
difficulty,
Expand Down Expand Up @@ -105,6 +107,10 @@ where
// Note: the block number is considered the `parent` block: <https://github.com/flashbots/mev-geth/blob/fddf97beec5877483f879a77b7dea2e58a58d653/internal/ethapi/api.go#L2104>
let (cfg, mut block_env, at) = self.eth_api().evm_env_at(block_id).await?;

if let Some(coinbase) = coinbase {
block_env.coinbase = coinbase;
}

// need to adjust the timestamp for the next block
if let Some(timestamp) = timestamp {
block_env.timestamp = U256::from(timestamp);
Expand All @@ -116,8 +122,16 @@ where
block_env.difficulty = U256::from(difficulty);
}

// default to call gas limit unless user requests a smaller limit
block_env.gas_limit = U256::from(self.inner.eth_api.call_gas_limit());
if let Some(gas_limit) = gas_limit {
block_env.gas_limit = U256::from(gas_limit);
let gas_limit = U256::from(gas_limit);
if gas_limit > block_env.gas_limit {
return Err(
EthApiError::InvalidTransaction(RpcInvalidTransactionError::GasTooHigh).into()
)
}
block_env.gas_limit = gas_limit;
}

if let Some(base_fee) = base_fee {
Expand Down
Loading