tempolang is a set of small languages, and their compiler, for building a Tempo node in which Tempo's invariants are compiler checks. The compiler is written in tempolang itself. Every program is checked first, then compiled to native x86-64 code. The interpreter for the same source is the executable spec, and native code is tested against it.
flowchart LR
src["tl-ledger / tl0 source"] --> check["checker + prover<br/>overflow, invariants, units,<br/>sessions, @total"]
check --> interp["interpreter<br/>(executable spec)"]
check --> gen["x86-64 code generator"] --> elf["native ELF"]
interp <-->|"same results<br/>DST from a seed, fuzzing"| elf
elf <-->|"differential oracle"| rust["Tempo's Rust precompiles"]
-
tl-ledger: the ledger language. Its checker proves no overflow, preserved invariants (such as conservation of supply) and atomic reverts. It has an interpreter and a native x86-64 backend. Two-state specs: an op's ensures (with old) and modifies clauses are proven by check.tl, and tl0 functions state @ensures and @modifies, checked by tl0c (docs/PROPERTIES.md).
-
TIP-20: examples/tip20.tl holds the full token surface and examples/tip20_core.tl the core ledger.
-
Self-hosted compiler: tlc's lexer, parser, checker, prover, interpreter, code generator and ELF writer, written in tl0 under src-tl/, with tl0's own compiler (src-tl/tl0c). The committed seed (seed/tlc, a fixed point) builds it; there is no Rust in the build. Two bug classes are compile errors in every build: a dropped result of a pure function, and overlapping or unowned slots of a shared scratch array that declares @slots regions (docs/ARCHITECTURE.md, "tl0 safety").
-
Units and sealed types in tl0 (src-tl/tl0c/units.tl, on by default):
unit Gas;makes mixing gas with a timestamp, nonce or block number a compile error, andsealed TxValid = tx_run;makes applying a transaction that skipped tx_run's checks one. Zero-cost (the ELF is unchanged); so far applied to tx application and gas signatures in exec/, not to the rest of the node (docs/ARCHITECTURE.md). -
Session types in tl0 (src-tl/tl0c/session.tl, on by default):
session Tx { Pending -> Validated by tx_validate; ... }declares a protocol's states and transitions; a token of a state is consumed exactly once on every path, so a skipped, repeated or forgotten step or an undeclared operation is a compile error (120-126). Zero-cost like units (docs/TYPESTATE.md); being applied to the node's protocols. -
Checks on by default (in progress): tl0c checks every function as
@total(trap sites proven unreachable) unless it is@trusted("reason")or its file still carries the transitional@legacy;marker. Today 34.9% of src-tl function lines are checked and 62.0% are legacy; tl-ledger and tl0 are still two languages.scripts/meter.shmeasures it and CI holds the ratchet (docs/ARCHITECTURE.md, "Checks on by default"). -
tl0 sum types: enums, exhaustive
matchand enum-indexed string tables (src-tl/tl0c/enum.tl), checked at compile time where they are used (trace halts and frame kinds, Tempo forks); the rest of tl0 still passes kinds as plain u64. -
DST: deterministic simulation runs the interpreter and the native code side by side from a seed, plus native fuzzing and checker fuzzing.
-
Crypto in tl0: keccak, SHA-256, secp256k1, P-256, WebAuthn and BLS12-381 under src-tl/crypto/, with constant-time checks on the source (ctlint) and on the machine code the compiler emits (ctx86); batched sender recovery runs eight signatures at once on AVX-512 IFMA where the CPU has it, square roots, scalar split and inversions included.
-
Oracle: every operation of tip20.tl, fees.tl and the TIP-403 registry, nonce and validator config programs runs, interpreted and native, against Tempo's own Rust precompiles (oracle/ is the reference shim; the drivers are tl0 under src-tl/oracle/).
-
Mixed devnet: scripts/mixnet/ runs one devnet whose validators and followers are tempo (Rust), the tempolang node and zempo, and compares every node's finalized hashes and state roots under faults; the tl validator builds its own blocks from its mempool and the tempo validators finalize them (scripts/mixnet/proposals.sh counts them).
-
Sync from peers: scripts/node-follow/p2p.sh follows a chain with no RPC: blocks over devp2p eth/68 and finalization certificates over tempo/1 from tempo or tl nodes, every block executed and every certificate verified (docs/ARCHITECTURE.md, Sync from peers).
The compiler builds itself from a committed seed, with no Rust in the build:
flowchart LR
seed["seed/tlc<br/>(committed, SHA-256 pinned)"] -->|"build0 src-tl/"| s1["stage1 tlc"]
s1 -->|"build0 src-tl/"| s2["stage2 tlc"]
s2 -.->|"byte-identical:<br/>seed = stage1 = stage2"| seed
The node it builds is checked against Tempo's own Rust node on a mixed devnet and on mainnet data:
flowchart TB
subgraph devnet["mixed devnet (scripts/mixnet)"]
rv["tempo validators (Rust)"] <-->|"consensus + p2p"| tv["tl validators"]
rv --> rf["followers"]
tv --> rf
end
devnet --> cmp["compare finalized hashes<br/>and state roots under faults"]
mn["mainnet blocks + certificates<br/>(devp2p eth/68, tempo/1)"] --> fol["tl follower"] --> rep["every block executed,<br/>every root and certificate checked"]
sh scripts/bootstrap.sh seed/tlc rebuilds itself from src-tl/
bash scripts/test.sh every test (TL_HEAVY=1 adds the long runs)
scripts/build0.sh -o tlc $(sed 's|^|src-tl/|' src-tl/tlc.files)
./tlc check examples/tip20.tl
tests/oracle/run.sh the oracle's gate (TL_REF=oracle/target/release/tl-ref adds live runs)
scripts/mixnet/up.sh DIR a mixed tempo/tl/zempo devnet from a localnet; check.sh, soak.sh
scripts/node-replay/synth.sh DIR a heavy payments-like chain from a seed for the replay benchmarks
After a change to src-tl/, sh scripts/bootstrap.sh --update rebuilds the seed. The Rust left is test-only: oracle/ (Tempo's reference behind tl-ref), and net-shim (real commonware peers for tests/net/interop.sh), which the script takes from git history.
The native backend, tl0 and the DST need x86-64 Linux.
There is no test CI. Whoever opens a pull request runs bash scripts/test.sh
and sh scripts/scorecard.sh --check (the ratchet in docs/scorecard.txt) on
the branch rebased onto main, then squash-merges it. Nothing gates a merge.
src-tl/: tlc in tl0 (and tl0c, the tl0 compiler), plus its DST and test driversseed/: the committed compiler that bootstraps src-tl/scripts/: bootstrap, build0, test and golden archive scriptsexamples/: tl-ledger programstests/: goldens frozen from the deleted Rust implementation, tl0 programs and inputsoracle/: the differential oracle against Tempo's referencedocs/ARCHITECTURE.md: the designdocs/STORAGE.md: the disk-backed state engine (design, targets, baseline numbers)
Licensed under either of Apache License, Version 2.0 or MIT license at your option.