Skip to content

Latest commit

 

History

History
7 lines (4 loc) · 490 Bytes

gas-section-snapshots.md

File metadata and controls

7 lines (4 loc) · 490 Bytes

Gas Section Snapshots

Forge can capture gas snapshots over arbitrary sections inside of your test functions. This can be useful to get a granular measurement of how much gas your logic is consuming as both external calls and internal gas usage are measured.

Instead of running a command like forge snapshot or forge test --gas-report, you use the snapshotGas cheatcodes in your tests to capture gas usage as follows:

{{#include ../cheatcodes/gas-snapshots.md}}