Socket
Socket
Sign inDemoInstall

@latticexyz/gas-report

Package Overview
Dependencies
46
Maintainers
3
Versions
897
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @latticexyz/gas-report

Gas reporter for specific lines within forge tests


Version published
Maintainers
3
Created

Changelog

Source

Version 2.0.9

Release date: Wed May 01 2024

Patch changes

fix(cli): do not require PRIVATE_KEY if using KMS (#2765) (@latticexyz/cli)

Fixed mud deploy to not require the PRIVATE_KEY environment variable when using a KMS signer.

feat(create-mud): redstone and garnet chains (#2776) (create-mud)

Updated templates with Redstone and Garnet chains and removed the deprecated Lattice testnet chain.

feat(store-indexer): add metric for distance from block tag to follow (#2763) (@latticexyz/store-indexer)

Added a distance_from_follow_block metric to compare the latest stored block number with the block number corresponding to the block tag the indexer follows.

feat(cli): blockscout is default verifier (#2775) (@latticexyz/cli)

mud verify now defaults to blockscout if no --verifier is provided.

fix(cli): run postdeploy with aws flag when kms is enabled (#2766) (@latticexyz/cli)

Fixed mud deploy to use the forge script --aws flag when executing PostDeploy with a KMS signer.

Note that you may need to update your PostDeploy.s.sol script, with vm.startBroadcast receiving no arguments instead of reading a private key from the environment:

-uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY");
-vm.startBroadcast(deployerPrivateKey);

+vm.startBroadcast();

feat(common): add indexer URL to chain configs (#2771) (@latticexyz/store-sync)

Updated createStoreSync to default to the chain's indexer URL when no indexerUrl is passed in. To intentionally unset the value and not use the indexer at all, indexerUrl can now also be false.

fix(cli): remove postdeploy gas setting in favor of script options (#2756) (@latticexyz/cli)

Removed manual gas setting in PostDeploy step of mud deploy in favor of forge script fetching it from the RPC.

If you still want to manually set gas, you can use mud deploy --forgeScriptOptions="--with-gas-price 1000000".

refactor(common,cli): kms deployer gets keyId from environment (#2760) (@latticexyz/cli)

The key ID for deploying via KMS signer is now set via an AWS_KMS_KEY_ID environment variable to better align with Foundry tooling. To enable KMS signing with this environment variable, use the --kms flag.

-mud deploy --awsKmsKeyId [key ID]
+AWS_KMS_KEY_ID=[key ID] mud deploy --kms

feat(common): add indexer URL to chain configs (#2771) (@latticexyz/common)

Added an optional indexerUrl property to MUDChain, and populated it in the Redstone and Garnet chain configs.

feat(common): add chain icons (#2778) (@latticexyz/common)

Added chain icons to Redstone and Garnet chain configs via chain.iconUrls.


Readme

Source

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.

FAQs

Last updated on 01 May 2024

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc