fix: Mint drip out of gas — add FAUCET_DRIP_GAS_LIMIT (soft-launch faucet) #474
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#474
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?
Bug report
Users on columbus-5 (
https://dex.cl8y.com/mint) report "Automatic gas sometimes fails" / "Actually all the time".Observed UI copy (wallet in-app browser, Terra Classic MAINNET):
This is the retail humanization of on-chain
out of gas(humanizeTerraTxError.ts). Mint shows Ready to mint / amount 100 / MINT CTA, then fails every attempt. Users still pay network fees for failed txs.Related: soft-launch faucet shipped in #473; identical failure class previously fixed for fee-discount
registerin #384.Current codebase
The dApp does not use LCD/wallet gas simulation for executes. “Automatic gas” means static per-message limits from
getGasLimitForTx×effectiveGasPriceUluna(), then an explicitFeeprotobuf withpreferNoSetFee: true.Mint execute path
MintPage.tsx→drip(wallet, token)faucet.ts→executeTerraContract(..., { drip: { token } })broadcastTerraExecuteContracts→estimateTerraClassicFeeForEntries→getGasLimitForTx(msg)→buildTerraClassicFeetryHumanizeTerraTxMessagemaps/out of gas/ito the user-facing string aboveRoot cause
getGasLimitForTxinterraGas.tshas no'drip' in executeMsgbranch. Faucet drip falls through to:On-chain, faucet
execute_drip(smartcontracts/contracts/faucet/src/contract.rs) does allowlist/cooldown storage plus a cross-contract CW20Mintsubmessage. That routinely needs > 200k gas (same pattern as fee-discountregistermeasured ~204k → fixed withREGISTER_FEE_DISCOUNT_GAS_LIMIT = 300_000in #384).Because the ceiling is fixed and too low, mint failure is deterministic (“all the time”), not intermittent block variance.
What is not the Mint failure
gasAdjustment: 1.75(stationNativeNetwork.ts)addNetworkonly — not dApp fee mathSWAP_GAS_BUFFER/ hybrid swap gasWhy a new implementation is needed
Soft-launch Mint is live on mainnet. Every drip attempt burns user LUNC and fails. #473 shipped the contract + page but never added a measured gas constant to the static envelope table (playbook
AGENTS_SOFT_LAUNCH_FAUCET.mdonly notes users pay gas). Without a dedicateddripmapping, Mint remains broken regardless of wallet (Keplr, Station in-app browser, simulated).Constraints / guardrails
terraClassicFeeEstimate.ts/ docs: no LCD simulate-before-broadcast as the primary fix).effectiveGasPriceUluna()floor (28.325 uluna/gas) — this bug is gas limit, not fee price.FAUCET_DRIP_GAS_LIMITfrom measuredgas_used+ ~20–30% margin (same discipline as #384). Prefer slightly over-allocating vs under (users pay more LUNC but tx succeeds).deployments/mainnet-soft-launch/faucet-trace.md).npm ci+ cosmes patch still required.Relevant files
frontend-dapp/src/services/terraclassic/terraGas.tsBASE_GAS_LIMIT,getGasLimitForTx— adddripbranchfrontend-dapp/src/services/terraclassic/faucet.ts{ drip: { token } }executefrontend-dapp/src/pages/MintPage.tsxfrontend-dapp/src/services/terraclassic/terraBroadcast.tsfrontend-dapp/src/services/terraclassic/terraClassicFeeEstimate.tsfrontend-dapp/src/utils/humanizeTerraTxError.tsfrontend-dapp/src/utils/constants.tssmartcontracts/contracts/faucet/src/contract.rsfrontend-dapp/src/services/terraclassic/__tests__/terraGas.feeDiscount.test.tsfrontend-dapp/src/services/terraclassic/__tests__/transactions.test.tsdocs/frontend.mdskills/AGENTS_TERRACLASSIC_GAS.mdskills/AGENTS_SOFT_LAUNCH_FAUCET.mdRecommended direction
FAUCET_DRIP_GAS_LIMIT(name bikeshed OK) interraGas.ts.'drip' in executeMsgingetGasLimitForTxbefore theBASE_GAS_LIMITfallback.drip, readgas_used, set constant to measured + margin. Starting guess until measured: 350k–400k (cross-contract mint + storage; register alone needed 300k).terraGas.faucet.test.tsor extend existing):getGasLimitForTx({ drip: … })≠ 200k and> measured.TerraClassicTxFeeHinton Mint (transparency for “you pay network gas”).docs/frontend.mdgas table + soft-launch faucet skill cross-link.make verify-issue-NNNscript patterned onscripts/qa/verify-issue-384.sh.Out of scope for this issue: full
getGasLimitForTxaudit of other retail msgs (separate follow-up); LCD simulate architecture; enabling mainnet fee guard (#429).Acceptance criteria
getGasLimitForTx({ drip: { token: 'terra1…' } })returns a dedicated constant > 200_000 and > measuredgas_usedwith documented margin.dripon columbus-5 from wallet in-app browser (and Keplr / simulated where available).gas_used < gas_wantedwith comfortable headroom.docs/frontend.md(and soft-launch faucet skill if needed) document the constant.Test plan (all paths)
TokenNotAllowed(or equivalent) — not OOGLAST_CLAIMwrite)FAUCET_DRIP_GAS_LIMIT× gas priceBASE_GAS_LIMIT(200k){ drip: { token } }FAUCET_DRIP_GAS_LIMITregister/deregister/ swap / hybridTest plan (attack / hack / abuse vectors)
dripwith huge/invalid token addressVerification criteria
Manual: open
/minton mainnet → select CORAL (or any mintable) → MINT → success toast / balance update; no “needed more gas than estimated.”marked as related to #473
marked as related to #384
marked as related to #475
mentioned in commit
d3e10ddb7bmentioned in merge request !1015
mentioned in issue #475
mentioned in commit
b598b37758