Gas Report
Measure and report gas usage within forge tests
Add some reports to your forge tests
import { Test } from "forge-std/Test.sol";
import { GasReporter } from "@latticexyz/gas-report/src/GasReporter.sol";
contract ExampleTest is Test, GasReporter {
function testGas() public {
startGasReport("description of behavior to measure gas for");
// do something here
endGasReport();
}
}
Then use the cli command to run tests and save the report:
pnpm gas-report --save gas-report.json
Or, if you have your own test command, you can pipe the output to gas-report --stdin
:
GAS_REPORTER_ENABLED=true forge test -vvv --isolate | pnpm gas-report --stdin
Run pnpm gas-report --help
for more details.
Version 2.2.13
Release date: Wed Oct 23 2024
Patch changes
fix(gas-report): include contract name in file of output (#3317) (@latticexyz/gas-report)
Gas report output now include contract name as part of the file
to help with stable ordering when sorting output.
chore(world-module-erc20): export erc20 module from internal (#3319) (@latticexyz/world-module-erc20)
The new ERC20 World Module provides a simpler alternative to the ERC20 Puppet Module, while also being structured in a more extendable way so users can create tokens with custom functionality.
To install this module, you can import and define the module configuration from the NPM package:
import { defineERC20Module } from "@latticexyz/world-module-erc20/internal";
// Add the output of this function to your World's modules
const erc20Module = defineERC20Module({ namespace: "erc20Namespace", name: "MyToken", symbol: "MTK" });
For detailed installation instructions, please check out the @latticexyz/world-module-erc20
README.md.
feat(explorer): multi-line sql editor (#3311) (@latticexyz/explorer)
The SQL query editor now supports multi-line input.
feat(abi-ts): extension option (#3315) (@latticexyz/abi-ts)
Added an --extension
option to customize the resulting TS or DTS output. It defaults to the previous behavior of .json.d.ts
, but can now be set to .d.json.ts
for compatibility with newer TS versions and .json.ts
or just .ts
for a pure TS file.
fix(store-sync): update latest block for live logs API (#3323) (@latticexyz/store-sync)
Fixed an issue where the sync progress was not moving to "live" when synced from the MUD indexer's live logs API.