feat(rfp-002): add spel-freeze-authority library and sample program#213
Draft
bristinWild wants to merge 4 commits into
Draft
feat(rfp-002): add spel-freeze-authority library and sample program#213bristinWild wants to merge 4 commits into
bristinWild wants to merge 4 commits into
Conversation
added 4 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
- FreezeState with program-level and account-level freeze - freeze_program/unfreeze_program — circuit breaker for entire program - freeze_account/unfreeze_account — per-account freeze - check_interaction() — single call gates any instruction - set_freeze_authority() — admin-controlled rotation and revocation - 11 unit tests for FreezeState - 9 integration tests in sample program - Full workspace: 0 failures Addresses RFP-002: Freeze Authority Library
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-002: Freeze Authority Library for LEZ programs.
What's included
spel-freeze-authoritycrateFreezeState- core freeze primitive with program-level and account-level freezecheck_interaction()- single call gates any instructionfreeze_program()/unfreeze_program()- emergency circuit breakerfreeze_account()/unfreeze_account()- per-account freezeset_freeze_authority()- admin-controlled rotation and revocationspel-freeze-authority-sample- reference programinitialize- creates config PDA with admin + freeze authorityinteract- normal instruction gated by check_interaction()freeze_program/unfreeze_program- freeze authority onlyfreeze_account/unfreeze_account- freeze authority onlyset_freeze_authority- admin only (rotate or revoke)Authority Hierarchy
AdminAuthority (spel-admin-authority, RFP-001)
└── FreezeAuthority (spel-freeze-authority, RFP-002)
├── freeze_program() / unfreeze_program()
├── freeze_account(account_id)
└── unfreeze_account(account_id)
Test results
spel-freeze-authority: 11 tests ✅spel-freeze-authority-sample: 9 tests ✅Related