-
Notifications
You must be signed in to change notification settings - Fork 210
Update head event in backwards compatible way #589
Description
Since the dependent root changes in Fulu, the head event's dependent roots are misleadingly named.
The current pre-Fulu definitions are:
previous_duty_dependent_root = get_block_root_at_slot(state, compute_start_slot_at_epoch(epoch - 1) - 1)current_duty_dependent_root = get_block_root_at_slot(state, compute_start_slot_at_epoch(epoch) - 1)
These are the correct proposer dependent roots prior to Fulu, i.e. the dependent root for epoch N, is the last block of epoch N - 1.
With Fulu, these dependent roots are completely wrong. The proposer dependent root for epoch N is now the block at the end of epoch N - 2. The spec's extant dependent roots are also unrelated to the attestation dependent roots, which follow the same cadence as the new proposer dependent roots (i.e. epoch N is determined at the end of N - 2).
The correct post-Fulu definitions are:
previous_epoch_dependent_root = get_block_root_at_slot(state, compute_start_slot_at_epoch(epoch - 2) - 1)current_epoch_dependent_root = get_block_root_at_slot(state, compute_start_slot_at_epoch(epoch - 1) - 1)next_epoch_dependent_root = get_block_root_at_slot(state, compute_start_slot_at_epoch(epoch) - 1)
Note that we can now offer lookahead for the next epoch for both proposer and attester duties.
Proposed Fixes
There are several ways to fix this without breaking the current events endpoint.
Option 1: New /eth/v2/events endpoint
Perhaps the most drastic: we add a new /eth/v2/events endpoint with a new head event that is versioned (similar to #587), and we take the opportunity to internally version all other events for future proofing. If we introduce this endpoint before Gloas, we can remove /eth/v1/events at the Heze fork boundary.
Option 2: New event type under v1
If we don't want to add a whole new /eth/v2/events endpoint, we could add a new event type under the existing event stream, with the Fulu changes, and a future-proof versioned structure. There are several things we could name this new event without conflict with existing events. Some ideas:
new_head: a double meaning on "new" – new in the sense of being newly made head, and new in the sense of replacing the oldheadeventhead_updated: kind of finehead_blockhead_v2: ugly IMO- etc
Option 3: New fields on existing head event
Probably the least elegant option would be to add new fields on the existing head event, and hope that they are simply not parsed by legacy implementations. The new fields could be named according to the corrected definitions above: previous_epoch_dependent_root, current_epoch_dependent_root, next_epoch_dependent_root.