Enforce net swap and AutoLP issuance floors with bounded hook work (#1398) #1425
No reviewers
Labels
No labels
agent:fix_bugfix
agent:fix_conflicts
agent:fix_security
agent:gap_analysis
agent:implement
agent:implement
agent:implement
agent:open_issues
agent:ready
agent:research
agent:security_audit
agent:verify
architecture
backend
blocker:hybrid
blocker:launch
blocker:limit-orders
blocker:v2
block:log_only
block:security
bug
ci
contracts
correctness
deploy
dev
devops
docs
documentation
duplicate
e2e
enhancement
epic
feature
frontend
functional-completion
gas
good first issue
governance
help wanted
high-risk
hooks
hybrid
indexer
infra
infrastructure
integrators
invalid
launch-blocker
limit-orders
localnet
localterra
low priority
missing-implementation
needs-design
ops
performance
priority
high
priority
medium
product
qa
QA
question
ready
ready
research
scripts
security
security-hardening
smartcontracts
tech-debt
testing
ux
UX
v2
verification
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
code/cl8y-dex-terraclassic!1425
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/issue-1398-net-floors"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Hook deductions could reduce swap receipts below pre-hook price protection, hook lists had no admission cap, and AutoLP provided balances without an issuance floor. This implements the source remediation for #1398.
Pair execution now requires a positive signed net
min_returnwhenever hooks are registered, while retaining the existing marketmax_spreadcalculation. Forward quotes share fail-closed tax/burn/LP-hook pricing with settlement; output-deducting hook reverse quotes explicitly error. Swap and Trade sign fresh direct-pool and hybrid net floors, preserving stronger reverse receive targets. Hook lists admit at most eight unique addresses; invalid legacy lists require explicit governance replacement.AutoLP stores manager-approved reserves/share economics at pair binding, carries swap/LP/ratio bounds through replies, and checks the LP recipient's actual balance increase before unlocking. Failed swaps/provides/mints roll back balances, allowances, treasury payments, LP supply and state. Modular pricing and LP-policy helpers keep the guards shared and testable.
Pair 1.21.0, factory 1.12.0, router 1.4.0 and AutoLP 1.1.0 distinguish these changes. Router accounting explicitly recognizes the reviewed pair version while preserving the 33-per-hop/96-per-request ceilings and opaque future-version handling. Legacy AutoLP needs an initialized pool and explicit rebind by its actual manager; token-owned legacy managers need a separate authorized refresh path.
Issue acceptance, verified in source and synthetic tests:
Validation on commit
33ede534:CONTRACTS_CARGO_HOME=/tmp/cl8y-1398-cargo-home CARGO_NET_OFFLINE=true make verify-issue-1398: 7 PASS, 0 FAIL, 0 SKIP in source scope; 977 workspace tests, 61 focused contract checks per pass, and 167 frontend tests per pass, with focused retest.make verify-issue-1390andmake verify-issue-1389passed with explicit infrastructure skips.make verify-issue-1376passed including all 14 Playwright receive-lifecycle smoke tests. The cleanmake verify-issue-1381rerun completed 10 PASS, 0 FAIL, 4 SKIP, validating full contract/route regressions with the same documented infrastructure skips.Agent review instructions and invariants:
make verify-issue-1398, review the concrete balance/escrow/supply assertions, and retest after fixes.Unverified scope: