fix(community-tax): SendFrom listed-pair Sell extra-debits beyond allowance #1233

Merged
PlasticDigits merged 2 commits from issue/1228 into main 2026-09-12 02:42:02 +00:00

Summary

  • execute_send_from classifies via tax::preview before deduct_allowance, then deducts TaxPreview.debit (pair-direct listed-pair Sell = amount + tax, T592-2 / A-allow).
  • Allowance equal to declared amount (or debit - 1) reverts before balances move. TransferFrom still deducts amount only (T592-7). Pair/router/factory wasm unchanged (H-01).
  • Multitest + make verify-issue-1228. Live 11611 / 11619 still need a later store+migrate (ops, not this PR).

Fixes #1228

Acceptance

  • AC1. Listed-pair SendFrom+Swap with allowance == declared amount reverts; no owner debit, no pair credit, no sink credit, allowance unchanged.
  • AC2. Same call with allowance == TaxPreview.debit succeeds; owner −debit, pair +amount, sinks +tax, remaining allowance 0.
  • AC3. SendFrom cannot skip sell tax (same extra-debit as owner Send for pair-direct).
  • AC4. TransferFrom to the listed pair (no Swap hook) remains 1:1; allowance decreases by amount only.
  • AC5. Unregistered pair / Honest path: SendFrom debit = amount; allowance = amount.
  • AC6. Pair-direct spoofed trader does not move the victim; owner is extra-debited (T592-13).
  • AC7. Manager-directory / manager-role skip: no extra-debit; allowance = amount.
  • AC8. Docs/skills: T592-2 states SendFrom allowance covers economic debit. No pair/router math change.
  • AC9. Existing sell_extra_debit_on_swap_send / greedy extra-debit tests stay green.

Test plan

  • cargo test -p cl8y-community-tax-token (crate suite)
  • make verify-issue-1228 (first pass + retest)
  • Reviewer: confirm execute_send_from deducts preview.debit and execute_transfer_from still deducts amount
  • Reviewer: pair/router/factory paths have empty diff
  • Ops follow-up (not this PR): store + migrate listed 11611 / 11619
## Summary - `execute_send_from` classifies via `tax::preview` **before** `deduct_allowance`, then deducts `TaxPreview.debit` (pair-direct listed-pair Sell = `amount + tax`, **T592-2** / **A-allow**). - Allowance equal to declared `amount` (or `debit - 1`) **reverts** before balances move. `TransferFrom` still deducts `amount` only (**T592-7**). Pair/router/factory wasm unchanged (**H-01**). - Multitest + `make verify-issue-1228`. Live **11611** / **11619** still need a later store+migrate (ops, not this PR). Fixes #1228 ## Acceptance - [x] AC1. Listed-pair `SendFrom+Swap` with allowance == declared `amount` reverts; no owner debit, no pair credit, no sink credit, allowance unchanged. - [x] AC2. Same call with allowance == `TaxPreview.debit` succeeds; owner −debit, pair +`amount`, sinks +tax, remaining allowance 0. - [x] AC3. `SendFrom` cannot skip sell tax (same extra-debit as owner `Send` for pair-direct). - [x] AC4. `TransferFrom` to the listed pair (no Swap hook) remains 1:1; allowance decreases by `amount` only. - [x] AC5. Unregistered pair / Honest path: `SendFrom` debit = `amount`; allowance = `amount`. - [x] AC6. Pair-direct spoofed `trader` does not move the victim; owner is extra-debited (**T592-13**). - [x] AC7. Manager-directory / manager-role skip: no extra-debit; allowance = `amount`. - [x] AC8. Docs/skills: **T592-2** states SendFrom allowance covers economic debit. No pair/router math change. - [x] AC9. Existing `sell_extra_debit_on_swap_send` / greedy extra-debit tests stay green. ## Test plan - [x] `cargo test -p cl8y-community-tax-token` (crate suite) - [x] `make verify-issue-1228` (first pass + retest) - [ ] Reviewer: confirm `execute_send_from` deducts `preview.debit` and `execute_transfer_from` still deducts `amount` - [ ] Reviewer: pair/router/factory paths have empty diff - [ ] Ops follow-up (not this PR): store + migrate listed **11611** / **11619**
Pair-direct listed-pair SendFrom extra-debits amount+tax (T592-2) but
used to consume only declared amount from allowance. Classify first and
deduct the economic debit so insufficient allowance fail-closes.
Pre-commit clippy on rustc 1.88 flags historical uninlined_format_args
in pair/dex-common; allow that style lint rather than touching pair wasm.
Author
Owner

drain skip: hard-blocked (needs-human / high-risk / human topic); remaining continue

drain skip: hard-blocked (needs-human / high-risk / human topic); remaining continue
Merge origin/main into issue/1228 for PR #1233
All checks were successful
ci/woodpecker/pr/woodpecker gitleaks tracked-tree scan passed locally
61756c2112
PlasticDigits deleted branch issue/1228 2026-09-12 02:42:02 +00:00
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!1233
No description provided.