-
Notifications
You must be signed in to change notification settings - Fork 74
fix(retryClient): stop retry newL2BlockV2 when this block is already known #1041
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -36,6 +36,7 @@ const ( | |
| // always fail and only delay error surfacing to the consensus layer. | ||
| BlockHashMismatchError = "block hash mismatch" | ||
| InvalidNextL1MsgIndexError = "invalid block.NextL1MsgIndex" | ||
| BlockAlreadyKnownError = "block already known" | ||
|
|
||
| // Geth connection retry settings | ||
| GethRetryAttempts = 60 // max retry attempts | ||
|
|
@@ -296,7 +297,8 @@ func retryableError(err error) bool { | |
| !strings.Contains(msg, WrongBlockNumberError) && | ||
| !strings.Contains(msg, ParentNotFoundError) && | ||
| !strings.Contains(msg, BlockHashMismatchError) && | ||
| !strings.Contains(msg, InvalidNextL1MsgIndexError) | ||
| !strings.Contains(msg, InvalidNextL1MsgIndexError) && | ||
| !strings.Contains(msg, BlockAlreadyKnownError) | ||
|
Comment on lines
+300
to
+301
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win 🔎 Supported by static analysis🏁 Script executed: #!/bin/bash
set -euo pipefail
rg -n -C 14 \
'\bretryableError\(|\bNewL2Block\(|\bNewL2BlockV2\(|\bAssembleL2BlockV2\(' \
node --glob '*.go'Repository: morph-l2/morph Length of output: 28688 🏁 Script executed: #!/bin/bash
set -euo pipefail
printf '%s\n' '--- retryable client definitions and error constants ---'
sed -n '1,45p;265,330p' node/types/retryable_client.go
rg -n -C 10 \
'BlockAlreadyKnownError|NewL2BlockV2|AssembleL2BlockV2|ApplyBlockV2' \
node --glob '*.go' --glob '!types/retryable_client.go'Repository: morph-l2/morph Length of output: 15600 🏁 Script executed: #!/bin/bash
set -euo pipefail
printf '%s\n' '--- bound authclient implementations and response semantics ---'
rg -n -C 12 \
'func \(.*\) (NewL2Block|NewL2BlockV2|AssembleL2BlockV2)\b|block already known|BlockAlreadyKnown' \
. --glob '*.go' --glob '!node/types/retryable_client.go'Repository: morph-l2/morph Length of output: 1660 🌐 Web query:
💡 Result: The error message "block already known" in the context of the morph-l2/go-ethereum repository typically indicates that an attempt is being made to import or process a block that already exists in the node's local database [1][2][3]. In the specific context of the authclient and the NewL2BlockV2 method (introduced in Morph's go-ethereum for sequencer and L2 block management), this error occurs when the consensus engine or the RPC caller attempts to add a block that is already present in the local chain [4]. Because morph-l2/go-ethereum is a fork of go-ethereum, it inherits standard Geth error handling, where ErrKnownBlock (defined as "block already known") is triggered by the core block validator or database layer when a block with the same hash and number has already been stored [1][2]. If you are encountering this error when using NewL2BlockV2: 1. It may indicate that the block has already been successfully processed and committed to the chain by a previous request. 2. It could be triggered during rapid re-syncing or if the sequencer is receiving duplicate submission requests. 3. In the context of NewL2BlockV2 specifically, the implementation includes logic to verify, process, and commit blocks [4]; if the block's hash is found in the local database during this process, the operation will be rejected to prevent duplicate state updates [2]. For developers, checking the node logs for the specific block hash and ensuring your sequencer or client is not sending redundant submissions is the recommended approach for debugging [4]. Citations:
Scope 🤖 Prompt for AI Agents |
||
| } | ||
|
|
||
| // ============================================================================ | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
Repository: morph-l2/morph
Length of output: 2387
🏁 Script executed:
Repository: morph-l2/morph
Length of output: 13625
🏁 Script executed:
Repository: morph-l2/morph
Length of output: 1651
🏁 Script executed:
Repository: morph-l2/morph
Length of output: 194
🏁 Script executed:
Repository: morph-l2/morph
Length of output: 3612
🏁 Script executed:
Repository: morph-l2/morph
Length of output: 21633
🏁 Script executed:
Repository: morph-l2/morph
Length of output: 5836
Return
falsefor"block already known".types.RetryableClient.NewL2BlockV2returns this non-retryable error, butApplyBlockV2treats it as success and returnstrue. This differs from the existing same-hash path, which returnsfalse, nil. Returnfalse, nilsoappliedremains consistent.🤖 Prompt for AI Agents