Fix: deploy-dex-local flat fees over-burn on terrad v4 (GitLab #292 followup) #315
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#315
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?
Current codebase
scripts/deploy-dex-local.shdefinesterrad_tx()with:Every deploy-phase transaction (factory instantiate, pair creates, treasury fund, router setup, token mints, liquidity seeds) pays a flat 500M uluna fee regardless of actual gas used.
On LocalTerra terrad v4 / SDK 0.53 (GitLab #292), minimum gas price is ~28.325 uluna/gas. With
--gas auto, actual gas wanted is typically far below 500M/28.325 — the script over-burns fees. Genesis test1 balance has drifted 1M → ~680k LUNC on repeated deploys.Treasury funding step
[9b.10]:Failures only WARN; deploy continues. Wrap E2E may fail later with opaque errors.
scripts/deploy-dex-local.shalready writesVITE_GAS_PRICE_ULUNA=28.325to.env.local(perskills/AGENTS_TERRACLASSIC_GAS.md) but does not use it for deploy txs.Follow-up: GitLab #292.
Why this is needed
Repeated local deploys drain the single test1 genesis account, eventually breaking
make deploy-local/ E2E / swarm funding mid-run. Silent treasury fund failure wastes ~15 min optimizer+deploy before wrap tests fail.Constraints / guardrails
docker exec … terradagainst pinned LocalTerra image (docs/localterra-sdk53.md).e2ejob ormake qa-verify-deploy.terrad_txhelper as single choke point.--gas-prices 28.325uluna(or query chain min) over flat--feeswhen using--gas auto.DEPLOY_GAS_PRICESfor future fee market changes.Relevant files
scripts/deploy-dex-local.sh(terrad_tx, treasury fund)packages/localnet-trading-swarm/src/funding.ts(also uses500000000uluna)docs/localterra-sdk53.md,skills/AGENTS_TERRACLASSIC_GAS.mdscripts/qa/verify-deploy.sh,skills/AGENTS_QA_DEPLOY_VERIFY.mdRecommended direction
--fees 500000000ulunawith--gas-prices ${DEPLOY_GAS_PRICES:-28.325uluna}interrad_tx.code != 0, print tx log andexit 1.packages/localnet-trading-swarm/src/funding.tsfee pattern.Acceptance criteria
make deploy-local/ CI e2e path unchanged functionally.Test plan (all paths)
make start && bash scripts/deploy-dex-local.shDEPLOY_GAS_PRICES=28.325ulunaAttack / abuse / hack vectors
--gas auto+ min gas prices preventsVerification criteria
make qa-verify-deploypasses after deploy.marked as related to #292
mentioned in merge request !772
Bundled this with #318 since both live in the deploy path.
Checked live: a tx now pays ~5,155,150 uluna (gas_wanted 182000 × 28.325) vs the old flat 500,000,000 — about 97% less per tx, which is what was draining test1 across repeated deploys.
Branch qa/318-315-deploy-fee-gas, commit
f5747ed, MR !772. @PlasticDigitsmentioned in issue #318
mentioned in commit
019ded61e2mentioned in issue #325
Verification report — GitLab #315
Issue: Fix: deploy-dex-local flat fees over-burn on terrad v4 (#292 followup)
Implementation: Merged via !772 (
fix(deploy): attach pair-creation fee + gas-prices on local deploy (#318, #315)). Verified onmain@1c4ad92.Acceptance criteria
./scripts/setup-cloud-agent-localterra.sh --no-indexer) completed; 237 txs loggedgas estimate. Per-tx fee on-chain: 5,155,150 uluna (gas182k × 28.325) vs old flat 500,000,000 (99% less gas per tx). Hypothetical flat total: 118.5B uluna; estimated gas-prices total: ~1.22B uluna.grep 'ERROR: Treasury fund tx failed' scripts/deploy-dex-local.sh— exits 1 + printsraw_log. NoWARNING: Treasury fund tx may have failedremains. Insufficient-funds bank send fails atterrad_tx(set -e) before silent continue.make deploy-local/ CI e2e path unchanged functionallymake qa-verify-deployandmake test-qa-verify-deployOK after deploy. Repeat deploy withDEPLOY_GAS_PRICES=28.325ulunacompleted end-to-end.packages/localnet-trading-swarm/src/funding.tsusesprocess.env.DEPLOY_GAS_PRICES ?? '28.325uluna'.npm run test:runin swarm package: 14/14 tests passed.Test plan
/tmp/setup-localterra.log—EXIT=0, Phase 6.3 stamp writtenDEPLOY_GAS_PRICES=28.325uluna bash scripts/deploy-dex-local.shsucceeded; treasury funded line presentDEPLOY_GAS_PRICESAdditional checks
bash -n scripts/deploy-dex-local.sh— PASSterrad_txchoke point uses--gas-prices "${DEPLOY_GAS_PRICES:-28.325uluna}"— PASS[9b.10]— PASSmake qa-verify-deployafter both deploys — PASSNotes
DEPLOY_GAS_PRICESis implemented in deploy + swarm code; optional doc cross-link indocs/localterra-sdk53.md/skills/AGENTS_TERRACLASSIC_GAS.mdwas not required for functional acceptance.Verifier: Cursor Cloud Agent (
agent:verifyautomation)