Closed howlbot-integration[bot] closed 2 months ago
It is correct for the throttle to accumulate before changing the supply, since it is a catch-up step. It should not happen after.
We can see straightforwardly that the following claim is incorrect because RTokens are successfully first minted all the time:
The supply throttle check will fail if current total supply is 0. This occurs when it is the first issuance of the RToken, or when all RTokens have been redeemed before.
thereksfour marked the issue as unsatisfactory: Invalid
Lines of code
https://github.com/code-423n4/2024-07-reserve/blob/main/contracts/p1/RToken.sol#L105-L155
Vulnerability details
Impact
The supply throttle check in issuance is performed before the
_scaleUp
, where_mint
is called within_scaleUp
. This is problematic:Proof of Concept
The
supply
used for throttle checking is the current total supply of RToken (i.e.totalSupply()
, L118). It does not contain the amount of current issuance, as the minting of RToken is performed in_scaleUp
(L496), which is called after the throttle checking.https://github.com/code-423n4/2024-07-reserve/blob/main/contracts/p1/RToken.sol#L105-L155
https://github.com/code-423n4/2024-07-reserve/blob/main/contracts/p1/RToken.sol#L483-L497
Total supply is then used to calculate the hourly limit of the supply throttle (L46 => L88), and the limit is then used to calculate the available amount to use (L49 => L75). If current total supply is 0, the available amount will be 0, and the supply throttle checking will fail (L58).
https://github.com/code-423n4/2024-07-reserve/blob/main/contracts/libraries/Throttle.sol#L37-L65
https://github.com/code-423n4/2024-07-reserve/blob/main/contracts/libraries/Throttle.sol#L69-L77
https://github.com/code-423n4/2024-07-reserve/blob/main/contracts/libraries/Throttle.sol#L80-L90
Tools Used
VS Code
Recommended Mitigation Steps
In issuance, perform the supply throttle checking after the
_scaleUp
.Assessed type
Other