chore(gas-report): update to use --json output for gas-report

This commit is contained in:
Ricardo Guilherme Schmidt 2024-11-11 21:37:50 -03:00
parent e9126b93ad
commit a60a6c76f5
No known key found for this signature in database
GPG Key ID: 54B4454CC123AD17
3 changed files with 36 additions and 20 deletions

View File

@ -1,18 +0,0 @@
| script/Deploy.s.sol:Deploy contract | | | | | |
|-------------------------------------|-----------------|--------|--------|--------|---------|
| Deployment Cost | Deployment Size | | | | |
| 320782 | 2729 | | | | |
| Function Name | min | avg | median | max | # calls |
| run | 221942 | 221942 | 221942 | 221942 | 1 |
| src/Foo.sol:Foo contract | | | | | |
|--------------------------|-----------------|-----|--------|-----|---------|
| Deployment Cost | Deployment Size | | | | |
| 20275 | 131 | | | | |
| Function Name | min | avg | median | max | # calls |
| id | 235 | 235 | 235 | 235 | 1 |

34
.gas-report.json Normal file
View File

@ -0,0 +1,34 @@
[
{
"contract" : "script/Deploy.s.sol:Deploy",
"deployment" : {
"gas" : 416048,
"size" : 2733
},
"functions" : {
"run()" : {
"calls" : 1,
"max" : 245006,
"mean" : 245006,
"median" : 245006,
"min" : 245006
}
}
},
{
"contract" : "src/Foo.sol:Foo",
"deployment" : {
"gas" : 0,
"size" : 0
},
"functions" : {
"id(uint256)" : {
"calls" : 1,
"max" : 235,
"mean" : 235,
"median" : 235,
"min" : 235
}
}
}
]

View File

@ -28,8 +28,8 @@
"lint:sol": "forge fmt --check && pnpm solhint {script,src,test,certora}/**/*.sol",
"prettier:check": "prettier --check **/*.{json,md,yml} --ignore-path=.prettierignore",
"prettier:write": "prettier --write **/*.{json,md,yml} --ignore-path=.prettierignore",
"gas-report": "forge snapshot --gas-report 2>&1 | (tee /dev/tty | awk '/Suite result:/ {found=1; buffer=\"\"; next} found && !/Ran/ {buffer=buffer $0 ORS} /Ran/ {found=0} END {printf \"%s\", buffer}' > .gas-report)",
"gas-report": "forge snapshot --gas-report --json | tee .gas-report.tmp | awk 'NR<2' | json_pp > .gas-report.json && tail +4 .gas-report.tmp && rm .gas-report.tmp",
"release": "commit-and-tag-version",
"adorno": "pnpm prettier:write && forge fmt && pnpm gas-report"
}
}
}