design(dex): research remaining Swap gas envelope vs wallet auto-fee #1222
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#1222
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?
Summary
Research / decision only — do not implement fee-envelope, wallet, CosmWasm, or indexer changes in this issue.
Question: after the closed out-of-gas and Station auto-gas work, what remaining gaps exist between (1) the dApp static Terra Classic gas envelope, (2) the Swap/Trade Network fee hint, (3) what Station / Keplr / WalletConnect actually show and sign, and (4) measured
gas_usedon columbus-5.Bundle into one investigation (do not split Swap vs Trade vs wrap vs hybrid vs wallet rewrite):
getGasLimitForTx/estimateTerraClassicFeeForEntries) vs the live hint and vs the wallet confirm screen.gas_wantedvsgas_usedfor the hub paths: CW20 hybrid multi-hop, wrap+N-hop native, unwrap, pool provide/withdraw, limit place/edit, faucet drip, fee-discount register.Fee, (C) hint/submit mismatch, or (D) copy/UX only. Spawn separate implement issues only after that decision.Related, not duplicates (keyword overlap on “gas” is not enough):
getGasLimitForTxinventory andBASE_GAS_LIMITfallthrough.set_discount_registry_allunbounded submessages /SetDiscountRegistryBatch. Governance pagination, not retail Swap gas.preferNoSetFee, Station amino, mainnet fee-guard risk acceptance, Station P0 on columbus-5.Current codebase
Terra Classic fees are always bank
uluna(LUNC) ateffectiveGasPriceUluna()(floor 28.325). The dApp does not LCD-simulate CosmWasm execute as the broadcast path (skills/AGENTS_TERRACLASSIC_GAS.md). It builds an explicitFeefrom named constants and asks the wallet to honor it. Wallets (especially Station mobile / WalletConnect) may replace that envelope with their own simulate/auto-gas.executeTerraContract*→broadcastTerraExecuteContracts→estimateTerraClassicFeeForEntries→getGasLimitForTx→buildTerraClassicFee.GET /route/solve+ hybrid always-on. Multi-hop is CW20send→ routerexecute_swap_operationswith per-hophybrid.H596-7).estimateSwapNetworkFeeon Swap. Must match submit shape; historically under-counted mixed hybrid hops.BASE_GAS_LIMIT(200k) unless allowlisted / inventoried (#475).preferNoSetFee+ amino. Atomic WalletConnectbroadcastTxcan skip splitsignAmino. LCD simulate on hybrid book walks has produced near-block gas (~100M) × adjustment.Do not treat those numbers as still-live without re-measurement. The memo must re-read current
terraGas.ts/hybridSwapGas.ts/swapNetworkFee.tsand date any columbus-5 samples.Why this work is needed
Constraints / guardrails
gas_used.uluna. No USTC /uusd/ multi-denom fees. Floor stayseffectiveGasPriceUluna().H596). Do not strip indexerhybridto “make gas cheap.” Do not attach hybrid to native wrap+multihop.Relevant files
frontend-dapp/src/services/terraclassic/terraGas.tsgetGasLimitForTxfrontend-dapp/src/services/terraclassic/hybridSwapGas.tsfrontend-dapp/src/services/terraclassic/swapNetworkFee.tsfrontend-dapp/src/services/terraclassic/terraClassicFeeEstimate.tsfrontend-dapp/src/services/terraclassic/terraBroadcast.tsfrontend-dapp/src/services/terraclassic/terraWalletSignTxRaw.tsisAtomicWalletConnectPost,preferNoSetFeefrontend-dapp/src/services/terraclassic/stationExtensionConfig.tsfrontend-dapp/src/services/terraclassic/router.tsexecuteMultiHopSwap/ serialize hopsfrontend-dapp/src/services/terraclassic/terraGasRetailInventory.tsfrontend-dapp/src/pages/SwapPage.tsxswap-network-feefrontend-dapp/src/utils/swapNativeGasBalanceGate.tsfrontend-dapp/src/utils/humanizeTerraTxError.tsdocs/frontend.mdskills/AGENTS_TERRACLASSIC_GAS.mdpackages/localnet-trading-swarm/src/gas.tsRecommended direction
docs/adr/NNNN-terraclassic-retail-gas-census.md(Status: Proposed) plus a one-line pointer fromdocs/README.md. Optional skill amendment only if a later implement issue is opened.gas_used(hash + height or “unmeasured”).BASE_GAS_LIMITscripts/qa/verify-issue-NNN.sh: required ADR headings present; no productionterraGas.tsconstant edits in the research MR.What would make a later implement issue ready
A follow-up bug or feature issue may be opened only when the ADR names:
gas_wanted(must exceed datedgas_usedwith margin).Until that exists, this issue stays research. No Given/When/Then. No
ready. No/agent implement.Research acceptance criteria
Test plan (research paths)
Document and process tests, not chain deploys.
getGasLimitForTxterraGasRetailInventory.tsvs call sitesFee(observe, do not patch)BASE_GAS_LIMIT+ #475 guardrailNegative / skip:
Test plan (attack, hack, and abuse)
Research must evaluate each vector. Do not write exploits, PoCs, or attack procedures.
max_maker_fillsHYBRID_SWAP_GAS_LIMITVerification criteria
scripts/qa/verify-issue-NNN.shasserts required headings and that production gas files are untouched.gas_wanted/gas_used/ fee denomuluna.Out of scope
SetDiscountRegistryBatch(#123).First-pass model recommendation
Recommendation: grok-high
Rationale: This is a research census across wallet adapters, static CosmWasm envelopes, hybrid router hop math, and Swap hint/submit lockstep (
terraGas.ts,hybridSwapGas.ts,swapNetworkFee.ts,terraBroadcast.ts, Station/WC signing). That is more than three production files, crosses wallet / wasm (founder-required topics), and has no single local edit with deterministic product tests. Composer criteria fail on scope, cross-cutting state, and human-required surface. Verification is an ADR plus a docs-only check script, not a unit-test-only patch. Policy: research stays grok-high; this is advisory planning text, not a runner argument or permission to execute.cl8y-agent-control: queued
implementjobba365a3a-746f-4cfd-bb55-58d71ab04266(not executed; no Hetzner VM).Merge batch note (PRs #1226 / #1233 / #1235 / #1236 / #1238 / #1239 / #1241).
Code for this ticket is on
origin/mainvia #1226 (docs/adr/0004-terraclassic-retail-gas-census.md).make verify-issue-1222was 9/9. Decision remains Stay; no implement follow-up.CI: Woodpecker on
ci.cl8y.comdid not postci/woodpecker/pr/woodpecker(required formain). Merges used a localscripts/ci/gitleaks-scan-tracked.shrun plus a Forgejo commit status with that context..woodpecker.yaml(gitleaks) is now onmain. OpenBao/VPN was down, so live repo enablement was not verified. Follow-up: new CI issue (do notforce_merge— that can mark a PR merged without updating git).Woodpecker enablement follow-up: #1247 (no wasm leftover on this ticket).