@@ -48,14 +48,12 @@ pub struct GovernanceConfig {
48
48
49
49
/// Minimum council weight a governance token owner must possess to be able to create a proposal
50
50
pub min_council_weight_to_create_proposal : u64 ,
51
- //
52
- // The threshold for Community Veto votes
53
- // Note: Community Veto vote is not supported in the current version
54
- // In order to use this threshold the space from GovernanceV2.reserved must be taken to expand GovernanceConfig size
55
- // pub community_veto_vote_threshold: VoteThreshold,
56
- //
51
+
57
52
/// Conditions under which a Council vote will complete early
58
53
pub council_vote_tipping : VoteTipping ,
54
+
55
+ /// The threshold for Community Veto votes
56
+ pub community_veto_vote_threshold : VoteThreshold ,
59
57
}
60
58
61
59
/// Governance Account
@@ -85,7 +83,7 @@ pub struct GovernanceV2 {
85
83
pub config : GovernanceConfig ,
86
84
87
85
/// Reserved space for future versions
88
- pub reserved : [ u8 ; 5 ] ,
86
+ pub reserved : [ u8 ; 3 ] ,
89
87
90
88
/// The number of proposals in voting state in the Governance
91
89
pub voting_proposal_count : u16 ,
@@ -228,10 +226,7 @@ impl GovernanceV2 {
228
226
let vote_threshold = if realm_data. community_mint == * vote_governing_token_mint {
229
227
match vote_kind {
230
228
VoteKind :: Electorate => & self . config . community_vote_threshold ,
231
- VoteKind :: Veto => {
232
- // Community Veto vote is not supported in current version
233
- return Err ( GovernanceError :: GoverningTokenMintNotAllowedToVote . into ( ) ) ;
234
- }
229
+ VoteKind :: Veto => & self . config . community_veto_vote_threshold ,
235
230
}
236
231
} else if realm_data. config . council_mint == Some ( * vote_governing_token_mint) {
237
232
match vote_kind {
@@ -289,7 +284,7 @@ pub fn get_governance_data(
289
284
governed_account : governance_data_v1. governed_account ,
290
285
proposals_count : governance_data_v1. proposals_count ,
291
286
config : governance_data_v1. config ,
292
- reserved : [ 0 ; 5 ] ,
287
+ reserved : [ 0 ; 3 ] ,
293
288
voting_proposal_count : governance_data_v1. voting_proposal_count ,
294
289
295
290
// Add the extra reserved_v2 padding
@@ -317,7 +312,10 @@ pub fn get_governance_data(
317
312
318
313
// For legacy accounts default Council VoteTipping to the Community
319
314
governance_data. config . council_vote_tipping =
320
- governance_data. config . community_vote_tipping . clone ( )
315
+ governance_data. config . community_vote_tipping . clone ( ) ;
316
+
317
+ // For legacy accoutns set the community Veto threshold to Disabled
318
+ governance_data. config . community_veto_vote_threshold = VoteThreshold :: Disabled ;
321
319
}
322
320
323
321
Ok ( governance_data)
@@ -472,6 +470,8 @@ pub fn assert_is_valid_governance_config(
472
470
governance_config : & GovernanceConfig ,
473
471
) -> Result < ( ) , ProgramError > {
474
472
assert_is_valid_vote_threshold ( & governance_config. community_vote_threshold ) ?;
473
+ assert_is_valid_vote_threshold ( & governance_config. community_veto_vote_threshold ) ?;
474
+
475
475
assert_is_valid_vote_threshold ( & governance_config. council_vote_threshold ) ?;
476
476
assert_is_valid_vote_threshold ( & governance_config. council_veto_vote_threshold ) ?;
477
477
@@ -574,6 +574,7 @@ mod test {
574
574
council_veto_vote_threshold : VoteThreshold :: YesVotePercentage ( 1 ) ,
575
575
min_council_weight_to_create_proposal : 1 ,
576
576
council_vote_tipping : VoteTipping :: Strict ,
577
+ community_veto_vote_threshold : VoteThreshold :: YesVotePercentage ( 1 ) ,
577
578
} ;
578
579
579
580
// Act
@@ -598,6 +599,7 @@ mod test {
598
599
council_veto_vote_threshold : VoteThreshold :: YesVotePercentage ( 1 ) ,
599
600
min_council_weight_to_create_proposal : 1 ,
600
601
council_vote_tipping : VoteTipping :: Strict ,
602
+ community_veto_vote_threshold : VoteThreshold :: YesVotePercentage ( 1 ) ,
601
603
} ;
602
604
603
605
// Act
@@ -622,6 +624,7 @@ mod test {
622
624
council_veto_vote_threshold : VoteThreshold :: YesVotePercentage ( 1 ) ,
623
625
min_council_weight_to_create_proposal : 1 ,
624
626
council_vote_tipping : VoteTipping :: Strict ,
627
+ community_veto_vote_threshold : VoteThreshold :: YesVotePercentage ( 1 ) ,
625
628
} ;
626
629
627
630
// Act
@@ -646,6 +649,32 @@ mod test {
646
649
council_veto_vote_threshold : VoteThreshold :: YesVotePercentage ( 0 ) ,
647
650
min_council_weight_to_create_proposal : 1 ,
648
651
council_vote_tipping : VoteTipping :: Strict ,
652
+ community_veto_vote_threshold : VoteThreshold :: YesVotePercentage ( 1 ) ,
653
+ } ;
654
+
655
+ // Act
656
+ let err = assert_is_valid_governance_config ( & governance_config)
657
+ . err ( )
658
+ . unwrap ( ) ;
659
+
660
+ // Assert
661
+ assert_eq ! ( err, GovernanceError :: InvalidVoteThresholdPercentage . into( ) ) ;
662
+ }
663
+
664
+ #[ test]
665
+ fn test_assert_config_invalid_with_community_zero_yes_veto_vote_threshold ( ) {
666
+ // Arrange
667
+ let governance_config = GovernanceConfig {
668
+ community_vote_threshold : VoteThreshold :: YesVotePercentage ( 1 ) ,
669
+ min_community_weight_to_create_proposal : 1 ,
670
+ min_transaction_hold_up_time : 1 ,
671
+ max_voting_time : 1 ,
672
+ council_vote_tipping : VoteTipping :: Strict ,
673
+ council_vote_threshold : VoteThreshold :: YesVotePercentage ( 1 ) ,
674
+ council_veto_vote_threshold : VoteThreshold :: YesVotePercentage ( 1 ) ,
675
+ min_council_weight_to_create_proposal : 1 ,
676
+ community_veto_vote_threshold : VoteThreshold :: YesVotePercentage ( 0 ) ,
677
+ community_vote_tipping : VoteTipping :: Strict ,
649
678
} ;
650
679
651
680
// Act
0 commit comments