Skip to content

Add current_slot to fast_confirmation event - #616

Merged
nflaig merged 5 commits into
ethereum:masterfrom
nazarhussain:nh/fcr-event-slot
Jun 9, 2026
Merged

Add current_slot to fast_confirmation event#616
nflaig merged 5 commits into
ethereum:masterfrom
nazarhussain:nh/fcr-event-slot

Conversation

@nazarhussain

@nazarhussain nazarhussain commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add current_slot (wall-clock slot at execution time) to the fast_confirmation event payload, alongside the existing block and slot of the most recent confirmed block.
  • Clarify that the event should be emitted every time the fast confirmation algorithm is run, regardless of whether the most recent confirmed block changed since the previous run.

Motivation

Without current_slot, consumers cannot distinguish a fresh FCR run that re-confirmed the same block from a stale or missed emission. Making the emission cadence explicit in the spec removes ambiguity about whether implementations may suppress unchanged results.

@nflaig nflaig changed the title docs(eventstream): add current_slot to fast_confirmation event Add current_slot to fast_confirmation event Jun 5, 2026
Comment thread apis/eventstream/index.yaml Outdated
Comment thread apis/eventstream/index.yaml Outdated
nazarhussain and others added 2 commits June 5, 2026 11:49
Co-authored-by: Nico Flaig <nflaig@protonmail.com>
Comment thread apis/eventstream/index.yaml Outdated
Co-authored-by: Nico Flaig <nflaig@protonmail.com>

@nflaig nflaig left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@rolfyone rolfyone left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

nflaig pushed a commit to ChainSafe/lodestar that referenced this pull request Jun 9, 2026
- Wires the new `fast_confirmation` Server-Sent Event from beacon-APIs
PR [#598](ethereum/beacon-APIs#598). The event
fires once per slot whenever the Fast Confirmation Rule executes and
carries `{block, slot}`, where `slot` is the slot of the confirmed
beacon block.
- Crosses the fork-choice ↔ beacon-node boundary via a new optional
`onFastConfirmation` callback on `ForkChoiceStore`, mirroring the
existing `onJustified` / `onFinalized` plumbing. The emit is invoked
from `ForkChoice.runFastConfirmation()` after the rule succeeds.
- Removes the now-redundant Lodestar-namespace endpoint `GET
/eth/v1/lodestar/fast_confirmation_info` (and its `getConfirmedBlock`
helper) — the standard SSE event supersedes it, and the head/checkpoint
fields it bundled are already available via standard beacon-API
endpoints.

This PR is aligned with the changes proposed in
ethereum/beacon-APIs#616

### Architecture

```
Chain.onClockSlot → forkChoice.updateTime
  └── (per tick) runFastConfirmation
       └── fcStore.notifyFastConfirmation({block, slot})
            └── ChainEventEmitter.emit(EventType.fastConfirmation, {block, slot})
                 └── SSE subscribers via /eth/v1/events?topics=fast_confirmation
```

`ApiEvents` in `ChainEventEmitter` is derived from
`routes.events.EventType`, so adding the new variant flows through
automatically — no per-event boilerplate in the chain or events API
layers.


### Edge cases

| Scenario | Behavior |
|---|---|
| `--chain.fastConfirmation` disabled (default) | No emit (FCR doesn't
run) |
| FCR rule throws | No emit; existing warn-and-continue catch is
unchanged |
| Confirmed root not in `protoArray` (defensive) | Warn log with
`slot`+`confirmedRoot`, skip emit |
| `updateTime` advances multiple slots | One emit per tick |
@nflaig
nflaig merged commit e3c6eb1 into ethereum:master Jun 9, 2026
3 checks passed
barnabasbusa added a commit to ethpandaops/dora that referenced this pull request Jul 8, 2026
Subscribe to the fast_confirmation beacon event stream topic (fast
confirmation rule, see ethereum/beacon-APIs#616) as an optional ancillary
SSE stream. Nodes that don't support the topic reject the subscription
with a 4xx response, in which case the stream silently gives up, so the
feature auto-activates only on FCR-enabled nodes.

The most recent fast confirmed (safe) block is tracked per client and
network-wide in the chain state, and visualized in the frontend:

- index page: safe slot next to the current slot in the network overview,
  and a shield marker on fast confirmed slots in the recent slots list
- consensus clients page: sortable "Safe Slot" column (only shown when at
  least one node reports fast confirmations)
- /v1/clients/consensus API: fcr_enabled, safe_slot and safe_root fields
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants