Badger-Finance / badger-strategies

5 stars 1 forks source link

[Review]: Voter Module #83

Open petrovska-petro opened 2 years ago

petrovska-petro commented 2 years ago

Module Review

Description

README

Code Link

release for review

Review By

Requesting green light from solidity pod for the code above and discussed during solidity office hours

Review by Security Board

Test Checks

Screenshot 2022-10-24 at 19 06 22
okjintao commented 2 years ago

Findings

Review will be broken down into the labeled sections of the contract

Constants Variables

State Variables

Events

Keepers - Executors

rewards > 0 && (block.timestamp - lastRewardClaimTimestamp) > interval

Invariant Check on Balance

Assume

(graviSafeBal / ONE_ETH) * graviPpfs

you'd end up with 0 * graviPpfs and so for any value < 1 ether

totalWdAura < Check will never be true

This only really applied is there was say, 0.25 WD Aura, and then you end up encoding the request to withdraw the proper amount as the multiplication math is good and you'd break.

I believe the correct way would just be to do

(graviSafeBal * graviPpfs) / ONE_ETH
shuklaayush commented 2 years ago
GalloDaSballo commented 2 years ago

Will review post the above edits

petrovska-petro commented 2 years ago

thanks guys for the review. created another release adding the suggestions in the above comments:

latest release for review

cc: @shuklaayush @axejintao @GalloDaSballo

GalloDaSballo commented 2 years ago

Fixes LGTM, added specific test coverage here: https://github.com/petrovska-petro/VoterModule/pull/1

I think it's good to go for a road test

shuklaayush commented 2 years ago
petrovska-petro commented 2 years ago
  • Change checkUpkeep condition to graviBal > 0 && totalWdAura > 0
  • Since anyone can claim rewards for anyone else, maybe the condition should be earnData[0].amount > 0 || auraBal.balanceOf(address(SAFE)) > 0

added your notes in latest release

petrovska-petro commented 2 years ago

final release addressing extra notes from @shuklaayush

shuklaayush commented 2 years ago

LGTM

petrovska-petro commented 2 years ago

thanks for the reviews, deployed the contract at: https://etherscan.io/address/0xc485afd2f3252ccb69d1c94392701d51013d42eb#contracts

will commence with the integration over the multisig repo issue

GalloDaSballo commented 2 years ago

@petrovska-petro I've forwarded to Watchpug, will ping if anything is off