Governance: Move reserved space to GovernanceConfig (#3628)

* chore: move reserved space to GovernanceConfig

* chore: fix build
This commit is contained in:
Sebastian Bor 2022-09-27 21:23:43 +01:00 committed by GitHub
parent 271c13b20c
commit aaaf537be3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 11 additions and 12 deletions

View File

@ -196,6 +196,7 @@ impl GovernanceChatProgramTest {
council_veto_vote_threshold: VoteThreshold::YesVotePercentage(50),
council_vote_tipping: spl_governance::state::enums::VoteTipping::Strict,
community_veto_vote_threshold: VoteThreshold::YesVotePercentage(55),
reserved: [0; 3],
};
let token_owner_record_address = get_token_owner_record_address(

View File

@ -57,7 +57,6 @@ pub fn process_create_governance(
governed_account: *governed_account_info.key,
config,
proposals_count: 0,
reserved: [0; 3],
voting_proposal_count: 0,
reserved_v2: [0; 128],
};

View File

@ -69,7 +69,6 @@ pub fn process_create_mint_governance(
governed_account: *governed_mint_info.key,
config,
proposals_count: 0,
reserved: [0; 3],
voting_proposal_count: 0,
reserved_v2: [0; 128],
};

View File

@ -69,7 +69,6 @@ pub fn process_create_program_governance(
governed_account: *governed_program_info.key,
config,
proposals_count: 0,
reserved: [0; 3],
voting_proposal_count: 0,
reserved_v2: [0; 128],
};

View File

@ -67,7 +67,6 @@ pub fn process_create_token_governance(
governed_account: *governed_token_info.key,
config,
proposals_count: 0,
reserved: [0; 3],
voting_proposal_count: 0,
reserved_v2: [0; 128],
};

View File

@ -54,6 +54,9 @@ pub struct GovernanceConfig {
/// The threshold for Community Veto votes
pub community_veto_vote_threshold: VoteThreshold,
/// Reserved space for future versions
pub reserved: [u8; 3],
}
/// Governance Account
@ -82,9 +85,6 @@ pub struct GovernanceV2 {
/// Governance config
pub config: GovernanceConfig,
/// Reserved space for future versions
pub reserved: [u8; 3],
/// The number of proposals in voting state in the Governance
pub voting_proposal_count: u16,
@ -284,7 +284,6 @@ pub fn get_governance_data(
governed_account: governance_data_v1.governed_account,
proposals_count: governance_data_v1.proposals_count,
config: governance_data_v1.config,
reserved: [0; 3],
voting_proposal_count: governance_data_v1.voting_proposal_count,
// Add the extra reserved_v2 padding
@ -575,6 +574,7 @@ mod test {
min_council_weight_to_create_proposal: 1,
council_vote_tipping: VoteTipping::Strict,
community_veto_vote_threshold: VoteThreshold::YesVotePercentage(1),
reserved: [0; 3],
};
// Act
@ -600,6 +600,7 @@ mod test {
min_council_weight_to_create_proposal: 1,
council_vote_tipping: VoteTipping::Strict,
community_veto_vote_threshold: VoteThreshold::YesVotePercentage(1),
reserved: [0; 3],
};
// Act
@ -625,6 +626,7 @@ mod test {
min_council_weight_to_create_proposal: 1,
council_vote_tipping: VoteTipping::Strict,
community_veto_vote_threshold: VoteThreshold::YesVotePercentage(1),
reserved: [0; 3],
};
// Act
@ -650,6 +652,7 @@ mod test {
min_council_weight_to_create_proposal: 1,
council_vote_tipping: VoteTipping::Strict,
community_veto_vote_threshold: VoteThreshold::YesVotePercentage(1),
reserved: [0; 3],
};
// Act
@ -675,6 +678,7 @@ mod test {
min_council_weight_to_create_proposal: 1,
community_veto_vote_threshold: VoteThreshold::YesVotePercentage(0),
community_vote_tipping: VoteTipping::Strict,
reserved: [0; 3],
};
// Act

View File

@ -1177,6 +1177,7 @@ mod test {
council_veto_vote_threshold: VoteThreshold::YesVotePercentage(50),
council_vote_tipping: VoteTipping::Strict,
community_veto_vote_threshold: VoteThreshold::YesVotePercentage(40),
reserved: [0; 3],
}
}

View File

@ -1415,6 +1415,7 @@ impl GovernanceProgramTest {
council_veto_vote_threshold: VoteThreshold::YesVotePercentage(55),
council_vote_tipping: spl_governance::state::enums::VoteTipping::Strict,
community_veto_vote_threshold: VoteThreshold::YesVotePercentage(80),
reserved: [0; 3],
}
}
@ -1489,7 +1490,6 @@ impl GovernanceProgramTest {
governed_account: governed_account_cookie.address,
config: governance_config.clone(),
proposals_count: 0,
reserved: [0; 3],
voting_proposal_count: 0,
reserved_v2: [0; 128],
};
@ -1660,7 +1660,6 @@ impl GovernanceProgramTest {
governed_account: governed_program_cookie.address,
config,
proposals_count: 0,
reserved: [0; 3],
voting_proposal_count: 0,
reserved_v2: [0; 128],
};
@ -1782,7 +1781,6 @@ impl GovernanceProgramTest {
governed_account: governed_mint_cookie.address,
config: governance_config.clone(),
proposals_count: 0,
reserved: [0; 3],
voting_proposal_count: 0,
reserved_v2: [0; 128],
};
@ -1864,7 +1862,6 @@ impl GovernanceProgramTest {
governed_account: governed_token_cookie.address,
config,
proposals_count: 0,
reserved: [0; 3],
voting_proposal_count: 0,
reserved_v2: [0; 128],
};