Raise router multi-hop gas floor to 950k/hop — 2-hop still OOGs at 1,810,000 (#353 reopen) #869
No reviewers
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!869
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "qa/353-2hop-router-gas-floor"
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?
#353 closed having fixed the wrap half, but the 2-hop half never got its gas floor raised — it's still deterministically out-of-gas at HEAD (
8408689).Live on-chain evidence (EMBER->JADE->RUBY, dapp Expert Mode, today):
Root cause:
gasLimitForRouterExecuteSwapOperations(2)=ROUTER_SWAP_OPS_MIN_GAS_PER_HOP (900,000) × 2 + SWAP_GAS_SAFETY_MARGIN (10,000)= exactly 1,810,000 — the same number the swaps need, zero headroom, so it tips over every time. The existing 2-hop test only guarded> 1,718,000(stale), so it never caught the knife-edge.Fix: raise the per-hop floor to 950,000 → 2-hop 1,910,000 (~100k / 5.5% headroom over the worst observed 1,810,206), 3-hop 2,860,000. Single-hop (
ROUTER_SINGLE_HOP_GAS_LIMIT1.4M) and direct-pairswappaths are untouched. Updated the 2-hop/3-hop assertions and re-floored the regression guard above the live observed 1,810,206 so it actually catches this class now.transactions.test.ts 51/51. Change is constant + test only.
Note: this MR does not address the separate, pre-existing tsc-only errors in terraTxHash.ts / terraWalletSignTxRaw.ts that a fresh-cache
npm run buildsurfaces on main — flagging that separately.Security review
Commit reviewed:
6afad1657c166a6e4942b13889b7db9e7845d61bScope:
frontend-dapp/src/utils/constants.ts(ROUTER_SWAP_OPS_MIN_GAS_PER_HOP900k → 950k) and matching assertions intransactions.test.ts.Method: Diff review plus trace of
gasLimitForRouterExecuteSwapOperations→getGasLimitForTx→buildTerraClassicFee/ broadcast. No prior security-review threads on this MR.Outcome: FINDINGS: 0 medium+
This change only raises the client-side multi-hop router gas floor so 2-hop
execute_swap_operationsgrants headroom above live observed usage (~1.81M). Single-hop (ROUTER_SINGLE_HOP_GAS_LIMIT) and direct-pairswappaths are unchanged. Hop count still derives from the signedoperationsarray length (pre-existing); no new attacker-controlled sinks, authn/authz changes, injection surfaces, secret handling, or dependency changes.Raising
gas_wantedincreases the fee quote users sign when the per-hop floor binds (~100k gas/hop); that is intentional reliability headroom, not an exploitable mis-estimation vector in this diff.Inline threads: none (no medium+ findings).
block:securitynot applied.mentioned in issue #353
mentioned in issue #337
mentioned in issue #370
approved this merge request
mentioned in commit
c492682376