Closed c4-bot-1 closed 1 month ago
Hi, thanks for your submission.
Indeed, after refactoring and changes, this point, although known, was missed in the new code
Thank you for your participation
alcueca marked the issue as satisfactory
alcueca marked the issue as primary issue
alcueca marked issue #11 as primary and marked this issue as a duplicate of 11
alcueca changed the severity to 3 (High Risk)
Per request from the judge @alcueca, updating the severity of this issue to Medium
to match their intent in this comment: https://github.com/code-423n4/2024-09-fenix-finance-findings/issues/11#issuecomment-2392118543.
Lines of code
https://github.com/code-423n4/2024-09-fenix-finance/blob/main/contracts/core/VotingEscrowUpgradeableV2.sol#L470
Vulnerability details
Impact
This could lead to an inaccurate balance between the actual locked amount and the permanentTotalSupply. In the worst case, users might not be able to unlock their permanent locks due to over-deduction by previous users with boosted balances.
Proof-of-Concept
The
_proccessLockChange
function is responsible for updating the locked balance of an NFT. When processing a lock change, the function checks if the lock is eligible for a boost reward from the VeBoost contract.If the lock is eligible, the function calculates the boost amount and adds it to the total locked amount.
However, when updating
permanentTotalSupply
(for permanent lock case), the function only adds the original deposit amount, excluding the boosted amount. This can lead to an inaccurate permanent total supply calculation, as shown in the following code snippet:In the code above,
permanentTotalSupply
is only incremented by the originalamount_
value, whileboostedValue
is added tonewLocked.amount
. This means that when a user withdraws their locked tokens, the contract will deduct more than was originally added topermanentTotalSupply
, leading to an underestimation of the permanent total supply.Recommended Mitigations
Assessed type
Context