-
Notifications
You must be signed in to change notification settings - Fork 0
libratus - Locked funds calculation is invalid if part of the reward pool was claimed #389
Comments
Will fix by simply removing crowdfunding and restricting funding to the bounty issuer |
Dupe of #257 |
Escalate for 20 USDC I don't think it's a duplicate of 257. Even though both likely originate from the same design choices, the issues are different in impact and repro steps. 257 advocates for proportional distribution of remaining refunds to depositors. It describes a scenario when all refunds are expired and ready to be refunded. The current issue, on the other hand, highlights incorrect calculations when determining the amount that can be refunded. In order to reproduce it, you need to have some deposits expired and some still ongoing. The impact is also about tokens being locked in the contract unnecessarily until the other deposit expires. In my opinion, there is a distinction and it is possible to fix one but not the other and vice versa. #421 is the same as this one, btw. |
You've created a valid escalation for 20 USDC! To remove the escalation from consideration: Delete your comment. You may delete or edit your escalation comment anytime before the 48-hour escalation window closes. After that, the escalation becomes final. |
Escalation rejected. It's a duplicate of #257 as it originates from the same design choice. 257 might have a different scenario and recommendation but it's based on the same flaw in the code. |
This issue's escalations have been rejected! Watsons who escalated this issue will have their escalation amount deducted from their next payout. |
libratus
medium
Locked funds calculation is invalid if part of the reward pool was claimed
Summary
If part of the reward pool is claimed,
getLockedFunds
calculation inBountyCore
will be invalid which may lead to errors when trying to refund a depositVulnerability Detail
In
getLockedFunds
locked funds are calculated the following way:Using
volume[depList[i]]
means always taking full deposit amount. This works for Atomic bounty but not for other types where it is possible to claim rewards in parts. If rewards were partially claimed, then only the remaining portion of the deposit should be considered locked. Current logic can lead to errors as shown in the PoC:Impact
Under certain circumstances depositor will not be able to refund an expired deposit
Code Snippet
https://github.com/sherlock-audit/2023-02-openq/blob/main/contracts/Bounty/Implementations/BountyCore.sol#L333-L352
Tool used
Manual Review
Recommendation
Subtract the amount of claimed tokens when calculating locked funds. Amount of claimed tokens can be tracked separately
Duplicate of #257
The text was updated successfully, but these errors were encountered: