Skip to content
This repository was archived by the owner on Mar 11, 2025. It is now read-only.

Commit aaaf537

Browse files
authored
Governance: Move reserved space to GovernanceConfig (#3628)
* chore: move reserved space to GovernanceConfig * chore: fix build
1 parent 271c13b commit aaaf537

File tree

8 files changed

+11
-12
lines changed

8 files changed

+11
-12
lines changed

governance/chat/program/tests/program_test/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,7 @@ impl GovernanceChatProgramTest {
196196
council_veto_vote_threshold: VoteThreshold::YesVotePercentage(50),
197197
council_vote_tipping: spl_governance::state::enums::VoteTipping::Strict,
198198
community_veto_vote_threshold: VoteThreshold::YesVotePercentage(55),
199+
reserved: [0; 3],
199200
};
200201

201202
let token_owner_record_address = get_token_owner_record_address(

governance/program/src/processor/process_create_governance.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ pub fn process_create_governance(
5757
governed_account: *governed_account_info.key,
5858
config,
5959
proposals_count: 0,
60-
reserved: [0; 3],
6160
voting_proposal_count: 0,
6261
reserved_v2: [0; 128],
6362
};

governance/program/src/processor/process_create_mint_governance.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ pub fn process_create_mint_governance(
6969
governed_account: *governed_mint_info.key,
7070
config,
7171
proposals_count: 0,
72-
reserved: [0; 3],
7372
voting_proposal_count: 0,
7473
reserved_v2: [0; 128],
7574
};

governance/program/src/processor/process_create_program_governance.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ pub fn process_create_program_governance(
6969
governed_account: *governed_program_info.key,
7070
config,
7171
proposals_count: 0,
72-
reserved: [0; 3],
7372
voting_proposal_count: 0,
7473
reserved_v2: [0; 128],
7574
};

governance/program/src/processor/process_create_token_governance.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ pub fn process_create_token_governance(
6767
governed_account: *governed_token_info.key,
6868
config,
6969
proposals_count: 0,
70-
reserved: [0; 3],
7170
voting_proposal_count: 0,
7271
reserved_v2: [0; 128],
7372
};

governance/program/src/state/governance.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@ pub struct GovernanceConfig {
5454

5555
/// The threshold for Community Veto votes
5656
pub community_veto_vote_threshold: VoteThreshold,
57+
58+
/// Reserved space for future versions
59+
pub reserved: [u8; 3],
5760
}
5861

5962
/// Governance Account
@@ -82,9 +85,6 @@ pub struct GovernanceV2 {
8285
/// Governance config
8386
pub config: GovernanceConfig,
8487

85-
/// Reserved space for future versions
86-
pub reserved: [u8; 3],
87-
8888
/// The number of proposals in voting state in the Governance
8989
pub voting_proposal_count: u16,
9090

@@ -284,7 +284,6 @@ pub fn get_governance_data(
284284
governed_account: governance_data_v1.governed_account,
285285
proposals_count: governance_data_v1.proposals_count,
286286
config: governance_data_v1.config,
287-
reserved: [0; 3],
288287
voting_proposal_count: governance_data_v1.voting_proposal_count,
289288

290289
// Add the extra reserved_v2 padding
@@ -575,6 +574,7 @@ mod test {
575574
min_council_weight_to_create_proposal: 1,
576575
council_vote_tipping: VoteTipping::Strict,
577576
community_veto_vote_threshold: VoteThreshold::YesVotePercentage(1),
577+
reserved: [0; 3],
578578
};
579579

580580
// Act
@@ -600,6 +600,7 @@ mod test {
600600
min_council_weight_to_create_proposal: 1,
601601
council_vote_tipping: VoteTipping::Strict,
602602
community_veto_vote_threshold: VoteThreshold::YesVotePercentage(1),
603+
reserved: [0; 3],
603604
};
604605

605606
// Act
@@ -625,6 +626,7 @@ mod test {
625626
min_council_weight_to_create_proposal: 1,
626627
council_vote_tipping: VoteTipping::Strict,
627628
community_veto_vote_threshold: VoteThreshold::YesVotePercentage(1),
629+
reserved: [0; 3],
628630
};
629631

630632
// Act
@@ -650,6 +652,7 @@ mod test {
650652
min_council_weight_to_create_proposal: 1,
651653
council_vote_tipping: VoteTipping::Strict,
652654
community_veto_vote_threshold: VoteThreshold::YesVotePercentage(1),
655+
reserved: [0; 3],
653656
};
654657

655658
// Act
@@ -675,6 +678,7 @@ mod test {
675678
min_council_weight_to_create_proposal: 1,
676679
community_veto_vote_threshold: VoteThreshold::YesVotePercentage(0),
677680
community_vote_tipping: VoteTipping::Strict,
681+
reserved: [0; 3],
678682
};
679683

680684
// Act

governance/program/src/state/proposal.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1177,6 +1177,7 @@ mod test {
11771177
council_veto_vote_threshold: VoteThreshold::YesVotePercentage(50),
11781178
council_vote_tipping: VoteTipping::Strict,
11791179
community_veto_vote_threshold: VoteThreshold::YesVotePercentage(40),
1180+
reserved: [0; 3],
11801181
}
11811182
}
11821183

governance/program/tests/program_test/mod.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1415,6 +1415,7 @@ impl GovernanceProgramTest {
14151415
council_veto_vote_threshold: VoteThreshold::YesVotePercentage(55),
14161416
council_vote_tipping: spl_governance::state::enums::VoteTipping::Strict,
14171417
community_veto_vote_threshold: VoteThreshold::YesVotePercentage(80),
1418+
reserved: [0; 3],
14181419
}
14191420
}
14201421

@@ -1489,7 +1490,6 @@ impl GovernanceProgramTest {
14891490
governed_account: governed_account_cookie.address,
14901491
config: governance_config.clone(),
14911492
proposals_count: 0,
1492-
reserved: [0; 3],
14931493
voting_proposal_count: 0,
14941494
reserved_v2: [0; 128],
14951495
};
@@ -1660,7 +1660,6 @@ impl GovernanceProgramTest {
16601660
governed_account: governed_program_cookie.address,
16611661
config,
16621662
proposals_count: 0,
1663-
reserved: [0; 3],
16641663
voting_proposal_count: 0,
16651664
reserved_v2: [0; 128],
16661665
};
@@ -1782,7 +1781,6 @@ impl GovernanceProgramTest {
17821781
governed_account: governed_mint_cookie.address,
17831782
config: governance_config.clone(),
17841783
proposals_count: 0,
1785-
reserved: [0; 3],
17861784
voting_proposal_count: 0,
17871785
reserved_v2: [0; 128],
17881786
};
@@ -1864,7 +1862,6 @@ impl GovernanceProgramTest {
18641862
governed_account: governed_token_cookie.address,
18651863
config,
18661864
proposals_count: 0,
1867-
reserved: [0; 3],
18681865
voting_proposal_count: 0,
18691866
reserved_v2: [0; 128],
18701867
};

0 commit comments

Comments
 (0)