Dapp-a-day 14: DSRoles – a DSAuthority that manages up to 256 roles
Each weekday leading up to devcon2, Nexus will highlight a dapp, library, or package (something with a dappfile
) as a promotion of our toolchain and as case studies for other developers. Previous Post
Today's dapp contains a DSAuthority
that manages up to 256 roles.
In the context of the Role Authority, a user is the sender,
while a capability is a (code,sig) :: (bytes32,bytes4)
pair.
https://github.com/nexusdev/ds-roles
The ability to check permissions in constant time is entirely due to the artificial constraint on number of roles.
256 was chosen because this lets us abuse the large word size and cheap native bitwise operators.