Skip to content

Conversation

@arad-starkware
Copy link
Collaborator

@arad-starkware arad-starkware commented Nov 27, 2025

This change is Reviewable


Note

Adds a new BalancesDelayMoreBalanceChangeFlow covering multi-epoch stake/delegation changes around upgrade and registers its mainnet fork test; also prunes an obsolete idea from flow_ideas.md.

  • Flow tests:
    • New BalancesDelayMoreBalanceChangeFlow: Adds a comprehensive flow in src/flow_test/flows.cairo that validates total staking power and STRK/BTC rewards across multiple epochs with additional balance changes pre/post-upgrade, including attestation and delegator/staker reward assertions.
    • Test hook: Registers balances_delay_more_balance_change_flow_test in src/flow_test/fork_test.cairo.
  • Docs:
    • Remove obsolete "k=1 -> k=2 Migration Staker" idea from src/flow_test/flow_ideas.md.

Written by Cursor Bugbot for commit 3c30c03. This will update automatically on new commits. Configure here.

Copy link
Collaborator Author

arad-starkware commented Nov 27, 2025

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.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

@arad-starkware arad-starkware self-assigned this Nov 27, 2025
@arad-starkware arad-starkware marked this pull request as ready for review November 27, 2025 08:59
@arad-starkware arad-starkware force-pushed the arad/test_add_another_balances_delay_flow branch from 29def9f to 13c90aa Compare November 27, 2025 09:28
@arad-starkware arad-starkware force-pushed the arad/test_yet_another_balances_delay_flow branch from 955c4b6 to d4eef5d Compare November 27, 2025 09:28
@arad-starkware arad-starkware force-pushed the arad/test_add_another_balances_delay_flow branch from 13c90aa to db7bd8c Compare November 27, 2025 09:40
@arad-starkware arad-starkware force-pushed the arad/test_yet_another_balances_delay_flow branch 2 times, most recently from a1b33ff to 92ca6e9 Compare November 27, 2025 15:23
@arad-starkware arad-starkware force-pushed the arad/test_add_another_balances_delay_flow branch from db7bd8c to 3f023b2 Compare November 27, 2025 15:23
@arad-starkware arad-starkware force-pushed the arad/test_yet_another_balances_delay_flow branch from 92ca6e9 to 8c226f7 Compare November 27, 2025 15:28
@arad-starkware arad-starkware force-pushed the arad/test_add_another_balances_delay_flow branch from 3f023b2 to b5c1e5a Compare November 27, 2025 15:28
@arad-starkware arad-starkware force-pushed the arad/test_yet_another_balances_delay_flow branch from 8c226f7 to c719119 Compare November 27, 2025 17:11
@arad-starkware arad-starkware force-pushed the arad/test_add_another_balances_delay_flow branch from b5c1e5a to 3023c5c Compare November 27, 2025 17:11
.delegator_claim_rewards(delegator: strk_delegator, pool: strk_pool);
let btc_delegator_rewards = system
.delegator_claim_rewards(delegator: btc_delegator, pool: btc_pool);
assert!(wide_abs_diff(strk_delegator_rewards, expected_strk_pool_rewards) <= 1);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Inconsistent tolerance for STRK delegator rewards assertion

The final STRK delegator rewards assertion uses wide_abs_diff with a tolerance of 1, while all other reward assertions in this flow (including the BTC delegator rewards on the next line) use exact equality. This inconsistency differs from the similar BalancesDelayBalanceChangeFlow which uses exact equality for all delegator reward checks. This suggests a potential rounding issue being masked rather than properly addressed, or an unintended deviation from the established pattern.

Fix in Cursor Fix in Web

@arad-starkware arad-starkware changed the base branch from arad/test_add_another_balances_delay_flow to graphite-base/84 November 27, 2025 17:25
@arad-starkware arad-starkware force-pushed the arad/test_yet_another_balances_delay_flow branch from c719119 to b3861f8 Compare November 27, 2025 17:25
@arad-starkware arad-starkware changed the base branch from graphite-base/84 to arad/test_add_accrue_rewards_across_versions_flow November 27, 2025 17:25
Copy link
Collaborator

@noa-starkware noa-starkware left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 0 of 3 files reviewed, 3 unresolved discussions (waiting on @arad-starkware)


-- commits line 2 at r2:
Rename the PR


src/flow_test/flow_ideas.md line 38 at r2 (raw file):

- staker enter in V2, advance epoch, upgrade to V3, advance epoch, attest,
- staker in V2, update balance staker+update balance pool, upgrade, attest in current epoch, attest in next epoch, attest in next next epoch
- staker in V2, advance epoch, update balance staker+update balance pool, advance epoch, update balance staker+update balance pool, upgrade, update balance staker+update balance pool, attest in current epoch, attest in next epoch, attest in next next epoch

Do you implemented 2 tests or one for both lines?

@arad-starkware arad-starkware changed the base branch from arad/test_add_accrue_rewards_across_versions_flow to graphite-base/84 December 2, 2025 10:31
@arad-starkware arad-starkware changed the title test: yet another balances delay flow test: balances delay flow Dec 2, 2025
@arad-starkware arad-starkware force-pushed the arad/test_yet_another_balances_delay_flow branch from b3861f8 to 947e295 Compare December 2, 2025 10:35
@arad-starkware arad-starkware changed the base branch from graphite-base/84 to arad/test_add_accrue_rewards_across_versions_flow December 2, 2025 10:35
@arad-starkware arad-starkware changed the title test: balances delay flow test: balances Dec 2, 2025
@arad-starkware arad-starkware changed the title test: balances test: add balances delay (more balance changes) flow Dec 2, 2025
Copy link
Collaborator Author

@arad-starkware arad-starkware left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 0 of 3 files reviewed, 1 unresolved discussion (waiting on @arad-starkware and @noa-starkware)


src/flow_test/flow_ideas.md line 38 at r2 (raw file):

Previously, noa-starkware wrote…

Do you implemented 2 tests or one for both lines?

We discussed offline, the second test eclipses the first one, so only the second one is implemented

@arad-starkware arad-starkware force-pushed the arad/test_yet_another_balances_delay_flow branch from 947e295 to 3a74b0a Compare December 2, 2025 10:42
@arad-starkware arad-starkware force-pushed the arad/test_yet_another_balances_delay_flow branch from 3a74b0a to 3c30c03 Compare December 2, 2025 10:47
@arad-starkware arad-starkware force-pushed the arad/test_add_accrue_rewards_across_versions_flow branch from 6303786 to a4c915a Compare December 2, 2025 10:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants