Skip to content

Enforce per-side MINIMUM_LIQUIDITY floor on first deposit (F-9) - #151

Merged
Bluechip23 merged 1 commit into
mainfrom
claude/eager-hamilton-n9mj23
Jun 10, 2026
Merged

Enforce per-side MINIMUM_LIQUIDITY floor on first deposit (F-9)#151
Bluechip23 merged 1 commit into
mainfrom
claude/eager-hamilton-n9mj23

Conversation

@Bluechip23

Copy link
Copy Markdown
Owner

calc_liquidity_for_deposit floored only the geometric mean (sqrt(amount0*amount1)) on the first deposit into an empty pool, so a highly asymmetric seed such as (20, 500_000_000) passed (sqrt = 100_000 >> MINIMUM_LIQUIDITY) yet left reserve0 at 20 — below the floor the swap path and maybe_auto_pause_on_low_liquidity both assume every live pool upholds, leaving the pool swap-broken on one side. The stateful fuzz harness surfaced this as minimum_liquidity_breached; it predated the F-1/F-2 fixes.

The genuinely-empty first deposit now requires both credited amounts

= MINIMUM_LIQUIDITY. Adds a deterministic regression test
(first_deposit_rejects_subfloor_reserve_side); the fuzz harness that found it is now green and a 3,000-case stateful run is clean. Updates SECURITY_AUDIT.md to mark F-9 fixed.

calc_liquidity_for_deposit floored only the geometric mean
(sqrt(amount0*amount1)) on the first deposit into an empty pool, so a
highly asymmetric seed such as (20, 500_000_000) passed
(sqrt = 100_000 >> MINIMUM_LIQUIDITY) yet left reserve0 at 20 — below the
floor the swap path and maybe_auto_pause_on_low_liquidity both assume
every live pool upholds, leaving the pool swap-broken on one side. The
stateful fuzz harness surfaced this as minimum_liquidity_breached; it
predated the F-1/F-2 fixes.

The genuinely-empty first deposit now requires both credited amounts
>= MINIMUM_LIQUIDITY. Adds a deterministic regression test
(first_deposit_rejects_subfloor_reserve_side); the fuzz harness that
found it is now green and a 3,000-case stateful run is clean. Updates
SECURITY_AUDIT.md to mark F-9 fixed.
@Bluechip23
Bluechip23 merged commit 0deead5 into main Jun 10, 2026
2 of 6 checks passed
@Bluechip23
Bluechip23 deleted the claude/eager-hamilton-n9mj23 branch July 7, 2026 20:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants