[New Permission 2a/5] smartcontract: implement authorize() mechanism#3208
Open
juan-malbeclabs wants to merge 1 commit intojo/permission-scaffoldingfrom
Open
[New Permission 2a/5] smartcontract: implement authorize() mechanism#3208juan-malbeclabs wants to merge 1 commit intojo/permission-scaffoldingfrom
juan-malbeclabs wants to merge 1 commit intojo/permission-scaffoldingfrom
Conversation
This was referenced Mar 9, 2026
elitegreg
reviewed
Mar 9, 2026
| // New path: validate Permission PDA and bitmask. | ||
| let (expected_pda, _) = get_permission_pda(program_id, payer_key); | ||
| if permission_account.key != &expected_pda { | ||
| return Err(ProgramError::InvalidArgument); |
Contributor
There was a problem hiding this comment.
Most of these errors we typically use assertions for. Why do things different?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary of Changes
authorize(), the central authorization function for all privileged instructions in the serviceability programActivatedstatus, and OR-matches the providedpermission_flagsbitmaskFeatureFlag::RequirePermissionAccountsis set, in which case the legacy path is disabled (with a carve-out: foundation members can always manage Permission accounts to prevent lockout)Diff Breakdown
A single focused module with no scaffolding, tests, or other changes.
Key files (click to expand)
smartcontract/programs/doublezero-serviceability/src/authorize.rs— newauthorize()function: Permission account path + legacy GlobalState fallback; 15-role flag→allowlist mapping table documented inlinesmartcontract/programs/doublezero-serviceability/src/lib.rs— addspub mod authorize;Testing Verification
authorize()is covered by the Permission processor integration tests added in the next PRmake rust-buildpasses with the new module in place