From 54bb55fbe9ece9bce2c251b6cafda53211517554 Mon Sep 17 00:00:00 2001 From: james-prysm Date: Tue, 22 Oct 2024 14:54:23 -0500 Subject: [PATCH 1/3] removing unnessesary reconnections --- beacon-chain/execution/service.go | 2 -- 1 file changed, 2 deletions(-) diff --git a/beacon-chain/execution/service.go b/beacon-chain/execution/service.go index d71b0b949407..e04c2c4477f9 100644 --- a/beacon-chain/execution/service.go +++ b/beacon-chain/execution/service.go @@ -529,7 +529,6 @@ func (s *Service) initPOWService() { // Cache eth1 headers from our voting period. if err := s.cacheHeadersForEth1DataVote(ctx); err != nil { err = errors.Wrap(err, "cacheHeadersForEth1DataVote") - s.retryExecutionClientConnection(ctx, err) if errors.Is(err, errBlockTimeTooLate) { log.WithError(err).Debug("Unable to cache headers for execution client votes") } else { @@ -557,7 +556,6 @@ func (s *Service) initPOWService() { s.chainStartData.GenesisBlock = genBlock if err := s.savePowchainData(ctx); err != nil { err = errors.Wrap(err, "savePowchainData") - s.retryExecutionClientConnection(ctx, err) errorLogger(err, "Unable to save execution client data") continue } From 6ce3beb8aa736adcc2f59893ab855a78579dc8f3 Mon Sep 17 00:00:00 2001 From: james-prysm Date: Tue, 22 Oct 2024 15:15:45 -0500 Subject: [PATCH 2/3] changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 22447bb5f331..702f823aca17 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -34,6 +34,7 @@ The format is based on Keep a Changelog, and this project adheres to Semantic Ve ### Removed - Removed finalized validator index cache, no longer needed. +- Removed some reconnection to EL calls on POW service initiation ### Fixed From ac667c202ff4c326f25e3d0e188607a69e67452f Mon Sep 17 00:00:00 2001 From: james-prysm Date: Wed, 23 Oct 2024 10:06:49 -0500 Subject: [PATCH 3/3] updating based on feedback --- beacon-chain/execution/engine_client.go | 11 +++++++++-- beacon-chain/execution/service.go | 13 +++++++++++-- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/beacon-chain/execution/engine_client.go b/beacon-chain/execution/engine_client.go index 2dfc479f4214..5deea5446b44 100644 --- a/beacon-chain/execution/engine_client.go +++ b/beacon-chain/execution/engine_client.go @@ -13,6 +13,7 @@ import ( gethRPC "github.com/ethereum/go-ethereum/rpc" "github.com/holiman/uint256" "github.com/pkg/errors" + "github.com/prysmaticlabs/prysm/v5/api/client" "github.com/prysmaticlabs/prysm/v5/beacon-chain/execution/types" fieldparams "github.com/prysmaticlabs/prysm/v5/config/fieldparams" "github.com/prysmaticlabs/prysm/v5/config/params" @@ -478,7 +479,10 @@ func (s *Service) ExecutionBlocksByHashes(ctx context.Context, hashes []common.H func (s *Service) HeaderByHash(ctx context.Context, hash common.Hash) (*types.HeaderInfo, error) { var hdr *types.HeaderInfo err := s.rpcClient.CallContext(ctx, &hdr, BlockByHashMethod, hash, false /* no transactions */) - if err == nil && hdr == nil { + if err != nil { + return nil, errors.Wrap(err, client.ErrConnectionIssue.Error()) + } + if hdr == nil { err = ethereum.NotFound } return hdr, err @@ -488,7 +492,10 @@ func (s *Service) HeaderByHash(ctx context.Context, hash common.Hash) (*types.He func (s *Service) HeaderByNumber(ctx context.Context, number *big.Int) (*types.HeaderInfo, error) { var hdr *types.HeaderInfo err := s.rpcClient.CallContext(ctx, &hdr, BlockByNumberMethod, toBlockNumArg(number), false /* no transactions */) - if err == nil && hdr == nil { + if err != nil { + return nil, errors.Wrap(err, client.ErrConnectionIssue.Error()) + } + if hdr == nil { err = ethereum.NotFound } return hdr, err diff --git a/beacon-chain/execution/service.go b/beacon-chain/execution/service.go index e04c2c4477f9..217db2a46359 100644 --- a/beacon-chain/execution/service.go +++ b/beacon-chain/execution/service.go @@ -10,6 +10,7 @@ import ( "reflect" "runtime/debug" "sort" + "strings" "sync" "time" @@ -20,6 +21,7 @@ import ( "github.com/pkg/errors" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/promauto" + "github.com/prysmaticlabs/prysm/v5/api/client" "github.com/prysmaticlabs/prysm/v5/beacon-chain/cache" "github.com/prysmaticlabs/prysm/v5/beacon-chain/cache/depositsnapshot" statefeed "github.com/prysmaticlabs/prysm/v5/beacon-chain/core/feed/state" @@ -506,7 +508,9 @@ func (s *Service) initPOWService() { header, err := s.HeaderByNumber(ctx, nil) if err != nil { err = errors.Wrap(err, "HeaderByNumber") - s.retryExecutionClientConnection(ctx, err) + if strings.Contains(err.Error(), client.ErrConnectionIssue.Error()) { + s.retryExecutionClientConnection(ctx, err) + } errorLogger(err, "Unable to retrieve latest execution client header") continue } @@ -529,6 +533,9 @@ func (s *Service) initPOWService() { // Cache eth1 headers from our voting period. if err := s.cacheHeadersForEth1DataVote(ctx); err != nil { err = errors.Wrap(err, "cacheHeadersForEth1DataVote") + if strings.Contains(err.Error(), client.ErrConnectionIssue.Error()) { + s.retryExecutionClientConnection(ctx, err) + } if errors.Is(err, errBlockTimeTooLate) { log.WithError(err).Debug("Unable to cache headers for execution client votes") } else { @@ -547,7 +554,9 @@ func (s *Service) initPOWService() { genHeader, err := s.HeaderByHash(ctx, genHash) if err != nil { err = errors.Wrapf(err, "HeaderByHash, hash=%#x", genHash) - s.retryExecutionClientConnection(ctx, err) + if strings.Contains(err.Error(), client.ErrConnectionIssue.Error()) { + s.retryExecutionClientConnection(ctx, err) + } errorLogger(err, "Unable to retrieve proof-of-stake genesis block data") continue }