improve(providers): add per-provider delta to quorum-mismatch warn log#1442
Open
droplet-rl wants to merge 1 commit into
Open
improve(providers): add per-provider delta to quorum-mismatch warn log#1442droplet-rl wants to merge 1 commit into
droplet-rl wants to merge 1 commit into
Conversation
The `Some providers mismatched with the quorum result or failed 🚸` warn used
to list which RPC origins disagreed but not what they disagreed about,
forcing operators to guess at the divergence.
Add a `diffRpcResults(method, a, b)` helper in providers/utils.ts that
returns a compact, JSON-safe delta, and thread per-provider deltas into the
existing `logQuorumMismatchOrFailureDetails` as a new `mismatchDetails`
field (origin URL -> delta). Per method:
- eth_getLogs: per-log onlyInA / onlyInB / differing, keyed by
`transactionHash:logIndex`, with per-log `fieldDiffs`. Strips the same
IGNORED_FIELDS the equality check strips. Each bucket capped at 5
entries with a `truncated` counter so payloads stay bounded.
- eth_getBlockByNumber: per-key `{ a, b }` for non-ignored field diffs.
- any other method: path-keyed deep diff (e.g.
`"receipt.logs[0].data": { a, b }`).
`compareRpcResults` is untouched (still returns `boolean`). `send()` is
untouched. Existing log fields (`quorumProviders`, `mismatchedProviders`,
`erroringProviders`) are unchanged — `mismatchDetails` is purely additive
for log consumers.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
c50e092 to
7f71030
Compare
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
Surface the exact source of provider disagreement when the RetryProvider's quorum check fails. The existing
Some providers mismatched with the quorum result or failed 🚸warn only listed which RPC origins disagreed — operators had no signal about what differed. This PR adds a newmismatchDetailsfield to the warn payload mapping each mismatched provider's origin to a compact, JSON-safe delta vs the quorum result.Per method:
eth_getLogs— per-logonlyInA/onlyInB/differing(withfieldDiffs: { field: { a, b } }), keyed bytransactionHash:logIndex. Strips the sameIGNORED_FIELDSthe equality check strips, so noise likeblockTimestampdoesn't show up. Each bucket is capped at 5 entries with atruncatedcounter so payloads stay bounded even when a provider returns thousands of stale logs.eth_getBlockByNumber— per-key{ a, b }for non-ignored fields."receipt.logs[0].data": { a, b }).Scope
Intentionally minimal — small, additive change to a load-bearing component:
compareRpcResultskeeps itsbooleanreturn type. No signature change, no caller updates beyondretryProvider.ts.RetryProvider.sendkeeps its current structure. The new code only adds a per-providergetMismatchDetails(values)helper alongside the existinggetMismatchedProviders(values), and threads the result into the existinglogQuorumMismatchOrFailureDetailscall as one new field.quorumProviders,mismatchedProviders,erroringProviders) are unchanged —mismatchDetailsis purely additive for log consumers.Production code change:
retryProvider.ts+37 / -6,utils.tspurely additive.Performance
eth_getLogs). Fields that are equal don't appear in the output — only divergent ones.Test plan
yarn hardhat test test/providers/utils.test.ts— 16/16 passing (covers ignored-field handling, per-log diffs, truncation, undefined inputs, block-level diffs, generic deep diff, primitive root, type-mismatch).yarn lint-check— clean.zion-across-relayer-primarycarries an actionablemismatchDetailspayload.