Skip to content

MCP: v1 layout wire encoding - #3245

Draft
xinyuan-dev wants to merge 1 commit into
xinyuan/da-raptorcastfrom
xinyuan/da-serialization
Draft

xinyuan-dev wants to merge 1 commit into
xinyuan/da-raptorcastfrom
xinyuan/da-serialization

Conversation

@xinyuan-dev

@xinyuan-dev xinyuan-dev commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

This PR implements the encoding and decoding of logical Chunk into/from v1 wire format (Bytes).

The concept of PacketLayout gets absorbed into wire/v1.rs and EncodingScheme. Now v1 packet layout is simplified into two parts: header (sig, signed bytes) and body (merkle proof, chunk header, symbol).

Clarified separation of responsibility:

  • wire/v1.rs owns the knowledge of packet format (segment length, positions of fields), decoding & encoding of the bytes
  • EncodingScheme is logical - it owns the knowledge of the app_msg_len, the depth and their calculation as well as other header fields.

Changes:

EncodingScheme for D25 now includes three fields: app_msg_len, depth, coarse_ts instead of two: app_msg_len, unix_ts. The extra depth field makes validation cheaper and obviate the need to pre-compute packet layout. The coarse-grained ts is better at expressing the semantic of equality on EncodingScheme.

The stub symbol codec implementation is changed to a repetition code to accommodate for the enforced symbol length.

Another conceptual simplification is the delayed verification of a chunk:

  • essential v1 packet well-formedness check: done at parse time
  • proposal header check (slot valid, author is proposer, depth canonical): done in SlotRaptorcast (aka authenticate, shared with chorus for proposal headers received in consensus message)
  • per-chunk merkle proof verification: done in RaptorcastInstance; so a chunk with invalid merkle proof still gets its header registered for potential equivocation.

@xinyuan-dev
xinyuan-dev force-pushed the xinyuan/da-serialization branch from 021aa2d to 32ea657 Compare September 7, 2026 17:20
@xinyuan-dev
xinyuan-dev force-pushed the xinyuan/da-serialization branch from 32ea657 to 8df6748 Compare September 7, 2026 18:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant