Limit RewardsUpdated scan to last month - #851
Merged
Merged
Conversation
cyc60
approved these changes
Sep 22, 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.
KeeperContract.get_last_rewards_updatescannedRewardsUpdatedlogs all the way back toKEEPER_GENESIS_BLOCK. Since_get_last_eventwalks chunks newest-first and aborts on the first hit, this is usually cheap, but when no event is found in the recent range it keeps sweeping to genesis.Rewards are updated regularly, so a one-month lookback is enough. This mirrors how v3-oracle does it (
APPROX_BLOCKS_PER_MONTHinsrc/rewards/execution.py):from_block = max(KEEPER_GENESIS_BLOCK, to_block - SECONDS_PER_MONTH // SECONDS_PER_BLOCK), still clamped at the keeper genesis block.Adds
SECONDS_PER_MONTHtosrc/config/settings.py.