ton-tvm
This note records the first ProofForge classification for TON smart contracts.
It does not add a Lean target profile yet.
Primary sources:
- Smart contracts overview
- Tolk language
- TVM overview
- TVM gas
- Get methods
- Messages overview
- Account status
- Execution phases
- Transaction fees
- Blockchain sharding
Classification
TON should not be treated as a Wasm-host target. The first classification should be a TVM source/package-generation target.Why This Matters For ProofForge
ProofForge should not model TON like EVM, Wasm, Move, or Solana. The target differences are not cosmetic:- contract state is serialized into cells, not slots or account resources;
- entrypoints are message handlers and get methods, not ordinary method calls;
- inbound messages may be internal or external and carry TON-specific bodies, values, bounce behavior, and sender semantics;
- outbound effects are represented through an action list, especially message sends;
- serialization and ABI surfaces are TL-B/cell-oriented;
- gas and fees are tied to TVM execution, storage, forwarding, and message handling;
- account lifecycle and execution phases affect contract behavior;
- sharding and asynchronous messaging make direct cross-contract assumptions unsafe;
- standardized contracts such as wallets, jettons, and NFTs are target-native surfaces, not generic token interfaces.
Candidate Target Family
Candidate family:Candidate Capabilities
Some existing capabilities have rough TON interpretations, but they need review:
Candidate capabilities that may need explicit ids later:
Do not add these ids to
ProofForge.Target.Capability until a target profile
and lowering rules are reviewed.
Implementation Road
Road 1: Tolk Package Sourcegen
This is the most conservative first spike. Generate or wrap a Tolk contract and validate it through the recommended TON toolchain. First spike:- choose a Counter-like contract with one internal message and one get method;
- define the storage cell layout explicitly;
- generate a minimal Tolk package or manifest around hand-authored source;
- compile with Acton or the current TON compiler path;
- record TVM/BOC artifacts, interface metadata, initial state, and validation result in artifact metadata.
Road 2: Lower-Level TVM/Cell IR
This road would target TVM more directly after the sourcegen spike clarifies the contract shape. First spike:- define a restricted cell/slice serialization IR;
- model inbound message decoding and outbound action emission;
- keep sharding, advanced libraries, jettons, and upgrades out of the first direct TVM path;
- validate against a local TON toolchain or emulator.
Non-Goals For The First Pass
- Do not add
ton-tvmto the code registry yet. - Do not classify TON as Wasm-host, EVM, Move, or ZK circuit sourcegen.
- Do not model TON storage as EVM slots.
- Do not treat message sends as synchronous cross-contract calls.
- Do not treat get methods and message handlers as the same entrypoint kind.
- Do not hide cell/TL-B layout behind generic JSON ABI.
- Do not claim supported TON output until a local compile/test smoke exists.
Research Exit Criteria
TON can leave Research only when we have:- a reviewed target profile proposal;
- a decided first spike path: Tolk package sourcegen or direct TVM/cell IR;
- a minimal Counter-like scenario with an internal message and get method;
- a cell/TL-B layout policy;
- a StateInit/deployment artifact policy;
- a documented toolchain requirement set, likely starting with Acton/Tolk;
- at least one reproducible local validation command;
- artifact metadata for source, TVM/BOC output, interface metadata, initial state, and validation result.