Repository navigation
store: Refuse a POI for a block below the earliest block - #6764
Open
dimitrovmaksim wants to merge 1 commit into
Open
dimitrovmaksim wants to merge 1 commit into
dimitrovmaksim wants to merge 1 commit into
Conversation
get_proof_of_indexing only checked the block against the subgraph head. For a pruned block the Poi$ query returned an incomplete set of digests, which were hashed into a well-formed but wrong POI. Return an error when the queried block is below earliest_block_number, checked after the query since pruning raises earliest_block_number before deleting rows. Fixes #6751
This branch has not been deployed
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.
Fixes #6751
Problem
DeploymentStore::get_proof_of_indexingonly checked the requested block against the subgraph head. For a block belowearliest_block_number, pruning has removedPoi$versions, so the query returned an incomplete set of causality-region digests.ProofOfIndexingFinisherhashed them into a well-formed but wrong POI, returned as a normal result.publicProofsOfIndexinggoes through the same function.Fix
After querying
Poi$, readearliest_block_numberand return an error if the queried block is below it. The error text is the one GraphQL queries already return for this case (DeploymentState::block_queryable).The check runs after the query on purpose. Pruning commits the new
earliest_block_numberbefore it deletes any rows, so if the query saw deleted rows, the read that follows sees the raised earliest block. A check before the query leaves a window where a prune commits between the check and the query. A comment indo_prunerecords the ordering this relies on.Behaviour changes
proofOfIndexingandpublicProofsOfIndexingreturnnullinstead of a wrong POI.earliest_block_numberstarts atstartBlock - 1, so blocks below it now also returnnull, on deployments that were never pruned too. Before, they returned a POI hashed from an emptyPoi$set. Both cases are treated the same way: the store has no data for the block. This matchesDeploymentState::block_queryableand needs no new state.null: the index-node resolver logs store errors and returnsnull, as it already does for a block above the head. The reason and the earliest block are in the graph-node log; the earliest block is also available asindexingStatuses { chains { earliestBlock } }.Operator note
With
indexerHints.prune: auto, a deployment keepsGRAPH_MIN_HISTORY_BLOCKSblocks of history (default2 * ETHEREUM_REORG_THRESHOLD= 500), and pruning runs once that is exceeded byGRAPH_STORE_HISTORY_SLACK_FACTOR(default 1.2). That is shorter than an epoch on every chain. Once the current epoch's start block has been pruned, graph-node now returnsnull, and indexer-agent refuses a normal allocation close with IE067 ("POI not available for deployment at current epoch start block"). Before this change it submitted a wrong POI that could be disputed.To keep closing allocations normally, retain at least one epoch of history for the chain: raise
GRAPH_MIN_HISTORY_BLOCKS, or set it per deployment withgraphman prune set.Tests
graft::prune: after a real prune (Rebuild and Delete strategies) moves the earliest block to 3, a POI at block 2 is an error naming block 3, and block 3 still returns a POI.graft::poi_below_start_block: a deployment created with a start block hasearliest_block_numberequal to it; a POI below it is an error, and at it returns a POI.Both tests fail without the fix: the store returns
Some(..)for the lower block.