fix: ensure the request's gas limit does not exceed the target gas limit (#11462)

This commit is contained in:
Matthias Seitz
2024-10-03 16:57:03 +02:00
committed by GitHub
parent f1aae36c69
commit 59c6329ffa

View File

@ -1107,6 +1107,14 @@ pub trait Call: LoadState + SpawnBlocking {
DB: DatabaseRef,
EthApiError: From<<DB as DatabaseRef>::Error>,
{
// TODO(mattsse): cleanup, by not disabling gaslimit and instead use self.call_gas_limit
if request.gas > Some(gas_limit) {
// configured gas exceeds limit
return Err(
EthApiError::InvalidTransaction(RpcInvalidTransactionError::GasTooHigh).into()
)
}
// we want to disable this in eth_call, since this is common practice used by other node
// impls and providers <https://github.com/foundry-rs/foundry/issues/4388>
cfg.disable_block_gas_limit = true;