Open hats-bug-reporter[bot] opened 4 months ago
If the LootCreator is one day changed to be replaced, a new method will be added to have the possibility to fetch all the data needed (totalQuestPeriodRewards
but also all Budget
& Allocations
) from the previous LootCreator.
For now, we will just add a check to make return early in the Loot creation if there is no totalQuestPeriodRewards
, so we avoid any division by 0 (see https://github.com/PaladinFinance/Vote-Flywheel/pull/2/commits/b25d1ebf4c2cb1c391f3658d47432dd42931a93a)
Github username: @chainNue Twitter username: chainNue Submission hash (on-chain): 0xf76a45fdb970b1ed33632ae8bc5fc774dde360cd36d4dae75db5e4dbc02ad4b2 Severity: medium
Description: Description
The
lootCreator
inMultiMerkleDistributorV2
can be changed viasetLootCreator
. If thelootCreator
can only be set once, then the function should bebut since the check above is not exist, I assume the LootCreator can be changed even after the first initialization.
By design, the
claim
in Distributor is not restricted only callable for the current running period, user canclaim
for late period, for example if the current period is week 10, they can claim from period week 5 if they have reward on it.There is possible case where the Distributor changed the
lootCreator
, and user trying toclaim
,claimQuest
,multiClaim
which will trigger_triggerCreateLoot
andnotifyQuestClaim
on this newlootCreator
.The issue here is this new
lootCreator
didn't have information of pasttotalQuestPeriodRewards
which is exist on oldlootCreator
, thus when user want tocreateLoot
of past period afterlootCreator
changed, it will be reverted sincetotalQuestPeriodRewards
is not available in newlootCreator
, due to division by zero onLootCreator
in line 484.Attack Scenario
Attachments
Proof of Concept (PoC) File
Revised Code File (Optional)
Recommendation
Consider to implement a proxy for
LootCreator
to remove the feature changing lootCreator address thus keeping the past statetotalQuestPeriodRewards