fix(chaintracker): retry previous slots on Solana block-not-available…#2254
fix(chaintracker): retry previous slots on Solana block-not-available…#2254
Conversation
Review Summary by QodoAdd Solana block-not-available retry mechanism for skipped slots
WalkthroughsDescription• Add retry mechanism for Solana block-not-available (-32004) errors - Retries up to 5 previous slots when endpoint returns -32004 - Handles skipped slots and propagation delays on Solana/SVM chains • Implement block-not-available detection in both provider and consumer fetchers - Extract response data for error inspection in chain_fetcher.go - Add JSON-RPC error code parsing utility function • Add comprehensive test coverage for error detection and chain identification • Enhance logging for endpoint health tracking and retry attempts Diagramflowchart LR
A["Fetch Block Hash Request"] --> B{"Is Solana Family?"}
B -->|Yes| C["Try Current Block"]
B -->|No| D["Single Attempt"]
C --> E{"Success?"}
E -->|Yes| F["Return Hash"]
E -->|No| G{"Block Not Available -32004?"}
G -->|Yes| H["Retry Previous Slot<br/>Max 5 Retries"]
G -->|No| I["Return Error"]
H --> E
D --> E
F --> J["Result"]
I --> J
File Changes1. protocol/chainlib/chain_fetcher.go
|
Code Review by Qodo
1. LavaFormatWarning missing gofmt spacing
|
ce72aac to
008f163
Compare
008f163 to
8f057c7
Compare
8f057c7 to
527933a
Compare
527933a to
3808812
Compare
3808812 to
aca549b
Compare
aca549b to
bf8de2b
Compare
…2004) Solana slots can be skipped or not yet propagated, causing -32004 errors during block hash fetching. This adds a two-phase retry mechanism for Solana-family chains in both provider and consumer chain fetchers: first, retry the same slot up to 2 times with a 150ms delay (propagation delays); then, fall back to up to 3 previous slots (permanently skipped slots).
bf8de2b to
eecc870
Compare
User description
… (-32004)
Solana slots can be skipped or not yet propagated, causing -32004 errors during block hash fetching. This adds a two-phase retry mechanism for Solana-family chains in both provider and consumer chain fetchers: first, retry the same slot up to 2 times with a 150ms delay (propagation delays); then, fall back to up to 3 previous slots (permanently skipped slots).
Description
Closes: #XXXX
Author Checklist
All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.
I have...
!in the type prefix if API or client breaking changemainbranchReviewers Checklist
All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.
I have...
Generated description
Below is a concise technical summary of the changes proposed in this PR:
Add a Solana-specific two-phase retry around block hash fetchers so that
ChainFetcher.FetchBlockHashByNumand the router’sEndpointChainFetcherfall back to the same slot or recent preceding slots when nodes surface -32004 errors. Tighten endpoint health tracking by makingMarkUnhealthy/ResetHealthreport state transitions and only emit metrics when an endpoint actually changes enabled state.FetchBlockHashWithSolanaRetry, add error classification/tests, and reroute slot fetches through the helper to cover bothChainFetcherand router-level fetchers.Modified files (7)
Latest Contributors(2)
MarkUnhealthy/ResetHealthand only updating smart-router metrics when the enabled state actually flips.Modified files (2)
Latest Contributors(2)