Skip to content

Fix GrantRoles CS to load from DS#21440

Merged
simsonraj merged 1 commit intodevelopfrom
fix-grant-roles-cs
Mar 6, 2026
Merged

Fix GrantRoles CS to load from DS#21440
simsonraj merged 1 commit intodevelopfrom
fix-grant-roles-cs

Conversation

@simsonraj
Copy link
Contributor

No description provided.

@simsonraj simsonraj requested a review from a team as a code owner March 6, 2026 11:15
Copilot AI review requested due to automatic review settings March 6, 2026 11:15
@github-actions
Copy link
Contributor

github-actions bot commented Mar 6, 2026

👋 simsonraj, thanks for creating this pull request!

To help reviewers, please consider creating future PRs as drafts first. This allows you to self-review and make any final changes before notifying the team.

Once you're ready, you can mark it as "Ready for review" to request feedback. Thanks!

@github-actions
Copy link
Contributor

github-actions bot commented Mar 6, 2026

✅ No conflicts with other open PRs targeting develop

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Risk Rating: MEDIUM — changes affect deployment changeset logic for role-granting and how MCMS+Timelock state is resolved (qualifier-aware DataStore loading).

This PR updates the GrantRoleInTimeLock changeset to load MCMS-with-timelock state on a per-chain basis, using TimelockQualifierPerChain when provided so the correct qualifier-isolated deployment is pulled from the DataStore.

Changes:

  • Replace bulk state loading (maps.Keys(...)) with per-chain loading that can apply per-chain timelock qualifiers.
  • Add loadMCMSStatePerChainWithQualifier helper to centralize qualifier-aware loading for both preconditions and execution paths.
  • Remove the golang.org/x/exp/maps dependency from this changeset.

}
chainState, err := state.MaybeLoadMCMSWithTimelockStateWithQualifier(e, []uint64{selector}, qualifier)
if err != nil {
return nil, err
Copy link

Copilot AI Mar 6, 2026

Choose a reason for hiding this comment

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

In loadMCMSStatePerChainWithQualifier, the error returned from MaybeLoadMCMSWithTimelockStateWithQualifier is propagated without chain/qualifier context. When multiple chains are processed, this makes it harder to identify which selector/qualifier caused the failure (e.g., when DataStore is missing for a qualifier). Consider wrapping the error with the selector and qualifier to make troubleshooting deterministic.

Suggested change
return nil, err
return nil, fmt.Errorf("failed to load MCMS state for selector %d with qualifier %q: %w", selector, qualifier, err)

Copilot uses AI. Check for mistakes.
Comment on lines +175 to 176
mcmsState, err := loadMCMSStatePerChainWithQualifier(e, cfg)
if err != nil {
Copy link

Copilot AI Mar 6, 2026

Choose a reason for hiding this comment

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

This PR changes GrantRoleInTimeLock to load MCMS state using per-chain timelock qualifiers (DataStore-qualified isolation). There’s no test covering the TimelockQualifierPerChain path to ensure GrantRoleInTimeLock loads the correct timelock bundle from DataStore (and does not fall back to AddressBook/unqualified DataStore when a qualifier is provided). Adding a test that populates DataStore with a non-empty qualifier and verifies roles are granted against that qualified timelock would prevent regressions.

Copilot uses AI. Check for mistakes.
@cl-sonarqube-production
Copy link

@simsonraj simsonraj enabled auto-merge March 6, 2026 12:24
@trunk-io
Copy link

trunk-io bot commented Mar 6, 2026

Static BadgeStatic BadgeStatic BadgeStatic Badge

View Full Report ↗︎Docs

@simsonraj simsonraj added this pull request to the merge queue Mar 6, 2026
Merged via the queue into develop with commit 9f353ad Mar 6, 2026
222 of 226 checks passed
@simsonraj simsonraj deleted the fix-grant-roles-cs branch March 6, 2026 18:15
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.

6 participants