From a60a6c76f576c587c239d8a40c3d5ef25a987f1f Mon Sep 17 00:00:00 2001 From: Ricardo Guilherme Schmidt <3esmit@gmail.com> Date: Mon, 11 Nov 2024 21:37:50 -0300 Subject: [PATCH] chore(gas-report): update to use --json output for gas-report --- .gas-report | 18 ------------------ .gas-report.json | 34 ++++++++++++++++++++++++++++++++++ package.json | 4 ++-- 3 files changed, 36 insertions(+), 20 deletions(-) delete mode 100644 .gas-report create mode 100644 .gas-report.json diff --git a/.gas-report b/.gas-report deleted file mode 100644 index 80df36b..0000000 --- a/.gas-report +++ /dev/null @@ -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 | - - - - diff --git a/.gas-report.json b/.gas-report.json new file mode 100644 index 0000000..7eb4126 --- /dev/null +++ b/.gas-report.json @@ -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 + } + } + } +] diff --git a/package.json b/package.json index 17c33d5..ca1cc54 100644 --- a/package.json +++ b/package.json @@ -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" } -} +} \ No newline at end of file