Event bus: build high-rate topics only for clients that subscribed to them

Đang mở
#845 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 6 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
42/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
rust

Hướng nghiên cứu

Start with crates/blockchain/src/events.rs and crates/net/rpc/src/events.rs, then trace the producer gates and sink trait in ethlambda-network-api; the issue describes two possible designs. Run or add a test where a client subscribes only to head. Done when that subscription does not build single_attestation, and the relevant high-rate topics are handled by the chosen design.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Problem. EventBus::has_subscribers is receiver_count() > 0 (crates/blockchain/src/events.rs:644). Every producer gates on it, so a single SSE client turns on every topic's payload construction, whatever ?topics= it asked for: a validator client that only wants head, for example. The filtering happens afterwards, in the stream (crates/net/rpc/src/events.rs, !topics.contains(&ev.topic())).

For the two high-rate beacon topics that means:

  • single_attestation (lambdaclass/ethlambda#757) clones every subnet attestation the node accepts: every vote on its backbone subnets, plus the duty subnets it joins.
  • attestation clones every accepted aggregate.

Both go into the one ring all topics share (CHAIN_EVENT_CHANNEL_CAPACITY, 8192, events.rs:600). A client whose connection stalls lags after capacity / total rate, and loses the low-rate events it did ask for, which it learns only from the dropped N messages comment frame. The doc on CHAIN_EVENT_CHANNEL_CAPACITY already names this and calls a per-topic split "the escape hatch". The rates on a mainnet node are not measured; lean_-prefixed counters per topic emitted would measure them.

Why not in lambdaclass/ethlambda#757. 757 adds one producer and follows the bus's existing gate, as attestation already does. Per-topic interest changes the bus, the SSE handler and every producer's gate.

Fix. Either of two:

  • Count subscriptions per Topic. The SSE handler registers its topic set with a guard that decrements on drop, and EventBus::wants(Topic) replaces has_subscribers at each producer; the sink trait in ethlambda-network-api grows the same method.
  • Keep has_subscribers, but give single_attestation and attestation a ring of their own, so their rate cannot push low-rate events out of a slow client's window.

A test: a client subscribed to head alone causes no single_attestation to be built.

Also high-rate (from lambdaclass/ethlambda#748): the gloas payload_attestation_message and execution_payload_bid events are built per message too, so the same per-topic interest check should cover them.

Ngôn ngữ chính
Rust
Star
86
Fork
34
Merge trung bình
9 ngày 20 giờ
Pull request đã merge (30 ngày)
77

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của lambdaclass/ethlambda

Tất cả issue của lambdaclass/ethlambda

Issue tương tự

Thêm issue về Rust

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.