optimism
optimism copied to clipboard
gasUsed is 0x0 in the response of debug_traceTransaction for simple coins transfer inside L2
L2 geth docker image: ethereumoptimism/l2geth:0.5.11
debug RPC API is enabled
Gas usage is correct in the receipt for the simple transfer of coins inside L2: "gasUsed":"0x5208"
curl -H 'Content-Type: application/json' -X POST --data '{"jsonrpc":"2.0","method":"eth_getTransactionReceipt","params":["0x9b3d4a7f5e6004a712c1b0dca58a56051754219205cfd3e1f9e494ddaf08df25"],"id":83}' http://localhost:8545
{"jsonrpc":"2.0","id":83,"result":{"blockHash":"0xe48b94c649b905306cde02a37da48a2ad3d610f7d31fc9669d15d580deb20ac5","blockNumber":"0x2e","contractAddress":null,"cumulativeGasUsed":"0x5208","from":"0xe587ed96c9f56381af24afb743de6758389e5227","gasUsed":"0x5208","l1Fee":"0x19b3","l1FeeScalar":"1.5","l1GasPrice":"0x1","l1GasUsed":"0x1122","logs":[],"logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","status":"0x1","to":"0xe587ed96c9f56381af24afb743de6758389e5227","transactionHash":"0x9b3d4a7f5e6004a712c1b0dca58a56051754219205cfd3e1f9e494ddaf08df25","transactionIndex":"0x0"}}
Whereas debug_traceTransaction for the same transaction returns "gasUsed":"0x0":
curl localhost:8545 -X POST --header 'Content-type: application/json' --data '{"jsonrpc":"2.0", "method":"debug_traceTransaction", "params":["0x9b3d4a7f5e6004a712c1b0dca58a56051754219205cfd3e1f9e494ddaf08df25", {"tracer": "callTracer"}], "id":1}'
{"jsonrpc":"2.0","id":1,"result":{"type":"CALL","from":"0xe587ed96c9f56381af24afb743de6758389e5227","to":"0xe587ed96c9f56381af24afb743de6758389e5227","value":"0x5af3107a4000","gas":"0x0","gasUsed":"0x0","input":"0x","output":"0x","time":"8.6µs"}}
This may actually not be a bug with l2geth but perhaps an upstream bug with Geth. Since this is a simple transfer, the 21000 gas is taken out of the gas supply at the very beginning of execution (in the pre-checks), before tracing happens. And since this is a top-level call, there's no additional gas charged. So it looks like gas used was 0 and gas left is also 0.
I have a strong suspicion you will get the same result if you do this test against upstream geth using the callTracer