Socket
Socket
Sign inDemoInstall

@latticexyz/gas-report

Package Overview
Dependencies
46
Maintainers
3
Versions
813
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
Weekly downloads
2.8K
decreased by-23.45%
Maintainers
3
Created
Weekly downloads
 

Changelog

Source

Version 2.0.7

Release date: Thu Apr 25 2024

Patch changes

feat(store-indexer): add prometheus metrics (#2739) (@latticexyz/store-indexer)

Add Prometheus metrics at /metrics to the Postgres indexer backend and frontend, as well as the SQLite indexer.

fix(common): use feeRef for sendTransaction calls (#2725) (@latticexyz/common)

Added asynchronous polling for current fees to sendTransaction.

fix(block-logs-stream): handle proxyd errors (#2726) (@latticexyz/block-logs-stream)

Added detection and handling for proxyd rate limit and block range errors.

feat(cli): deploy with kms (#2704) (@latticexyz/cli)

Added a --awsKmsKeyId flag to mud deploy that deploys the world using an AWS KMS key as a transaction signer.

fix(store-sync): await fetchAndStoreLogs (#2702) (@latticexyz/store-sync)

Partially revert #2665 to guarantee logs are stored in order.

fix(cli): add retry to getLogs when getting resource ID's (#2709) (@latticexyz/cli)

Deploying now retries on "block is out of range" errors, for cases where the RPC is load balanced and out of sync.

feat(cli): manually fetch gas price from rpc before PostDeploy runs (#2638) (@latticexyz/cli)

Deploy will now fetch and set the gas price during execution of PostDeploy script. This should greatly reduce the fees paid for L2s.

fix(world-modules): properly concat baseURI and tokenURI in ERC721 module (#2686) (@latticexyz/world-modules)

Fixed ERC721 module to properly encode token ID as part of token URI.

feat(cli): verify command (#2662) (@latticexyz/cli)

Added a new mud verify command which verifies all contracts in a project. This includes systems, modules, the WorldFactory and World.

fix(common): kms correctly serializes transactions (#2721) (@latticexyz/common)

Added kmsKeyToAccount, a viem custom account that signs transactions using AWS KMS.

To use it, you must first install @aws-sdk/client-kms@3.x and asn1.js@5.x dependencies into your project. Then create a KMS account with:

import { kmsKeyToAccount } from "@latticexyz/common/kms";
const account = kmsKeyToAccount({ keyId: ... });

By default, a KMSClient will be created, but you can also pass one in via the client option. The default KMS client will use your environment's AWS SDK configuration.

fix(cli): fix deployer warning (#2683) (@latticexyz/cli)

Fixed an issue where deploys were warning about mismatched bytecode when the bytecode was correct and what we expect.

fix(create-mud): make worlds.json address type more specific (#2685) (create-mud)

Made worlds.json's address type more like viem's Hex type so it's easy to pass through as an argument.

refactor(world,cli): rename useProxy to upgradeableWorldImplementation (#2732) (@latticexyz/world, @latticexyz/cli)

Added a deploy.upgradeableWorldImplementation option to the MUD config that deploys the World as an upgradeable proxy contract. The proxy behaves like a regular World contract, but the underlying implementation can be upgraded by calling setImplementation.

fix(store): enforce unique table names across types (#2736) (@latticexyz/store)

Added a check to registerTable that prevents registering both an offchain and onchain table with the same name, making it easier to use human-readable names in indexers.

feat(world-modules): string systemId in callWithSignature typehash (#2700) (@latticexyz/world-modules, @latticexyz/world)

Replaced the systemId field in the Unstable_CallWithSignatureSystem typehash with individual systemNamespace and systemName string fields.

feat(cli): add user-specified PostDeploy forge options (#2703) (@latticexyz/cli)

Added a --forgeScriptOptions flag to deploy and dev commands to allow passing in additional CLI flags to forge script command.

fix(common): make Resource type props readonly (#2516) (@latticexyz/common)

Resource type props are now readonly.


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 25 Apr 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