Add shielded access control#419
Conversation
Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com> Co-authored-by: 0xisk <iskander.andrews@openzeppelin.com>
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (24)
WalkthroughThis PR introduces a complete shielded access control module enabling role-based access without publicly disclosing role assignments. The core implementation uses Merkle trees to store role commitments, derives account identifiers from secret keys, and validates authorization through witness-backed circuit proofs. Supporting infrastructure includes a comprehensive test suite, simulators, witness implementations, and updates existing witness interfaces to be generic over ledger types. Changes
Sequence Diagram(s)sequenceDiagram
actor User
participant Contract as ShieldedAccessControl
participant Witness as Witness System
participant PrivateState as Private State
participant Ledger as Merkle Tree Ledger
User->>Contract: assertOnlyRole(role)
Contract->>Witness: wit_secretKey()
Witness->>PrivateState: retrieve secretKey
PrivateState-->>Witness: secretKey
Witness-->>Contract: [privateState, secretKey]
Contract->>Contract: computeAccountId(secretKey, instanceSalt)
Contract->>Contract: computeRoleCommitment(role, accountId)
Contract->>Witness: wit_getRoleCommitmentPath(roleCommitment)
Witness->>Ledger: findPathForLeaf(roleCommitment)
Ledger-->>Witness: merkleTreePath
Witness-->>Contract: [privateState, merkleTreePath]
Contract->>Contract: computeNullifier(roleCommitment)
Contract->>Ledger: check nullifier membership
Ledger-->>Contract: nullifier status
alt Role is valid and not revoked
Contract-->>User: ✓ Authorization granted
else Role not found or revoked
Contract-->>User: ✗ Authorization denied
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes The PR introduces substantial new functionality with a comprehensive shielded access control module (782 lines), extensive test coverage (1366 lines), and simulator implementations. However, the witness type generalization follows a consistent, repetitive pattern across multiple files, reducing per-file complexity. The changes span diverse areas (Compact circuits, TypeScript utilities, tests, documentation) requiring separate reasoning for each cohort, but the core logic is well-contained within the ShieldedAccessControl module. Possibly related PRs
Suggested reviewers
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Supersedes #190 -> keeps commit history clean in original PR by not changing history with f/p signed commits. Resolves #88
Summary by CodeRabbit
Release Notes
New Features
Tests
Documentation