Skip to content

Conversation

@remollemo
Copy link
Collaborator

@remollemo remollemo commented Nov 3, 2025

This change is Reviewable


Note

Introduces UPGRADE_AGENT role with APIs, events, guard, and tests; also adds SECURITY_GOVERNOR role support and updates admin mappings and error codes.

  • Roles Component (roles.cairo):
    • Add is_upgrade_agent, register_upgrade_agent, remove_upgrade_agent and corresponding UpgradeAgentAdded/Removed events.
    • Add is_security_governor, register_security_governor, remove_security_governor and SecurityGovernorAdded/Removed events.
    • Add guards only_upgrader (allows UPGRADE_AGENT or UPGRADE_GOVERNOR) and only_security_governor.
    • Update initialize to set admins: UPGRADE_AGENT -> APP_ROLE_ADMIN, SECURITY_GOVERNOR -> SECURITY_ADMIN.
  • Interfaces (interface.cairo):
    • Define role IDs UPGRADE_AGENT, SECURITY_GOVERNOR.
    • Extend IRoles/IMinimalRoles with is_*, register_*, remove_* for upgrade agent and security governor; add related event structs.
  • Errors (errors.cairo): Add ONLY_UPGRADER, ONLY_SECURITY_GOVERNOR describable errors.
  • Testing:
    • Constants: add UPGRADE_AGENT.
    • Event test utils: add assertions for UpgradeAgentAdded/Removed.
    • Tests: add register/remove_upgrade_agent cases verifying role checks and event emission.

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

@remollemo remollemo self-assigned this Nov 3, 2025
@remollemo remollemo requested a review from RoeeGross November 3, 2025 09:46
cursor[bot]

This comment was marked as outdated.

@codecov
Copy link

codecov bot commented Nov 3, 2025

Codecov Report

❌ Patch coverage is 89.77273% with 9 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (main@38b172c). Learn more about missing BASE report.

Files with missing lines Patch % Lines
.../utils/src/components/roles/event_test_utils.cairo 60.00% 4 Missing ⚠️
packages/utils/src/components/roles/roles.cairo 85.00% 3 Missing ⚠️
packages/utils/src/components/roles/errors.cairo 0.00% 2 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main     #127   +/-   ##
=======================================
  Coverage        ?   89.36%           
=======================================
  Files           ?       43           
  Lines           ?     2464           
  Branches        ?        0           
=======================================
  Hits            ?     2202           
  Misses          ?      262           
  Partials        ?        0           

☔ 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.

@remollemo remollemo force-pushed the remo/roles/upgrade-agent branch 3 times, most recently from 7ecec92 to 287d845 Compare November 3, 2025 10:28
Copy link
Collaborator

@RoeeGross RoeeGross left a comment

Choose a reason for hiding this comment

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

@RoeeGross reviewed 1 of 1 files at r2, 2 of 2 files at r3, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @remollemo)

cursor[bot]

This comment was marked as outdated.

@remollemo remollemo force-pushed the remo/roles/upgrade-agent branch 2 times, most recently from 5e19946 to d85b11e Compare November 4, 2025 12:43
Copy link
Collaborator Author

@remollemo remollemo 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: 3 of 5 files reviewed, all discussions resolved (waiting on @remollemo)

@remollemo remollemo force-pushed the remo/roles/upgrade-agent branch 2 times, most recently from 146b241 to e919b5b Compare November 6, 2025 08:04
@remollemo remollemo force-pushed the remo/roles/upgrade-agent branch from e919b5b to 33c582d Compare November 6, 2025 08:52
@starkware-libs starkware-libs deleted a comment from cursor bot Nov 6, 2025
@remollemo remollemo enabled auto-merge (squash) November 6, 2025 14:56
@remollemo remollemo disabled auto-merge November 6, 2025 14:56
Copy link
Collaborator Author

@remollemo remollemo left a comment

Choose a reason for hiding this comment

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

@remollemo reviewed 1 of 1 files at r2, 2 of 2 files at r3, 1 of 2 files at r4, 1 of 2 files at r5, 1 of 1 files at r6, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @remollemo)

@remollemo remollemo force-pushed the remo/roles/upgrade-agent branch from 57d5fa3 to c4cf173 Compare November 6, 2025 20:38
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Bug: Reclaim Legacy Roles: Missing UPGRADE_AGENT and SECURITY_GOVERNOR

The reclaim_legacy_roles function is missing calls to reclaim the newly added UPGRADE_AGENT and SECURITY_GOVERNOR roles. Users who had these roles in the legacy system will not be able to reclaim them when calling this function. The function should include self._reclaim_role(role: UPGRADE_AGENT, :account); and self._reclaim_role(role: SECURITY_GOVERNOR, :account); to be consistent with the other roles.

packages/utils/src/components/roles/roles.cairo#L323-L334

}
fn reclaim_legacy_roles(ref self: ComponentState<TContractState>) {
let account = get_caller_address();
self._reclaim_role(role: GOVERNANCE_ADMIN, :account);
self._reclaim_role(role: APP_GOVERNOR, :account);
self._reclaim_role(role: APP_ROLE_ADMIN, :account);
self._reclaim_role(role: OPERATOR, :account);
self._reclaim_role(role: TOKEN_ADMIN, :account);
self._reclaim_role(role: UPGRADE_GOVERNOR, :account);
self._reclaim_role(role: SECURITY_ADMIN, :account);
self._reclaim_role(role: SECURITY_AGENT, :account);
}

Fix in Cursor Fix in Web


Copy link
Collaborator Author

@remollemo remollemo left a comment

Choose a reason for hiding this comment

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

@remollemo reviewed 3 of 3 files at r7, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @remollemo)

@remollemo remollemo force-pushed the remo/roles/upgrade-agent branch from c4cf173 to 02f7255 Compare November 9, 2025 08:04
Copy link
Collaborator Author

@remollemo remollemo left a comment

Choose a reason for hiding this comment

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

@remollemo reviewed 1 of 1 files at r8, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @remollemo)

@remollemo remollemo merged commit 475ee83 into main Nov 9, 2025
6 checks passed
@remollemo remollemo deleted the remo/roles/upgrade-agent branch November 9, 2025 08:08
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