fix: validate response staleness before returning to users#1157
Closed
MoonBoi9001 wants to merge 1 commit intomainfrom
Closed
fix: validate response staleness before returning to users#1157MoonBoi9001 wants to merge 1 commit intomainfrom
MoonBoi9001 wants to merge 1 commit intomainfrom
Conversation
6211938 to
8e01362
Compare
Indexers can self-report being "fresh" via status endpoint while serving stale data. This adds post-response validation of probe_block.timestamp against current time. Changes: - Add ResponseTooStale error variant to UnavailableReason - Add max_response_staleness_seconds config (default: 30 min) - Add gw_stale_responses_rejected metric counter - Add validate_response_staleness() function in client_query - Integrate validation into response handling loop - Treat staleness rejections as failures in performance feedback Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
8e01362 to
dc805e8
Compare
Member
|
We cannot make such assumptions about user preferences for freshness across the board, unfortunately. Luckily, the root cause of the issues this is trying to mitigate is resolved in #1158 |
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.
Motivation
The gateway extracts
probe_blockfrom indexer responses (containing actual block timestamp) but never validates freshness before returning to users. Indexers can self-report being "fresh" via status endpoint while serving data that is months or even years old. This creates a gap where stale data reaches users despite the gateway having the information needed to detect it.Summary
probe_block.timestampagainst current timeChanges
ResponseTooStale { seconds_behind: u64 }error variantmax_response_staleness_secondsconfig option (default: 1800 / 30 min)gw_stale_responses_rejectedcounter metric (labeled by deployment)validate_response_staleness()function that checks probe_block timestampchain.notifyfor stale-rejected responses to prevent stale blocks from distorting chain head andblocks_per_minuteestimates🤖 Generated with Claude Code