# Incorrect initial deposit calculation may cause cancelProgram to revert

Superfluid cancelProgram recomputes initialDeposit from live governance params instead of stored value, so parameter changes cause revert or misaccounting on cancellation.

- Payout: Audit contest
- Severity: medium
- Program: Superfluid
- Found by: 0x73696d616f
- Disclosed: 2025-06-02
- Write-up quality: 6/10
- Original: https://github.com/sherlock-audit/2025-06-superfluid-locker-system-judging/issues/96
- Library page: https://bugbountylibrary.com/r/sherlock%3A2025-06-superfluid-locker-system%3AM-3
- Tags: area:web3 domain:web3 impact:dos impact:funds-loss kind:contest platform:sherlock sev:medium tech:evm tech:solidity technique:source-review vuln:accounting-error vuln:business-logic

**Target:** FluidEPProgramManager.cancelProgram()
**Root cause:** cancelProgram() recomputes the buffer via getBufferAmountByFlowRate using current minimum deposit and liquidation period governance configs rather than the values in effect when the program was funded.
**Steps:**
1. Program created and funded; initialDeposit computed from then-current min deposit and liquidation period.
2. Governance calls setSuperTokenMinimumDeposit() or setPPPConfig() changing those params.
3. Call cancelProgram(); it recomputes buffer = getBufferAmountByFlowRate(fundingFlowRate+subsidyFlowRate) + totalFlowRate*EARLY_PROGRAM_END.
4. If params increased, computed initialDeposit exceeds actual balance -> transfer to treasury reverts, blocking cancellation.
5. If params decreased, computed initialDeposit is lower -> excess funds stranded in contract.
**How found:** Code reading of cancelProgram() noticing it recomputes initialDeposit from live governance configs (SUPERTOKEN_MINIMUM_DEPOSIT_KEY, CFAV1_PPP_CONFIG_KEY) instead of persisting the funded amount, then tracing the getBufferAmountByFlowRate call chain to confirm the dependency.
**Exploitation:** Not attacker-driven; triggered by legitimate governance parameter changes. Cancellation either reverts (funds locked, program uncancellable) or returns less than deposited to treasury, stranding excess in the contract.
**Insight:** When a contract recomputes a stored financial quantity from external mutable config at exit time, compare it against the value captured at entry; any governance-tunable parameter (min deposit, liquidation period) in that recomputation is a divergence bug.

