From 6082399e837a12f66f0a218a75eaa52a36dc1e03 Mon Sep 17 00:00:00 2001 From: Ricardo Guilherme Schmidt <3esmit@gmail.com> Date: Sat, 24 Feb 2024 16:32:58 -0300 Subject: [PATCH] chore: add gas-report for all contracts --- .gas-report | 95 ++++++++++++++++++++++++++++++++ .github/PULL_REQUEST_TEMPLATE.md | 1 + package.json | 1 + 3 files changed, 97 insertions(+) create mode 100644 .gas-report diff --git a/.gas-report b/.gas-report new file mode 100644 index 0000000..1fb0e50 --- /dev/null +++ b/.gas-report @@ -0,0 +1,95 @@ +| contracts/StakeManager.sol:StakeManager contract | | | | | | +|--------------------------------------------------|-----------------|--------|--------|--------|---------| +| Deployment Cost | Deployment Size | | | | | +| 2012229 | 10266 | | | | | +| Function Name | min | avg | median | max | # calls | +| MAX_LOCKUP_PERIOD | 405 | 405 | 405 | 405 | 2 | +| MIN_LOCKUP_PERIOD | 264 | 264 | 264 | 264 | 3 | +| accounts | 1406 | 1406 | 1406 | 1406 | 2 | +| currentEpoch | 341 | 2118 | 2341 | 2341 | 9 | +| executeAccount | 1311 | 1311 | 1311 | 1311 | 1 | +| isVault | 517 | 2335 | 2517 | 2517 | 11 | +| lock | 2614 | 2614 | 2614 | 2614 | 1 | +| migrateTo | 1041 | 1713 | 1041 | 2721 | 5 | +| oldManager | 240 | 240 | 240 | 240 | 8 | +| owner | 2341 | 2341 | 2341 | 2341 | 8 | +| pendingReward | 2386 | 2386 | 2386 | 2386 | 8 | +| setVault | 22606 | 22606 | 22606 | 22606 | 10 | +| stake | 2638 | 142484 | 208380 | 209064 | 13 | +| stakedToken | 260 | 260 | 260 | 260 | 22 | +| totalSupply | 561 | 561 | 561 | 561 | 8 | +| totalSupplyBalance | 362 | 1592 | 2362 | 2362 | 13 | +| totalSupplyMP | 384 | 1984 | 2384 | 2384 | 10 | +| unstake | 1730 | 13754 | 5176 | 83235 | 8 | + + +| contracts/StakeVault.sol:StakeVault contract | | | | | | +|----------------------------------------------|-----------------|--------|--------|--------|---------| +| Deployment Cost | Deployment Size | | | | | +| 635445 | 3370 | | | | | +| Function Name | min | avg | median | max | # calls | +| acceptMigration | 1726 | 1726 | 1726 | 1726 | 2 | +| leave | 1712 | 1712 | 1712 | 1712 | 1 | +| owner | 362 | 362 | 362 | 362 | 10 | +| stake | 3433 | 170519 | 239155 | 239839 | 13 | +| stakedToken | 212 | 212 | 212 | 212 | 2 | +| unstake | 2588 | 18674 | 9497 | 87556 | 7 | + + +| contracts/VaultFactory.sol:VaultFactory contract | | | | | | +|--------------------------------------------------|-----------------|--------|--------|--------|---------| +| Deployment Cost | Deployment Size | | | | | +| 1043406 | 5305 | | | | | +| Function Name | min | avg | median | max | # calls | +| createVault | 670954 | 674489 | 675454 | 675454 | 14 | +| setStakeManager | 2518 | 5317 | 4644 | 8790 | 3 | +| stakeManager | 368 | 1868 | 2368 | 2368 | 4 | + + +| lib/openzeppelin-contracts/contracts/token/ERC20/ERC20.sol:ERC20 contract | | | | | | +|---------------------------------------------------------------------------|-----------------|-------|--------|-------|---------| +| Deployment Cost | Deployment Size | | | | | +| 649818 | 3562 | | | | | +| Function Name | min | avg | median | max | # calls | +| approve | 24603 | 24603 | 24603 | 24603 | 11 | +| balanceOf | 561 | 1132 | 561 | 2561 | 42 | +| transfer | 3034 | 3034 | 3034 | 3034 | 5 | +| transferFrom | 27530 | 27530 | 27530 | 27530 | 12 | + + +| script/Deploy.s.sol:Deploy contract | | | | | | +|-------------------------------------|-----------------|---------|---------|---------|---------| +| Deployment Cost | Deployment Size | | | | | +| 5096726 | 26763 | | | | | +| Function Name | min | avg | median | max | # calls | +| run | 4791797 | 4791797 | 4791797 | 4791797 | 30 | + + +| script/DeploymentConfig.s.sol:DeploymentConfig contract | | | | | | +|---------------------------------------------------------|-----------------|-----|--------|-----|---------| +| Deployment Cost | Deployment Size | | | | | +| 1634091 | 8548 | | | | | +| Function Name | min | avg | median | max | # calls | +| activeNetworkConfig | 455 | 455 | 455 | 455 | 60 | + + +| test/mocks/BrokenERC20.s.sol:BrokenERC20 contract | | | | | | +|---------------------------------------------------|-----------------|-------|--------|-------|---------| +| Deployment Cost | Deployment Size | | | | | +| 475642 | 2660 | | | | | +| Function Name | min | avg | median | max | # calls | +| approve | 24603 | 24603 | 24603 | 24603 | 1 | +| balanceOf | 561 | 1227 | 561 | 2561 | 3 | +| transferFrom | 511 | 511 | 511 | 511 | 1 | + + +| test/script/DeployBroken.s.sol:DeployBroken contract | | | | | | +|------------------------------------------------------|-----------------|---------|---------|---------|---------| +| Deployment Cost | Deployment Size | | | | | +| 3869460 | 20561 | | | | | +| Function Name | min | avg | median | max | # calls | +| run | 3631620 | 3631620 | 3631620 | 3631620 | 1 | + + + + diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 8bf4f3d..5f121c0 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 a4145ff..730e243 100644 --- a/package.json +++ b/package.json @@ -24,6 +24,7 @@ "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 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)", "verify:stake_vault": "certoraRun certora/confs/StakeVault.conf", "verify:stake_manager": "certoraRun certora/confs/StakeManager.conf", "verify:stake_manager_start_migration": "certoraRun certora/confs/StakeManagerStartMigration.conf"