Fix issue #548: Ensure consistent block author values #618
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.
Fix issue #548: Ensure consistent block author values
Summary
This PR fixes issue #548 where two indexers with identical configurations but starting from different block heights would produce different
authorvalues in theblockstable for the same blocks.Fixes #548
Problem
When running two indexers with identical configurations but starting from different block heights, the
authorfield in theblockstable would differ for the same blocks. This was caused by the indexer fetching authorities only when they wereNone, which meant indexers starting from different points would use different authority sets.Root Cause
The indexer was caching authorities and only fetching them:
NewSessioneventIf Indexer A started from genesis and Indexer B started from block 250, they would fetch different initial authority sets, leading to different author calculations for the same blocks.
Solution
Modified
chain-indexer/src/infra/subxt_node.rsto always fetch authorities from the specific block being indexed, ensuring that:Changes
File:
chain-indexer/src/infra/subxt_node.rs(lines 231-249)Testing
To verify the fix:
authorvalues in theblockstableImpact
Performance
Minimal impact. Authorities are cached in the Node and fetched only when sessions change (~every 200 blocks).
Backward Compatibility
✅ Fully backward compatible
✅ No database migrations required
✅ No breaking API changes
User Experience
✅ Consistent block author values across all indexers
✅ Reliable data regardless of indexer starting point
Related Issues