docs: clarify EIP-8037 gas accounting - #910
Conversation
mattsse
left a comment
There was a problem hiding this comment.
Vm.sol is generated from cheatcodes.json, so the substantive review is on foundry#16772 and regenerating with scripts/vm.py after that lands will pick everything up. Leaving the same suggestions inline here so they can be applied directly if this PR goes first; the text is identical to the foundry ones apart from the // field-comment style this file uses.
| /// This scalar snapshot is not the EIP-8037 sum of regular and state gas. | ||
| /// It can include state gas drawn from regular gas, but excludes state gas paid from the reservoir. | ||
| /// Isolated frames with zero net state gas use receipt gas instead. | ||
| /// Use `lastFrameGas` for separate components. See <https://eips.ethereum.org/EIPS/eip-8037>. |
There was a problem hiding this comment.
Same as on foundry#16772: one pointer sentence per overload instead of the four-line block, and the "isolated frames with zero net state gas" clause goes away once the stack.rs behaviour is settled (details in the foundry review).
| /// This scalar snapshot is not the EIP-8037 sum of regular and state gas. | |
| /// It can include state gas drawn from regular gas, but excludes state gas paid from the reservoir. | |
| /// Isolated frames with zero net state gas use receipt gas instead. | |
| /// Use `lastFrameGas` for separate components. See <https://eips.ethereum.org/EIPS/eip-8037>. | |
| /// Records regular gas only; EIP-8037 state gas paid from the reservoir is excluded. See <https://getfoundry.sh/reference/cheatcodes/gas-snapshots>. |
|
Regenerated AI assistance: Codex authored this update and reply. |
Clarify every
Vm.Gasfield and the last-frame and snapshot cheatcode docs, including which values exclude EIP-8037 state gas, how state refills differ from ordinary refunds, and what isolation changes. Explain signed state deltas and why measured consumption is not a sufficient transaction gas limit, with references to the EIP and the book. Import the documentation from Foundry's canonical cheatcode metadata while preserving the existing interface surface.The canonical documentation comes from foundry-rs/foundry#16772; merge that before the next full interface regeneration. The expanded guide is in foundry-rs/book#2076, with matching Rust API documentation in alloy-rs/alloy#4195.
AI assistance: Codex authored the documentation and PR description.