Skip to content

fix(sdk-coin-ton): validate TON send mode semantics - #9806

Draft
ralph-bitgo[bot] wants to merge 2 commits into
masterfrom
wcn-1888-ton-verifier-guard
Draft

ralph-bitgo[bot] wants to merge 2 commits into
masterfrom
wcn-1888-ton-verifier-guard

Conversation

@ralph-bitgo

@ralph-bitgo ralph-bitgo Bot commented Sep 24, 2026 •

Copy link
Copy Markdown

What

  • Validate every parsed send action before producing native or jetton outputs; only exact, non-destructive mode 3 is accepted.
  • Use nominalAmount for native outputs with the semantic parser contract, while retaining a strict mode-3-only read of amount for the currently pinned @bitgo/wasm-ton 1.1.1 API.
  • Add mode-3 native/jetton regressions and reject mode-128/160 jetton actions, contradictory carry flags, destruction markers, and dangerous later actions.

Why

  • The tton verifier checks only explained outputs against recipients. Without inspecting each action's send-mode semantics, a jetton transfer can otherwise carry the wallet's remaining TON balance or destroy an emptied account while appearing to match the token amount.
  • This companion guard consumes the parser-side semantics from BitGoWASM PR #404. The parser-only PR should remain marked partial until this verifier change is merged.

Test plan

  • Focused WASM explanation tests (13 passing)
  • TON package formatting and lint
  • Scoped Lerna build for TON and its dependencies
  • BitGoJS CI: full unit-test matrix passed on Node 22, 24, and 26, plus browser tests

Local full-suite execution was blocked by the unavailable BITGOJS_TEST_PASSWORD; CI ran the full suite successfully.

Ticket: WCN-1888

Guard every parsed action before extracting native or jetton outputs.\nUse nominalAmount for the new parser contract and keep a strict mode-3\ncompatibility read for the pinned 1.1.1 package.\n\nThis prevents recipient amount checks from approving balance-carrying\nor account-destroying TON sends.\n\nTicket: WCN-1888

Session-Id: c3c1a2b6-ca94-47c4-81d9-b16cf4920171
Task-Id: aec26d89-87b2-4383-8624-e3f7972c32e7
Cover carry-inbound and carry-all flags that conflict with an\notherwise exact mode, alongside conditional account destruction.\n\nThese divergences must fail closed before recipient output checks.\n\nTicket: WCN-1888

Session-Id: c3c1a2b6-ca94-47c4-81d9-b16cf4920171
Task-Id: aec26d89-87b2-4383-8624-e3f7972c32e7
@ralph-bitgo
ralph-bitgo Bot force-pushed the wcn-1888-ton-verifier-guard branch from 49ea3e5 to 7c96963 Compare September 24, 2026 03:33
@linear-code

linear-code Bot commented Sep 24, 2026

Copy link
Copy Markdown
Contributor

WCN-1888

@github-actions

github-actions Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ Unit tests are failing on Node 26.x (Current release line, non-blocking). This is not an LTS version yet, so it does not block merge, but it signals an incompatibility to fix before Node 26.x becomes LTS.

View run

@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

This PR is stale because it has been open 45 days with no activity. Remove stale label or comment or this will be closed in 10 days.

@github-actions github-actions Bot added the stale label Nov 9, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant