@@ -10,13 +10,16 @@ use spl_governance::{
1010 } ,
1111 state:: {
1212 enums:: {
13- GovernanceAccountType , MintMaxVoteWeightSource , ProposalState , VoteThresholdPercentage ,
13+ GovernanceAccountType , MintMaxVoterWeightSource , ProposalState , VoteThreshold ,
1414 VoteTipping ,
1515 } ,
1616 governance:: get_governance_address,
1717 proposal:: { get_proposal_address, ProposalV2 } ,
18- realm:: { get_realm_address, RealmConfig , RealmV2 } ,
19- token_owner_record:: { get_token_owner_record_address, TokenOwnerRecordV2 } ,
18+ realm:: { get_realm_address, GoverningTokenConfigAccountArgs , RealmConfig , RealmV2 } ,
19+ realm_config:: GoverningTokenType ,
20+ token_owner_record:: {
21+ get_token_owner_record_address, TokenOwnerRecordV2 , TOKEN_OWNER_RECORD_LAYOUT_VERSION ,
22+ } ,
2023 } ,
2124} ;
2225
@@ -64,7 +67,7 @@ impl GovernanceTest {
6467
6568 #[ allow( dead_code) ]
6669 pub fn add_program ( program_test : & mut ProgramTest ) {
67- program_test. add_program ( "spl_governance_deposit_allowed " , Self :: program_id ( ) , None ) ;
70+ program_test. add_program ( "spl_governance " , Self :: program_id ( ) , None ) ;
6871 }
6972
7073 #[ allow( dead_code) ]
@@ -93,21 +96,27 @@ impl GovernanceTest {
9396 let realm_name = format ! ( "Realm #{}" , self . next_id) . to_string ( ) ;
9497
9598 let min_community_weight_to_create_governance = 1 ;
96- let community_mint_max_vote_weight_source = MintMaxVoteWeightSource :: FULL_SUPPLY_FRACTION ;
99+ let community_mint_max_voter_weight_source = MintMaxVoterWeightSource :: FULL_SUPPLY_FRACTION ;
97100
98101 let realm_key = get_realm_address ( & self . program_id , & realm_name) ;
99102
103+ let community_token_config_args = GoverningTokenConfigAccountArgs {
104+ voter_weight_addin : self . community_voter_weight_addin ,
105+ max_voter_weight_addin : None ,
106+ token_type : GoverningTokenType :: default ( ) ,
107+ } ;
108+
100109 let create_realm_ix = create_realm (
101110 & self . program_id ,
102111 & realm_authority. pubkey ( ) ,
103112 & community_mint_cookie. address ,
104113 & self . bench . payer . pubkey ( ) ,
105114 Some ( council_mint_cookie. address ) ,
106- self . community_voter_weight_addin ,
115+ Some ( community_token_config_args ) ,
107116 None ,
108117 realm_name. clone ( ) ,
109118 min_community_weight_to_create_governance,
110- community_mint_max_vote_weight_source . clone ( ) ,
119+ community_mint_max_voter_weight_source . clone ( ) ,
111120 ) ;
112121
113122 self . bench
@@ -125,12 +134,13 @@ impl GovernanceTest {
125134 council_mint : Some ( council_mint_cookie. address ) ,
126135 reserved : [ 0 ; 6 ] ,
127136 min_community_weight_to_create_governance,
128- community_mint_max_vote_weight_source ,
129- use_community_voter_weight_addin : false ,
130- use_max_community_voter_weight_addin : false ,
137+ legacy1 : 0 ,
138+ legacy2 : 0 ,
139+ community_mint_max_voter_weight_source ,
131140 } ,
132- voting_proposal_count : 0 ,
141+
133142 reserved_v2 : [ 0 ; 128 ] ,
143+ legacy1 : 0 ,
134144 } ;
135145
136146 Ok ( RealmCookie {
@@ -208,13 +218,19 @@ impl GovernanceTest {
208218 & realm_cookie. realm_authority . pubkey ( ) ,
209219 None ,
210220 spl_governance:: state:: governance:: GovernanceConfig {
211- vote_threshold_percentage : VoteThresholdPercentage :: YesVote ( 60 ) ,
212221 min_community_weight_to_create_proposal : 1 ,
213222 min_transaction_hold_up_time : 0 ,
214- max_voting_time : 600 ,
215- vote_tipping : VoteTipping :: Disabled ,
216- proposal_cool_off_time : 0 ,
217223 min_council_weight_to_create_proposal : 1 ,
224+
225+ community_vote_threshold : VoteThreshold :: YesVotePercentage ( 60 ) ,
226+ voting_base_time : 600 ,
227+ community_vote_tipping : VoteTipping :: Strict ,
228+ council_vote_threshold : VoteThreshold :: YesVotePercentage ( 60 ) ,
229+ council_veto_vote_threshold : VoteThreshold :: Disabled ,
230+ council_vote_tipping : VoteTipping :: Disabled ,
231+ community_veto_vote_threshold : VoteThreshold :: Disabled ,
232+ voting_cool_off_time : 0 ,
233+ deposit_exempt_proposal_count : 10 ,
218234 } ,
219235 ) ;
220236
@@ -225,14 +241,14 @@ impl GovernanceTest {
225241 )
226242 . await ?;
227243
228- let proposal_index: u32 = 0 ;
229244 let proposal_governing_token_mint = realm_cookie. account . community_mint ;
245+ let proposal_seed = Pubkey :: new_unique ( ) ;
230246
231247 let proposal_key = get_proposal_address (
232248 & self . program_id ,
233249 & governance_key,
234250 & proposal_governing_token_mint,
235- & proposal_index . to_le_bytes ( ) ,
251+ & proposal_seed ,
236252 ) ;
237253
238254 let create_proposal_ix = create_proposal (
@@ -249,7 +265,7 @@ impl GovernanceTest {
249265 spl_governance:: state:: proposal:: VoteType :: SingleChoice ,
250266 vec ! [ "Yes" . to_string( ) ] ,
251267 true ,
252- 0_u32 ,
268+ & proposal_seed ,
253269 ) ;
254270
255271 let sign_off_proposal_ix = sign_off_proposal (
@@ -276,7 +292,7 @@ impl GovernanceTest {
276292 vote_type : spl_governance:: state:: proposal:: VoteType :: SingleChoice ,
277293 options : vec ! [ ] ,
278294 deny_vote_weight : Some ( 1 ) ,
279- veto_vote_weight : None ,
295+ veto_vote_weight : 0 ,
280296 abstain_vote_weight : None ,
281297 start_voting_at : None ,
282298 draft_at : 1 ,
@@ -289,10 +305,12 @@ impl GovernanceTest {
289305 execution_flags : spl_governance:: state:: enums:: InstructionExecutionFlags :: None ,
290306 max_vote_weight : None ,
291307 max_voting_time : None ,
292- vote_threshold_percentage : None ,
308+
293309 reserved : [ 0 ; 64 ] ,
294310 name : String :: from ( "Proposal #1" ) ,
295311 description_link : String :: from ( "Proposal #1 link" ) ,
312+ reserved1 : 0 ,
313+ vote_threshold : None ,
296314 } ;
297315
298316 Ok ( ProposalCookie {
@@ -362,11 +380,11 @@ impl GovernanceTest {
362380 governing_token_owner : token_owner_cookie. address ,
363381 governing_token_deposit_amount : tokens_to_deposit,
364382 unrelinquished_votes_count : 0 ,
365- total_votes_count : 0 ,
366383 outstanding_proposal_count : 0 ,
367- reserved : [ 0 ; 7 ] ,
384+ reserved : [ 0 ; 6 ] ,
368385 governance_delegate : None ,
369386 reserved_v2 : [ 0 ; 128 ] ,
387+ version : TOKEN_OWNER_RECORD_LAYOUT_VERSION ,
370388 } ;
371389
372390 Ok ( TokenOwnerRecordCookie {
@@ -384,6 +402,7 @@ impl GovernanceTest {
384402 ) -> Result < ( ) , TransportError > {
385403 let relinquish_vote_ix = relinquish_vote (
386404 & self . program_id ,
405+ & token_owner_record_cookie. account . realm ,
387406 & proposal_cookie. account . governance ,
388407 & proposal_cookie. address ,
389408 & token_owner_record_cookie. address ,
0 commit comments