Skip to content

Conversation

galargh
Copy link
Contributor

@galargh galargh commented Aug 1, 2025

  • Because this PR includes a bug fix, relevant tests have been included.
  • Because this PR includes a new feature, the change was previously discussed on an Issue or with someone from the team.
  • I didn't do anything of this.

This PR implements v0 from https://www.notion.so/nomicfoundation/Function-level-gas-reporting-for-Solidity-tests-Hardhat-3-Implementation-Plan-241578cdeaf580fe99bee173b5e8e4e0?source=copy_link#241578cdeaf580d48831cc8a7d1326eb

It is in draft because it does not implement any tests yet. I'll add the tests once the implementation plan for v0 is approved.

It adds a dependency on string-width which allows discovering the true display width of strings which is useful for building terminal tables.

This is an example of a gas report displayed in the terminal:
Screenshot 2025-08-01 at 13 40 28

Copy link

changeset-bot bot commented Aug 1, 2025

🦋 Changeset detected

Latest commit: 868a611

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@nomicfoundation/hardhat-utils Patch
hardhat Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-project-automation github-project-automation bot moved this to Backlog in Hardhat Aug 1, 2025
@galargh galargh marked this pull request as draft August 1, 2025 12:39
Copy link
Contributor

github-actions bot commented Aug 1, 2025

hardhat

Total size of the bundle: 55M
Total number of dependencies (including transitive): 41

List of dependencies (sorted by size)
48M	total
20M	esbuild
7.3M	@sentry/core
5.2M	zod
2.7M	micro-eth-signer
1.9M	@noble/curves
1.7M	undici
1.2M	@noble/hashes
880K	@nomicfoundation/hardhat-utils
864K	@streamparser/json
624K	micro-packed
592K	tsx
544K	fast-equals
532K	@nomicfoundation/hardhat-errors
492K	@scure/bip39
448K	@nomicfoundation/edr
408K	json-stream-stringify
368K	ethereum-cryptography
332K	@streamparser/json-node
320K	enquirer
288K	semver
200K	ws
168K	@scure/base
136K	get-tsconfig
136K	adm-zip
96K	@scure/bip32
92K	chalk
72K	@nomicfoundation/solidity-analyzer
68K	debug
64K	@nomicfoundation/hardhat-zod-utils
56K	rfdc
52K	emoji-regex
48K	ansi-colors
44K	resolve.exports
40K	resolve-pkg-maps
36K	p-map
36K	get-east-asian-width
24K	strip-ansi
24K	string-width
24K	env-paths
24K	ansi-regex
20K	ms

@galargh galargh marked this pull request as ready for review August 1, 2025 16:44
@kanej kanej linked an issue Aug 2, 2025 that may be closed by this pull request
@kanej kanej changed the base branch from v-next to main August 11, 2025 21:11
@galargh galargh requested a review from schaable August 13, 2025 17:45
@fvictorio fvictorio changed the title feat: implement function-level gas reporting for solidity tests feat: implement function-level gas tracking for solidity tests Sep 2, 2025
@schaable schaable removed their request for review September 4, 2025 16:48
@schaable schaable marked this pull request as draft September 4, 2025 16:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Backlog
Development

Successfully merging this pull request may close these issues.

Gas usage reporting per contract/function
2 participants