Expand description
Wire message payload types for deCDN ALPN protocols.
Every ALPN defines a top-level enum (e.g. ProbeMessage) whose variants
wrap the per-message structs. The enum is serialized as the outermost
postcard value inside a length-prefixed frame (see crate::framing).
§Signed-field freezing (ADR 013 §Signed Field Freezing)
ProbeResponse is exactly a signed ProbeResponseBody plus its
slash_sig; every unsigned field trails in ProbeResponseExt, encoded
separately and decoded two-phase (ADR 013 §Tier 1). Unlike an Ed25519
signature over postcard bytes, slash_sig is not computed over a
postcard serialization: it is an EIP-712
secp256k1 signature over the typed-data hash of the body fields
{hash, has_blob, rate_per_mb, timestamp_us}, exactly as defined in ADR
014 §EIP-712 Type Definitions and implemented in
decdn_incentive::ProbeSlashData. There is intentionally no
signing_bytes() helper here — postcard bytes are not the signing
input, and exposing one would invite incompatible verifier
implementations. The #[serde(deserialize_with)] validation on
rate_per_mb lives on the body field so the protocol-boundary bound on
MAX_RATE_PER_MB continues to apply (issue #378).
This establishes the cdn/probe/v1 signed baseline — it is not an
ALPN bump. ADR 013 freezes a signed field set at the protocol version that
introduces it; cdn/probe/v1 had no prior signed ProbeResponse, so the
set {hash, has_blob, rate_per_mb, timestamp_us} is the v1 baseline (ADR
005 §cdn/probe/v1, ADR 014 §1). total_bytes rides in
ProbeResponseExt as the ADR 013 Tier-1 unsigned-evolution exemplar (ADR
005 §cdn/probe/v1) and is deliberately NOT covered by slash_sig. The
ProbeMessage variant order is unchanged.
This crate deliberately does not depend on any crypto library. The caller
(decdn_incentive::ProbeSlashData and the probe handler/CLI) computes and
verifies the EIP-712 slash_sig.
Structs§
- Probe
Request - Client → node request on
cdn/probe/v1(ADR 005 §cdn/probe/v1). - Probe
Response - Node → client response on
cdn/probe/v1(ADR 005 §cdn/probe/v1). - Probe
Response Body - Signed fields of a
ProbeResponse. Layout is frozen per ADR 013 — future additions go onProbeResponseas optional unsigned fields, not here. - Probe
Response Ext - Optional
ProbeResponseextension fields, carried as trailing bytes after theProbeResponsemessage via the two-phase pattern (ADR 013 §Tier 1; seeencode_probe_response/parse_probe_response_ext).
Enums§
- Message
Validation Error - Errors produced when validating wire-decoded protocol messages.
- Probe
Message - Top-level protocol enum for
cdn/probe/v1. Variant order is frozen per ADR 013 — new variants MUST be appended at the end.
Constants§
- MAX_
RATE_ PER_ MB - Maximum permitted value for
ProbeResponseBody::rate_per_mb(issue #378). - SLASH_
SIG_ LEN - Length in bytes of an EOA secp256k1 EIP-712 signature (
r‖s‖v, 32+32+1).
Functions§
- encode_
probe_ response - Encode a
ProbeResponsewith its optional trailingProbeResponseExt(ADR 013 §Tier 1, two-phase). - parse_
probe_ response_ ext - Parse the trailing
ProbeResponseExtbytes returned as the remainder bycrate::decode_messageafter aProbeMessage::Response.