EVM patterns
OpenZeppelin AccessControl: Verify Role Removal and Remaining Authority
A role-removal receipt does not prove that an account has lost every privileged route. In 96 local cases using OpenZeppelin AccessControl v5.5.0, 17 successful removal calls were no-ops and subjects restored 5 of 9 actually removed minter memberships. Verify the membership change and the remaining administrator path separately.

Key facts
- Executed population
- 96 complete local EVM cases with direct and extended grant probes
- First-call outcomes
- 38 succeeded, with 21 actual removals and 17 no-ops
- Minter restoration
- 5 of 9 actually removed minter memberships restored, including 2 through an intermediate role
- Administrator removal
- 6 of 12 actual removals retained direct mint access
- Scope
- Base AccessControl v5.5.0 with a guarded counter, not a live token
Start with role-specific evidence
The pinned source writes _roles[role].hasRole[account] = false when it revokes an existing membership. The key includes the role. That detail limits what a successful removal can establish: one membership changed, while other memberships and administration relationships need their own evidence. A statement that an account has lost all control requires a wider record.
OpenZeppelin AccessControl implements role-based access control through role identifiers and account membership. A child contract uses those checks to restrict particular functions. It does not turn every privileged action into one ownership flag. Follow the guarded function before interpreting a role name such as minter, guardian or administrator.
- Membership
hasRole(role, account)reports whether that account holds the specified role in the observed state.- Administration
getRoleAdmin(role)identifies the role required to grant or revoke that membership. This relationship may differ between roles.- Capability
- The action an account can actually perform, directly or after authorized state changes. A membership read is evidence for this assessment, not the whole assessment.
- Default administrator
DEFAULT_ADMIN_ROLEis0x00and starts as its own administrator in the pinned base implementation. A custom administrator can replace it for another role.
Consider an account with both the default administrator role and MINTER_ROLE. Removing the first membership does not, by itself, remove the second. Conversely, removing its minter membership can leave the administrator route that grants minter again. Those are different failures of an overbroad revocation claim. Neither implies that the library violated its documented contract.
The official access-control guide distinguishes role members from role administrators. Our administrative key management guide covers the wider custody and authority inventory. The narrower question here is what the actual removal call and subsequent state prove about one subject's permissions.
Use the exact role identifier in the record. A display label such as minter does not establish which hash the deployed guard checks. Compare the identifier used by the function, the removal argument and the subsequent membership query. An interface that shows a familiar label can still prepare a call for a different role.
Keep the claim bounded. The account submitting a transaction, the account losing membership and an account still able to administer the role may be different. Record those identities separately, then inspect the implementation that the target actually executes.
What 96 local role-removal cases showed
Method
We executed the base AccessControl source retained from OpenZeppelin Contracts tag v5.5.0 on . The fixture inherits that implementation and adds a counter guarded by onlyRole(MINTER_ROLE). Its function is named mint, but it does not issue an ERC20 token. This experiment measures permission behavior.
- Population
96cases:4removal calls,4starting subject-role sets,3callers and2administrator mappings. No cases were excluded from the final grid.- Removal calls
revokeRoleorrenounceRole, targeting either the default administrator membership or the minter membership.- Starting roles
- The subject holds neither role, default administrator only, minter only or both. A separate operator always holds default and custom administration roles. The outsider holds neither.
- Administrator mapping
- Minter is administered by the default role or a custom administrator role. The subject starts without that custom role. The extended probe can subsequently acquire it.
- Observation sequence
- On a fresh fixture, attempt removal, read both memberships, attempt subject minting, attempt subject self-grant of minter and attempt subject minting again. Then attempt a subject grant of custom administrator, another minter grant and a final mint. The harness verifies that the custom role itself is administered by the default role. A failed call is captured without skipping later probes.
- Execution and records
- Solidity
0.8.36, optimizer enabled, via IR and a Cancun local EVM. Repository artifacts areseo/research/openzeppelin-accesscontrol-revocation-2026-11-25/measurement.py,RoleMatrix.t.solandmeasurement.json. They are not public downloads.
The first probe implementation was invalid: reading the role identifier after setting a test sender consumed that sender override. We retained the failed evidence, cached the identifier before the override and reran the grid. Only the corrected ledger supports these results. An independent checker reconstructed every authorization branch and membership transition, then an execution replay reproduced all final rows.
Results
| Call | Cases | Succeeded | Actual removals | Successful no-ops |
|---|---|---|---|---|
| Revoke default administrator | 24 | 12 | 8 | 4 |
| Revoke minter | 24 | 10 | 5 | 5 |
| Renounce default administrator | 24 | 8 | 4 | 4 |
| Renounce minter | 24 | 8 | 4 | 4 |
Across the grid, 38 first calls succeeded, but only 21 changed the selected membership from present to absent. The remaining 17 succeeded when the selected role was already absent. A receipt without the starting state cannot distinguish these outcomes. The classification comes from before-and-after membership, not an event count.
| Membership actually removed | Cases | Immediate subject mint succeeded | Restored by direct subject grant | Restored after extended probe |
|---|---|---|---|---|
| Default administrator | 12 | 6 | Not applicable | Not applicable |
| Minter | 9 | 0 | 3 | 5 |
In 6 of the 12 actual administrator removals, the subject retained its separate minter membership and could still call the guarded function. All 9 actual minter removals blocked the immediate mint probe. A direct self-grant restored 3 of those memberships. The extended sequence restored 5 in total, including 2 that first required acquiring the custom administrator role. These are outcomes within the same 9 actual minter removals, not extra cases.
One matched contrast starts with the subject holding both roles and the operator revoking minter. Under the default administrator mapping, the subject loses immediate mint access but successfully grants minter back. Under the custom mapping, the same subject cannot make that direct grant. But the custom role's own administrator is still the default role. The retained default administrator can grant custom administrator to itself, then grant minter. The separately authorized operator also remains able to administer minter in either configuration.
The denominator matters. Later acquisition of minter by a subject that never held it is not restoration of a removed role. Our ledger keeps newly gained membership separate from the subset in the second table. The retained operator also remains authorized throughout, so even a subject with no remaining route does not demonstrate an administrator-free system.
- Removing minter blocks the direct guarded action.
- Under the default mapping, retained default administration can grant minter directly.
- The tested custom mapping requires an additional grant. Default administration controls the custom role, which then controls minter. A failed direct probe does not close this chain.
Limits
- These are constructed local states, not estimates of deployed privilege exposure, incident frequency or loss.
- Only base AccessControl was executed. The experiment did not run DefaultAdminRules, Enumerable, Ownable, AccessManager, proxy upgrades or a timelock.
- No event collection, historical member reconstruction, transaction race, compromised wallet or off-chain custody process was tested.
- The counter is a minimal guarded capability. It does not test token supply, mint economics or the correctness of an application using the same role name.
Trace the caller and administrator
A removal transaction needs an authorized path. In the pinned base implementation, revokeRole(role, account) requires the caller to hold getRoleAdmin(role). The account being removed does not have to submit that call. A revocation signed by the operator and a renunciation signed by the subject therefore leave different evidence about who acted.
Renunciation checks another condition.
renounceRole(role, callerConfirmation) requires confirmation of the effective caller's own account. Passing another address does not let the operator impersonate that subject. Our non-subject callers failed that check, even when the operator had the administrator role that would authorize an ordinary revocation. A signature from an administrator does not make the wrong function valid.
Then follow the role-administrator edge. Mapping minter to a custom administrator blocks the subject's immediate grant because it initially holds no custom membership. That denial proves only the direct check. Follow the custom administrator's own administrator before deciding whether access is reconstructible. In this fixture, the next edge returns to default administration and enables the extended probe.
function mint() external onlyRole(MINTER_ROLE) {
minted++;
}The function's guard is part of the evidence. A role may exist without restricting a particular action, or a child implementation may change the role-check behavior. Read the inherited code and overrides, then test the actual privileged entry point. An account list alone cannot establish that a mint, pause or upgrade is unavailable. The same applies to a single denied grant: another administrator edge can make that capability reachable after an intermediate operation.
Changing a role administrator is also a distinct operation. The internal _setRoleAdmin helper updates the administrator relationship and emits its change event. It does not rewrite every current membership of the administered role. If a child exposes that helper, the child's authorization around the exposure belongs in the review scope.
Separate that question from custody.
The experiment proves what the configured subject and operator could call. It says nothing about whether their keys share a recovery mechanism or whether one person controls both accounts. An authority graph can be accurate while operational independence remains unresolved.
Diagnose rejected removal calls
Two error families identify different boundaries. AccessControlUnauthorizedAccount carries the account and needed role for a failed membership check. AccessControlBadConfirmation identifies the renunciation confirmation mismatch. Decode against the actual deployed ABI before assigning either meaning to a transaction error.
- Identify the executing implementation and dependency version. Confirm whether it is base AccessControl or an extension with additional rules.
- Resolve the effective caller. Base Context returns
msg.sender, while an application may override the sender context. - Read the administrator role for the selected membership at the relevant block, then check whether that caller holds it.
- For renunciation, compare the confirmation argument with the effective caller instead of substituting the account an operator wants to remove.
- Preserve the failing trace and verify the resulting state. A failed first call does not establish that the subject lost permission.
A rejected removal and a rejected capability call are different outcomes. If an outsider's removal attempt fails, the subject may still exercise its unchanged permission afterward. Keep both results rather than turning any revert into a broad statement that access was blocked. In our fixture, the low-level failure capture deliberately allows the subsequent probes to proceed.
Our probe correction illustrates a testing boundary rather than an AccessControl defect. A sender override is only useful if it applies to the intended call. An intervening external lookup changed who made the self-grant attempt in the invalid run. Cache inputs before impersonation and verify the caller at the privileged boundary. Do not publish a reassuring denial produced by the wrong actor.
Use the dependency review record to keep the ABI and source pin aligned. A generic interface screenshot may describe a different release or extension. The observation should include which call failed, whose authority was checked and what remained unchanged afterward.
Separate base AccessControl from other authority systems
Library names are evidence boundaries. The access API reference contains several contracts with similarly named functions. A rule for one extension cannot be attributed to every implementation of revokeRole. The executed fixture uses the base contract, with no inherited default-administrator extension.
| Mechanism | Relevant distinction | Additional evidence needed |
|---|---|---|
| AccessControlDefaultAdminRules | Default admin transfer and renunciation have extra rules | Pending transfer and delay state |
| Ownable | Ownership is separate from role memberships | Owner read plus any coexisting roles |
| AccessControlEnumerable | Role member enumeration is available | Complete queries at one block |
| Upgradeable target or timelock | Another authority can change the reachable path | Controller and implementation graph |
In the pinned DefaultAdminRules source, ordinary grants and revocations of the default administrator role are blocked in favor of the extension's controlled process. Renunciation of that role requires a scheduled transfer toward the zero address whose delay has passed. Its delayed transfer is a different state machine from the base calls measured above.
Ownable's renounceOwnership sets its ownership field to zero. That field is not the AccessControl membership mapping. If an application combines ownership and roles, inspect both systems before describing it as renounced. We inspected the source distinction, not a combined application or its upgrade behavior.
A timelock adds execution conditions and its own role population. The timelock authorization and readiness guide covers that separate path. For an upgradeable target, follow the implementation and upgrade authority review. Removing a target role cannot establish that another controller is unable to replace the target's logic.
Close the revocation evidence trail
A bounded conclusion names the account, membership, capability and observation state. The claim that an account lacks one role is narrower than the claim that it cannot regain the role. Both are narrower than the claim that nobody can perform the protected action. The evidence packet should make that difference visible.
| Claim | Evidence to retain | What remains unresolved |
|---|---|---|
| Selected membership disappeared | Before-and-after hasRole reads | Other roles held by the subject |
| Direct capability is blocked | Actual guarded function test | Authorized ways to regain membership |
| Subject cannot reconstruct access | Recursive administrator mapping and grant-path tests | Other actors and controllers |
| Role population is accounted for | Covered history or supported enumeration | Missing history and later changes |
Base AccessControl directs member reconstruction toward event history rather than an on-chain member list. Event evidence needs a coverage boundary and current-state verification. The interface also notes that the initial default administrator relationship need not have a corresponding change event. Absence of a change event is insufficient evidence that the relationship does not exist.
When Enumerable is actually deployed, query its member count and member entries at the same block. Its ordering can change, so mixing responses from different states can produce an unreliable population. Enumeration concerns members of a specified role. It is not a complete inventory of every role identifier or privileged function in a custom application. We did not execute this reconstruction method in the local grid.
Record chain, contract, block hash, role identifier, administrator identifier and effective caller. Include the source revision, encoded removal arguments and follow-up capability tests. Keep the role-change transaction distinct from the later self-grant probe, because the probe intentionally changes state and is not a passive read. Run state-changing diagnostic probes in an isolated test environment. Production readback should observe the actual release state without restoring the authority being retired.
Also identify the point within the observation sequence. Our before-regrant and after-regrant reads occur at different stages of one executed test function. A block label alone would not explain that distinction. The record needs the ordered call trace and the state associated with each claim, especially when a diagnostic probe itself changes membership.
Provider profiles such as the Pharos Production member record can help organize review scope, while the security tools hub covers supporting checks. A directory entry does not establish the permissions of a particular deployment. Ask for evidence tied to the actual contract and the claim being reviewed.
This measured conclusion is limited: role-specific removal did not automatically close separate or reconstructible authority. The remaining evidence is implementation-specific. An event history with gaps, an unreviewed controller or an unknown effective caller should stay unresolved until the record closes that gap.
Frequently asked questions
Does ERC165 supportsInterface prove the role-removal policy?
The pinned AccessControl implementation reports its interface support. That answer does not enumerate the guarded functions, identify the caller or establish current role membership. Inspect the executing implementation and the relevant permission checks. Interface detection was not a separate executed route in this experiment.
Why should an old _setupRole tutorial be checked against the installed version?
The retained v5.5.0 implementation uses _grantRole for internal grants. Compare the actual installed source and dependency lock with a tutorial before choosing an API. An internal helper has no access restriction of its own, so replacing a function name does not establish that a public wrapper is authorized. No historical-version migration was executed here.
What if a compromised subject cannot submit renounceRole?
An authorized role administrator can use revokeRole for the subject under the actual administrator mapping. Verify that the intended operator still controls that role and inspect the remaining subject capabilities afterward. If no authorized route is available, recovery depends on the wider design. The experiment kept an authorized operator and did not test lost-key recovery.