Refactor block range calculations for token and exchange events in Transfer/TransferApproval indexers#1768
Merged
YoshihitoAso merged 1 commit intodev-26.3from Feb 25, 2026
Conversation
Coverage Report •
|
|||||||||||||||||||||||||||||||||||||||||||||
61c70ba to
5af3db5
Compare
YoshihitoAso
approved these changes
Feb 25, 2026
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.
📌 Description
This pull request refactors and improves the logic for determining the starting block (
fromBlock) when querying blockchain logs for both token and exchange events in theindexer_Transfer.pyandindexer_TransferApproval.pyfiles. The main goal is to ensure that log queries start from the correct minimum block for each target, preventing redundant or missed log retrievals, while also simplifying the code structure.✅ Related Issues
🔄 Changes
1. Improved Minimum Block Calculation Logic
__calculate_minimum_from_block_for_targets,__calculate_minimum_from_block_for_token_targets, and__calculate_minimum_from_block_for_exchange_targets) to accurately determine the minimumfromBlockfor log queries based on per-target cursors or skip blocks, replacing the previous approach of using a singleoldest_block_fromvalue.2. Refactored Mapping of Targets and Decoders
target_by_address) that stores tuples of (target, event_decoder), eliminating the need for separate decoder dictionaries and reducing redundant lookups.📌 Checklist