LAUNCH-BLOCKER: Swap transactions fail with 'out of gas' — gas estimate too low for wasm contract execution #115
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#115
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?
Found during #114 Visual UX verification (Section B — pool-only swap happy path) on fresh LocalTerra stack + latest main.
Repro
cd frontend-dapp && npm run devObserved
Transaction fails on-chain with:
Overshoot: ~43,000 gas units beyond estimate.
Why launch-blocker
Every pool swap will fail with this pattern — gas estimator is consistently under-provisioning by ~6% vs actual consumption for a simple pool-only swap. This is:
Proposed fix scope
Screenshots
Happy path quote (pre-submit) and failure toast attached via web UI.
cc @PlasticDigits urgent — blocks DEX launch
mentioned in issue #114
@brouie Could you re-verify on LocalTerra + Station when you have a moment?
What changed
ac9338e`): Raised `SWAP_GAS_BUFFER` from 1.1 → 1.2 in `frontend-dapp/src/utils/constants.ts`, so single-hop pool-only `gasWanted` is 770,000 (still below hybrid floors where applicable).Verification checklist
Issue left open until you confirm. Thanks!
mentioned in issue #127
mentioned in issue #133
mentioned in issue #121
mentioned in commit
80a69f321d#115 follow-up — swap gas buffer aligned with
terrad --gas-adjustment 1.3Earlier mitigation (buffer 1.1 → 1.2, ~770k
gas_wantedsingle-hop) addressed the repro where 753,321gas_usedexceeded 710,000 wanted. This change tightens alignment with how we operate the chain in scripts:SWAP_GAS_BUFFER= 1.3 infrontend-dapp/src/utils/constants.ts→ single-hop pool-onlyexecute_swap_operationsgas_wanted= 830,000 (formula unchanged; seedocs/frontend.md§ Terra Classic gas limits).packages/localnet-trading-swarm/src/gas.ts— same buffer so scripted LocalTerra swaps match wallet broadcasts (documented in swarmREADME.md+skills/AGENTS_LOCALNET_TRADING_SWARM.md).frontend-dapp/src/services/terraclassic/__tests__/transactions.test.tsupdated;npm ci+vitest --run …/transactions.test.tspasses;packages/localnet-trading-swarmnpm run test:runpasses.skills/AGENTS_TERRACLASSIC_GAS.md,docs/README.mdcrosslinks refreshed.main:80a69f3Other issues on
main(brief verification)effectiveGasPriceUluna, limit gates vsgasLimitForExecuteSwapOperations). No merge conflict with this buffer change.Checklist for @brouie (please re-verify; leaving issue open until you confirm):
frontend-dappdev server, Station wallet, Swap default pair EMBER → CORAL, amount 10 EMBER, 1% slippageout of gas); optional: notegas_wantedvsgas_usedin explorerThanks — tagging @brouie for verification.
@PlasticDigits @totdking — picking up verification on this. since totdking is now driving DEX visual QA, tagging him for the on-stack repro since he likely has the LocalTerra + Station setup running already. happy to walk it myself next time I have the DEX stack up if it makes more sense.
totdking — when you get a moment: fresh LocalTerra + DEX, frontend swap default EMBER → CORAL, 10 EMBER amount, 1% slippage. on commit
80a69f3the buffer is 1.3 so single-hopgas_wantedshould be ~830k. confirm tx lands without out-of-gas, ideally note gas_wanted vs gas_used from the explorer.mentioned in issue #134
mentioned in commit
3f6a2e5680Verified on LocalTerra stack (commit
3f6a2e5):Root cause (follow-up): After SWAP_GAS_BUFFER=1.3, single-hop
gasWantedwas exactly 830,000 but on-chaingasUsedwas 830,102 (and up to 830,162 on retry) — failing by ~100 gas at the formula ceiling.Fix: Added
SWAP_GAS_SAFETY_MARGIN = 10_000togasLimitForExecuteSwapOperations(dApp + localnet-trading-swarm). Single-hop pool-only swap now broadcasts with 840,000gas_wanted.Verification (browser MCP, Simulated Wallet, EMBER→CORAL, 10 EMBER):
code=0,gas_wanted=840000,gas_used=449963)transactions.test.ts,extensionSignedFeeGuard.test.tspassClosing #115.
mentioned in issue #206
mentioned in issue #249
mentioned in issue #252
mentioned in issue #372
mentioned in merge request !886
mentioned in merge request !894
mentioned in issue #475
mentioned in issue #587
mentioned in issue #621