Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ERC: Access Control Registry #723

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

shubh-ta
Copy link

When opening a pull request to submit a new EIP, please use the suggested template: https://github.com/ethereum/EIPs/blob/master/eip-template.md

We have a GitHub bot that automatically merges some PRs. It will merge yours immediately if certain criteria are met:

  • The PR edits only existing draft PRs.
  • The build passes.
  • Your GitHub username or email address is listed in the 'author' header of all affected PRs, inside .
  • If matching on email address, the email address is the one publicly listed on your GitHub profile.

@eip-review-bot
Copy link
Collaborator

eip-review-bot commented Nov 19, 2024

File ERCS/erc-7820.md

Requires 1 more reviewers from @axic, @g11tech, @SamWilsn, @xinbenlv

@eip-review-bot eip-review-bot changed the title Add: Access Control Registry Standard Add ERC: Access Control Registry Nov 19, 2024
ERCS/erc-xxxx.md Outdated Show resolved Hide resolved
ERCS/erc-xxxx.md Outdated Show resolved Hide resolved
Copy link

@Joj501 Joj501 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix the err and add ERC

@anushka642000
Copy link

@Joj501 Could you clarify which specific error you're referring to?

Copy link

The commit bf21f1a (as a parent of 48b3f97) contains errors.
Please inspect the Run Summary for details.

@github-actions github-actions bot added the w-ci label Nov 26, 2024
ERCS/erc-7820.md Outdated Show resolved Hide resolved
ERCS/erc-7820.md Show resolved Hide resolved
ERCS/erc-7820.md Show resolved Hide resolved
ERCS/erc-7820.md Outdated
Comment on lines 52 to 55
struct ContractInfo {
bool isActive;
address admin;
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This struct isn't used in any of the public functions of the interface, and should be removed.

Comment on lines +95 to +103
// Grants roles to multiple accounts for multiple contracts.
// @param targetContracts An array of contract addresses to which roles will be granted.
// @param roles An array of roles to be granted.
// @param accounts An array of accounts to be granted the roles.
function grantRole(
address[] memory targetContracts,
bytes32[] memory roles,
address[] memory accounts
) external;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The documentation for this function is a bit ambiguous. Does this grant all the listed roles to all the targetContracts for all the accounts, or is it more like a tuple (contract, role, account)?


## Rationale

The IAccessControlRegistry interface aims to provide a standardized way to manage access control across multiple contracts within the ecosystem. By defining a clear structure and set of events, this interface helps streamline the process of registering, unregistering, and managing roles for contracts. The rationale for each function and event is as follows:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The IAccessControlRegistry interface aims to provide a standardized way to manage access control across multiple contracts within the ecosystem. By defining a clear structure and set of events, this interface helps streamline the process of registering, unregistering, and managing roles for contracts. The rationale for each function and event is as follows:
The `IAccessControlRegistry` interface aims to provide a standardized way to manage access control across multiple contracts within the ecosystem. By defining a clear structure and set of events, this interface helps streamline the process of registering, unregistering, and managing roles for contracts. The rationale for each function and event is as follows:

ERCS/erc-7820.md Outdated
Comment on lines 178 to 180
#### Efficient Storage and Lookup

**Mapping Utilization**: The use of mappings for storing contract information (mapping(address => ContractInfo) private contracts) and role assignments (mapping(address => mapping(address => mapping(bytes32 => bool))) private _contractRoles) ensures efficient storage and lookup. This is crucial for maintaining performance in a large-scale system with numerous contracts and roles.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is specific to your reference implementation. The rationale section is for documenting the specification itself. If you'd like to explain choices made about your reference implementation, please put it in that section instead.

ERCS/erc-7820.md Outdated

#### Role Management Flexibility

**Bulk Operations**: Functions like grantRole and revokeRole allow for the assignment and revocation of roles to multiple accounts for multiple contracts in a single transaction. This bulk operation reduces gas costs and simplifies the process of role management in large systems.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
**Bulk Operations**: Functions like grantRole and revokeRole allow for the assignment and revocation of roles to multiple accounts for multiple contracts in a single transaction. This bulk operation reduces gas costs and simplifies the process of role management in large systems.
**Bulk Operations**: Functions like `grantRole` and `revokeRole` allow for the assignment and revocation of roles to multiple accounts for multiple contracts in a single transaction. This bulk operation reduces gas costs and simplifies the process of role management in large systems.

ERCS/erc-7820.md Outdated

#### Robust Security Measures

**Admin-Only Operations**: Functions that modify the state, such as unRegisterContract, _grantRole, and _revokeRole, are restricted to contract admins. This ensures that only authorized personnel can manage contracts and roles, reducing the risk of unauthorized changes.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similarly, _grantRole and _revokeRole don't appear in the Specification.

ERCS/erc-7820.md Outdated
## Reference Implementation

```solidity
// SPDX-License-Identifier: MIT
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code that's inline in the document itself must be CC0-1.0 licensed. We do allow MIT in the assets/ directory if you'd like to link to it there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants