Storm-Labs-Inc / cove-contracts-boosties

Core smart contracts of the Cove Protocol
Other
18 stars 6 forks source link

fix(YAUDIT-COVE-18): reverse traversing in `previewMints` and `previewWithdraws` #298

Closed penandlim closed 7 months ago

penandlim commented 7 months ago

Describe your changes

Relevant: https://github.com/yAudit/cove-report/issues/18

Checklist before requesting a review

github-actions[bot] commented 7 months ago

Slither report

THIS CHECKLIST IS NOT COMPLETE. Use --show-ignored-findings to show all the results. Summary

github-actions[bot] commented 7 months ago

Changes to gas cost

Generated at commit: 6871c585e7721b537249f4466c5e431be2fc1902, compared to commit: 08dd75f4bf24156f49a520dc6655ed39e80899bb

๐Ÿงพ Summary (10% most significant diffs)

Contract Method Avg (+/-) %
Yearn4626RouterExt previewMints
previewWithdraws
-7,231 โœ…
-2,308 โœ…
-27.87%
-8.85%
DYFIRedeemer receiveFlashLoan +1,596 โŒ +1.69%

Full diff report ๐Ÿ‘‡
| Contract | Deployment Cost (+/-) | Method | Min (+/-) | % | Avg (+/-) | % | Median (+/-) | % | Max (+/-) | % | # Calls (+/-) | |:-|-:|:-|-:|-:|-:|-:|-:|-:|-:|-:|-:| | **Yearn4626RouterExt** | 3,473,608 (+9,250) | _previewMints_
_previewWithdraws_ | 627 (0)
628 (0) | **0.00%**
**0.00%** | 18,717 (-7,231)
23,765 (-2,308) | **-27.87%**
**-8.85%** | 8,190 (-18,641)
20,582 (-5,734) | **-69.48%**
**-21.79%** | 49,264 (+276)
48,918 (-19) | **+0.56%**
**-0.04%** | 7 (+1)
8 (+1) | | **SwapAndLock** | 1,183,769 (+10,534) | _dYfiRedeemer_
_setDYfiRedeemer_ | 343 (-22)
23,966 (-6) | **-6.03%**
**-0.03%** | 343 (-22)
63,712 (-12) | **-6.03%**
**-0.02%** | 343 (-22)
76,054 (-6) | **-6.03%**
**-0.01%** | 343 (-22)
76,289 (-6) | **-6.03%**
**-0.01%** | 768 (0)
1,296 (0) | | **DYFIRedeemer** | 2,139,607 (0) | _massRedeem_
_receiveFlashLoan_
_setSlippage_ | 30,408 (0)
23,419 (0)
24,054 (+36) | **0.00%**
**0.00%**
**+0.15%** | 441,297 (+15)
96,168 (+1,596)
38,867 (+2) | **+0.00%**
**+1.69%**
**+0.01%** | 440,099 (0)
25,238 (-256)
30,088 (0) | **0.00%**
**-1.00%**
**0.00%** | 689,094 (0)
279,843 (0)
53,508 (0) | **0.00%**
**0.00%**
**0.00%** | 1,545 (0)
1,280 (0)
513 (0) | | **YearnStakingDelegate** | 3,639,792 (0) | _deposit_
_execute_
_harvest_
_setDepositLimit_
_setGaugeRewardSplit_
_setSwapAndLock_
_treasury_
_withdraw(address,uint256)_
_withdraw(address,uint256,address)_ | 26,589 (0)
27,929 (0)
24,054 (0)
48,062 (0)
25,584 (0)
24,116 (0)
443 (0)
22,081 (0)
22,507 (0) | **0.00%**
**0.00%**
**0.00%**
**0.00%**
**0.00%**
**0.00%**
**0.00%**
**0.00%**
**0.00%** | 127,735 (+1)
137,755 (+147)
311,379 (-16)
48,133 (+1)
35,732 (-1)
47,417 (+2)
446 (+3)
95,290 (+2)
104,740 (-2) | **+0.00%**
**+0.11%**
**-0.01%**
**+0.00%**
**-0.00%**
**+0.00%**
**+0.68%**
**+0.00%**
**-0.00%** | 110,791 (0)
149,225 (0)
352,133 (0)
48,062 (0)
25,856 (0)
47,540 (0)
443 (0)
59,896 (0)
90,250 (0) | **0.00%**
**0.00%**
**0.00%**
**0.00%**
**0.00%**
**0.00%**
**0.00%**
**0.00%**
**0.00%** | 249,863 (0)
149,609 (0)
431,958 (0)
48,434 (0)
54,789 (0)
53,849 (0)
2,443 (+2,000)
172,423 (0)
192,751 (0) | **0.00%**
**0.00%**
**0.00%**
**0.00%**
**0.00%**
**0.00%**
**+451.47%**
**0.00%**
**0.00%** | 3,334 (0)
268 (0)
1,803 (0)
526 (0)
1,283 (0)
280 (0)
513 (+1)
769 (0)
512 (0) | | **YearnGaugeStrategy** | 1,817,865 (0) | _deposit_
_redeem_
_report_
_setDYfiRedeemer_
_withdraw_ | 30,717 (0)
293,599 (0)
58,515 (0)
27,506 (0)
74,620 (0) | **0.00%**
**0.00%**
**0.00%**
**0.00%**
**0.00%** | 291,876 (+18)
300,265 (-1)
302,958 (+1)
75,256 (-4)
176,029 (+123) | **+0.01%**
**-0.00%**
**+0.00%**
**-0.01%**
**+0.07%** | 308,482 (0)
298,435 (0)
69,644 (0)
79,805 (0)
201,040 (0) | **0.00%**
**0.00%**
**0.00%**
**0.00%**
**0.00%** | 447,268 (0)
308,756 (0)
914,852 (-10)
79,824 (0)
256,348 (0) | **0.00%**
**0.00%**
**-0.00%**
**0.00%**
**0.00%** | 7,938 (0)
769 (0)
5,890 (0)
3,587 (0)
1,792 (0) | | **GaugeRewardReceiver** | 1,428,645 (0) | _harvest_ | 5,864 (0) | **0.00%** | 293,144 (+157) | **+0.05%** | 350,867 (0) | **0.00%** | 455,946 (0) | **0.00%** | 2,058 (0) | | **StakingDelegateRewards** | 1,990,696 (0) | _notifyRewardAmount_
_setRewardReceiver_ | 24,268 (0)
45,291 (0) | **0.00%**
**0.00%** | 104,145 (+3)
45,447 (-1) | **+0.00%**
**-0.00%** | 141,488 (0)
45,519 (0) | **0.00%**
**0.00%** | 161,736 (0)
45,519 (0) | **0.00%**
**0.00%** | 527 (0)
257 (0) |
codecov[bot] commented 7 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 97.57%. Comparing base (637e7ed) to head (15380cf).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #298 +/- ## ======================================= Coverage 97.56% 97.57% ======================================= Files 19 19 Lines 987 988 +1 Branches 202 203 +1 ======================================= + Hits 963 964 +1 Misses 1 1 Partials 23 23 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.