feat: calculate block rewards by timestamp#66
Merged
Conversation
noa-starkware
force-pushed
the
noa/staking/v3/update_current_epoch_block_rewards
branch
from
November 27, 2025 20:50
deb5f00 to
6fda82c
Compare
noa-starkware
force-pushed
the
noa/staking/v3/calculate-block-rewards
branch
3 times, most recently
from
November 30, 2025 08:44
b6dd1db to
313688c
Compare
remollemo
approved these changes
Mar 12, 2026
remollemo
left a comment
Contributor
There was a problem hiding this comment.
@remollemo reviewed 7 files and all commit messages, and made 1 comment.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on NirLevi-starkware).
Base automatically changed from
noa/staking/v3/update_current_epoch_block_rewards
to
main
March 12, 2026 16:21
noa-starkware
force-pushed
the
noa/staking/v3/calculate-block-rewards
branch
2 times, most recently
from
March 12, 2026 16:39
fa8c27c to
1adf198
Compare
noa-starkware
enabled auto-merge (squash)
March 12, 2026 16:39
noa-starkware
force-pushed
the
noa/staking/v3/calculate-block-rewards
branch
from
March 17, 2026 20:44
1adf198 to
76687b8
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #66 +/- ##
=======================================
Coverage 95.78% 95.78%
=======================================
Files 42 42
Lines 10295 10299 +4
=======================================
+ Hits 9861 9865 +4
Misses 434 434 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
This change is
Note
High Risk
Changes core reward distribution by caching per-epoch block rewards and sourcing them from timestamp-based avg block duration via
RewardSupplier; mistakes could misprice rewards across epochs or break reward updates if epoch transitions aren’t handled correctly.Overview
Block reward calculation is changed to be timestamp-based and epoch-cached.
Stakingnow storeslast_calculated_epochandblock_rewards, andupdate_rewardscallscalculate_block_rewards(..., curr_epoch)which refreshes rewards only once per epoch by invokingRewardSupplier.update_current_epoch_block_rewards().Test utilities and flow/tests are updated to advance both block number and timestamp (
advance_blocks) and to compute expected V3 rewards directly from the minting curve using an average block duration (instead of dividing epoch rewards by epoch length). The V3 replaceability upgrade flow now also upgrades theRewardSupplierimplementation.Written by Cursor Bugbot for commit 76687b8. This will update automatically on new commits. Configure here.