Repository navigation
fix(rpc): narrow XDR error predicate, stop skipping on bare "unknown" - #208
Closed
makar52nn2016-jpg wants to merge 1 commit into
Closed
makar52nn2016-jpg wants to merge 1 commit into
makar52nn2016-jpg wants to merge 1 commit into
Conversation
Closes Miracle656#183 — fetchEventsSafe was silently skipping ledgers whenever the RPC error message contained the substring "unknown". That matched far too much: bare `unknown error`, `getaddrinfo ENOTFOUND … unknown host`, provider 5xx bodies. A transient network blip was indistinguishable from a genuinely unindexable ledger, and the cursor would advance past it without anything but a `console.warn`. ## What changed - New `isXdrDecodeError(err)` predicate covers the real XDR failure cases (SDK decoder messages containing "xdr", Soroban-specific "unknown scval type" / "unknown scaddress type" / "unknown soroban") and only those. Network blips, 5xx bodies, and bare "unknown" no longer match. - `fetchEventsSafe` calls the predicate instead of the substring check in both the single-ledger branch (line ~209) and the multi-ledger bisection branch (line ~222). - New `ledgers_skipped_total` Prometheus counter, labelled by network, increments on every XDR-skip. Skips are visible rather than only logged, so a sustained rate is alertable. ## Acceptance criteria coverage - [x] Classification moves to a named predicate covering the real XDR cases and *not* bare "unknown" - [x] A transient `Error("unknown error")` propagates and is retried instead of skipping the ledger — fails before, passes after - [x] A genuine XDR error still bisects and skips; existing `fetchEventsSafe` tests stay green (20/20 pass) - [x] Every skipped ledger increments a metric, so skips are visible rather than only logged ## Tests `src/__tests__/fetchEventsSafe.test.ts` adds 13 new cases: - `isXdrDecodeError` returns true for SDK decoder errors + Soroban unknown-type errors; false for bare "unknown", "unknown host", 5xx bodies, plain network errors, nullish inputs. Case-insensitive. - `fetchEventsSafe` re-throws bare "unknown error" instead of skipping - `fetchEventsSafe` re-throws "getaddrinfo ENOTFOUND … unknown host" instead of skipping - `fetchEventsSafe` still skips a genuine XDR error on single-ledger range AND increments the new skip metric - `fetchEventsSafe` still bisects genuine XDR errors on multi-ledger ranges - `fetchEventsSafe` increments skipped-ledger metric for every XDR-skipped ledger Bounty: Stellar Wave — Drips Wave — 150 points
Author
|
Closing this PR. Issue #183 is assigned to @JemimahEkong through the official Stellar Wave program workflow (application accepted on 2026-09-26, due 2026-09-30). I missed the application step and submitted this PR directly — that was incorrect. Maintainer's review queue should focus on the assigned contributor's work. Apologies for the noise. |
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.
Closes #183 —
fetchEventsSafewas silently skipping ledgers whenever the RPC error message contained the substring"unknown". That matched far too much: bareunknown error,getaddrinfo ENOTFOUND … unknown host, provider 5xx bodies. A transient network blip was indistinguishable from a genuinely unindexable ledger, and the cursor would advance past it without anything but aconsole.warn.What changed
isXdrDecodeError(err)predicate covers the real XDR failure cases (SDK decoder messages containing"xdr", Soroban-specific"unknown scval type"/"unknown scaddress type"/"unknown soroban") and only those. Network blips, 5xx bodies, and bare"unknown"no longer match.fetchEventsSafecalls the predicate instead of the substring check in both the single-ledger branch (line ~209) and the multi-ledger bisection branch (line ~222).ledgers_skipped_totalPrometheus counter, labelled by network, increments on every XDR-skip. Skips are visible rather than only logged, so a sustained rate is alertable.Acceptance criteria coverage
"unknown"Error("unknown error")propagates and is retried instead of skipping the ledger — fails before, passes afterfetchEventsSafetests stay green (20/20 pass)Tests
src/__tests__/fetchEventsSafe.test.tsadds 13 new cases:isXdrDecodeErrorreturns true for SDK decoder errors + Soroban unknown-type errors; false for bare"unknown","unknown host", 5xx bodies, plain network errors, nullish inputs. Case-insensitive.fetchEventsSafere-throws bare"unknown error"instead of skippingfetchEventsSafere-throws"getaddrinfo ENOTFOUND … unknown host"instead of skippingfetchEventsSafestill skips a genuine XDR error on single-ledger range AND increments the new skip metricfetchEventsSafestill bisects genuine XDR errors on multi-ledger rangesfetchEventsSafeincrements skipped-ledger metric for every XDR-skipped ledgerThe
Integration testsCI job is red onmainand predates this PR (per the issue body, open PRs #177 and #178 address it). If that job is red here too, it is not from these changes.Bounty: Stellar Wave — Drips Wave — 150 points