builder icon indicating copy to clipboard operation
builder copied to clipboard

RPC endpoint `eth_estimateGasBundle` always returns a `gasUsed` value even if transaction execution fails

Open spencerxiao opened this issue 2 years ago • 0 comments

System information

Builder version: latest CL client & version: e.g. lighthouse/nimbus/[email protected] OS & Version: Windows/Linux/OSX Commit hash : (if develop)

Expected behaviour

An error field which contains the error message shall be returned along with the gasUsed field so that RPC callers knows that the gas estimation fails and the returned gasUsed value shall not be used for gas estimation.

Actual behaviour

No error field is returned and the returned gasUsed value is only the gas usage until the point that the transaction failed and thus it is not a valid gas estimation.

Steps to reproduce the behaviour

Send the following RPC request to the builder node and note that you may need to change the blockNumber and stateBlockNumber field to a more recent main block number. {"method":"eth_estimateGasBundle","params":[{"txs":[{"from":"0x682CD3E420f2bFAcc633D289eF6F42d8543A6Ee0","to":"0x7d2768dE32b0b80b7a3454c06BdAc94A69DDc7A9","data":"0x00a718a9000000000000000000000000514910771af9ca656af840dff83e8264ecf986ca000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48000000000000000000000000c557f40a556a0e7eca4c7a81c49bb2f21d3b4cbc000000000000000000000000000000000000000000000000000000000d14d8b00000000000000000000000000000000000000000000000000000000000000000","gasLimit":2000000,"value":"0x0"}],"blockNumber":"0x10cd21f","stateBlockNumber":"0x10cd21f"}],"id":1,"jsonrpc":"2.0"}

If you send the same transaction to the go-ethereum node to the eth_esitmateGas endpoint: {"method":"eth_estimateGas","params":[{"from":"0x682CD3E420f2bFAcc633D289eF6F42d8543A6Ee0","to":"0x7d2768dE32b0b80b7a3454c06BdAc94A69DDc7A9","data":"0x00a718a9000000000000000000000000514910771af9ca656af840dff83e8264ecf986ca000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48000000000000000000000000c557f40a556a0e7eca4c7a81c49bb2f21d3b4cbc000000000000000000000000000000000000000000000000000000000d14d8b00000000000000000000000000000000000000000000000000000000000000000","gasLimit":2000000,"value":"0x0"}],"id":1,"jsonrpc":"2.0"} it will shows that the transaction is invalid.

Backtrace

[backtrace]

When submitting logs: please submit them as text and not screenshots.

spencerxiao avatar Jul 05 '23 06:07 spencerxiao