fix: size one-sided zap provide to swap min_return (#559) #1084

Merged
PlasticDigits merged 2 commits from fix/559-zap-floor-sizing into main 2026-08-18 03:09:49 +00:00
PlasticDigits commented 2026-08-18 02:38:11 +00:00 (Migrated from gitlab.com)

Summary

  • Retail one-sided Add was sizing provide_liquidity to the quoted ask while the swap only guaranteed min_return. A fill in (min_return, quote) reverted Overflow: Cannot Sub at message index 3 (production UST1/cUSTC).
  • Execution amounts now follow floors: zap-in provideAsk ≤ swapMinReturn then ratio-trim to conservative post-swap reserves; zap-out swap/unwrap uses min_assets + swapMinReturn. Leftover stays in the wallet (no silent ask-balance spend).
  • Pre-sign min-swap is human units. New invariant Z559-1–Z559-4, skill AGENTS_FRONTEND_POOL_ZAP_FLOORS.md, make verify-issue-559.

Closes #559

Test plan

  • Units T-Z1–T-Z12 (oneSidedLiquidity, Quote, Tx, Copy)
  • VERIFY_ISSUE_559_SKIP_E2E=1 make verify-issue-559 (includes nested verify-issue-533)
  • Playwright smoke P1–P3 (e2e-smoke, 5 workers)
  • LocalTerra P4 + P9 (e2e-tx, 1 worker) — seeded pair add succeeds; pre-sign is not raw min swap 500571
  • Manual: Settings 5%, UST1/cUSTC-shaped 6-dec/6-dec Add; must not show Cannot Sub with <fill> and <quote> at msg index 3
  • make test-frontend on Coolify/CI for the touched files
## Summary - Retail one-sided Add was sizing `provide_liquidity` to the **quoted** ask while the swap only guaranteed `min_return`. A fill in `(min_return, quote)` reverted `Overflow: Cannot Sub` at message index 3 (production UST1/cUSTC). - Execution amounts now follow floors: zap-in `provideAsk ≤ swapMinReturn` then ratio-trim to conservative post-swap reserves; zap-out swap/unwrap uses `min_assets` + `swapMinReturn`. Leftover stays in the wallet (no silent ask-balance spend). - Pre-sign min-swap is human units. New invariant **Z559-1–Z559-4**, skill [`AGENTS_FRONTEND_POOL_ZAP_FLOORS.md`](skills/AGENTS_FRONTEND_POOL_ZAP_FLOORS.md), `make verify-issue-559`. Closes #559 ## Test plan - [x] Units T-Z1–T-Z12 (`oneSidedLiquidity`, `Quote`, `Tx`, `Copy`) - [x] `VERIFY_ISSUE_559_SKIP_E2E=1 make verify-issue-559` (includes nested `verify-issue-533`) - [x] Playwright smoke P1–P3 (`e2e-smoke`, 5 workers) - [x] LocalTerra P4 + P9 (`e2e-tx`, 1 worker) — seeded pair add succeeds; pre-sign is not raw `min swap 500571` - [ ] Manual: Settings 5%, UST1/cUSTC-shaped 6-dec/6-dec Add; must not show `Cannot Sub with <fill> and <quote>` at msg index 3 - [ ] `make test-frontend` on Coolify/CI for the touched files
PlasticDigits commented 2026-08-18 03:09:42 +00:00 (Migrated from gitlab.com)

added 12 commits

  • cb834f30...f6a06fcd - 11 commits from branch main
  • a932718f - Merge branch 'main' into fix/559-zap-floor-sizing

Compare with previous version

added 12 commits <ul><li>cb834f30...f6a06fcd - 11 commits from branch <code>main</code></li><li>a932718f - Merge branch &#39;main&#39; into fix/559-zap-floor-sizing</li></ul> [Compare with previous version](/PlasticDigits/cl8y-dex-terraclassic/-/merge_requests/366/diffs?diff_id=1967165970&start_sha=cb834f306929fd204dd0789191aba9fbdca7053a)
PlasticDigits (Migrated from gitlab.com) merged commit da133bd380 into main 2026-08-18 03:09:49 +00:00
PlasticDigits commented 2026-08-18 03:09:52 +00:00 (Migrated from gitlab.com)

mentioned in commit da133bd380

mentioned in commit da133bd38010537fb71eb98536da7d0283f25a9c
PlasticDigits commented 2026-08-18 03:11:22 +00:00 (Migrated from gitlab.com)

mentioned in issue #554

mentioned in issue #554
PlasticDigits commented 2026-08-18 03:11:23 +00:00 (Migrated from gitlab.com)

mentioned in issue #553

mentioned in issue #553
PlasticDigits commented 2026-08-18 03:11:25 +00:00 (Migrated from gitlab.com)

mentioned in issue #556

mentioned in issue #556
PlasticDigits commented 2026-08-18 03:11:27 +00:00 (Migrated from gitlab.com)

mentioned in issue #559

mentioned in issue #559
PlasticDigits commented 2026-08-18 03:11:34 +00:00 (Migrated from gitlab.com)

mentioned in issue #551

mentioned in issue #551
PlasticDigits commented 2026-08-18 03:12:09 +00:00 (Migrated from gitlab.com)

mentioned in issue #560

mentioned in issue #560
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
code/cl8y-dex-terraclassic!1084
No description provided.