Skip to content

Conversation

@arad-starkware
Copy link
Collaborator

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

This change is Reviewable


Note

Adds a flow testing attestation behavior immediately after upgrade (fail then succeed post-epoch) and wires it into mainnet-fork tests.

  • Flow tests:
    • Add AttestAfterUpgradeFlow in src/flow_test/flows.cairo to validate attestation immediately after upgrade:
      • First attest via IAttestationSafeDispatcherTrait fails (no previous-epoch trace), then after advancing an epoch attestation succeeds and rewards equal calculate_staker_strk_rewards_v2.
    • Register test attest_after_upgrade_flow_test in src/flow_test/fork_test.cairo.

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

Copy link
Collaborator Author

arad-starkware commented Nov 26, 2025

@arad-starkware arad-starkware self-assigned this Nov 26, 2025
@arad-starkware arad-starkware marked this pull request as ready for review November 26, 2025 09:18
@codecov
Copy link

codecov bot commented Nov 26, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.81%. Comparing base (b42160b) to head (0becc70).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main      #71   +/-   ##
=======================================
  Coverage   95.81%   95.81%           
=======================================
  Files          42       42           
  Lines       10194    10194           
=======================================
  Hits         9767     9767           
  Misses        427      427           

☔ 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_attest_after_upgrade_test branch from 6f96aaf to 6638029 Compare November 26, 2025 11:51
@arad-starkware arad-starkware changed the base branch from main to graphite-base/71 November 26, 2025 14:10
@arad-starkware arad-starkware force-pushed the arad/test_add_attest_after_upgrade_test branch from 6638029 to d58cf94 Compare November 26, 2025 14:10
@arad-starkware arad-starkware changed the base branch from graphite-base/71 to arad/test_add_token_state_after_upgrade_flow November 26, 2025 14:11
@arad-starkware arad-starkware force-pushed the arad/test_add_attest_after_upgrade_test branch from d58cf94 to aca4787 Compare November 26, 2025 14:21
@arad-starkware arad-starkware force-pushed the arad/test_add_token_state_after_upgrade_flow branch from 0e7d1c5 to 6c46b05 Compare November 26, 2025 14:21
This was referenced Nov 26, 2025
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, 2 unresolved discussions (waiting on @arad-starkware)


src/flow_test/flows.cairo line 7136 at r2 (raw file):

        );
        let result = attestation_safe.attest(block_hash: Zero::zero());
        assert_panic_with_error(:result, expected_error: "Index out of bounds");

Doc why we expect to fail with this error.

@arad-starkware arad-starkware force-pushed the arad/test_add_attest_after_upgrade_test branch from aca4787 to 25bdeb4 Compare November 26, 2025 14:41
@arad-starkware arad-starkware force-pushed the arad/test_add_token_state_after_upgrade_flow branch from 6c46b05 to ec67025 Compare November 26, 2025 14:41
@arad-starkware arad-starkware force-pushed the arad/test_add_attest_after_upgrade_test branch from 25bdeb4 to 1505bf7 Compare November 26, 2025 14:51
@arad-starkware arad-starkware force-pushed the arad/test_add_token_state_after_upgrade_flow branch from ec67025 to d6355ec Compare November 26, 2025 14:51
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, 1 unresolved discussion (waiting on @noa-starkware)


src/flow_test/flows.cairo line 7136 at r2 (raw file):

Previously, noa-starkware wrote…

Doc why we expect to fail with this error.

Done.

@arad-starkware arad-starkware force-pushed the arad/test_add_token_state_after_upgrade_flow branch from d6355ec to b70aa82 Compare November 26, 2025 14:56
@arad-starkware arad-starkware force-pushed the arad/test_add_attest_after_upgrade_test branch from 1505bf7 to af22f54 Compare November 26, 2025 14:56
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, 2 unresolved discussions (waiting on @arad-starkware)


src/flow_test/flows.cairo line 7136 at r2 (raw file):

Previously, arad-starkware wrote…

Done.

fixed in V3 sounds like staker can attest, but we only fixed the error msg.


src/flow_test/flows.cairo line 7136 at r4 (raw file):

        );
        let result = attestation_safe.attest(block_hash: Zero::zero());
        // Fails because the staker trace has no entry for the previous epoch (fixed in V3).

Suggestion:

// Fails because a staker can’t attest in their starting epoch (zero balance).
// If the staker started in V2, the trace has no entry for that epoch, so it reverts with an "index out of bounds" error (this case).
// If the staker started in V3, the trace includes that entry, so it reverts with ATTEST_WITH_ZERO_BALANCE.

@arad-starkware arad-starkware force-pushed the arad/test_add_token_state_after_upgrade_flow branch from b70aa82 to ed9fb2d Compare November 26, 2025 17:05
@arad-starkware arad-starkware force-pushed the arad/test_add_attest_after_upgrade_test branch from af22f54 to 94bf90d Compare November 26, 2025 17:05
@arad-starkware arad-starkware force-pushed the arad/test_add_token_state_after_upgrade_flow branch from ed9fb2d to 878cc79 Compare November 26, 2025 17:10
@arad-starkware arad-starkware force-pushed the arad/test_add_attest_after_upgrade_test branch from 94bf90d to 3958f47 Compare November 26, 2025 17:10
@arad-starkware arad-starkware force-pushed the arad/test_add_attest_after_upgrade_test branch from 77a3d40 to 9d0e8f3 Compare November 27, 2025 08:17
@arad-starkware arad-starkware changed the base branch from graphite-base/71 to arad/test_add_token_state_after_upgrade_flow November 27, 2025 08:17
@arad-starkware arad-starkware force-pushed the arad/test_add_attest_after_upgrade_test branch from 9d0e8f3 to 641afe8 Compare November 27, 2025 15:23
@arad-starkware arad-starkware force-pushed the arad/test_add_token_state_after_upgrade_flow branch 2 times, most recently from a123f39 to 6fa473d Compare November 27, 2025 15:28
@arad-starkware arad-starkware force-pushed the arad/test_add_attest_after_upgrade_test branch 2 times, most recently from 13fa384 to ee36d3b Compare November 27, 2025 17:11
@arad-starkware arad-starkware force-pushed the arad/test_add_token_state_after_upgrade_flow branch from 6fa473d to 9734280 Compare November 27, 2025 17:11
@arad-starkware arad-starkware force-pushed the arad/test_add_attest_after_upgrade_test branch from ee36d3b to 18cc23d Compare December 2, 2025 10:32
@arad-starkware arad-starkware force-pushed the arad/test_add_token_state_after_upgrade_flow branch 2 times, most recently from 0b9ed88 to 8a44fec Compare December 2, 2025 10:47
@arad-starkware arad-starkware force-pushed the arad/test_add_attest_after_upgrade_test branch from 18cc23d to d33b3ea Compare December 2, 2025 10:47
@arad-starkware arad-starkware force-pushed the arad/test_add_token_state_after_upgrade_flow branch from 8a44fec to f7f21fa Compare December 4, 2025 12:47
@arad-starkware arad-starkware force-pushed the arad/test_add_attest_after_upgrade_test branch from d33b3ea to 7678b32 Compare December 4, 2025 12:47
@arad-starkware arad-starkware force-pushed the arad/test_add_token_state_after_upgrade_flow branch 2 times, most recently from 1a95f7b to e5c165d Compare December 4, 2025 13:02
@arad-starkware arad-starkware force-pushed the arad/test_add_attest_after_upgrade_test branch from 7678b32 to 81dde17 Compare December 4, 2025 13:02
@arad-starkware arad-starkware changed the base branch from arad/test_add_token_state_after_upgrade_flow to graphite-base/71 December 4, 2025 13:07
@arad-starkware arad-starkware force-pushed the arad/test_add_attest_after_upgrade_test branch from 81dde17 to b364631 Compare December 4, 2025 13:07
@graphite-app graphite-app bot changed the base branch from graphite-base/71 to main December 4, 2025 13:08
@arad-starkware arad-starkware force-pushed the arad/test_add_attest_after_upgrade_test branch from b364631 to 0becc70 Compare December 4, 2025 13:08
@arad-starkware arad-starkware merged commit 3bc74af into main Dec 4, 2025
5 of 6 checks passed
Copy link
Collaborator Author

Merge activity

@arad-starkware arad-starkware deleted the arad/test_add_attest_after_upgrade_test branch December 4, 2025 13:12
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