Skip to content

test: add update_rewards strk pool flow#46

Merged
arad-starkware merged 1 commit intomainfrom
arad/test_add_update_rewards_strk_pool_flow
Nov 24, 2025
Merged

test: add update_rewards strk pool flow#46
arad-starkware merged 1 commit intomainfrom
arad/test_add_update_rewards_strk_pool_flow

Conversation

@arad-starkware
Copy link
Collaborator

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

This change is Reviewable


Note

Adds a flow test for update_rewards with a STRK pool under consensus rewards and a start_consensus_rewards helper; updates flow ideas.

  • Tests:
    • Add update_rewards_strk_pool_flow_test in src/flow_test/test.cairo to validate staker rewards post-update_rewards and delegator rewards after next epoch under consensus STRK pool.
  • Utilities:
    • Add SystemState.start_consensus_rewards() in src/flow_test/utils.cairo to set consensus_rewards_first_epoch and advance K epochs.
  • Docs:
    • Update src/flow_test/flow_ideas.md by removing STRK-only pool case from update_rewards ideas.

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

@arad-starkware arad-starkware marked this pull request as ready for review November 20, 2025 14:59
Copy link
Collaborator Author

arad-starkware commented Nov 20, 2025

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

@codecov
Copy link

codecov bot commented Nov 20, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.61%. Comparing base (a28d60e) to head (5b22f3d).
⚠️ Report is 14 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #46      +/-   ##
==========================================
+ Coverage   95.43%   95.61%   +0.17%     
==========================================
  Files          45       45              
  Lines        9446     9806     +360     
==========================================
+ Hits         9015     9376     +361     
+ Misses        431      430       -1     

☔ 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 force-pushed the arad/test_add_update_rewards_strk_pool_flow branch from a8941d5 to d077709 Compare November 23, 2025 07:30
@arad-starkware arad-starkware changed the base branch from main to graphite-base/46 November 23, 2025 09:33
@arad-starkware arad-starkware force-pushed the arad/test_add_update_rewards_strk_pool_flow branch from d077709 to 15ddf08 Compare November 23, 2025 09:33
@arad-starkware arad-starkware changed the base branch from graphite-base/46 to arad/test_add_disable_rewards_flow November 23, 2025 09:33
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, 4 unresolved discussions (waiting on @arad-starkware)


src/flow_test/utils.cairo line 1525 at r2 (raw file):

        self.set_consensus_rewards_first_epoch(:epoch_id);
        self.advance_k_epochs();
    }

different trait?

Code quote:

    fn start_consensus_rewards(self: SystemState) {
        let epoch_id = self.staking.get_current_epoch() + K.into();
        self.set_consensus_rewards_first_epoch(:epoch_id);
        self.advance_k_epochs();
    }

src/flow_test/test.cairo line 2762 at r2 (raw file):

/// Flow:
/// Start consensus rewards.
/// Staker stake with STRK pool.

Is it the same behavior with empty BTC pool? Do we want to test that?


src/flow_test/test.cairo line 2767 at r2 (raw file):

/// update_rewards.
/// Test staker rewards.
/// Test delegator rewards.

Unnecessary IMO

Code quote:

Test delegator rewards.

src/flow_test/test.cairo line 2795 at r2 (raw file):

    );
    let staker_rewards = system.staker_claim_rewards(:staker);
    let delegator_rewards = system.delegator_claim_rewards(:delegator, :pool);

Unnecessary

@arad-starkware arad-starkware force-pushed the arad/test_add_disable_rewards_flow branch from a8d6962 to 1ca1905 Compare November 23, 2025 15:01
@arad-starkware arad-starkware force-pushed the arad/test_add_update_rewards_strk_pool_flow branch from 15ddf08 to 0b4b53b Compare November 23, 2025 15:01
@arad-starkware arad-starkware force-pushed the arad/test_add_disable_rewards_flow branch from 1ca1905 to 7de0c7c Compare November 23, 2025 15:44
@arad-starkware arad-starkware force-pushed the arad/test_add_update_rewards_strk_pool_flow branch 2 times, most recently from 5f1b470 to 636625a Compare November 23, 2025 15:49
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, 4 unresolved discussions (waiting on @noa-starkware)


src/flow_test/test.cairo line 2762 at r2 (raw file):

Previously, noa-starkware wrote…

Is it the same behavior with empty BTC pool? Do we want to test that?

There's a different flow for that, or I didn't understand


src/flow_test/test.cairo line 2767 at r2 (raw file):

Previously, noa-starkware wrote…

Unnecessary IMO

Why not test the expected behavior? Is this tested somewhere else?


src/flow_test/utils.cairo line 1525 at r2 (raw file):

Previously, noa-starkware wrote…

different trait?

Done.

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)


src/flow_test/test.cairo line 2767 at r2 (raw file):

Previously, arad-starkware wrote…

Why not test the expected behavior? Is this tested somewhere else?

It is not related to this test. And it should be tested somewhere. But i dont care to leave it


src/flow_test/utils.cairo line 578 at r4 (raw file):

    }

    fn start_consensus_rewards(self: SystemState) {

I think it should be in the same trait of advance epoch

@arad-starkware arad-starkware force-pushed the arad/test_add_disable_rewards_flow branch from 7de0c7c to 670c521 Compare November 23, 2025 16:01
@arad-starkware arad-starkware force-pushed the arad/test_add_update_rewards_strk_pool_flow branch from 636625a to b2047ee Compare November 23, 2025 16:01
@arad-starkware arad-starkware force-pushed the arad/test_add_disable_rewards_flow branch from 670c521 to ff2da76 Compare November 23, 2025 16:10
@arad-starkware arad-starkware force-pushed the arad/test_add_update_rewards_strk_pool_flow branch from b2047ee to 00c2854 Compare November 23, 2025 16:10
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, 2 unresolved discussions (waiting on @noa-starkware)


src/flow_test/test.cairo line 2767 at r2 (raw file):

Previously, noa-starkware wrote…

It is not related to this test. And it should be tested somewhere. But i dont care to leave it

I'd rather leave it then


src/flow_test/utils.cairo line 578 at r4 (raw file):

Previously, noa-starkware wrote…

I think it should be in the same trait of advance epoch

Done.

@arad-starkware arad-starkware changed the base branch from arad/test_add_disable_rewards_flow to graphite-base/46 November 23, 2025 16:16
@arad-starkware arad-starkware force-pushed the arad/test_add_update_rewards_strk_pool_flow branch from 00c2854 to c622701 Compare November 23, 2025 16:17
@graphite-app graphite-app bot changed the base branch from graphite-base/46 to main November 23, 2025 16:17
@arad-starkware arad-starkware force-pushed the arad/test_add_update_rewards_strk_pool_flow branch 3 times, most recently from 0d5e8ea to dec5ece Compare November 23, 2025 16:51
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 3 files reviewed, all discussions resolved (waiting on @arad-starkware)

@arad-starkware arad-starkware force-pushed the arad/test_add_update_rewards_strk_pool_flow branch from dec5ece to ea61d51 Compare November 24, 2025 07:59
@arad-starkware arad-starkware force-pushed the arad/test_add_update_rewards_strk_pool_flow branch from ea61d51 to 5b22f3d Compare November 24, 2025 08:03
Copy link
Collaborator Author

arad-starkware commented Nov 24, 2025

Merge activity

@arad-starkware arad-starkware merged commit c8b0f3b into main Nov 24, 2025
6 of 7 checks passed
@arad-starkware arad-starkware deleted the arad/test_add_update_rewards_strk_pool_flow branch November 24, 2025 08:07
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