ChainSafe / ChainSafe/lodestar

Eventstream API fallback support

Open
#6,180 2 comments 0 reactions 1 assignee Claimed by @enyinnaya1234 View on GitHub
good first issue help wanted meta-feature-request prio-low
Dominant language
TypeScript
Stars
1.4k
Forks
483
Avg merge
1d 16h
Merged PRs (30d)
150

Description

### Problem description

The current implementation of [eventstream](https://ethereum.github.io/beacon-APIs/#/Events/eventstream) does not support fallback beacon nodes.

Only the URL of the primary node is used
https://github.com/ChainSafe/lodestar/blob/959a8af1b757c46a0e57450788fb72773a372608/packages/api/src/beacon/client/index.ts#L31

This means if primary node is down, the validator client will stop receiving head events which are currently used to detect reorgs and to prevent querying beacon node for block root when producing sync committe messages
https://github.com/ChainSafe/lodestar/blob/959a8af1b757c46a0e57450788fb72773a372608/packages/validator/src/services/attestationDuties.ts#L62
https://github.com/ChainSafe/lodestar/blob/959a8af1b757c46a0e57450788fb72773a372608/packages/validator/src/services/syncCommittee.ts#L126
Not detecting dependent root changes might lead to missed attestation duties.

### Solution description

Eventstream API should support fallback beacon nodes
- if primary node does not have any issue only open one eventstream
- if primary node has an error that is recoverable e.g. not status 400 or 500 then open eventstream with secondary node
- if second has an error then open eventstream with third node, and so on
- the eventstream to primary node should never be closed, if at some point it does not error then swap back to only using primary node and close all fallback eventstream connections

### Additional context

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.