Skip to content

Commit 01387cd

Browse files
committed
Use provided height on eth_estimateGas instead of fetching latest
1 parent 214ef6b commit 01387cd

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

services/requester/requester.go

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -345,17 +345,13 @@ func (e *EVM) EstimateGas(
345345
passingGasLimit = uint64(*txArgs.Gas)
346346
}
347347

348-
// Cap the maximum gas allowance according to EIP-7825 if the estimation targets Osaka
349348
if passingGasLimit > gethParams.MaxTxGas {
350-
latestBlockHeight, err := e.blocks.LatestEVMHeight()
349+
// Cap the maximum gas allowance according to EIP-7825 if the estimation targets Osaka
350+
targetBlock, err := e.blocks.GetByHeight(height)
351351
if err != nil {
352352
return 0, err
353353
}
354-
latestBlock, err := e.blocks.GetByHeight(latestBlockHeight)
355-
if err != nil {
356-
return 0, err
357-
}
358-
blockNumber, blockTime := new(big.Int).SetUint64(latestBlock.Height), latestBlock.Timestamp
354+
blockNumber, blockTime := new(big.Int).SetUint64(targetBlock.Height), targetBlock.Timestamp
359355
emulatorConfig := emulator.NewConfig(
360356
emulator.WithChainID(e.config.EVMNetworkID),
361357
emulator.WithBlockNumber(blockNumber),

0 commit comments

Comments
 (0)