feat(rpc): add GET /lean/v0/events SSE stream#517
Conversation
🤖 Kimi Code ReviewThe PR implements an SSE endpoint for chain events with proper best-effort semantics and clean separation between the blockchain actor (publisher) and RPC (subscriber). No critical issues found. Minor observations:
Security/Performance notes:
Architecture verification:
The implementation follows Rust async best practices and integrates cleanly with the existing axum router structure. Automated review by Kimi (Moonshot AI) · kimi-k2.5 · custom prompt |
🤖 Codex Code Review
Otherwise the wiring looks clean, and the flat JSON framing test is a good regression check for the earlier double-tagging bug. I couldn’t run Automated review by OpenAI Codex · gpt-5.4 · custom prompt |
🤖 Claude Code ReviewReview:
|
Greptile SummaryThis PR adds a live SSE stream for blockchain events. The main changes are:
Confidence Score: 5/5This looks safe to merge.
|
| Filename | Overview |
|---|---|
| crates/net/rpc/src/events.rs | Adds the SSE handler, event framing, keep-alives, and handler coverage. |
| crates/net/rpc/src/lib.rs | Registers the events route and provides the event bus through an extension. |
| bin/ethlambda/src/main.rs | Shares the blockchain event bus with the RPC server. |
| crates/net/rpc/Cargo.toml | Adds the stream dependencies required by the SSE endpoint. |
| docs/rpc.md | Documents the endpoint, event payloads, delivery behavior, and content type. |
Reviews (3): Last reviewed commit: "feat(rpc): add GET /lean/v0/events SSE s..." | Re-trigger Greptile
🤖 Kimi Code ReviewOverall Assessment: Clean, idiomatic implementation of SSE streaming for consensus events. Correctly handles backpressure via bounded broadcast channel semantics and implements best-effort delivery as specified. Minor Issues & Suggestions: 1. Rust Version Compatibility (Line 47,
// Alternative for older Rust versions:
.json_data(&ev)
.map_err(|err| tracing::warn!(%err, "Failed to serialize SSE chain event"))
.ok()?2. Test Race Condition Risk (Lines 67-97,
3. Connection Resource Limits
4. Serialization Failure Handling (Line 47)
5. Documentation Accuracy (Line 27,
Security & Consensus Considerations:
Performance:
Acknowledgments:
Verdict: LGTM. Address the Rust version check for Automated review by Kimi (Moonshot AI) · kimi-k2.5 · custom prompt |
🤖 Codex Code Review
I didn’t find other correctness issues in the diff. This PR doesn’t alter fork choice, attestation validation, finalization, state transition, XMSS, or SSZ logic; it only exposes existing I couldn’t run Automated review by OpenAI Codex · gpt-5.4 · custom prompt |
🤖 Claude Code ReviewConsistent with existing conventions. I have enough context to write the review now. Review:
|
23825f1 to
3a3c804
Compare
bb2acdd to
8bc49c0
Compare
🤖 Codex Code ReviewNo findings. The diff stays out of consensus-critical execution paths: it only wires the existing Residual risk: I couldn’t run Automated review by OpenAI Codex · gpt-5.4 · custom prompt |
🤖 Kimi Code ReviewThe PR adds a clean, well-tested SSE endpoint for chain events. Implementation follows Axum best practices and correctly handles slow clients via lag detection. Minor observations:
Security & Performance:
Consensus considerations:
Verdict: LGTM. The lag-handling logic is correct for a best-effort consensus event stream. Automated review by Kimi (Moonshot AI) · kimi-k2.5 · custom prompt |
🤖 Claude Code ReviewReview:
|
3a3c804 to
a966632
Compare
8bc49c0 to
50050d2
Compare
Second PR of the chain-events series: the transport for the event bus introduced in the previous PR. Kept separate from the mechanism so the axum plumbing reviews on its own; topic filtering (?topics=) follows in the next PR, so this stream is unfiltered. Each connection subscribes its own receiver and forwards events as SSE frames: the topic name goes on the event: line via ChainEvent::topic() (no hardcoded name match to drift from the enum) and the data: line carries the flat JSON payload, so the topic is never duplicated inside the body. A lagged client skips past the events the bounded channel overwrote (debug log, stream continues) rather than ending the stream: the stream is best-effort by contract and clients re-sync via the blocks endpoints. Keep-alive comments hold idle connections open through proxies.
50050d2 to
03118fc
Compare
a966632 to
60d9c2e
Compare
Adds
GET /lean/v0/events, a Server-Sent Events stream of the chain events introduced in #516:head,block,justified_checkpoint,finalized_checkpoint. Every subscriber currently receives all events; server-side?topics=filtering lands in the next PR of the series.Frames carry the topic on the SSE
event:line and a flat JSON payload indata:(built fromChainEvent::topic(), no hardcoded name mapping). A client that reads too slowly skips the events it missed (debug-logged, best-effort; re-sync via the blocks endpoints) rather than back-pressuring the actor. Keep-alive comments hold idle connections open. Documented indocs/rpc.md.Stacked on #516.
Has handler tests and passes clippy with
-D warnings.