node: add turnkey BroadcastNode Host wrapper - #79
Merged
Conversation
Package the QUIC RS-broadcast assembly that previously existed only as test
sequences in `transport/eth_ec_quic_enabled.zig` into a reusable, poll-driven
Host (`src/node/broadcast_host.zig`).
`BroadcastNode` owns a QUIC listen endpoint, a dial endpoint, a
`broadcast.Engine`, a per-peer `EngineQuicHost`, and a per-channel
`Subscription`, and fills the gaps a raw `EngineQuicHost` leaves to the caller:
- bind (listen) + connect (dial) + the BCAST handshake exchange,
- a peer map and a single-threaded `tick(now_ms)` poll loop,
- the outbound SESS session_open + RS chunk send on publish,
- the decode-and-deliver trigger (poll `progress()`, `sessionDecode`,
hand the FullMessage to the channel `Subscription`), and periodic GC.
Includes a loopback self-interop test: node A publishes a message and node B
reconstructs the identical payload over real QUIC. Registered under the
`test-quic` CI job (`ci_root_quic.zig`).
Scope: the outbound path is single-peer-correct (the emit planner tags each
dispatch with a peer, but `SendRsChunkFn` is peer-agnostic). Multi-peer
routing, peer authentication, and peer-disconnect events are out of scope.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds
src/node/broadcast_host.zig— a turnkey, poll-driven BroadcastNode Host that packages the QUIC RS-broadcast assembly which until now existed only as test sequences intransport/eth_ec_quic_enabled.zig.A raw
EngineQuicHostbridges one inbound peer's SESS/CHUNK streams into anEngine; everything else (bind, dial, the BCAST handshake, the peer map, the poll loop, the outbound send, and the decode-and-deliver trigger) was left to the caller.BroadcastNodefills those gaps:connect/acceptInboundcomplete the QUIC handshake then run the BCAST handshake exchange and capture the remote peer id.tick(now_ms)— single-threaded poll loop: pump QUIC, accept inbound, advance handshakes, decode+deliver, GC. No goroutines/tickers, matching the library's synchronous port style.session_open(preamble) then the RS shard chunks to each ready peer.progress(), callssessionDecodewhen a relay session has enough shards, and hands theFullMessageto the channel'sSubscription. Origin sessions are skipped (no self-delivery).Test
Loopback self-interop test (registered under the
test-quicCI job): node Apublishes a message and node B reconstructs the identical payload over real QUIC. Verified locally with the 0.16.0 toolchain (test-quic59/59 green; defaultzig buildclean;zig fmt --checkclean).Scope / limitations
Deliberately experimental, mirroring the parallel-broadcast adapter pattern:
SendRsChunkFnis peer-agnostic, so onesessionDrainOutboundOverQuiccall fans one session to one connection.co_poll_ephook exists for in-process loopback tests; real deployments passnull(each process pumps its own socket viatick).