Skip to content

test: add get_stakers switch flow#33

Merged
arad-starkware merged 1 commit intomainfrom
arad/test_add_get_stakers_switch_flow
Nov 20, 2025
Merged

test: add get_stakers switch flow#33
arad-starkware merged 1 commit intomainfrom
arad/test_add_get_stakers_switch_flow

Conversation

@arad-starkware
Copy link
Collaborator

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

This change is Reviewable


Note

Adds a test covering get_stakers behavior when a delegator switches delegation between stakers across epochs, and cleans up flow ideas.

  • Tests:
    • Add get_stakers_switch_delegation_flow_test in flow_test/test.cairo to verify get_stakers weights across epochs during full exit intent and stepwise delegation switches between two stakers.
  • Docs:
    • Trim flow_test/flow_ideas.md by removing the obsolete get_stakers idea section.

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

@arad-starkware arad-starkware self-assigned this Nov 19, 2025
@arad-starkware arad-starkware marked this pull request as ready for review November 19, 2025 13:25
@arad-starkware arad-starkware force-pushed the arad/test_add_get_stakers_increase_stake_flow branch from 8c2a594 to 73eaa21 Compare November 19, 2025 13:27
@arad-starkware arad-starkware force-pushed the arad/test_add_get_stakers_switch_flow branch from 504b9b9 to 86c458f Compare November 19, 2025 13:27
@arad-starkware arad-starkware force-pushed the arad/test_add_get_stakers_increase_stake_flow branch from 73eaa21 to 986b446 Compare November 19, 2025 13:36
@arad-starkware arad-starkware force-pushed the arad/test_add_get_stakers_switch_flow branch from 86c458f to 044ec48 Compare November 19, 2025 13:36
@arad-starkware arad-starkware force-pushed the arad/test_add_get_stakers_increase_stake_flow branch from 986b446 to 494b83c Compare November 19, 2025 13:39
@arad-starkware arad-starkware force-pushed the arad/test_add_get_stakers_switch_flow branch 2 times, most recently from 10b3104 to 896b20e Compare November 19, 2025 13:41
@arad-starkware arad-starkware force-pushed the arad/test_add_get_stakers_increase_stake_flow branch from 494b83c to 7b1c4df Compare November 19, 2025 13:41
@arad-starkware arad-starkware force-pushed the arad/test_add_get_stakers_switch_flow branch from 896b20e to be214f3 Compare November 19, 2025 13:48
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 2 files reviewed, 3 unresolved discussions (waiting on @arad-starkware)


workspace/apps/staking/contracts/src/flow_test/test.cairo line 2418 at r2 (raw file):

/// Test get_stakers.
/// Switch rest of delegation to staker 2.
/// Test get_stakers.

Suggestion:

/// Flow:
/// 2 Stakers stake.
/// Delegate to staker 1.
/// Test get_stakers.
/// Delegator full intent.
/// Test get_stakers.
/// Delegator switch half of delegation to staker 2.
/// Test get_stakers.
/// Delegator switch rest of delegation to staker 2.
/// Test get_stakers.

workspace/apps/staking/contracts/src/flow_test/test.cairo line 2484 at r2 (raw file):

        (
            staker_1.staker.address,
            mul_wide_and_div(lhs: STRK_WEIGHT_FACTOR, rhs: stake_amount, div: stake_amount * 5 / 2)

Suggestion:

stake_amount * 2 + stake_amount / 2

workspace/apps/staking/contracts/src/flow_test/test.cairo line 2491 at r2 (raw file):

            staker_2.staker.address,
            mul_wide_and_div(
                lhs: STRK_WEIGHT_FACTOR, rhs: stake_amount * 3 / 2, div: stake_amount * 5 / 2,

Suggestion:

stake_amount * 2 + stake_amount / 2

@arad-starkware arad-starkware force-pushed the arad/test_add_get_stakers_switch_flow branch from be214f3 to 1bb31ed Compare November 19, 2025 14:15
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 2 files reviewed, 2 unresolved discussions (waiting on @arad-starkware and @noa-starkware)


workspace/apps/staking/contracts/src/flow_test/test.cairo line 2418 at r2 (raw file):

/// Test get_stakers.
/// Switch rest of delegation to staker 2.
/// Test get_stakers.

Done


workspace/apps/staking/contracts/src/flow_test/test.cairo line 2484 at r2 (raw file):

        (
            staker_1.staker.address,
            mul_wide_and_div(lhs: STRK_WEIGHT_FACTOR, rhs: stake_amount, div: stake_amount * 5 / 2)

I'd rather leave it as is


workspace/apps/staking/contracts/src/flow_test/test.cairo line 2491 at r2 (raw file):

            staker_2.staker.address,
            mul_wide_and_div(
                lhs: STRK_WEIGHT_FACTOR, rhs: stake_amount * 3 / 2, div: stake_amount * 5 / 2,

same

@arad-starkware arad-starkware force-pushed the arad/test_add_get_stakers_increase_stake_flow branch from 7b1c4df to 1ee509f Compare November 19, 2025 14:27
@arad-starkware arad-starkware force-pushed the arad/test_add_get_stakers_switch_flow branch 2 times, most recently from c37d705 to b4bf2cf Compare November 19, 2025 14:29
@arad-starkware arad-starkware force-pushed the arad/test_add_get_stakers_increase_stake_flow branch from 1ee509f to c409301 Compare November 19, 2025 14:29
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.

:lgtm:

Reviewable status: 0 of 2 files reviewed, all discussions resolved (waiting on @arad-starkware)

@arad-starkware arad-starkware force-pushed the arad/test_add_get_stakers_increase_stake_flow branch from c409301 to c265e2e Compare November 20, 2025 08:15
@arad-starkware arad-starkware force-pushed the arad/test_add_get_stakers_switch_flow branch 2 times, most recently from 4cd417a to 2337137 Compare November 20, 2025 08:17
@arad-starkware arad-starkware force-pushed the arad/test_add_get_stakers_increase_stake_flow branch 2 times, most recently from 1908dd3 to c428848 Compare November 20, 2025 08:20
@arad-starkware arad-starkware force-pushed the arad/test_add_get_stakers_switch_flow branch from 2337137 to 8d9378d Compare November 20, 2025 08:20
@arad-starkware arad-starkware force-pushed the arad/test_add_get_stakers_increase_stake_flow branch from c428848 to 93ede53 Compare November 20, 2025 08:28
@arad-starkware arad-starkware force-pushed the arad/test_add_get_stakers_switch_flow branch 2 times, most recently from c42088b to 9da15c6 Compare November 20, 2025 08:31
@arad-starkware arad-starkware force-pushed the arad/test_add_get_stakers_increase_stake_flow branch from 93ede53 to cc0c679 Compare November 20, 2025 08:32
@arad-starkware arad-starkware force-pushed the arad/test_add_get_stakers_switch_flow branch from 9da15c6 to 88f4f8b Compare November 20, 2025 09:40
@arad-starkware arad-starkware force-pushed the arad/test_add_get_stakers_increase_stake_flow branch from cc0c679 to 920d336 Compare November 20, 2025 09:40
@arad-starkware arad-starkware force-pushed the arad/test_add_get_stakers_switch_flow branch from 88f4f8b to 928b0df Compare November 20, 2025 09:50
@arad-starkware arad-starkware force-pushed the arad/test_add_get_stakers_increase_stake_flow branch 2 times, most recently from 9a7c1ae to 280e737 Compare November 20, 2025 11:02
@arad-starkware arad-starkware force-pushed the arad/test_add_get_stakers_switch_flow branch from 928b0df to 2e3484c Compare November 20, 2025 11:03
@arad-starkware arad-starkware force-pushed the arad/test_add_get_stakers_increase_stake_flow branch 2 times, most recently from 323336e to 72468ce Compare November 20, 2025 11:07
@arad-starkware arad-starkware force-pushed the arad/test_add_get_stakers_switch_flow branch from 2e3484c to 8eac940 Compare November 20, 2025 11:07
@arad-starkware arad-starkware changed the base branch from arad/test_add_get_stakers_increase_stake_flow to graphite-base/33 November 20, 2025 11:12
@arad-starkware arad-starkware force-pushed the arad/test_add_get_stakers_switch_flow branch from 8eac940 to 6f24aa1 Compare November 20, 2025 11:13
@graphite-app graphite-app bot changed the base branch from graphite-base/33 to main November 20, 2025 11:13
@arad-starkware arad-starkware force-pushed the arad/test_add_get_stakers_switch_flow branch from 6f24aa1 to 003bd3c Compare November 20, 2025 11:13
@codecov
Copy link

codecov bot commented Nov 20, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.53%. Comparing base (a28d60e) to head (003bd3c).
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #33      +/-   ##
==========================================
+ Coverage   95.43%   95.53%   +0.09%     
==========================================
  Files          45       45              
  Lines        9446     9657     +211     
==========================================
+ Hits         9015     9226     +211     
  Misses        431      431              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@arad-starkware arad-starkware merged commit fc48614 into main Nov 20, 2025
6 of 7 checks passed
Copy link
Collaborator Author

Merge activity

@arad-starkware arad-starkware deleted the arad/test_add_get_stakers_switch_flow branch November 20, 2025 11:19
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.

2 participants