Repository navigation
Conversation
get_proof_of_indexing only compared the requested block to the deployment's head. A block below earliest_block_number has had its causality-region digests removed by pruning, so the query at that block returns an incomplete set and ProofOfIndexingFinisher hashes it into a well-formed but wrong POI. Nothing downstream can tell that apart from a correct one — not the operator's other nodes, since they prune the same blocks and agree. Return an error instead, and say which block is the earliest still available. get_public_proof_of_indexing goes through the same path, so it inherits this. A deployment with indexerHints.prune: auto keeps GRAPH_MIN_HISTORY_BLOCKS (default 500, about 100 minutes on mainnet) of history. An allocation that closes after its epoch's start block has been pruned was submitting that wrong value, which has happened in production and been disputed. Signed-off-by: 梁旭 <liangxu.5@bytedance.com>
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
get_proof_of_indexingcompared the requested block to the deployment's head, but never toearliest_block_number. A block below it has had its causality-region digests removed by pruning, so the query at that block returns an incomplete set.ProofOfIndexingFinisherhashes whatever it gets into a well-formed POI, and that value is returned as a normal result.This is worse than an error: nothing downstream can tell the value is wrong. Pruned nodes agree with each other, so cross-checking between an operator's own nodes does not catch it either. It has already produced a disputed POI in production.
get_public_proof_of_indexinggoes through the same function, so it had the same problem.Fix
Refuse to compute a POI for a block below the earliest retained block, and say which block is still available.
The rest of the function is unchanged: a retained block behaves exactly as before, and a block above the head keeps its existing deterministic-failure handling.
Testing
Added
store/test-store/tests/postgres/pruned_poi.rs, which creates a test subgraph, sets its head to 200 and itsearliest_block_numberto 100, then asks for a POI at 120 and at 50.Ok.Without the change, the second case returns a valid-looking 32-byte hash, so the test fails with that hash printed. With it, the call returns the "has been pruned" error.
The test harness needs
THEGRAPH_STORE_POSTGRES_DIESEL_URLpointed at a Postgres 14 instance created with--locale=C, astests/docker-compose.ymldescribes.Out of scope
The
prune: autodefault of 500 blocks is shorter than an epoch on every chain, which is what makes an epoch's start block get pruned before the allocation closes. That needs a per-chain or time-based minimum and is a separate decision, as the issue notes.