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

Fix/roles revamp #1772 #1889

Closed

Conversation

alanarvelo
Copy link
Contributor

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:

  1. Is this implementation of RoleChecker.sol accurate and viable?
  2. What should happen to the Role Contracts defined under /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?
  3. Is there a particular reason for the roleIds — hashes of address + counter — to be type uint256 instead of the return type of keccak256 bytes32?

TO-DO:

  1. Refactor all Roles in the repo to use new Roles paradigm
  2. Verify all tests pass and possibly new ones

Looking forward to continue working on this!

@stale
Copy link

stale bot commented Sep 2, 2019

Hi all!
This Pull Request has not had any recent activity, is it still relevant? If so, what is blocking it? Is there anything we can do to help move it forward?
Thanks!

@stale stale bot added the stale label Sep 2, 2019
@nventuro
Copy link
Contributor

nventuro commented Sep 2, 2019

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 :)

What should happen to the Role Contracts defined under /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?

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 :)

Is there a particular reason for the roleIds — hashes of address + counter — to be type uint256
instead of the return type of keccak256 bytes32?

No, I simply tried to convey the fact that they are 256-bit ids. If bytes32 is a more convenient type than uint256, then we should use it.

@stale stale bot removed the stale label Sep 2, 2019
Copy link
Contributor

@nventuro nventuro left a 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) {
Copy link
Contributor

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; }
Copy link
Contributor

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
Copy link
Contributor

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.

@stale
Copy link

stale bot commented Sep 17, 2019

Hi all!
This Pull Request has not had any recent activity, is it still relevant? If so, what is blocking it? Is there anything we can do to help move it forward?
Thanks!

@stale stale bot added the stale label Sep 17, 2019
@stale
Copy link

stale bot commented Oct 2, 2019

Hi folks!
This Pull Request is being closed as there was no response to the previous prompt. However, please leave a comment whenever you're ready to resume, so it can be reopened.
Thanks again!

@stale stale bot closed this Oct 2, 2019
@nventuro
Copy link
Contributor

nventuro commented Oct 2, 2019

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?

@nventuro nventuro reopened this Oct 2, 2019
@stale stale bot removed the stale label Oct 2, 2019
@stale
Copy link

stale bot commented Oct 17, 2019

Hi all!
This Pull Request has not had any recent activity, is it still relevant? If so, what is blocking it? Is there anything we can do to help move it forward?
Thanks!

@stale stale bot added the stale label Oct 17, 2019
@frangio
Copy link
Contributor

frangio commented Oct 18, 2019

Putting this on hold until we have time to dedicate to it.

@stale stale bot removed the stale label Oct 18, 2019
@frangio frangio added the on hold Put on hold for some reason that must be specified in a comment. label Oct 18, 2019
@alcueca alcueca mentioned this pull request Jan 29, 2020
@nventuro
Copy link
Contributor

nventuro commented Jun 5, 2020

This PR was superceded by #2112 - sorry to have kept it open for so long.

@nventuro nventuro closed this Jun 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
on hold Put on hold for some reason that must be specified in a comment.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants