Implement access control: admin, whitelists, and role checks across N…#152
Merged
1nonlypiece merged 10 commits intoCommitlabs-Org:masterfrom Feb 26, 2026
Merged
Conversation
…FT, Core, Attestation
Contributor
|
@anumukul Please fix the pipeline |
… fix commitment_core event symbols and commitment_nft CURRENT_VERSION
Contributor
Author
I have fixed it please review it |
Contributor
… import in pausable
Contributor
|
@anumukul fix the pipeline |
Contributor
1 similar comment
Contributor
Contributor
Author
|
@1nonlypiece I have resolved the conflicts please review |
Contributor
|
@anumukul please resolve the conflicts |
Contributor
Author
|
@1nonlypiece please review |
Contributor
Author
|
@1nonlypiece please merge it |
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.
Implement robust access control across all contracts
Summary
Implements a robust access control system across Commitment NFT, Commitment Core, and Attestation Engine to manage permissions and authorized callers as specified in the issue.
closes #18
Access control patterns
require_ownerused where applicable.Implementation
Whitelist management (all contracts)
add_authorized_contract(caller, contract_address)– Admin-only; adds an address to the whitelist.remove_authorized_contract(caller, contract_address)– Admin-only; removes an address from the whitelist.is_authorized(contract_address) -> bool– Returns whether an address may perform the protected action.Commitment NFT
AuthorizedMinter(Address)(existing key used).AuthorizedContractAdded,AuthorizedContractRemovedon whitelist changes.mintnow takescalleras first argument:mint(caller, owner, commitment_id, ...).Commitment Core
AuthorizedAllocator(Address).AuthorizedContractAdded,AuthorizedContractRemovedon whitelist changes.allocatenow takescalleras first argument:allocate(caller, commitment_id, target_pool, amount).pause/unpause/is_pausedmoved from a misplaced free block into the contract impl; admin-only via stored admin andrequire_auth.Attestation Engine
add_verifier/remove_verifierretained; added public aliasesadd_authorized_contractandremove_authorized_contractfor API consistency.is_authorized(contract_address)added (delegates to existing verifier check).VerifierAdded,VerifierRemovedon whitelist changes.Security
NotAuthorized/Unauthorized).Testing
test_add_remove_is_authorized_contract,test_mint_unauthorized_caller_fails; all existing mint tests updated to pass caller.test_add_remove_is_authorized_allocator,test_allocate_unauthorized_caller_fails;test_allocate_eventupdated with caller andmock_all_auths.Breaking changes
mint(owner, commitment_id, ...)→mint(caller, owner, commitment_id, ...). Callers (e.g. commitment_core) must pass the invoking address ascaller.allocate(commitment_id, target_pool, amount)→allocate(caller, commitment_id, target_pool, amount). Callers must pass the authorized address (admin or whitelisted allocator) ascaller.Checklist