diff --git a/CHANGELOG.md b/CHANGELOG.md index 22acddd53ed..d74f49c1a74 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -40,6 +40,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 diff --git a/beacon-chain/execution/engine_client.go b/beacon-chain/execution/engine_client.go index 6acb0eafd7d..20f51a9a108 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" "github.com/prysmaticlabs/prysm/v5/beacon-chain/verification" fieldparams "github.com/prysmaticlabs/prysm/v5/config/fieldparams" @@ -481,7 +482,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 @@ -491,7 +495,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 41dbfdb5dcd..e654b76e6e1 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" @@ -519,7 +521,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 } @@ -542,7 +546,9 @@ 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 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 { @@ -561,7 +567,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 } @@ -570,7 +578,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 }