<!-- canonical: https://0xsimao.com/findings/glacier-reserve-remove-unnecessary-logic -->

# In GReservePool, remove unnecessary logic

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

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

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

---

### Description

In the function withdraw(), the variable amountTransfered is going to be equal to the
biggest of two variables, either totalWithdraw or amount. Since totalWithdraw will either
be bigger than amount or the same, there is no need to check if one is bigger than the other
as totalWithdraw will always be the correct value. Therefore you can just use
totalWithdraw for the transfer.

### Status

Currently being reviewed by the team.

---

Related findings:

- [`ReserveLogic::_updateIndexes()` assumes the utilization rate was constant the whole time when calculating the new borrows](https://0xsimao.com/findings/yieldoor-constant-whole-calculating-borrows): Yieldoor
- [StakingPool is missing rewards distribution end logic](https://0xsimao.com/findings/spirit-protocol-staking-rewards-distribution-end): Spirit Protocol
- [`VaultPoolLib::reserve()` will store the `Pa` not attributed to user withdrawals incorrectly and leave in untracked once it expires again](https://0xsimao.com/findings/cork-protocol-attributed-withdrawals-untracked-expires): Cork Protocol
