fix(swarm): sync ROUTER_SWAP_OPS_MIN_GAS_PER_HOP to 950k (#353) #952

Merged
Brouie merged 1 commit from qa/353-swarm-gas-hop-sync into main 2026-06-29 00:07:06 +00:00
Brouie commented 2026-06-28 23:24:11 +00:00 (Migrated from gitlab.com)

Caught during the 8c56f4b8 backend re-baseline (#337). #353 bumped ROUTER_SWAP_OPS_MIN_GAS_PER_HOP 900k -> 950k on the frontend (2-hop router floor 1.81M -> 1.91M), but the swarm copy at packages/localnet-trading-swarm/src/gas.ts:29 stayed at 900k despite its // Keep in sync with ROUTER_SWAP_OPS_MIN_GAS_PER_HOP (#353) comment.

Effect: the swarm's gasLimitForRouterExecuteSwapOperations 2-hop floor is 1.80M (2 x 900k) vs the observed ~1.81M gas_used on 2-hop router swaps — i.e. the swarm can under-budget a 2-hop and OOG, the exact failure #353 fixed on the dapp.

This one-line bump brings it in line. Only this constant drifted — ROUTER_SINGLE_HOP_GAS_LIMIT (1.4M), SWAP_GAS_SAFETY_MARGIN (10k), and EXECUTE_SWAP_OPS_MIN_GAS_PER_HOP (661k) all still match constants.ts. Constant-only, no logic change.

Caught during the 8c56f4b8 backend re-baseline (#337). #353 bumped `ROUTER_SWAP_OPS_MIN_GAS_PER_HOP` 900k -> 950k on the frontend (2-hop router floor 1.81M -> 1.91M), but the swarm copy at `packages/localnet-trading-swarm/src/gas.ts:29` stayed at 900k despite its `// Keep in sync with ROUTER_SWAP_OPS_MIN_GAS_PER_HOP (#353)` comment. Effect: the swarm's `gasLimitForRouterExecuteSwapOperations` 2-hop floor is 1.80M (2 x 900k) vs the observed ~1.81M gas_used on 2-hop router swaps — i.e. the swarm can under-budget a 2-hop and OOG, the exact failure #353 fixed on the dapp. This one-line bump brings it in line. Only this constant drifted — `ROUTER_SINGLE_HOP_GAS_LIMIT` (1.4M), `SWAP_GAS_SAFETY_MARGIN` (10k), and `EXECUTE_SWAP_OPS_MIN_GAS_PER_HOP` (661k) all still match constants.ts. Constant-only, no logic change.
Brouie commented 2026-06-28 23:24:44 +00:00 (Migrated from gitlab.com)

mentioned in issue #337

mentioned in issue #337
PlasticDigits commented 2026-06-28 23:25:46 +00:00 (Migrated from gitlab.com)

Security review — MR !952

Commit reviewed: 1b3f6474284a2ca7d45c97d7**83259c164a9a06d
Scope: Single-line constant sync in packages/localnet-trading-swarm/src/gas.ts — ROUTER_SWAP_OPS_MIN_GAS_PER_HOP 900k → 950k to match frontend-dapp/src/utils/constants.ts (#353).

Outcome: FINDINGS: 0 medium+

Summary

Reviewed the diff and traced ROUTER_SWAP_OPS_MIN_GAS_PER_HOP through gasLimitForRouterExecuteSwapOperations → gasLimitForSwapOperationsMsg → getGasLimitForExecuteMsg → broadcast.ts fee estimation. No prior security-review threads on this MR.

This change raises the per-hop gas floor for multi-hop router execute_swap_operations estimates. It does not alter control flow, message parsing, auth, or on-chain contract logic. Attacker-controlled input does not reach this constant; the swarm derives hop count from its own constructed execute payloads.

Why no findings:

  • No injection / deserialization risk — only a numeric literal changes; no new parsing or external input handling.
  • No authn/authz impact — gas estimation is client-side fee math for swarm broadcasts; it does not gate contract permissions.
  • No fund-drain or partial-execution vector — Cosmos txs are atomic; under-budgeting (pre-fix) caused OOG reverts (availability for swarm bots), not exploitable state corruption. Increasing the floor adds at most ~50k × hops to the fee ceiling; actual fees remain gas_used × gas_price.
  • No secret leakage or logging changes.

Security review: no medium+ findings on this diff.

Inline threads: none (no findings).

## Security review — MR !952 **Commit reviewed:** `1b3f6474284a2ca7d45c97d7**83259c164a9a06d` **Scope:** Single-line constant sync in `packages/localnet-trading-swarm/src/gas.ts` — `ROUTER_SWAP_OPS_MIN_GAS_PER_HOP` 900k → 950k to match `frontend-dapp/src/utils/constants.ts` (#353). **Outcome:** `FINDINGS: 0` medium+ ### Summary Reviewed the diff and traced `ROUTER_SWAP_OPS_MIN_GAS_PER_HOP` through `gasLimitForRouterExecuteSwapOperations` → `gasLimitForSwapOperationsMsg` → `getGasLimitForExecuteMsg` → `broadcast.ts` fee estimation. No prior security-review threads on this MR. This change **raises** the per-hop gas floor for multi-hop router `execute_swap_operations` estimates. It does not alter control flow, message parsing, auth, or on-chain contract logic. Attacker-controlled input does not reach this constant; the swarm derives hop count from its own constructed execute payloads. **Why no findings:** - **No injection / deserialization risk** — only a numeric literal changes; no new parsing or external input handling. - **No authn/authz impact** — gas estimation is client-side fee math for swarm broadcasts; it does not gate contract permissions. - **No fund-drain or partial-execution vector** — Cosmos txs are atomic; under-budgeting (pre-fix) caused OOG reverts (availability for swarm bots), not exploitable state corruption. Increasing the floor adds at most ~50k × hops to the fee *ceiling*; actual fees remain `gas_used × gas_price`. - **No secret leakage or logging changes.** **Security review: no medium+ findings on this diff.** Inline threads: none (no findings).
PlasticDigits commented 2026-06-28 23:25:52 +00:00 (Migrated from gitlab.com)

Correction: commit reviewed is 1b3f6474284a2ca7d45c97d7c83259c164a9a06d (typo in prior note).

Correction: commit reviewed is `1b3f6474284a2ca7d45c97d7c83259c164a9a06d` (typo in prior note).
PlasticDigits commented 2026-06-29 00:07:06 +00:00 (Migrated from gitlab.com)

mentioned in commit 767dcd1e1d

mentioned in commit 767dcd1e1d125b21f18ace8409438e6886d8806b
PlasticDigits (Migrated from gitlab.com) merged commit 767dcd1e1d into main 2026-06-29 00:07:06 +00:00
Brouie commented 2026-06-29 07:59:03 +00:00 (Migrated from gitlab.com)

mentioned in merge request !953

mentioned in merge request !953
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
code/cl8y-dex-terraclassic!952
No description provided.