-
Notifications
You must be signed in to change notification settings - Fork 135
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
Agent: warn and wait if subgraph is behind the chain head #762
Agent: warn and wait if subgraph is behind the chain head #762
Conversation
fd45a0c
to
fe25da4
Compare
CI results differ between the two previous runs: failed tests in one run have passed in the other. Also, tests passed locally. |
fe25da4
to
10a55a8
Compare
10a55a8
to
16a202d
Compare
Rebased on top of latest |
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.
I'd just warn in the case of the subgraph being ahead of the provider. Otherwise looks great! Feel free to merge once you update that part.
This PR introduces a new class,
SubgraphFreshnessChecker
, designed to continuously retry subgraph queries if the subgraph is significantly behind the latest block in the blockchain. When such a condition is met, a warning will indicate the incident alongside the current block distance from the chain head.Configuration options have been extended both in network specification files and CLI parameters:
maxBlockDistance
: Defines the threshold for subgraph freshness by measuring the distance between the latest indexed block in the subgraph and the most recent block on the network.freshnessSleepMilliseconds
: Specifies the duration to wait before reattempting the query.After monitoring the testnet indexer block distances for an hour, we observed that the block distances for Arbitrum-Goerli typically fall below the 50-block threshold. No such distances were noted in Goerli. Consequently, we have set the default values for
maxBlockDistance
to0
blocks andfreshnessSleepMilliseconds
to5000
.If the Agent or Service utilizes these default settings while operating on Arbitrum networks, a warning will be emitted to inform the user of the potential risk that queries may never be considered fresh.