Skip to content

Commit 68adaf5

Browse files
committed
Correctly set unlocked crite
1 parent e2eb45d commit 68adaf5

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

contracts/access/AccessControlAdminRules.sol

+2-2
Original file line numberDiff line numberDiff line change
@@ -198,10 +198,10 @@ abstract contract AccessControlAdminRules is IAccessControlAdminRules, AccessCon
198198
}
199199

200200
/**
201-
* @dev Checks if a {delayUntil} has been set and met.
201+
* @dev Checks if a {delayedUntil} has been set and met.
202202
*/
203203
function _adminTransferIsUnlocked() private view returns (bool) {
204204
uint48 delayedUntilTimestamp = delayedUntil();
205-
return delayedUntilTimestamp > 0 && delayedUntilTimestamp > block.timestamp;
205+
return delayedUntilTimestamp > 0 && delayedUntilTimestamp < block.timestamp;
206206
}
207207
}

test/access/AccessControl.behavior.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ function shouldBehaveLikeAccessControlAdminRules(errorPrefix, delay, admin, newA
291291
// possiblty creating false positives (eg. expect revert for incorrect caller but getting it
292292
// from a badly expected delayed until)
293293
correctPendingAdmin = newAdmin;
294-
correctIncreaseTo = (await time.latest()).add(delay).subn(1);
294+
correctIncreaseTo = (await time.latest()).add(delay).addn(1);
295295

296296
await this.accessControl.beginAdminTransfer(correctPendingAdmin, { from: admin });
297297
});
@@ -341,7 +341,7 @@ function shouldBehaveLikeAccessControlAdminRules(errorPrefix, delay, admin, newA
341341
let incorrectIncreaseTo;
342342

343343
beforeEach(async function () {
344-
incorrectIncreaseTo = correctIncreaseTo.addn(1);
344+
incorrectIncreaseTo = correctIncreaseTo.subn(1);
345345
});
346346

347347
it('should revert if block.timestamp is equal to delayed until', async function () {
@@ -353,7 +353,7 @@ function shouldBehaveLikeAccessControlAdminRules(errorPrefix, delay, admin, newA
353353
});
354354

355355
it('should revert if block.timestamp is less to delayed until', async function () {
356-
await time.increaseTo(incorrectIncreaseTo.addn(1));
356+
await time.increaseTo(incorrectIncreaseTo.subn(1));
357357
await expectRevert(
358358
this.accessControl.acceptAdminTransfer({ from: correctPendingAdmin }),
359359
`${errorPrefix}: delay must be met and caller must be pending admin`,
@@ -386,7 +386,7 @@ function shouldBehaveLikeAccessControlAdminRules(errorPrefix, delay, admin, newA
386386
let from = admin;
387387

388388
beforeEach(async function () {
389-
correctIncreaseTo = (await time.latest()).add(delay).subn(1);
389+
correctIncreaseTo = (await time.latest()).add(delay).addn(1);
390390
await this.accessControl.beginAdminTransfer(ZERO_ADDRESS, { from });
391391
});
392392

@@ -436,7 +436,7 @@ function shouldBehaveLikeAccessControlAdminRules(errorPrefix, delay, admin, newA
436436
let incorrectIncreaseTo;
437437

438438
beforeEach(async function () {
439-
incorrectIncreaseTo = correctIncreaseTo.addn(1);
439+
incorrectIncreaseTo = correctIncreaseTo.subn(1);
440440
});
441441

442442
it('reverts if block.timestamp is equal to delayed until', async function () {
@@ -448,7 +448,7 @@ function shouldBehaveLikeAccessControlAdminRules(errorPrefix, delay, admin, newA
448448
});
449449

450450
it('reverts if block.timestamp is less to delayed until', async function () {
451-
await time.increaseTo(incorrectIncreaseTo.addn(1));
451+
await time.increaseTo(incorrectIncreaseTo.subn(1));
452452
await expectRevert(
453453
this.accessControl.renounceRole(DEFAULT_ADMIN_ROLE, admin, { from }),
454454
`${errorPrefix}: admin can only renounce in two delayed steps`,

0 commit comments

Comments
 (0)