Skip to content

`maxRedeem` rounding

Low
Schlagonia published GHSA-v6rq-8g58-4pcp Oct 21, 2024

Package

No package listed

Affected versions

v3.0.0 - v3.0.1

Patched versions

v3.0.2

Description

Affected versions

  • v3.0.0
  • v3.0.1

Summary

During maxRedeem, internally, the amount is rounded up and in some cases can lead to 1 wei more shares than actually possible to redeem when the amount to redeem is limited by the strategy's withdraw limit.

return min(
        # Convert to shares is rounding up so we check against the full balance.
        self._convert_to_shares(self._max_withdraw(owner, max_loss, strategies), Rounding.ROUND_UP),
        self.balance_of[owner]
    )

Impact

If required conditions are met, an attempt by a user to exit their position using the output of maxRedeem will revert.

Patches

Patch introduced in v3.0.2

Workarounds

If the strategy is not liquid enough to support a user redemption, subtract 1 wei from the the maxRedeem amount and use it in the redeem function instead.

Severity

Low

CVE ID

No known CVE

Weaknesses

No CWEs