test: add disable_rewards intermittently flow#91
Conversation
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
| staking_contract: system.staking.address, | ||
| minting_curve_contract: system.minting_curve.address, | ||
| ); | ||
| assert!(rewards == expected_rewards); |
There was a problem hiding this comment.
Bug: Missing non-zero assertion could mask broken rewards
The test assertion assert!(rewards == expected_rewards) lacks the sanity check assert!(expected_rewards.is_non_zero()) that exists in the similar test update_rewards_disable_rewards_consensus_rewards_flow_test (lines 2880-2881). The test's purpose is to verify that exactly one block's worth of rewards is given when disable_rewards: false is called. Without the non-zero check, if both values were unexpectedly zero due to a bug in the rewards calculation, the equality assertion would still pass, masking a failure in the rewards mechanism.
5b321b5 to
fec770a
Compare
2cd8a0c to
486ac4d
Compare
fec770a to
eb46cf8
Compare
486ac4d to
bdb1849
Compare
noa-starkware
left a comment
There was a problem hiding this comment.
Reviewable status: 0 of 2 files reviewed, 2 unresolved discussions (waiting on @arad-starkware)
src/flow_test/test.cairo line 3841 at r2 (raw file):
/// update rewards with disable_rewards = false. /// Advance block. /// update rewards with disable_rewards = true.
Can you add one with false again here?
eb46cf8 to
feac4a7
Compare
bdb1849 to
4dcf4e2
Compare
feac4a7 to
7670413
Compare

This change is
Note
Adds RewardSupplier EIC and block duration configuration (with clamped avg block time) and caches per-epoch block rewards in Staking; updates tests and docs accordingly.
RewardSupplierEICinitializingavg_block_durationandBlockDurationConfigwith validations.IRewardSupplierConfig(set_block_duration_config) and viewget_block_duration_config; new errors (INVALID_*, etc.).min_block_durationandmax_block_duration; sets sensible defaults.last_calculated_epochand cachedblock_rewards;calculate_block_rewardsnow updates/reads per-epoch viaupdate_current_epoch_block_rewards.set_consensus_rewards_first_epochinitializes block rewards and tracking.disable_rewards).advance_blocks, block-reward calculators, and reward supplier upgrade helpers; replaces direct block advances.get_block_duration_config,set_block_duration_config,BlockDurationConfig, andINVALID_MIN_MAX_BLOCK_DURATION.starkware-starknet-utilsrevision.Written by Cursor Bugbot for commit 7670413. This will update automatically on new commits. Configure here.