validator: attest and send sync committee messages when the slot's block arrives, and PTC votes when its payload does

Đang mở
#829 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ó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
35/100
Loại issue
Tính năng
Độ rõ ràng
Đặc tả 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/validator/src/lib.rs and crates/validator/src/slot_clock.rs to trace the duty deadlines, then read the BeaconNodeApi event handling and crates/blockchain/src/events.rs for supported node events. The issue calls for reconnecting event streams, coordinating each event with deadline attempts, and checking returned data before signing; the listed tests define the key cases. Done means early duties fire only on valid matching events, deadlines remain the fallback, and no duty signs twice.

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

Mô tả

The validator client signs attestations, sync committee messages and PTC votes only at their clock offsets. It never signs earlier when the slot's block, or at gloas its payload, arrives. The specification asks for whichever comes first. All seven other validator clients read below attest on the block's arrival by default.

Code references are at main @ 5d8628e9.

What happens today

After the proposal, the loop sleeps to the slot's first duty (crates/validator/src/lib.rs:515-520). Then serve_slot_duties sleeps each duty to its own offset:

  • Attestation: clock.until_attestation (lib.rs:659). That is ATTESTATION_DUE_BPS, 3333 (4 s into a 12 s slot), or from gloas ATTESTATION_DUE_BPS_GLOAS, 2500 (3 s) (slot_clock.rs:129-136).
  • Sync committee message: clock.until_sync_message (lib.rs:690), at SYNC_MESSAGE_DUE_BPS or its gloas value (slot_clock.rs:164-171).
  • PTC vote: clock.until_payload_attestation (lib.rs:664), at PAYLOAD_ATTESTATION_DUE_BPS, 7500 (9 s) (slot_clock.rs:142-144).

The client reads nothing from the beacon node's event stream. Its clock is independent of the stream on purpose: "that stream is best-effort by contract, dropping events for a slow subscriber, and a dropped event must not mean a missed duty" (slot_clock.rs:1-6).

What the specification says

At consensus-specs master @ 2ea9d96a:

  • Attestation: "when either (a) the validator has received a valid block from the expected block proposer for the assigned slot or (b) get_attestation_due_ms() milliseconds has transpired since the start of the slot -- whichever comes first" (specs/phase0/validator.md:610-614). Gloas changes only the deadline (specs/gloas/validator.md:99).
  • Sync committee message: the same two conditions, with get_sync_message_due_ms() (specs/altair/validator.md:346-352).
  • PTC vote: "as soon as it has seen the execution payload envelope and blob data for the block, and no later than get_payload_attestation_due_ms()" (specs/gloas/validator.md:402-404). blob_data_available may be set to False only once that deadline has passed (gloas/validator.md:425-427). So a PTC vote is triggered early by the payload and its blob data. The block alone is not enough, and an early vote is always one that saw both.

Why it matters

  • Less time to reach the aggregators. A subnet's aggregators publish at AGGREGATE_DUE_BPS: 8 s into the slot before gloas, 6 s at gloas. An attestation sent at the deadline gets 4 s, or 3 s at gloas, to reach them. Sent when the block arrives, usually well before the deadline, it gets that time plus the wait. A vote that misses every aggregate depends on a proposer's node having seen it on its own.
  • The same for sync committee messages, ahead of the contributions at CONTRIBUTION_DUE_BPS.
  • PTC votes have to reach the next proposer. A vote sent at 9 s has 3 s to propagate before the next slot's block is built. Sent when the payload and blobs are available, it has most of the slot.
  • The beacon node's latency comes on top. The attestation data request starts at the deadline, so a node that takes a second to answer makes the vote a second late. Started on the block's arrival, the same wait mostly falls before the deadline.

None of this has been measured for this client.

What other clients do

Client Attestation Sync committee message PTC vote Read at
Lighthouse A head event for the slot or the deadline, whichever comes first, on by default (attestation_service.rs:205-216). It checks the produced data's block root against the event's, and falls back to the deadline on a mismatch (:285-325). Optimistic heads do not trigger it (beacon_head_monitor.rs:194-200). --disable-beacon-head-monitor turns it off The same trigger (sync_committee_service.rs:145-152) On execution_payload_available, only when the data says payload_present, and again at the deadline if that attempt fails (payload_attestation_service.rs:170-178, :308-316). --disable-payload-available-monitor unstable @ 11813cfb
Teku On head events, on by default, --validators-early-attestations-enabled (EventSourceHandler.java:174-180, ValidatorConfig.java:65) At the deadline only (SyncCommitteeScheduler.java:125) On execution_payload_available for the last reported head (EventSourceHandler.java:203-209) master @ 62a54b96
Prysm A head event at the slot or the due time, on by default, --disable-attest-timely (attest.go:305-312) The same wait (sync_committee.go:41) execution_payload_available or the deadline (wait_helpers.go:86-94) develop @ 0c1e3d24
Nimbus A block event or the deadline (attestation_service.nim:540-544), then a further half of the attestation offset after the block (validator_duties.nim:68-74). On with the default --block-monitor-type=event (conf.nim:1141-1145) The same wait (sync_committee_service.nim:362) execution_payload_available or PAYLOAD_DUE_BPS, and once more at the deadline when the blob data was missing (payload_attestation_service.nim:85) unstable @ 9bed158a
Lodestar Races the due time against a head event at the slot (attestation.ts:80-85). A hidden --afterBlockDelaySlotFraction, 0 by default, delays the publish after an early block (attestation.ts:29, :176-178) The same race (syncCommittee.ts:89-93) execution_payload_available for the head at the slot, or the deadline (ptc.ts:70-76) unstable @ 77088eb7
Vouch "Fast track": on a head event for the current slot it waits 500 ms, then runs the slot's attestation job (events.go:200-212, main.go:262-264) The same, controller.fast-track.sync-committees (events.go:214-219) The first execution_payload_available, with the deadline as the fallback (events.go:42-60) master @ 691f3652
Vero The first head_v2 from any node, always on (attestation.py:172-177) The same trigger (sync_committee.py:154-160) The first execution_payload_available (ptc.py:91-105) master @ 9d110c1d

File names are relative to each client's validator client directory, except Vouch's main.go, at its repository root.

All seven attest on the block's arrival by default, and all seven vote PTC on execution_payload_available. Six of the seven also send sync committee messages early; Teku does not.

What it takes

  • An event stream in the beacon node client. A server-sent events reader for GET /eth/v1/events?topics=head, plus execution_payload_available at gloas, behind a new BeaconNodeApi method. It has to reconnect after a drop.
  • Triggers next to the clock. The slot clock stays the deadline, and whichever fires first runs the duty, once.
    • A head event whose slot is the current slot and whose execution_optimistic is false wakes the slot's attestation and sync committee message.
    • An execution_payload_available event for the current slot's block wakes the PTC vote.
  • One attempt per duty. attest must not be called twice in a slot (attestation.rs:83-94): a second call signs new data that slashing protection refuses. The early trigger and the deadline have to share one attempt.
    • Falling back to the deadline is safe only when the early attempt signed nothing. Lighthouse falls back on a block-root mismatch, which it detects before signing.
  • A check of what came back. The attestation data's beacon_block_root should be the event's block, or the duty waits for the deadline (Lighthouse, attestation_service.rs:285-292).
  • An early PTC vote only when it says the payload is there. If the data does not say payload_present, wait for the deadline, as Lighthouse does (payload_attestation_service.rs:308-316). blob_data_available may be False only once the deadline has passed, so an early vote must also have it True.
  • Node side, for the PTC trigger. ethlambda's node accepts but never emits execution_payload_available or head_v2 (crates/blockchain/src/events.rs:296-311; docs/rpc.md:1031-1036 lists them as never emitted). It emits head (docs/rpc.md:1023), so attestations and sync committee messages can be triggered against it today, while the PTC trigger needs the node to emit the event first.

To decide

  • A delay after the block. Vouch waits 500 ms, Nimbus half the attestation offset, Lodestar nothing by default. A short wait lets the block propagate before votes for it arrive at other nodes.
  • Which node's events, with several configured. Vero takes the first event from any node, then cross-checks the data with a majority of nodes. Lighthouse opens a head stream on each of its candidate nodes (beacon_head_monitor.rs:160-164).
  • A flag to turn it off. Lighthouse, Teku and Prysm have one; Vero and the PTC paths of most clients do not.
  • The aggregation. It stays at its own offset. The early attestation's data is the data it asks the aggregate for, as today (attestation.rs:21-50).

Tests

  • A mock event stream that delivers a head for the current slot one second in: assert the attestation and the sync committee message are published before the attestation offset.
  • No event: assert both still go out at their offsets.
  • A head event for the wrong block root, or an optimistic one: assert the duty waits for the deadline.
  • An event arriving after the deadline attempt has started: assert nothing is signed twice.
  • An execution_payload_available whose data says payload_present = false: assert the PTC vote waits for its deadline.
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.