The function drip will revert when diff is 0, which leads to the DOS of key functionalities.
Summary
In SNst.sol, the function withdraw, redeem, mint and deposit will be DOSed as the function drip reverts. This problem will occur in the following two scenarios:
When the difference between block.timestamp and rho is small, it may cause nChi to be the same as chi.
When the nsr is set to a smaller value, it may cause nChi to be the same as chi. **An extreme case is when nsr=RAY, nChi will always be equal to chi, which causes the contract to be permanently DOS until the admin updates it.**
zraxx
Medium
The function
drip
will revert when diff is 0, which leads to the DOS of key functionalities.Summary
In
SNst.sol
, the function withdraw, redeem, mint and deposit will be DOSed as the functiondrip
reverts. This problem will occur in the following two scenarios:Root Cause
https://github.com/sherlock-audit/2024-06-makerdao-endgame/blob/main/sdai/src/SNst.sol#L214-L229
In
SNst.sol:220
, there is no check whether diff is 0, causing the parameter ofnstJoin.exit
to be 0.Internal pre-conditions
No pre-conditions
External pre-conditions
No pre-conditions
Attack Path
Calls to the function withdraw, redeem, mint and deposit may fail at any time.
Impact
Users will not be able to withdraw, redeem, mint and deposit.
PoC
Please put this piece of code in the file
NstJoin.t.sol
. This piece of code will be reverted as the parameter of function nstJoin.exit is 0.Mitigation
before calling the nstJoin.exit, check where diff is 0.