@@ -18,10 +18,16 @@ import {
18
18
TimelockConfig ,
19
19
TimelockProposalListResponse ,
20
20
} from '@neutron-org/neutronjsplus/dist/dao' ;
21
- import { Wallet } from '@neutron-org/neutronjsplus/dist/types' ;
21
+ import {
22
+ SingleChoiceProposal ,
23
+ Wallet ,
24
+ } from '@neutron-org/neutronjsplus/dist/types' ;
22
25
import { BroadcastTx200ResponseTxResponse } from '@cosmos-client/core/cjs/openapi/api' ;
23
26
import cosmosclient from '@cosmos-client/core' ;
24
- import { waitSeconds } from '@neutron-org/neutronjsplus/dist/wait' ;
27
+ import {
28
+ getWithAttempts ,
29
+ waitSeconds ,
30
+ } from '@neutron-org/neutronjsplus/dist/wait' ;
25
31
import {
26
32
paramChangeProposal ,
27
33
sendProposal ,
@@ -480,6 +486,86 @@ describe('Neutron / Subdao', () => {
480
486
} ) ;
481
487
} ) ;
482
488
489
+ describe ( 'Timelock3: Closed overruled proposal should not prevent execution' , ( ) => {
490
+ let proposalId : number ;
491
+ beforeAll ( async ( ) => {
492
+ proposalId = await subdaoMember1 . submitUpdateSubDaoConfigProposal (
493
+ {
494
+ name : 'dao name after timelock3' ,
495
+ } ,
496
+ 'single2' ,
497
+ ) ;
498
+
499
+ // move proposal to the timelocked state where it can be overruled
500
+ const timelockedProp = await subdaoMember1 . supportAndExecuteProposal (
501
+ proposalId ,
502
+ 'single2' ,
503
+ ) ;
504
+
505
+ expect ( timelockedProp . id ) . toEqual ( proposalId ) ;
506
+ expect ( timelockedProp . status ) . toEqual ( 'timelocked' ) ;
507
+ expect ( timelockedProp . msgs ) . toHaveLength ( 1 ) ;
508
+ } ) ;
509
+
510
+ test ( 'close rejected overrule proposal' , async ( ) => {
511
+ const overruleProposalId = await mainDao . getOverruleProposalId (
512
+ subDao . contracts . proposals . single2 . pre_propose . timelock ! . address ,
513
+ proposalId ,
514
+ ) ;
515
+
516
+ // wait 20 seconds
517
+ await waitSeconds ( 20 ) ;
518
+
519
+ const propOverruledTest =
520
+ await mainDao . chain . queryContract < SingleChoiceProposal > (
521
+ mainDaoMember . dao . contracts . proposals . overrule ?. address ,
522
+ {
523
+ proposal : {
524
+ proposal_id : overruleProposalId ,
525
+ } ,
526
+ } ,
527
+ ) ;
528
+ expect ( propOverruledTest . proposal . status ) . toEqual ( 'rejected' ) ;
529
+
530
+ await subdaoMember1 . user . executeContract (
531
+ mainDaoMember . dao . contracts . proposals . overrule . address ,
532
+ JSON . stringify ( {
533
+ close : { proposal_id : overruleProposalId } ,
534
+ } ) ,
535
+ ) ;
536
+
537
+ const propOverruledTest2 = await getWithAttempts (
538
+ neutronChain . blockWaiter ,
539
+ async ( ) =>
540
+ await mainDao . chain . queryContractWithWait < SingleChoiceProposal > (
541
+ mainDaoMember . dao . contracts . proposals . overrule ?. address ,
542
+ {
543
+ proposal : {
544
+ proposal_id : overruleProposalId ,
545
+ } ,
546
+ } ,
547
+ ) ,
548
+ async ( p ) => p . proposal . status === 'closed' ,
549
+ 5 ,
550
+ ) ;
551
+
552
+ expect ( propOverruledTest2 . proposal . status ) . toEqual ( 'closed' ) ;
553
+ } ) ;
554
+
555
+ test ( 'execute timelocked: success' , async ( ) => {
556
+ await waitSeconds ( 20 ) ;
557
+ await subdaoMember1 . executeTimelockedProposal ( proposalId , 'single2' ) ;
558
+
559
+ const timelockedProp = await subDao . getTimelockedProposal (
560
+ proposalId ,
561
+ 'single2' ,
562
+ ) ;
563
+ expect ( timelockedProp . id ) . toEqual ( proposalId ) ;
564
+ expect ( timelockedProp . status ) . toEqual ( 'executed' ) ;
565
+ expect ( timelockedProp . msgs ) . toHaveLength ( 1 ) ;
566
+ } ) ;
567
+ } ) ;
568
+
483
569
describe ( 'Non-timelock typed duration pause proposal: Succeed creation' , ( ) => {
484
570
let proposalId : number ;
485
571
0 commit comments