feat(interop): make autorelay retries + backoff configurable, fix dead retry path - #421
Open
abhicris wants to merge 1 commit into
Open
feat(interop): make autorelay retries + backoff configurable, fix dead retry path#421abhicris wants to merge 1 commit into
abhicris wants to merge 1 commit into
Conversation
…d retry path relayMessageWithRetry was always called with maxRetries=1 at both call sites in interop/relayer.go (lines 121, 188), so the exponential backoff in the retry loop was dead code and any single transient destination-chain RPC failure dropped a cross-chain message permanently. This patch: - Adds --interop.autorelay.retries (default 3) and --interop.autorelay.retry.backoff.max (default 8s) flags, plumbed through CLIConfig. - Threads them into NewL2ToL2MessageRelayer(logger, maxRetries, backoffMax) so the indexer-driven and waiting-pool relay paths both use r.maxRetries. - Caps the time.Sleep(1<<attempt) backoff at retryBackoffMax to prevent unbounded sleep on long retry counts. - Defaults are conservative (3 attempts, 8s cap) so existing users see improved liveness on transient RPC blips without behavioral surprise. Setting --interop.autorelay.retries=1 reproduces the prior no-retry behavior. Refs ethereum-optimism#291 (autorelay flake).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
relayMessageWithRetrywas always called withmaxRetries=1at both call sites ininterop/relayer.go(today's lines 121, 188), so the exponential backoff inside the retry loop was dead code and any single transient destination-chain RPC failure dropped a cross-chain message permanently. This PR makes the retry behavior real and configurable.Changes
--interop.autorelay.retries(default3) — max relay attempts per message before giving up. Set to1to reproduce the prior no-retry behavior.--interop.autorelay.retry.backoff.max(default8s) — caps the1<<attemptexponential backoff so high retry counts don't trigger unbounded sleeps.NewL2ToL2MessageRelayer(logger, maxRetries, retryBackoffMax)signature now accepts the new parameters; orchestrator passes them through fromCLIConfig.relayMessageWithRetry(..., 1)) now passr.maxRetries.relayMessageWithRetrycaps each backoff atretryBackoffMax(when > 0).The defaults (3 attempts, 8s cap) are conservative — users get improved liveness against transient RPC blips with no surprise; downstream tests that depend on the no-retry behavior can opt out.
Why
Refs #291 ("Supersim autorelay flakes"). The
Promise#dispatchCallbacksand waiting-pool retry paths both relied onrelayMessageWithRetryto absorb transient errors, but the hardcoded1meant the retry loop never iterated. Local repro: any transienteth_sendTransactionfailure (port contention, mempool full, restarted Anvil) would drop the cross-chain message and leak the waiting-pool entry.Compatibility
NewL2ToL2MessageRelayeris internal — onlyorchestrator.NewOrchestratorcalls it, updated in this PR. No exported API removed.--interop.autorelay.retries=1.maxRetries <= 0is normalized to1to keep the loop body running at least once.Test plan
go build ./...go vet ./...go test -run TestL2ToL2Message -count 1 ./interop/...(passes;interoppackage OK in 0.985s)This PR intentionally stays mechanical (config + dead-code revival) and does not also try to fix the
InvalidTimestamprace in #291 — that's a separate concern that should ride a dedicated PR so the two changes can be evaluated independently.