<!-- canonical: https://0xsimao.com/findings/glacier-checks-effects-interactions-pattern -->

# Checks effects interactions pattern should always be used

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

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

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

---

### Description

The [checks-effects-interactions](https://fravoll.github.io/solidity-patterns/checks_effects_interactions.html) pattern should be used whenever possible, even if
apparently it has no consequences. There are some instances specified in the relevant links
where it isn't followed.

### Recommendation

For example in withdraw() of glAVAX

```solidity
... // Transfer the user with the AVAX
payable(user).transfer(toWithdraw);
_updateWithdrawTotal(toWithdraw);
...
```

Should be instead

```solidity
... _updateWithdrawTotal(toWithdraw);
// Transfer the user with the AVAX
payable(user).transfer(toWithdraw);
...
```

### Status

Currently being reviewed by the team.

---

Related findings:

- [completeUnstake() not following checks-effects-interactions pattern](https://0xsimao.com/findings/metazero-ii-complete-unstake-following-interactions): MetaZero Staking
- [Checks effects interactions pattern is now always followed](https://0xsimao.com/findings/orange-effects-interactions-now-followed): Orange Bridge
- [Checks effects interactions pattern is not always followed](https://0xsimao.com/findings/singularity-effects-interactions-pattern-followed): Singularity
- [Checks-effects-interations pattern is not always followed, which can be used to drain all tokens](https://0xsimao.com/findings/singularity-effects-interations-followed-drain): Singularity
