Commit c3e66e57 authored by Mark Tyneway's avatar Mark Tyneway

l2geth: add block tag to `eth_estimateGas`

Copies the implementation from upstream
https://github.com/ethereum/go-ethereum/blob/389021a5afd01147c851870c693ded8760e6a08c/internal/ethapi/api.go#L1149
parent abaa065b
---
'@eth-optimism/l2geth': patch
---
Add the gas estimation block tag to `eth_estimateGas` to be RPC compliant
......@@ -1062,9 +1062,12 @@ func DoEstimateGas(ctx context.Context, b Backend, args CallArgs, blockNrOrHash
// EstimateGas returns an estimate of the amount of gas needed to execute the
// given transaction against the current pending block. This is modified to
// encode the fee in wei as gas price is always 1
func (s *PublicBlockChainAPI) EstimateGas(ctx context.Context, args CallArgs) (hexutil.Uint64, error) {
blockNrOrHash := rpc.BlockNumberOrHashWithNumber(rpc.PendingBlockNumber)
return DoEstimateGas(ctx, s.b, args, blockNrOrHash, s.b.RPCGasCap())
func (s *PublicBlockChainAPI) EstimateGas(ctx context.Context, args CallArgs, blockNrOrHash *rpc.BlockNumberOrHash) (hexutil.Uint64, error) {
bNrOrHash := rpc.BlockNumberOrHashWithNumber(rpc.PendingBlockNumber)
if blockNrOrHash != nil {
bNrOrHash = *blockNrOrHash
}
return DoEstimateGas(ctx, s.b, args, bNrOrHash, s.b.RPCGasCap())
}
// ExecutionResult groups all structured logs emitted by the EVM
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment