@@ -235,9 +235,42 @@ describe('GovernorTimelockAccess', function () {
235235 // Set base delay
236236 await this . mock . $_setBaseDelaySeconds ( baseDelay ) ;
237237
238- await this . helper . setProposal ( [ this . restricted . operation ] , 'descr' ) ;
238+ const { id } = await this . helper . setProposal ( [ this . restricted . operation ] , 'descr' ) ;
239239 await this . helper . propose ( ) ;
240- expect ( await this . mock . proposalNeedsQueuing ( this . helper . currentProposal . id ) ) . to . be . false ;
240+ expect ( await this . mock . proposalNeedsQueuing ( id ) ) . to . be . false ;
241+
242+ await this . helper . waitForSnapshot ( ) ;
243+ await this . helper . connect ( this . voter1 ) . vote ( { support : VoteType . For } ) ;
244+ await this . helper . waitForDeadline ( ) ;
245+
246+ // No need for queuing, so it should not revert
247+ await expect ( this . helper . execute ( ) ) . to . not . be . reverted ;
248+ } ) ;
249+
250+ it ( 'does need to queue proposals with base delay' , async function ( ) {
251+ const roleId = 1n ;
252+ const executionDelay = 0n ;
253+ const baseDelay = 10n ;
254+
255+ // Set execution delay
256+ await this . manager . connect ( this . admin ) . setTargetFunctionRole ( this . receiver , [ this . restricted . selector ] , roleId ) ;
257+ await this . manager . connect ( this . admin ) . grantRole ( roleId , this . mock , executionDelay ) ;
258+
259+ // Set base delay
260+ await this . mock . $_setBaseDelaySeconds ( baseDelay ) ;
261+
262+ const { id } = await this . helper . setProposal ( [ this . restricted . operation ] , 'descr' ) ;
263+ await this . helper . propose ( ) ;
264+ expect ( await this . mock . proposalNeedsQueuing ( id ) ) . to . be . true ;
265+
266+ await this . helper . waitForSnapshot ( ) ;
267+ await this . helper . connect ( this . voter1 ) . vote ( { support : VoteType . For } ) ;
268+ await this . helper . waitForDeadline ( ) ;
269+
270+ // Not queued, so it should revert
271+ await expect ( this . helper . execute ( ) )
272+ . to . be . revertedWithCustomError ( this . mock , 'GovernorUnexpectedProposalState' )
273+ . withArgs ( id , ProposalState . Succeeded , GovernorHelper . proposalStatesToBitMap ( [ ProposalState . Queued ] ) ) ;
241274 } ) ;
242275
243276 it ( 'needs to queue proposals with any delay' , async function ( ) {
@@ -257,12 +290,21 @@ describe('GovernorTimelockAccess', function () {
257290 // Set base delay
258291 await this . mock . $_setBaseDelaySeconds ( baseDelay ) ;
259292
260- await this . helper . setProposal (
293+ const { id } = await this . helper . setProposal (
261294 [ this . restricted . operation ] ,
262295 `executionDelay=${ executionDelay . toString ( ) } }baseDelay=${ baseDelay . toString ( ) } }` ,
263296 ) ;
264297 await this . helper . propose ( ) ;
265- expect ( await this . mock . proposalNeedsQueuing ( this . helper . currentProposal . id ) ) . to . be . true ;
298+ expect ( await this . mock . proposalNeedsQueuing ( id ) ) . to . be . true ;
299+
300+ await this . helper . waitForSnapshot ( ) ;
301+ await this . helper . connect ( this . voter1 ) . vote ( { support : VoteType . For } ) ;
302+ await this . helper . waitForDeadline ( ) ;
303+
304+ // Not queued, so it should revert
305+ await expect ( this . helper . execute ( ) )
306+ . to . be . revertedWithCustomError ( this . mock , 'GovernorUnexpectedProposalState' )
307+ . withArgs ( id , ProposalState . Succeeded , GovernorHelper . proposalStatesToBitMap ( [ ProposalState . Queued ] ) ) ;
266308 }
267309 } ) ;
268310
@@ -556,7 +598,7 @@ describe('GovernorTimelockAccess', function () {
556598 . withArgs (
557599 this . proposal . id ,
558600 ProposalState . Canceled ,
559- GovernorHelper . proposalStatesToBitMap ( [ ProposalState . Succeeded , ProposalState . Queued ] ) ,
601+ GovernorHelper . proposalStatesToBitMap ( [ ProposalState . Queued ] ) , // proposal needs queueing
560602 ) ;
561603 } ) ;
562604
@@ -602,7 +644,7 @@ describe('GovernorTimelockAccess', function () {
602644 . withArgs (
603645 original . currentProposal . id ,
604646 ProposalState . Canceled ,
605- GovernorHelper . proposalStatesToBitMap ( [ ProposalState . Succeeded , ProposalState . Queued ] ) ,
647+ GovernorHelper . proposalStatesToBitMap ( [ ProposalState . Queued ] ) , // proposal needs queueing
606648 ) ;
607649 } ) ;
608650
@@ -628,7 +670,7 @@ describe('GovernorTimelockAccess', function () {
628670 . withArgs (
629671 this . proposal . id ,
630672 ProposalState . Canceled ,
631- GovernorHelper . proposalStatesToBitMap ( [ ProposalState . Succeeded , ProposalState . Queued ] ) ,
673+ GovernorHelper . proposalStatesToBitMap ( [ ProposalState . Succeeded ] ) , // not queueing necessary
632674 ) ;
633675 } ) ;
634676
@@ -649,7 +691,7 @@ describe('GovernorTimelockAccess', function () {
649691 . withArgs (
650692 this . proposal . id ,
651693 ProposalState . Canceled ,
652- GovernorHelper . proposalStatesToBitMap ( [ ProposalState . Succeeded , ProposalState . Queued ] ) ,
694+ GovernorHelper . proposalStatesToBitMap ( [ ProposalState . Succeeded ] ) , // not queueing necessary
653695 ) ;
654696 } ) ;
655697
0 commit comments