Where does it stop?
Unlike the refusals at the node, this one happens inside a block. The transaction passed every check, was mined and then ran out of gas while the code was running. It has a hash and a receipt, and the receipt says reverted.
What is spent, and what is undone?
The gas limit is the most you are willing to spend. When the code needs more than that, the EVM stops. All the changes are reverted, but all the gas provided is still consumed for the work performed.
There is no revert reason, because the code never reached a revert: it simply ran out of gas, so there is nothing to decode.
Why does it happen?
- A gas limit set by hand and too low. A copied number, or one a model chose in a tool argument.
- A stale estimate. The estimate was right for the state at that moment. The state changed before the transaction was mined.
- Code that does more work than expected. A loop over data that has grown.
How do I fix it?
- Estimate instead of guessing, and add headroom on top of the estimate. See the snippet on the intrinsic gas page.
- Do not override the limit with a smaller number than the estimate.
- If the estimate is large, find out why. A loop that grows with data is a bug to fix, not a limit to raise.
- In a worker or an agent, record the limit with the transaction, so a receipt with gas used equal to the limit is easy to spot.
What does it look like in a trace?
The send span is fine: the transaction was accepted and has a hash. The confirm span ends with an error, because the receipt says reverted:
- blockchain.tx.status
- reverted
- blockchain.tx.gas.used
- 50,000
- blockchain.tx.fee
- 88,296,564,050,000
- error.type
- reverted
No revert reason on a reverted confirm span, and gas used equal to the limit you sent, point to out of gas. A reverted span that does have a reason is execution reverted. How the status is set is in span status.