Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

removing unnecessary reconnections to el #14567

Draft
wants to merge 5 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,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

Expand Down
11 changes: 9 additions & 2 deletions beacon-chain/execution/engine_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
15 changes: 11 additions & 4 deletions beacon-chain/execution/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"reflect"
"runtime/debug"
"sort"
"strings"
"sync"
"time"

Expand All @@ -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"
Expand Down Expand Up @@ -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
}
Expand All @@ -529,7 +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")
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 {
Expand All @@ -548,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
}
Expand All @@ -557,7 +565,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
}
Expand Down
Loading