<!-- canonical: https://0xsimao.com/findings/glacier-reverts-current-reserves-target -->

# rebalance() in glAVAX reverts if currentReserves == reserveTarget

Low/Info · Three Sigma · Liquid staking · 12th July, 2023

Finding 3S-GLACIER-L04 of the Glacier security review.

- Protocol: https://www.glacier.io/
- Report: /reports/glacier
- Source: https://cdn.sanity.io/files/qoqld077/production/21bd3b6fa78c55968a6c9c7ea4fd49f34a8bd3d8.pdf

---

### Description

[rebalance()](https://github.com/JackFrostDev/glacier-contracts/blob/main/contracts/protocol/GlacialAVAX/glAVAX.sol#L314) in glAVAX deposits to the ReservePool if there is available liquidity (balance)
and the currentReserves are smaller than the reserveTarget.
The problem is that the ReservePool reverts when trying to [withdraw 0](https://github.com/JackFrostDev/glacier-contracts/blob/main/contracts/protocol/ReservePool/GReservePool.sol#L192), which is the case if
currentReserves == reserveTarget.

### Status

Currently being reviewed by the team.

---

Related findings:

- [ClampLib::mulDivDownInverse reverts on `target == type(uint256).max` before the overflow guard runs](https://0xsimao.com/findings/tenor-markets-reverts-overflow-guard-runs): Tenor Morpho Migrations
