@@ -621,14 +621,15 @@ function shouldBehaveLikeAccessControlDefaultAdminRules(errorPrefix, delay, defa
621
621
} ) ;
622
622
623
623
describe ( 'renounces admin' , function ( ) {
624
+ let expectedSchedule ;
624
625
let delayPassed ;
626
+ let delayNotPassed ;
625
627
626
628
beforeEach ( async function ( ) {
627
629
await this . accessControl . beginDefaultAdminTransfer ( constants . ZERO_ADDRESS , { from : defaultAdmin } ) ;
628
- delayPassed = web3 . utils
629
- . toBN ( await time . latest ( ) )
630
- . add ( delay )
631
- . addn ( 1 ) ;
630
+ expectedSchedule = web3 . utils . toBN ( await time . latest ( ) ) . add ( delay ) ;
631
+ delayNotPassed = expectedSchedule ;
632
+ delayPassed = expectedSchedule . addn ( 1 ) ;
632
633
} ) ;
633
634
634
635
it ( 'reverts if caller is not default admin' , async function ( ) {
@@ -639,6 +640,15 @@ function shouldBehaveLikeAccessControlDefaultAdminRules(errorPrefix, delay, defa
639
640
) ;
640
641
} ) ;
641
642
643
+ it ( "renouncing the admin role when not an admin doesn't affect the schedule" , async function ( ) {
644
+ await time . setNextBlockTimestamp ( delayPassed ) ;
645
+ await this . accessControl . renounceRole ( DEFAULT_ADMIN_ROLE , other , { from : other } ) ;
646
+
647
+ const { newAdmin, schedule } = await this . accessControl . pendingDefaultAdmin ( ) ;
648
+ expect ( newAdmin ) . to . equal ( constants . ZERO_ADDRESS ) ;
649
+ expect ( schedule ) . to . be . bignumber . equal ( expectedSchedule ) ;
650
+ } ) ;
651
+
642
652
it ( 'keeps defaultAdmin consistent with hasRole if another non-defaultAdmin user renounces the DEFAULT_ADMIN_ROLE' , async function ( ) {
643
653
await time . setNextBlockTimestamp ( delayPassed ) ;
644
654
@@ -677,12 +687,6 @@ function shouldBehaveLikeAccessControlDefaultAdminRules(errorPrefix, delay, defa
677
687
} ) ;
678
688
679
689
describe ( 'schedule not passed' , function ( ) {
680
- let delayNotPassed ;
681
-
682
- beforeEach ( function ( ) {
683
- delayNotPassed = delayPassed . subn ( 1 ) ;
684
- } ) ;
685
-
686
690
for ( const [ fromSchedule , tag ] of [
687
691
[ - 1 , 'less' ] ,
688
692
[ 0 , 'equal' ] ,
0 commit comments