test: tax-aware localnet swarm workers (exclude gems from extra-debit) #621
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#621
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Parent / siblings
Depends on the LocalTerra community-tax seed + funding + indexer env issue (deploy must create a registered tax/EMBER pair and Transfer-fund it). Parent product: #592 T592-2/3/13, #607, #119, #293.
Do not reopen swarm liquidity (#293) unless OE-1 gem hub checks regress.
Current codebase
Two localnet-only bot layers enumerate all factory pairs and treat every CW20
Sendas 1:1:TypeScript
@cl8y-dex/localnet-trading-swarm:factoryTokens.ts— paginatepairs, unique CW20s for funding + graph.funding.ts—Mintevery CW20 (sibling issue adds Transfer for tax).actions.ts—pair_swap/hybrid_swap/limit_order/ LP usepickOfferAmount(slice of reserves) as theSend.amount. Pair-directswapleavestraderunset.router_multihopSends to the router withexecute_swap_operationsand no tax headroom.profiles.json— five Poisson ~20s profiles; no tax worker.localterra(validateLocalnet.ts).Python
scripts/bots/swarm.py+launch-swarm.sh:--from test1._iter_factory_pairs→swap_cw20_send/place_limit_cw20_send/provide_liquiditywith reserve-fraction amounts.EMBER/CORAL,TOPAZ/ONYX,ONYX/CORAL).Neither layer queries
TaxPreview, sizesamount + sell_bps, or sets official-routerSwap.trader. After the seed issue lands, random walks will pick the tax pair and revert (underfunded extra-debit) or mis-account buys.Why this is needed
The swarm is how QA generates tape, book, LP churn, and indexer load for “most CW20s.” A listed tax token is not an honest mintable gem: sell extra-debits the trader; official-router hops extra-debit authenticated
trader(T592-13); place-limitSendstays 1:1 (T592-7). Dumping the pair into the naive random walk either fails loudly or silently skips after errors, so the tax market never gets volume. Dedicated workers are the only way to exercise the same action set (swap / router / hybrid / limit / LP) correctly.Constraints / guardrails
VITE_NETWORK=localguards stay.--worker tax) must:TaxPreview(oramount * (1 + sell_bps/10000)fail-closed if preview missing).balance ≥ debitbefore broadcast.from; do not spooftrader.Swap.traderonly whenSendis toconfig.router(T592-13). Pair-direct must ignore spoofedtrader.pool_onlysymmetry checks until quotes are net-of-tax (#293). Hub gems stay the OE-1 target.test1(Python) + five TS wallets: extra-debit + gas must not drain below #372 soak floor. Prefer Transfer top-up from deploy funding, not Mint.SWAP_GAS_BUFFER(#115). Router+tax may need the same hop padding, not a new FoT gas model.Relevant files
packages/localnet-trading-swarm/src/actions.tspackages/localnet-trading-swarm/src/factoryTokens.tspackages/localnet-trading-swarm/src/funding.tspackages/localnet-trading-swarm/src/profiles.jsonpackages/localnet-trading-swarm/src/liquidityGuards.tspackages/localnet-trading-swarm/README.mdscripts/bots/swarm.pyscripts/bots/launch-swarm.shscripts/bots/bootstrap-swarm-liquidity.pyskills/AGENTS_LOCALNET_TRADING_SWARM.mdskills/AGENTS_COMMUNITY_TAX_ROUTER.mdRecommended direction
VITE_TOKEN_COMMUNITY_TAX_ADDRESSand/or LCDGetConfig/GetLauncherOriginon a CW20.randomCw20PairEndpoints/randomLiquidPairfor existing profiles. Add profiletax_listed(or envSWARM_TAX_WORKERS=1) that only acts on the tax/EMBER pair + one official-router ≥2hop that includes the tax token.Sendswap:tax_preview { from, to: pair or router, amount, send_msg }; use previewdebitfor balance gate;Send.amountstays the economic swap amount (pair still creditsamount)._collect_pair_metasfor swap/lp workers; add--worker taxstarted fromlaunch-swarm.sh(one process is enough). Limit workers may include the tax token (1:1 place).tax_debit,tax_credit,bps,path=pair|routerso QA can grep extra-debit vs 1:1.tradernot set on pair-direct.Acceptance criteria
make swarm-local/make swarm-launchstart without Mint errors and without a storm of insufficient-funds on the tax pair.traderset.tax_hybrid_skip(do not broadcast a 1:1-sized hybrid sell).--dry-runstill validates localterra + factory including the tax pair.npm run test:runin the TS package andmake test-swarm-liquiditystay green.AGENTS_LOCALNET_TRADING_SWARM.mddocument exclude + tax workers.Test plan (all paths)
--dry-run— tax pair visible, no broadcast.tax_listedactions; gem profiles have no tax offer token.launch-swarm.sh— tax worker txs included; swap workers skip tax pair; limit worker may place on tax/EMBER.TaxPreview.debit; pair credit ==amount.traderwallet, not the router’s CW20 inventory (T592-13).TransferFrom1:1.MIN_RESERVE_PER_SIDE).SWARM_TAX_WORKERS=0— exclude only; no tax volume (escape hatch).Test plan (attack / hack / abuse)
Send+Swapwith spoofedtrader(another wallet)fromonly. Bots must not settraderon pair-directtradertraderSend.amount= wallet balance (no tax headroom)SendEMBER→CORALvsCORAL→EMBERincludes tax hopstest1via 500 bps extra-debit all daypreflight-test1-uluna.shstill warnsVerification
marked as related to #620
marked as related to #119
marked as related to #293
marked as related to #592
marked as related to #607
mentioned in issue #620
marked as related to #622
marked as related to #623
mentioned in issue #624
mentioned in commit
68db92b778mentioned in merge request !1133
mentioned in commit
3ca5f62887mentioned in commit
77df08f4c2mentioned in commit
5f683cfe9fMerge note (!1133)
Merged to
mainas !1133 (3ca5f628). Did not wait for CI; GitLab jobs failed withci_quota_exceeded(not a code defect).Sanity on this tip
make verify-issue-6219/9 on mergedmain(01cd541b): docs, TS/Python static + units (50 TS / 20 Python), and live--dry-runagainst the running LocalTerra. Dry-run emittedkind: swarm_taxwithtaxWorkers: trueand saw the #620 seed pairterra1zmh0…cp2t8.Remaining (do not reopen this ticket)
Acceptance that still needs a clean #620 seed deploy (this VM’s factory also lists leftover ephemeral tax pairs from #623):
tax_listedsell extra-debit / buy split / routertrader/ provide 1:1 / limit 1:1 /tax_hybrid_skipmake swarm-launchthenmake swarm-stop—tax-0txs; gem swap/LP skip tax;SWARM_TAX_WORKERS=0exclude-onlymake verify-issue-293— gem hub OE-1 stillpool_only(do not add tax/EMBER)Tracked on the new post-merge issue for !1133–!1135.
mentioned in issue #622
mentioned in issue #623
mentioned in issue #625
marked as related to #625