You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Agreed in the SDK team chat (PG + Sergey, 2026-08-06): change the TrUAPI wire envelope's method identifier from a single u8 to two u8s — one for the namespace (the API trait), one for the method within that trait.
This is a wire-breaking change. It will not merge until every host runs the Rust-based implementation; until then the branch is kept rebased and ready.
Current state
The envelope is [SCALE str requestId][u8 discriminant][payload] (js/packages/truapi/src/transport.ts, truapi-server/src/frame.rs on the PR-104/PR-295 lineage). The single u8 is the whole address:
Ids are hand-written #[wire(request_id = N)] attributes in rust/crates/truapi/src/api/*.rs; a request burns 2 slots, a subscription 4. They are append-only and never reused.
163 of 255 values are already assigned; ids 70–75 are permanently burned by the retired JsonRpc trait, and coin_payment alone consumed 28 slots.
Five traits (notifications, account, signing, statement_store, payment) already have non-contiguous id blocks because new methods can only append at the global tail.
Splitting into (trait: u8, method: u8) gives each trait its own 256-slot method space, keeps trait id blocks contiguous forever, and makes the namespace visible on the wire for dispatch and debug tooling.
Proposed change
New envelope: [SCALE str requestId][u8 trait][u8 method][payload].
Trait ids are assigned explicitly (new trait-level wire attribute), pinned forever.
Method ids restart from 0 within each trait. Since this ships as a coordinated cutover, existing method ids are renumbered once; append-only then resumes per trait.
Re-pin byte-exact tests: wire-equality.test.mjs golden hex, wire-table-loop.test.mjs, frame.rs frame-length asserts, codegen golden files
Codec version 2 + explicit error on unknown (trait, method) on both sides
Follow-up, separate PR, only if it executes quickly (per PG): consume @parity/truapi's generated wire table inside triangle-js-sdks instead of the hand-maintained allocator in packages/host-api/src/protocol/impl.ts — that table has already diverged from the spec (max id 135 vs 163), and triangle-js-sdks is retired once hosts move to the Rust SDK.
Context
Agreed in the SDK team chat (PG + Sergey, 2026-08-06): change the TrUAPI wire envelope's method identifier from a single
u8to twou8s — one for the namespace (the API trait), one for the method within that trait.This is a wire-breaking change. It will not merge until every host runs the Rust-based implementation; until then the branch is kept rebased and ready.
Current state
The envelope is
[SCALE str requestId][u8 discriminant][payload](js/packages/truapi/src/transport.ts,truapi-server/src/frame.rson the PR-104/PR-295 lineage). The singleu8is the whole address:#[wire(request_id = N)]attributes inrust/crates/truapi/src/api/*.rs; a request burns 2 slots, a subscription 4. They are append-only and never reused.JsonRpctrait, andcoin_paymentalone consumed 28 slots.notifications,account,signing,statement_store,payment) already have non-contiguous id blocks because new methods can only append at the global tail.Splitting into
(trait: u8, method: u8)gives each trait its own 256-slot method space, keeps trait id blocks contiguous forever, and makes the namespace visible on the wire for dispatch and debug tooling.Proposed change
New envelope:
[SCALE str requestId][u8 trait][u8 method][payload].Scope
In
truapi:truapi-macros: trait-level namespace id + per-method ids in#[wire(...)]; keep the rustdoc doc-smuggling path workingtruapi-codegen: extraction (rustdoc.rs), sort/collision/overflow logic and TS emitters (ts.rs), Rust emitters (rust/wire_table.rs, dispatcher) — collision detection becomes per-traitjs/packages/truapi/src/transport.tsencode/decode,truapi-server/src/frame.rstruapi-server/src/dispatcher.rsandtruapi-hostTS dispatch keyed on the pairSENSITIVE_FRAME_IDS,WIRE_DECODE_TABLE,truapi-debuggerframe decodingwire-equality.test.mjsgolden hex,wire-table-loop.test.mjs,frame.rsframe-length asserts, codegen golden files(trait, method)on both sidesFollow-up, separate PR, only if it executes quickly (per PG): consume
@parity/truapi's generated wire table insidetriangle-js-sdksinstead of the hand-maintained allocator inpackages/host-api/src/protocol/impl.ts— that table has already diverged from the spec (max id 135 vs 163), andtriangle-js-sdksis retired once hosts move to the Rust SDK.Sequencing
feature/people-rfc); the renumbering picks them up either way.Open questions
api/mod.rsorder, pinned in the spec.