feat(rfp-001): add spel-admin-authority library and #[require_admin] macro#212
Draft
bristinWild wants to merge 3 commits into
Draft
feat(rfp-001): add spel-admin-authority library and #[require_admin] macro#212bristinWild wants to merge 3 commits into
bristinWild wants to merge 3 commits into
Conversation
added 2 commits
May 20, 2026 02:35
- Add spel-admin-authority crate with AdminState core primitive - assert_admin(), transfer_admin(), revoke_admin() operations - Atomic mutations — state only changes after all checks pass - 9 unit tests covering all authority lifecycle scenarios - Add spel-admin-authority-sample SPEL program demonstrating integration - initialize: creates config PDA, sets admin authority - set_config_value: admin-gated privileged instruction - transfer_admin: rotate authority to new key - revoke_admin: permanently revoke (irreversible) - 8 integration tests covering all 4 instructions + error cases - Full workspace compiles clean, 17 tests passing Addresses RFP-001: Admin Authority Library
- Add require_admin proc macro attribute to spel-framework-macros
- #[lez_program] now detects #[require_admin(config)] on instructions
and injects AdminConfig::assert_admin() check before handler body runs
- Add AdminConfig to spel-admin-authority library (re-exported in sample)
- Update sample program to use #[require_admin(config)] annotation
- Full workspace: all tests passing, 0 failures
Usage:
#[instruction]
#[require_admin(config)]
pub fn set_config_value(
#[account(mut, pda = literal("config"))]
config: AccountWithMetadata,
#[account(signer)]
admin: AccountWithMetadata,
new_value: u64,
) -> SpelResult { ... } // admin check injected automatically
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.
Implements RFP-001: Admin Authority Library for LEZ programs.
What's included
spel-admin-authoritycrateAdminState— core authority primitive (set, transfer, revoke)AdminConfig— standard config PDA type for authority programsspel-admin-authority-sample— reference programinitialize— creates config PDA, sets admin authorityset_config_value— admin-gated privileged instructiontransfer_admin— rotate authority to new keyrevoke_admin— permanently revoke (irreversible)#[require_admin]macro inspel-framework-macrosrequire_adminproc macro attribute#[lez_program]detects#[require_admin(config)]on instructionsAdminConfig::assert_admin()check before handler bodyUsage
Test results
spel-admin-authority: 9 testsspel-admin-authority-sample: 8 testsRelated