RFC 0028: Nested Wire Envelope: Trait, Method, Version, and Direction - #557
Open
decrypto21 wants to merge 4 commits into
Open
RFC 0028: Nested Wire Envelope: Trait, Method, Version, and Direction#557decrypto21 wants to merge 4 commits into
decrypto21 wants to merge 4 commits into
Conversation
This was referenced Sep 1, 2026
decrypto21
force-pushed
the
rfc/0028-nested-wire-envelope
branch
from
September 2, 2026 10:14
76ede58 to
d4078ff
Compare
johnthecat
reviewed
Sep 2, 2026
| Start(Start), | ||
| Stop, | ||
| Interrupt(Option<Err>), | ||
| Receive(Item), |
Contributor
There was a problem hiding this comment.
I think Receive should be after Start
pub enum Subscription<Start, Item, Err> {
Start(Start),
Receive(Item),
Interrupt(Option<Err>),
Stop,
}So subscriptions can be partly backward compatible with request
|
|
||
| ## Summary | ||
|
|
||
| The codec 2 envelope (`[requestId][trait: u8][method: u8][payload]`) still spends its per-trait method-id budget on *direction*: a request/response method reserves two consecutive ids, a subscription reserves four. This RFC moves direction into the payload itself, one decode step past the `(trait, method)` routing pair: version selects a method's own `{Method}Version` enum, and that version wraps a `Request<Req, Res>` (or, for subscriptions, a `Subscription<Start, Item, Err>`) value whose own variant tag carries direction. The `(trait, method)` address stays exactly as flat as it is today (one `MethodIds` constant per method, unchanged as the dispatcher's routing key); only what a method's *payload* decodes into changes. Each method costs exactly one id, method ids run as a dense 0, 1, 2, ... sequence per trait, and a method's version history is the single place its shape (request/response today, subscription tomorrow) can change without touching its wire address. |
Contributor
There was a problem hiding this comment.
Hard to read, for some reason we're not using normal vocabulary like "Enum", "Section/Pallet", etc.
Let's define wording first and then define what we want to do with it. Low level bytes position is part of SCALE spec itself, we need to reuse this abstraction and work with higher level primitives
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds the design proposal for folding wire direction (request/response, or a subscription's start/stop/interrupt/receive) and version into the payload itself, so each method costs one wire id instead of two or four. Registers it in docs/rfcs/_index.md.
Implemented directly in #357 rather than a separate PR: neither has merged, and the nested envelope isn't separable from that PR's own wire redesign, same unreleased codec 2 cutover.