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.1.1
Release date: Tue Aug 20 2024
Patch changes
chore: upgrade zod to latest (#3020) (@latticexyz/cli, @latticexyz/faucet, @latticexyz/store-indexer, @latticexyz/store-sync, @latticexyz/world-modules)
Upgrade zod
to 3.23.8
to avoid issues with excessively deep type instantiations.
chore: bump viem, abitype (#3038) (@latticexyz/block-logs-stream, @latticexyz/cli, @latticexyz/common, @latticexyz/config, @latticexyz/dev-tools, @latticexyz/faucet, @latticexyz/protocol-parser, @latticexyz/query, @latticexyz/schema-type, @latticexyz/store-indexer, @latticexyz/store-sync, @latticexyz/store, @latticexyz/world, create-mud)
Bumped viem to 2.19.8
and abitype to 1.0.5
.
MUD projects using viem or abitype should do the same to ensure no type errors due to mismatched versions:
pnpm recursive up viem@2.19.8 abitype@1.0.5
refactor(world): make AccessControl lib usable outside of world package (#3034) (@latticexyz/world-module-metadata, @latticexyz/world-modules, @latticexyz/world)
Refactored AccessControl
library exported from @latticexyz/world
to be usable outside of the world package and updated module packages to use it.
feat(world,cli): add system deploy config (#3011) (@latticexyz/world)
Added deploy
config options to systems in the MUD config:
disabled
to toggle deploying the system (defaults to false
)registerWorldFunctions
to toggle registering namespace-prefixed system functions on the world (defaults to true
)
import { defineWorld } from "@latticexyz/world";
export default defineWorld({
systems: {
HiddenSystem: {
deploy: {
registerWorldFunctions: false,
},
},
},
});
feat(world-module-metadata): add metadata module (#3026) (@latticexyz/cli, @latticexyz/world-module-metadata)
Added metadata module to be automatically installed during world deploy. This module allows for tagging any resource with arbitrary metadata. Internally, we'll use this to tag resources with labels onchain so that we can use labels to create a MUD project from an existing world.
refactor(common): simplify writeContract/sendTransaction actions (#3043) (@latticexyz/common)
Refactored writeContract
and sendTransaction
actions for simplicity and better error messages.
fix(world): worldgen should read system source from root dir (#3027) (@latticexyz/world)
Fixed an issue with worldgen when using a different rootDir
from the current working directory, where worldgen would read system source files from the wrong place.
feat(config,store,world): add namespaceLabel to table config (#3039) (@latticexyz/config, @latticexyz/store-sync, @latticexyz/store, @latticexyz/world)
Add a strongly typed namespaceLabel
to the table config output.
It corresponds to the label
of the namespace the table belongs to and can't be set manually.