Skip to content

RoleBastion for TribalCouncil#610

Merged
thomas-waite merged 15 commits intofeat-governance-upgradefrom
feat-role-admin-helper
Mar 29, 2022
Merged

RoleBastion for TribalCouncil#610
thomas-waite merged 15 commits intofeat-governance-upgradefrom
feat-role-admin-helper

Conversation

@thomas-waite
Copy link
Contributor

@thomas-waite thomas-waite commented Mar 24, 2022

Summary

Introduces a RoleBastion to allow the TribalCouncil to create new roles. Core will be used to grant and revoke roles.

RoleBastion is granted the GOVERNOR role to allow it to create new roles. It has a very simple API with one external state changing function to minimise the attack surface.

@thomas-waite thomas-waite self-assigned this Mar 24, 2022
@thomas-waite thomas-waite requested a review from a team as a code owner March 24, 2022 17:11
@thomas-waite thomas-waite changed the base branch from develop to feat-governance-upgrade March 24, 2022 17:11
@thomas-waite thomas-waite changed the title RoleBastion for TribalCouncil [WIP] RoleBastion for TribalCouncil Mar 24, 2022
@thomas-waite thomas-waite changed the title [WIP] RoleBastion for TribalCouncil RoleBastion for TribalCouncil Mar 25, 2022
@thomas-waite thomas-waite force-pushed the feat-role-admin-helper branch from 94e9383 to 6582fd4 Compare March 25, 2022 18:00
@thomas-waite thomas-waite force-pushed the feat-role-admin-helper branch from 93a1307 to aa24a3a Compare March 25, 2022 18:34
onlyTribeRole(TribeRoles.ROLE_ADMIN)
{
bytes32 roleAdmin = core().getRoleAdmin(role);
require(roleAdmin == bytes32(0), "Role already exists");
Copy link
Contributor

Choose a reason for hiding this comment

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

We should not allow a role that is bytes32(0) to be created using this createRole method as that is the CONTRACT_ADMIN_ROLE in core.

Screen Shot 2022-03-25 at 11 45 33 AM

Copy link
Contributor

Choose a reason for hiding this comment

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

Idk if its possible to grant another contract admin of 0x0 but good to test and make sure

Copy link
Contributor Author

@thomas-waite thomas-waite Mar 27, 2022

Choose a reason for hiding this comment

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

It is possible to create and grant a role of bytes32(0) - it has not yet been created in core. I wrote an integration test locally that validates that it can be created. As I understand it, that would allow the TribalCouncil to create a powerful role, which it could then grant.

Have added a check to prevent creating the bytes32(0) role + a test to validate. I'm not sure I follow what you mean by granting another contract admin of 0x0?

Copy link
Contributor

Choose a reason for hiding this comment

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

bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00; in AccessControl.sol

The 0 role is the default admin of all non-created roles and is super powerful. Good to make sure this can't be granted out

@thomas-waite thomas-waite merged commit 30c6a6f into feat-governance-upgrade Mar 29, 2022
@thomas-waite thomas-waite deleted the feat-role-admin-helper branch March 29, 2022 15:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Comments