Repository navigation
fix(gossip): pin iroh-gossip frame ceiling to GOSSIP_MAX_FRAME (#660) - #661
Conversation
Wires iroh-gossip's per-actor `max_message_size` to a deCDN-controlled `GOSSIP_MAX_FRAME = 16 KiB` (ADR 013 §Gossip Framing) via a new `decdn_gossip::build_gossip` helper used by both the runtime and the regression test. Replaces the silent reliance on iroh-gossip 0.98's 4 KiB default — too tight to carry our `MAX_TRAILING_BYTES` extension allowance — and corrects PR #659's stale doc-comments that conflated deCDN's `MAX_MESSAGE_SIZE` (probe/client ALPNs) with iroh-gossip's unrelated per-actor cap. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
There was a problem hiding this comment.
Pull request overview
This PR pins iroh-gossip’s per-actor frame size ceiling to a deCDN-controlled constant (GOSSIP_MAX_FRAME = 16 KiB) to bound pre-allocation in iroh-gossip’s framing (read_lp) and prevent regressions back to the upstream 4 KiB default, while documenting the distinction between deCDN ALPN framing and gossip framing.
Changes:
- Introduces
GOSSIP_MAX_FRAMEand abuild_gossip(endpoint)helper that applies.max_message_size(GOSSIP_MAX_FRAME)and is used by both the node runtime and a regression test. - Adds a compile-time invariant ensuring
MAX_TRAILING_BYTES + envelope + wrappers <= GOSSIP_MAX_FRAME. - Updates ADR 013 with a new “Gossip Framing” subsection clarifying coordination constraints and operator policy scope.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| crates/node/src/runtime/mod.rs | Switches runtime gossip actor construction to build_gossip(...) to ensure the frame ceiling is always applied. |
| crates/gossip/src/validation.rs | Adds GOSSIP_MAX_FRAME and a const-assert tying trailing-bytes allowance to the gossip frame ceiling; updates related docs/comments. |
| crates/gossip/src/service.rs | Adds build_gossip(endpoint) and a regression test asserting the configured max message size is wired through. |
| crates/gossip/src/lib.rs | Re-exports build_gossip and GOSSIP_MAX_FRAME for consumers (notably decdn-node). |
| adr/013-schema-evolution.md | Documents gossip framing separately from deCDN-owned ALPN framing and clarifies the network-coordination invariant. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Coverage reportTotal: 90.05% (was 90.04%, ▲ +0.01%) — 17091/18979 lines
History
|
There was a problem hiding this comment.
Code Review
This pull request establishes a 16 KiB frame size limit for gossip messages by introducing the GOSSIP_MAX_FRAME constant, which overrides the smaller upstream default. The construction of the iroh-gossip actor is now centralized in a build_gossip helper to ensure this limit is consistently enforced. Additionally, the PR updates ADR 013 documentation, adds a regression test for the new helper, and includes a compile-time assertion to verify that the frame size can accommodate the maximum allowed trailing bytes. I have no feedback to provide.
Address PR #661 review comments: switch "defence-in-depth" to "defense-in-depth" (matches the 10 existing files using American spelling, e.g. adr/001-network.md) and fix accidental double backticks around `HyParView` in the network-coordination invariant paragraph. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
…framing Comment fixes surfaced by the post-fix re-review: - HyParView control frames ARE topic-scoped — every iroh-gossip wire frame carries a TopicId (`iroh_gossip::proto::state::Message<PI>`), and iroh-gossip maintains a separate HyParView swarm per topic. The prior parenthetical "(which are not topic-scoped)" was the inverse of reality. Rephrased to convey the intended point (tightening GOSSIP_MAX_FRAME breaks legitimate non-payload frames too). - "~100× across the gossip fan-out" conflated per-frame size ratio (16 KiB / 150 B ≈ 109×) with Plumtree fan-out (eager-peer count). Reworded to name them as separate multipliers. - `AnnounceReject::OversizeTrailingBytes` doc-comment now states the 4 KiB threshold inline so operators reading the metric label don't have to chase `MAX_TRAILING_BYTES`. - `build_gossip` doc-comment now pins the 4 KiB upstream default to iroh-gossip 0.98 so a future minor-version bump that shifts it doesn't silently invalidate the comment. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Summary
GOSSIP_MAX_FRAME = 16 KiB(new constant indecdn-gossip), wired through abuild_gossip(endpoint)helper that both the runtime and the regression test call — so dropping the cap from the helper fails the test rather than silently reverting to iroh-gossip's 4 KiB default.#### Gossip Framingsubsection: distinguishes deCDN'sMAX_MESSAGE_SIZE(probe/client ALPNs) from iroh-gossip's per-actor cap, documents the network-coordination invariant (cap is enforced symmetrically; asymmetric tightening silently partitions the swarm per upstream iroh-gossip#131), and explicitly scopes the existing operator-policy note so it doesn't apply to gossip.const _: () = assert!(MAX_TRAILING_BYTES + envelope + wrappers <= GOSSIP_MAX_FRAME)so future drift on either constant breaks the build at the right line.validation.rsthat referenced "iroh-gossip's MAX_MESSAGE_SIZE (16 MiB)" — that 16 MiB figure is deCDN'sdecdn_protocol::framing::MAX_MESSAGE_SIZEand was never iroh-gossip's. Restores the multiplicative-allocation-amplification rationale for the trailing-bytes cap.Why 16 KiB
Analytical bounds from iroh-gossip 0.98 source:
NodeAnnounce+ 64 B sig + version) + 4 KiBMAX_TRAILING_BYTES+ ~64 B plumtree/topic wrappers + 4 B u32 length prefix.Shuffle/ShuffleReplyat default fanout (7PeerInfoentries with two-relayAddrInfo).PeerDatagrowth.iroh-gossip 0.98's 4 KiB default is insufficient — it can't carry our existing
MAX_TRAILING_BYTESextension allowance, making PR #659's M3 padding cap structurally unreachable under default settings.Test plan
cargo build -p decdn-gossip -p decdn-nodecleancargo clippy --workspace --all-targetscleancargo fmt --checkcleancargo nextest run— 936/936 workspace tests passbuild_gossip_wires_gossip_max_frameexercises the production wiring seam (assertsGossip::max_message_size() == GOSSIP_MAX_FRAMEviabuild_gossip)MAX_TRAILING_BYTES + envelope + wrappers <= GOSSIP_MAX_FRAMEOut of scope
read_lprejection: iroh-gossip 0.98 exposes no in-process seam for that path (net::utilispub(crate),WriteError/ReadErrornot public). Requires the two-Gossip-instance harness deferred alongside other integration tests; the compile-time invariant and wiring test cover the regression vectors that matter for this change.GOSSIP_MAX_FRAME: per the ADR, this is a wire-coordination value, not an operator-tunable.Closes #660.
🤖 Generated with Claude Code