Drop support for mpsc frames without the MessageEnd byte

Open
#178 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 2 days

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
43/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
rust

Research direction

Read decode_frame and its protocol version or ALPN handling, along with the related discussion in #27. Trace how frame length and MessageEnd are decoded, then check the protocol tests for compatibility cases. Done means frames require an end byte, aborted frames are dropped before decoding, malformed frames return protocol errors, and the wire break is accompanied by a version bump.

Written by the indexing model from the issue text.

Description

Since #167, an mpsc frame ends with a one-byte MessageEnd (0 = complete, 1 = aborted), included in the length prefix. To stay wire compatible with pre-1.0 senders, decode_frame also accepts frames without that byte, and treats them as complete.

Because an old frame has no end marker, its last byte is just message data, so the receiver cannot tell the two formats apart by looking at the last byte. decode_frame therefore has to:

  1. decode the message first,
  2. then look at what is left: nothing means an old frame (complete), one byte is the MessageEnd,
  3. and if the decode fails, drop the frame if its last byte happens to be 1 (Aborted).

This has two warts:

  • An aborted message is fully deserialized only to be thrown away.
  • A pre-1.0 frame that does not decode and happens to end in 1 is silently dropped instead of failing with MessageDecodeFailed (roughly 1 in 256 undecodable old frames). This is documented on decode_frame, but it is weird.

Once we no longer need to talk to pre-1.0 senders, we should require the end byte:

  • last byte 1: drop the frame without decoding it,
  • last byte 0: decode, and any decode failure is a real error,
  • no end byte / trailing garbage: protocol error.

This is a wire break for pre-1.0 senders, so it should come with a protocol version bump (e.g. a new ALPN) rather than land silently.

Related: #27

Dominant language
Rust
Stars
59
Forks
10
Avg merge
3d 15h
Merged PRs (30d)
21

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from n0-computer/irpc

All issues in n0-computer/irpc

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.