-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
xiaoming90 - Rebalance will be delayed due to revert #44
Labels
Medium
A valid Medium severity issue
Reward
A payout will be made for this issue
Sponsor Confirmed
The sponsor acknowledged this issue is valid
Will Fix
The sponsor confirmed this issue will be fixed
Comments
1 comment(s) were left on this issue during the judging contest. takarez commented:
|
sbuljac
added a commit
to notional-finance/contracts-v3
that referenced
this issue
Feb 1, 2024
sherlock-admin2
changed the title
Strong Leather Toad - Rebalance will be delayed due to revert
xiaoming90 - Rebalance will be delayed due to revert
Feb 3, 2024
sherlock-admin2
added
Reward
A payout will be made for this issue
Will Fix
The sponsor confirmed this issue will be fixed
labels
Feb 3, 2024
jeffywu
pushed a commit
to notional-finance/contracts-v3
that referenced
this issue
Feb 12, 2024
* Audit: part of solution for issue #44 /sherlock-audit/2023-12-notional-update-5-judging/issues/44 * Simplify checkRebalance method
jeffywu
pushed a commit
to notional-finance/contracts-v3
that referenced
this issue
Feb 13, 2024
* Audit: part of solution for issue #44 /sherlock-audit/2023-12-notional-update-5-judging/issues/44 * Simplify checkRebalance method
The protocol team fixed this issue in PR/commit notional-finance/contracts-v3#32. |
The Lead Senior Watson signed-off on the fix. |
jeffywu
pushed a commit
to notional-finance/contracts-v3
that referenced
this issue
Feb 27, 2024
* Audit: part of solution for issue #44 /sherlock-audit/2023-12-notional-update-5-judging/issues/44 * Simplify checkRebalance method
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Medium
A valid Medium severity issue
Reward
A payout will be made for this issue
Sponsor Confirmed
The sponsor acknowledged this issue is valid
Will Fix
The sponsor confirmed this issue will be fixed
xiaoming90
medium
Rebalance will be delayed due to revert
Summary
The rebalancing of unhealthy currencies will be delayed due to a revert, resulting in an excess of liquidity being lent out in the external market. This might affect the liquidity of the protocol, potentially resulting in withdrawal or liquidation having issues executed due to insufficient liquidity.
Vulnerability Detail
Assume that Notional supports 5 currencies ($A, B, C, D, E$ ), and the Gelato bot is configured to call the
checkRebalance
function every 30 minutes.Assume that the current market condition is volatile. Thus, the inflow and outflow of assets to Notional, utilization rate, and available liquidity at AAVE change frequently. As a result, the target amount that should be externally lent out also changes frequently since the computation of this value relies on the spot market information.
At T1, when the Gelato bot calls the$A$ , $B$ , and $C$ are unhealthy and need to be rebalanced.
checkRebalance()
view function, it returns that currenciesShortly after receiving the execution payload from the
checkRebalance()
, the bot submits the rebalancing TX to the mempool for execution at T2.When the rebalancing TX is executed at T3, one of the currencies (Currency$A$ ) becomes healthy. As a result, the require check at Line 326 will revert and the entire rebalancing transaction will be cancelled. Thus, currencies $B$ and $C$ that are still unhealthy at this point will not be rebalanced.
If this issue occurs frequently or repeatedly over a period of time, the rebalancing of unhealthy currencies will be delayed.
https://github.com/sherlock-audit/2023-12-notional-update-5/blob/main/contracts-v3/contracts/external/actions/TreasuryAction.sol#L326
Impact
The rebalancing of unhealthy currencies will be delayed, resulting in an excess of liquidity being lent out to the external market. This might affect the liquidity of the protocol, potentially resulting in withdrawal or liquidation having issues executed due to insufficient liquidity.
Code Snippet
https://github.com/sherlock-audit/2023-12-notional-update-5/blob/main/contracts-v3/contracts/external/actions/TreasuryAction.sol#L326
Tool used
Manual Review
Recommendation
If one of the currencies becomes healthy when the rebalance TX is executed, consider skipping this currency and move on to execute the rebalance on the rest of the currencies that are still unhealthy.
The text was updated successfully, but these errors were encountered: