Skip to content

feat: CEP-22 - transport-agnostic oversized transfer framing engine#88

Merged
ContextVM-org merged 1 commit into
ContextVM:mainfrom
harsh04044:feat/cep22-pr1-framing-engine
Jun 4, 2026
Merged

feat: CEP-22 - transport-agnostic oversized transfer framing engine#88
ContextVM-org merged 1 commit into
ContextVM:mainfrom
harsh04044:feat/cep22-pr1-framing-engine

Conversation

@harsh04044

Copy link
Copy Markdown

Part of #87
Builds the pure framing engine with no transport wiring - dead code until PR 3 (#87), but fully unit-tested.

What's in this PR:

New src/transport/oversized_transfer/ module:

  • frame.rs - OversizedFrame enum (Start/Accept/Chunk/End/Abort) with serde tagging matching the TS wire format exactly
  • constants.rs - all defaults aligned with TS (48KB chunk/threshold, 100MiB max, 5min transfer-timeout default - constant only, watchdog is wired in a later PR)
  • errors.rs - 5-class error taxonomy (Abort/Policy/Digest/Reassembly/Sequence)
  • codec.rs - SHA-256 digest, UTF-8 char-aware byte split (never breaks a multibyte codepoint), frame builder with correct progress slot layout
  • receiver.rs - stateful OversizedTransferReceiver with admission control, out-of-order buffering, and triple validation at end (byte-len → SHA-256 → JSON-RPC parse)

Also adds validate_and_parse_oversized() to core/validation.rs - reassembled payloads can exceed the normal 1MB cap, bound to maxTransferBytes (100MiB).

One hardening over the TS reference: gap arithmetic uses i128 (vs the obvious i64) so a crafted u64::MAX progress value can't overflow or wrap - TS sidesteps this via JS floats.

@ContextVM-org ContextVM-org merged commit 6fef2e9 into ContextVM:main Jun 4, 2026
3 checks passed
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.

2 participants