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
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.
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 sidesSequencing
feature/people-rfc); the renumbering picks them up either way.Open questions (and Recommendations)
api/mod.rsorder, pinned in the spec.