Skip to content
Open
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
13 changes: 8 additions & 5 deletions node/types/retryable_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@ const (
DiscontinuousBlockError = "discontinuous block number"

// Geth connection retry settings
GethRetryAttempts = 60 // max retry attempts
GethRetryInterval = 5 * time.Second // interval between retries
GethRetryAttempts = 60 // max retry attempts
GethRetryInterval = 5 * time.Second // interval between retries
GethRetryMaxElapsedTime = 30 * time.Minute
Comment on lines +34 to +36
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

This still leaves the startup retry path capped at 5 minutes.

FetchGethConfigWithRetry is still bounded by GethRetryAttempts * GethRetryInterval (60 * 5s), so boot-time geth readiness will continue to fail after ~5 minutes even though this PR introduces a 30-minute retry window. If the goal is to tolerate slower geth bring-up, please derive that loop from GethRetryMaxElapsedTime or move it onto the same backoff policy.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@node/types/retryable_client.go` around lines 34 - 36,
FetchGethConfigWithRetry still uses a fixed loop based on GethRetryAttempts and
GethRetryInterval (60 * 5s ≈ 5 minutes) so startup is capped at ~5 minutes;
change FetchGethConfigWithRetry to honor GethRetryMaxElapsedTime instead (or
reuse the same backoff policy used elsewhere) by looping until elapsed time >=
GethRetryMaxElapsedTime or using the existing backoff/RetryWithBackoff helper,
replacing the fixed attempt/count check with a time-based check that references
GethRetryMaxElapsedTime (and keep GethRetryInterval as the sleep between
attempts).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The DefaultMaxElapsedTime is 15 * time.Minute. Why do we need to change RetryableClient.b's max elapsed time to 30 minutes via GethRetryMaxElapsedTime?

)

// configResponse represents the eth_config RPC response (EIP-7910)
Expand Down Expand Up @@ -156,7 +157,9 @@ func (rc *RetryableClient) MPTForkTime() uint64 {
// The switchTime should be fetched via FetchGethConfig before calling this function.
func NewRetryableClient(authClient *authclient.Client, ethClient *ethclient.Client, nextAuthClient *authclient.Client, nextEthClient *ethclient.Client, switchTime uint64, logger tmlog.Logger) *RetryableClient {
logger = logger.With("module", "retryClient")

// set MaxElapsedTime to 30 min
bo := backoff.NewExponentialBackOff()
bo.MaxElapsedTime = GethRetryMaxElapsedTime
// If next client is not configured, disable switch
if nextAuthClient == nil || nextEthClient == nil {
logger.Info("L2Next client not configured, switch disabled")
Expand All @@ -166,7 +169,7 @@ func NewRetryableClient(authClient *authclient.Client, ethClient *ethclient.Clie
nextAuthClient: authClient, // fallback to current
nextEthClient: ethClient, // fallback to current
switchTime: switchTime,
b: backoff.NewExponentialBackOff(),
b: bo,
logger: logger,
}
}
Expand All @@ -188,7 +191,7 @@ func NewRetryableClient(authClient *authclient.Client, ethClient *ethclient.Clie
nextAuthClient: nextAuthClient,
nextEthClient: nextEthClient,
switchTime: switchTime,
b: backoff.NewExponentialBackOff(),
b: bo,
logger: logger,
}

Expand Down
Loading