From 706a5c916367cd5a2f93b102fd2e5a80427da81e Mon Sep 17 00:00:00 2001 From: Ricardo Guilherme Schmidt <3esmit@gmail.com> Date: Sat, 24 Feb 2024 13:39:09 -0300 Subject: [PATCH] chore: add gas-report --- .gas-report | 18 ++++++++++++++++++ .github/PULL_REQUEST_TEMPLATE.md | 1 + package.json | 5 +++-- 3 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 .gas-report diff --git a/.gas-report b/.gas-report new file mode 100644 index 0000000..80df36b --- /dev/null +++ b/.gas-report @@ -0,0 +1,18 @@ +| 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/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 8bf4f3d..31820a3 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -8,6 +8,7 @@ Ensure you completed **all of the steps** below before submitting your pull requ - [ ] Added natspec comments? - [ ] Ran `forge snapshot`? +- [ ] Ran `pnpm gas:report`? - [ ] Ran `pnpm lint`? - [ ] Ran `forge test`? - [ ] Ran `pnpm verify`? diff --git a/package.json b/package.json index 32895e5..452463a 100644 --- a/package.json +++ b/package.json @@ -26,6 +26,7 @@ "verify": "certoraRun certora/certora.conf", "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" + "prettier:write": "prettier --write **/*.{json,md,yml} --ignore-path=.prettierignore", + "gas-report": "forge test --gas-report 2>&1 | (tee /dev/tty | awk '/Test result:/ {found=1; buffer=\"\"; next} found && !/Ran/ {buffer=buffer $0 ORS} /Ran/ {found=0} END {printf \"%s\", buffer}' > .gas-report)" } -} +} \ No newline at end of file