RoleBastion for TribalCouncil#610
Conversation
94e9383 to
6582fd4
Compare
93a1307 to
aa24a3a
Compare
| onlyTribeRole(TribeRoles.ROLE_ADMIN) | ||
| { | ||
| bytes32 roleAdmin = core().getRoleAdmin(role); | ||
| require(roleAdmin == bytes32(0), "Role already exists"); |
There was a problem hiding this comment.
Idk if its possible to grant another contract admin of 0x0 but good to test and make sure
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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

Summary
Introduces a
RoleBastionto allow the TribalCouncil to create new roles.Corewill be used to grant and revoke roles.RoleBastionis granted theGOVERNORrole to allow it to create new roles. It has a very simple API with one external state changing function to minimise the attack surface.