feat(admin): extract storage module with Role enum - #623
Open
d3v-active wants to merge 2 commits into
Open
Conversation
|
@d3v-active Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
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.
Closes #397
This PR resolves the issue: Define Role Enum with Minter. It establishes a foundational, dedicated storage layer for the Access Control and Role-Based Access Control (RBAC) structures within the
bc-forgearchitecture.Previously, essential storage layout types such as
AdminKeyand theRoleenum (including the criticalMinterrole variant) were co-located in the mainlib.rsfile. This change extracts these structures into an isolated storage module to improve the organization of the codebase, reduce the size of the root library module, and establish a clean pattern for future data types.Step-by-Step Implementation
storage.rsmodule: Introduced a dedicated storage module undercontracts/admin/src/storage.rs.lib.rstostorage.rs:AdminKeyenum: Defines the primary slots (Admin,Role(Role, Address),AdminPool, etc.) preventing storage collision.Roleenum: The RBAC definitions, securely containing theMintervariant for token minting privileges.Proposalstruct: Governance and multi-sig proposal state representations.SUPER_ADMIN_ROLEconstant: Allows easy gating for SuperAdmin roles.contracts/admin/src/lib.rsto expose the extracted definitions completely transparently viapub mod storage;andpub use storage::*;.Acceptance Criteria Met
cargo build --target wasm32-unknown-unknown) without syntax warnings or errors.AdminKeyandRoleremained strictly unaltered during extraction, all previously persisted ledger entries will continue decoding successfully to their correct storage slots.is_valid_roleandrequire_non_zero_addressfunctions, which maintain robust checking before engaging with the underlying storage layer.Validation / Testing
wasm32-unknown-unknowntarget.bc-forge-admintests behave as expected since allpub usealiases mimic the exact pre-existing API surface of the module.