Skip to content

Commit

Permalink
eth/executionclient: use go-eth2-client with el_offline support
Browse files Browse the repository at this point in the history
  • Loading branch information
nkryuchkov committed Feb 3, 2025
1 parent 65e739f commit 4994094
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 49 deletions.
7 changes: 5 additions & 2 deletions beacon/goclient/goclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ func (gc *GoClient) addSingleClient(ctx context.Context, addr string) error {
eth2clienthttp.WithReducedMemoryUsage(true),
eth2clienthttp.WithAllowDelayedStart(true),
eth2clienthttp.WithHooks(gc.singleClientHooks()),
eth2clienthttp.WithSyncDistanceTolerance(gc.syncDistanceTolerance),
eth2clienthttp.WithELConnectionCheck(true),
)
if err != nil {
gc.log.Error("Consensus http client initialization failed",
Expand Down Expand Up @@ -367,7 +367,6 @@ func (gc *GoClient) Healthy(ctx context.Context) error {
recordBeaconClientStatus(ctx, statusSyncing, gc.multiClient.Address())
recordSyncDistance(ctx, syncState.SyncDistance, gc.multiClient.Address())

// TODO: also check if syncState.ElOffline when github.com/attestantio/go-eth2-client supports it
if syncState.IsSyncing && syncState.SyncDistance > gc.syncDistanceTolerance {
gc.log.Error("Consensus client is not synced")
return errSyncing
Expand All @@ -376,6 +375,10 @@ func (gc *GoClient) Healthy(ctx context.Context) error {
gc.log.Error("Consensus client is in optimistic mode")
return fmt.Errorf("optimistic")
}
if syncState.ELOffline {
gc.log.Error("Consensus client's EL node is offline")
return fmt.Errorf("EL is offline")
}

recordBeaconClientStatus(ctx, statusSynced, gc.multiClient.Address())

Expand Down
37 changes: 19 additions & 18 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ require (
github.com/dgraph-io/badger/v4 v4.2.0
github.com/dgraph-io/ristretto v0.1.1
github.com/ethereum/go-ethereum v1.14.8
github.com/ferranbt/fastssz v0.1.3
github.com/ferranbt/fastssz v0.1.4
github.com/go-chi/chi/v5 v5.0.8
github.com/go-chi/render v1.0.2
github.com/golang/gddo v0.0.0-20200528160355-8d077c1d8f4c
Expand All @@ -19,7 +19,7 @@ require (
github.com/gorilla/websocket v1.5.3
github.com/hashicorp/golang-lru/v2 v2.0.7
github.com/herumi/bls-eth-go-binary v1.29.1
github.com/holiman/uint256 v1.3.1
github.com/holiman/uint256 v1.3.2
github.com/ilyakaznacheev/cleanenv v1.4.2
github.com/jellydator/ttlcache/v3 v3.2.0
github.com/libp2p/go-libp2p v0.36.3
Expand All @@ -30,7 +30,7 @@ require (
github.com/patrickmn/go-cache v2.1.0+incompatible
github.com/pkg/errors v0.9.1
github.com/prometheus/client_golang v1.20.5
github.com/prysmaticlabs/go-bitfield v0.0.0-20240328144219-a1caa50c3a1e
github.com/prysmaticlabs/go-bitfield v0.0.0-20240618144021-706c95b2dd15
github.com/prysmaticlabs/prysm/v4 v4.0.8
github.com/rs/zerolog v1.32.0
github.com/sanity-io/litter v1.5.6
Expand All @@ -50,13 +50,15 @@ require (
go.uber.org/zap v1.27.0
golang.org/x/exp v0.0.0-20240808152545-0cdaa3abc0fa
golang.org/x/mod v0.20.0
golang.org/x/sync v0.8.0
golang.org/x/text v0.18.0
golang.org/x/sync v0.10.0
golang.org/x/text v0.21.0
gopkg.in/natefinch/lumberjack.v2 v2.2.1
gopkg.in/yaml.v3 v3.0.1
tailscale.com v1.72.0
)

require github.com/emicklei/dot v1.6.4 // indirect

require (
github.com/BurntSushi/toml v1.4.1-0.20240526193622-a339e1f7089c // indirect
github.com/DataDog/zstd v1.5.2 // indirect
Expand Down Expand Up @@ -89,7 +91,7 @@ require (
github.com/elastic/gosigar v0.14.3 // indirect
github.com/ethereum/c-kzg-4844 v1.0.0 // indirect
github.com/ethereum/go-verkle v0.1.1-0.20240306133620-7d920df305f0 // indirect
github.com/fatih/color v1.17.0 // indirect
github.com/fatih/color v1.18.0 // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/flynn/noise v1.1.0 // indirect
github.com/francoispqt/gojay v1.2.13 // indirect
Expand Down Expand Up @@ -132,7 +134,7 @@ require (
github.com/jbenet/goprocess v0.1.4 // indirect
github.com/joho/godotenv v1.4.0 // indirect
github.com/klauspost/compress v1.17.9 // indirect
github.com/klauspost/cpuid/v2 v2.2.8 // indirect
github.com/klauspost/cpuid/v2 v2.2.9 // indirect
github.com/koron/go-ssdp v0.0.4 // indirect
github.com/kr/pretty v0.3.1 // indirect
github.com/kr/text v0.2.0 // indirect
Expand All @@ -150,7 +152,7 @@ require (
github.com/libp2p/go-yamux/v4 v4.0.1 // indirect
github.com/libp2p/zeroconf/v2 v2.2.0 // indirect
github.com/marten-seemann/tcp v0.0.0-20210406111302-dfbc87cc63fd // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-colorable v0.1.14 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mattn/go-runewidth v0.0.14 // indirect
github.com/miekg/dns v1.1.62 // indirect
Expand Down Expand Up @@ -230,13 +232,13 @@ require (
go.opentelemetry.io/otel/trace v1.32.0 // indirect
go.uber.org/dig v1.18.0 // indirect
go.uber.org/fx v1.22.2 // indirect
golang.org/x/crypto v0.27.0 // indirect
golang.org/x/crypto v0.32.0 // indirect
golang.org/x/net v0.29.0 // indirect
golang.org/x/sys v0.27.0 // indirect
golang.org/x/term v0.24.0 // indirect
golang.org/x/sys v0.29.0 // indirect
golang.org/x/term v0.28.0 // indirect
golang.org/x/time v0.5.0 // indirect
golang.org/x/tools v0.24.0 // indirect
golang.org/x/xerrors v0.0.0-20240716161551-93cc26a95ae9 // indirect
golang.org/x/xerrors v0.0.0-20240903120638-7835f813f4da // indirect
gonum.org/v1/gonum v0.13.0 // indirect
google.golang.org/protobuf v1.35.1 // indirect
gopkg.in/Knetic/govaluate.v3 v3.0.0 // indirect
Expand All @@ -251,9 +253,8 @@ replace github.com/google/flatbuffers => github.com/google/flatbuffers v1.11.0

replace github.com/dgraph-io/ristretto => github.com/dgraph-io/ristretto v0.1.1-0.20211108053508-297c39e6640f

// github.com/attestantio/go-eth2-client considers node as synced if is_syncing is false,
// however, it's been observed that it may take up to around 50 slots until is_syncing becomes true,
// which causes downtime.
// Using el_offline flag doesn't solve the issue because Prysm doesn't set it (TODO: check behavior of other clients).
// Using a fix from https://github.com/ssvlabs/go-eth2-client/commits/fix-multi-rotation-v0.21.7/
replace github.com/attestantio/go-eth2-client => github.com/ssvlabs/go-eth2-client v0.6.31-0.20250128220448-69c1f6bda599
// github.com/attestantio/go-eth2-client doesn't support el_offline flag, it causes downtime when EL node is down but CL node is up
// Using a fix from https://github.com/ssvlabs/go-eth2-client/commits/syncing-el-offline/ (https://github.com/attestantio/go-eth2-client/pull/192)
// NOTE: Prysm doesn't set el_offline correctly (https://github.com/prysmaticlabs/prysm/issues/14226),
// so the fix uses workaround with checking sync distance to check if EL is offline
replace github.com/attestantio/go-eth2-client => github.com/ssvlabs/go-eth2-client v0.6.31-0.20250203205310-2b7a98912f15
Loading

0 comments on commit 4994094

Please sign in to comment.