Open sherlock-admin2 opened 10 months ago
1 comment(s) were left on this issue during the judging contest.
takarez commented:
valid because { This is valid}
The protocol team fixed this issue in PR/commit https://github.com/notional-finance/contracts-v3/pull/34.
The Lead Senior Watson signed-off on the fix.
xiaoming90
high
Low precision is used when checking spot price deviation
Summary
Low precision is used when checking spot price deviation, which might lead to potential manipulation or create the potential for an MEV opportunity due to valuation discrepancy.
Vulnerability Detail
Assume the following:
nTokenOracleValue
is 1,000,000,000nTokenSpotValue
is 980,000,001https://github.com/sherlock-audit/2023-12-notional-update-5/blob/main/contracts-v3/contracts/global/Constants.sol#L47
https://github.com/sherlock-audit/2023-12-notional-update-5/blob/main/contracts-v3/contracts/internal/nToken/nTokenCalculations.sol#L65
Based on the above formula:
The above shows that the oracle and spot values have deviated by 1.99999%, which is close to 2%. However, due to a rounding error, it is rounded down to 1%, and the TX will not revert.
Impact
The purpose of the deviation check is to ensure that the spot market value is not manipulated. If the deviation check is not accurate, it might lead to potential manipulation or create the potential for an MEV opportunity due to valuation discrepancy.
Code Snippet
https://github.com/sherlock-audit/2023-12-notional-update-5/blob/main/contracts-v3/contracts/internal/nToken/nTokenCalculations.sol#L65
Tool used
Manual Review
Recommendation
Consider increasing the precision.
For instance, increasing the precision from
Constants.PERCENTAGE_DECIMALS
(100) to 1e8 would have caught the issue mentioned earlier in the report even after the rounding down.1% of 1e8 = 1000000