# `FluidLocker::_getUnlockingPercentage()` uses 540 instead of `540 days` leading to stuck funds as the unlocking percentage will be bigger than `100%` and underflow

FluidLocker's _getUnlockingPercentage used 540 instead of 540 days, inflating the unlock percentage past 100% and reverting the unlock flow, trapping user funds.

- Payout: Audit contest
- Severity: high
- Program: Superfluid
- Found by: 0x73696d616f
- Disclosed: 2024-11-13
- Write-up quality: 6/10
- Original: https://github.com/sherlock-audit/2024-11-superfluid-locking-contract-judging/issues/21
- Library page: https://bugbountylibrary.com/r/sherlock%3A2024-11-superfluid-locking-contract%3AH-2
- Tags: area:web3 domain:web3 impact:dos impact:funds-loss kind:contest platform:sherlock sev:high tech:solidity technique:source-review vuln:accounting-error vuln:dos

**Target:** FluidLocker.sol vesting/unlock logic
**Root cause:** _getUnlockingPercentage divides by Math.sqrt(540 * _SCALER) instead of Math.sqrt(540 days * _SCALER), making the computed unlocking percentage far exceed 10_000 BP.
**Steps:**
1. Call unlock on FluidLocker with any unlockPeriod.
2. _getUnlockingPercentage returns a value >10_000 BP due to the 540 vs 540 days error.
3. unlockFlowRate = globalFlowRate * percentage / BP_DENOMINATOR exceeds globalFlowRate.
4. taxFlowRate = globalFlowRate - unlockFlowRate underflows and reverts, blocking the unlock.
**How found:** Code review of the unlock percentage formula spotted the literal 540 where the maximum unlock period constant 540 days was intended, then traced the resulting overflow into the flow-rate subtraction.
**Insight:** When a formula normalizes against a maximum period, verify the constant carries the same time unit as the input; a bare integer where a duration is expected silently inflates the ratio.

## Proof of concept (copied exactly from the original report)

**Unlock flow rate calculation that reverts**

```
unlockFlowRate = (globalFlowRate * int256(_getUnlockingPercentage(unlockPeriod))).toInt96()
            / int256(_BP_DENOMINATOR).toInt96();
will be bigger than the global flow rate, so it reverts when calculating the tax flow rate `taxFlowRate = globalFlowRate - unlockFlowRate;
```

