Skip to content

Commit

Permalink
Remove unnecessary SLOAD. (OpenZeppelin#1715)
Browse files Browse the repository at this point in the history
  • Loading branch information
nventuro authored Apr 10, 2019
1 parent b353f7e commit 1ebeef7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
2 changes: 0 additions & 2 deletions contracts/access/Roles.sol
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ library Roles {
* @dev Give an account access to this role.
*/
function add(Role storage role, address account) internal {
require(account != address(0));
require(!has(role, account));

role.bearer[account] = true;
Expand All @@ -23,7 +22,6 @@ library Roles {
* @dev Remove an account's access to this role.
*/
function remove(Role storage role, address account) internal {
require(account != address(0));
require(has(role, account));

role.bearer[account] = false;
Expand Down
6 changes: 3 additions & 3 deletions test/access/Roles.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ contract('Roles', function ([_, authorized, otherAuthorized, anyone]) {
this.roles = await RolesMock.new();
});

it('reverts when querying roles for the null account', async function () {
it('reverts when querying roles for the zero account', async function () {
await shouldFail.reverting(this.roles.has(ZERO_ADDRESS));
});

Expand All @@ -31,7 +31,7 @@ contract('Roles', function ([_, authorized, otherAuthorized, anyone]) {
await shouldFail.reverting(this.roles.add(authorized));
});

it('reverts when adding roles to the null account', async function () {
it('reverts when adding roles to the zero account', async function () {
await shouldFail.reverting(this.roles.add(ZERO_ADDRESS));
});
});
Expand All @@ -54,7 +54,7 @@ contract('Roles', function ([_, authorized, otherAuthorized, anyone]) {
await shouldFail.reverting(this.roles.remove(anyone));
});

it('reverts when removing roles from the null account', async function () {
it('reverts when removing roles from the zero account', async function () {
await shouldFail.reverting(this.roles.remove(ZERO_ADDRESS));
});
});
Expand Down

0 comments on commit 1ebeef7

Please sign in to comment.