-
Notifications
You must be signed in to change notification settings - Fork 11.8k
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
Fix/roles revamp #1772 #1889
Fix/roles revamp #1772 #1889
Conversation
Hi all! |
Hello @alanarvelo! Sorry for taking so long to review this, I try to give feedback as early as possible and really dropped the ball here. This is quite a big feature that we want to get right, so progress may not be super fast :)
We should definitely keep the contracts and the current interface (see our API stability guideline. It feels like it should be possible to do a light rewrite using this new paradigm while keeping the external interface intact, but I guess we won't know until we try :)
No, I simply tried to convey the fact that they are 256-bit ids. If |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your work @alanarvelo! I left a couple high-level comments, no point in nit-picking or writing tests until we get the generalities right :)
|
||
function roleExists(uint256 _roleId) internal view returns (bool) { return roles[_roleId].exists; } | ||
|
||
function newRole() internal returns (uint256) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We may want to add a string here, to help with debugging
_; | ||
} | ||
|
||
function roleExists(uint256 _roleId) internal view returns (bool) { return roles[_roleId].exists; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting, I had not considered this! Can you think of use cases where someone might want to check if a role exists?
@@ -31,6 +32,7 @@ library Roles { | |||
*/ | |||
function has(Role storage role, address account) internal view returns (bool) { | |||
require(account != address(0), "Roles: account is the zero address"); | |||
// require(role.exists, "Roles: role does not exists");git |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The fact that this check is not really necessary makes me think that perhaps having .exists
is not the best way to go: it is possible to misuse the Roles
struct by forgetting to set this field.
Hi all! |
Hi folks! |
We're definitely interested in getting this merged! If @alanarvelo is unable to continue the PR, is there anyone else that might take up development? |
Hi all! |
Putting this on hold until we have time to dedicate to it. |
This PR was superceded by #2112 - sorry to have kept it open for so long. |
Hi all,
This is a first pass at the Issue Proposal to revamp Roles #1772. Merely an implementation of the
RoleChecker.sol
contract, whose intellectual author is @nventuro. Actual repo functionality was not altered. Made a PR to facilitate the discussion over the implementation details.A few questions:
RoleChecker.sol
accurate and viable?/access/roles
e.g. CapperRole, MinterRole, PauserRole, etc.? Should they be refactored to abide by the new paradigm as depicted by @nventuro in issue #1772, or should those contracts be deleted and all roles & functionality be defined where they are needed/used?roleIds
— hashes of address + counter — to be typeuint256
instead of the return type of keccak256bytes32
?TO-DO:
Looking forward to continue working on this!