diff --git a/Cargo.lock b/Cargo.lock index 632eb462..6d6ab613 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4184,9 +4184,9 @@ dependencies = [ [[package]] name = "spl-governance" -version = "2.2.4" +version = "3.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ab3e781972cd03348c14217739ddf946ab5324c32a85392237cf3ab9492df7a" +checksum = "f7a42340af2f3334ee1ee718e6d68b939c98cab4ceb381429f952c72d68e1ebf" dependencies = [ "arrayref", "bincode", @@ -4204,9 +4204,9 @@ dependencies = [ [[package]] name = "spl-governance-addin-api" -version = "0.1.2" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5df620226aed88689457ef18a80dfed709721365bee0bf8c843dcef30279d5fc" +checksum = "1e0feddb2c7efa42f39954e3bb1b0bfc6dc7e9292ca467eff40ecd934c14106b" dependencies = [ "borsh", "solana-program", @@ -4215,9 +4215,9 @@ dependencies = [ [[package]] name = "spl-governance-addin-mock" -version = "0.1.2" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abf879cb4193a2ce4763cfcf8c314f9275eedcf241a19db7eb87bd119e632f29" +checksum = "49390332293d75d973dec617090157ab39d3d63f064ea7790cc8fee36d26c149" dependencies = [ "arrayref", "bincode", @@ -4235,9 +4235,9 @@ dependencies = [ [[package]] name = "spl-governance-tools" -version = "0.1.2" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a206f0837415046d919f3075d6b3af9bd3f1f707c887898c335a6210b194627" +checksum = "3bd674d9e8f3fc9ea628dcbe56d48991ea1cb05b994a7845782572c705efd836" dependencies = [ "arrayref", "bincode", diff --git a/programs/gateway/Cargo.toml b/programs/gateway/Cargo.toml index 4ef8b4fc..14294453 100644 --- a/programs/gateway/Cargo.toml +++ b/programs/gateway/Cargo.toml @@ -27,13 +27,13 @@ num-derive = "0.3" num-traits = "0.2" solana-gateway = "0.2.2" solana-program = "1.14.16" -spl-governance = { version = "2.2.4", features = ["no-entrypoint"] } -spl-governance-tools= "0.1.2" -spl-governance-addin-api = "0.1.2" +spl-governance = { version = "3.1.1", features = ["no-entrypoint"] } +spl-governance-tools= "0.1.3" +spl-governance-addin-api = "0.1.3" spl-token = { version = "3.3", features = [ "no-entrypoint" ] } [dev-dependencies] borsh = "0.9.1" solana-sdk = "1.14.16" solana-program-test = "1.14.16" -spl-governance-addin-mock = "0.1.2" \ No newline at end of file +spl-governance-addin-mock = "0.1.3" \ No newline at end of file diff --git a/programs/gateway/tests/fixtures/spl_governance.so b/programs/gateway/tests/fixtures/spl_governance.so index 9a6f5962..84786e9a 100755 Binary files a/programs/gateway/tests/fixtures/spl_governance.so and b/programs/gateway/tests/fixtures/spl_governance.so differ diff --git a/programs/gateway/tests/fixtures/spl_governance_deposit_allowed.so b/programs/gateway/tests/fixtures/spl_governance_deposit_allowed.so deleted file mode 100755 index 009df5fb..00000000 Binary files a/programs/gateway/tests/fixtures/spl_governance_deposit_allowed.so and /dev/null differ diff --git a/programs/gateway/tests/program_test/governance_test.rs b/programs/gateway/tests/program_test/governance_test.rs index 04576b9d..e17e31ae 100644 --- a/programs/gateway/tests/program_test/governance_test.rs +++ b/programs/gateway/tests/program_test/governance_test.rs @@ -10,13 +10,16 @@ use spl_governance::{ }, state::{ enums::{ - GovernanceAccountType, MintMaxVoteWeightSource, ProposalState, VoteThresholdPercentage, + GovernanceAccountType, MintMaxVoterWeightSource, ProposalState, VoteThreshold, VoteTipping, }, governance::get_governance_address, proposal::{get_proposal_address, ProposalV2}, - realm::{get_realm_address, RealmConfig, RealmV2}, - token_owner_record::{get_token_owner_record_address, TokenOwnerRecordV2}, + realm::{get_realm_address, GoverningTokenConfigAccountArgs, RealmConfig, RealmV2}, + realm_config::GoverningTokenType, + token_owner_record::{ + get_token_owner_record_address, TokenOwnerRecordV2, TOKEN_OWNER_RECORD_LAYOUT_VERSION, + }, }, }; @@ -64,7 +67,7 @@ impl GovernanceTest { #[allow(dead_code)] pub fn add_program(program_test: &mut ProgramTest) { - program_test.add_program("spl_governance_deposit_allowed", Self::program_id(), None); + program_test.add_program("spl_governance", Self::program_id(), None); } #[allow(dead_code)] @@ -93,21 +96,27 @@ impl GovernanceTest { let realm_name = format!("Realm #{}", self.next_id).to_string(); let min_community_weight_to_create_governance = 1; - let community_mint_max_vote_weight_source = MintMaxVoteWeightSource::FULL_SUPPLY_FRACTION; + let community_mint_max_voter_weight_source = MintMaxVoterWeightSource::FULL_SUPPLY_FRACTION; let realm_key = get_realm_address(&self.program_id, &realm_name); + let community_token_config_args = GoverningTokenConfigAccountArgs { + voter_weight_addin: self.community_voter_weight_addin, + max_voter_weight_addin: None, + token_type: GoverningTokenType::default(), + }; + let create_realm_ix = create_realm( &self.program_id, &realm_authority.pubkey(), &community_mint_cookie.address, &self.bench.payer.pubkey(), Some(council_mint_cookie.address), - self.community_voter_weight_addin, + Some(community_token_config_args), None, realm_name.clone(), min_community_weight_to_create_governance, - community_mint_max_vote_weight_source.clone(), + community_mint_max_voter_weight_source.clone(), ); self.bench @@ -125,12 +134,13 @@ impl GovernanceTest { council_mint: Some(council_mint_cookie.address), reserved: [0; 6], min_community_weight_to_create_governance, - community_mint_max_vote_weight_source, - use_community_voter_weight_addin: false, - use_max_community_voter_weight_addin: false, + legacy1: 0, + legacy2: 0, + community_mint_max_voter_weight_source, }, - voting_proposal_count: 0, + reserved_v2: [0; 128], + legacy1: 0, }; Ok(RealmCookie { @@ -208,13 +218,19 @@ impl GovernanceTest { &realm_cookie.realm_authority.pubkey(), None, spl_governance::state::governance::GovernanceConfig { - vote_threshold_percentage: VoteThresholdPercentage::YesVote(60), min_community_weight_to_create_proposal: 1, min_transaction_hold_up_time: 0, - max_voting_time: 600, - vote_tipping: VoteTipping::Disabled, - proposal_cool_off_time: 0, min_council_weight_to_create_proposal: 1, + + community_vote_threshold: VoteThreshold::YesVotePercentage(60), + voting_base_time: 600, + community_vote_tipping: VoteTipping::Strict, + council_vote_threshold: VoteThreshold::YesVotePercentage(60), + council_veto_vote_threshold: VoteThreshold::Disabled, + council_vote_tipping: VoteTipping::Disabled, + community_veto_vote_threshold: VoteThreshold::Disabled, + voting_cool_off_time: 0, + deposit_exempt_proposal_count: 10, }, ); @@ -225,14 +241,14 @@ impl GovernanceTest { ) .await?; - let proposal_index: u32 = 0; let proposal_governing_token_mint = realm_cookie.account.community_mint; + let proposal_seed = Pubkey::new_unique(); let proposal_key = get_proposal_address( &self.program_id, &governance_key, &proposal_governing_token_mint, - &proposal_index.to_le_bytes(), + &proposal_seed, ); let create_proposal_ix = create_proposal( @@ -249,7 +265,7 @@ impl GovernanceTest { spl_governance::state::proposal::VoteType::SingleChoice, vec!["Yes".to_string()], true, - 0_u32, + &proposal_seed, ); let sign_off_proposal_ix = sign_off_proposal( @@ -276,7 +292,7 @@ impl GovernanceTest { vote_type: spl_governance::state::proposal::VoteType::SingleChoice, options: vec![], deny_vote_weight: Some(1), - veto_vote_weight: None, + veto_vote_weight: 0, abstain_vote_weight: None, start_voting_at: None, draft_at: 1, @@ -289,10 +305,12 @@ impl GovernanceTest { execution_flags: spl_governance::state::enums::InstructionExecutionFlags::None, max_vote_weight: None, max_voting_time: None, - vote_threshold_percentage: None, + reserved: [0; 64], name: String::from("Proposal #1"), description_link: String::from("Proposal #1 link"), + reserved1: 0, + vote_threshold: None, }; Ok(ProposalCookie { @@ -362,11 +380,11 @@ impl GovernanceTest { governing_token_owner: token_owner_cookie.address, governing_token_deposit_amount: tokens_to_deposit, unrelinquished_votes_count: 0, - total_votes_count: 0, outstanding_proposal_count: 0, - reserved: [0; 7], + reserved: [0; 6], governance_delegate: None, reserved_v2: [0; 128], + version: TOKEN_OWNER_RECORD_LAYOUT_VERSION, }; Ok(TokenOwnerRecordCookie { @@ -384,6 +402,7 @@ impl GovernanceTest { ) -> Result<(), TransportError> { let relinquish_vote_ix = relinquish_vote( &self.program_id, + &token_owner_record_cookie.account.realm, &proposal_cookie.account.governance, &proposal_cookie.address, &token_owner_record_cookie.address, diff --git a/programs/nft-voter/Cargo.toml b/programs/nft-voter/Cargo.toml index 07723931..59be1a18 100644 --- a/programs/nft-voter/Cargo.toml +++ b/programs/nft-voter/Cargo.toml @@ -23,8 +23,8 @@ anchor-spl = { version = "0.26.0", features = ["token"] } itertools = "0.10.2" mpl-token-metadata = { version = "=1.1.0", features = ["no-entrypoint"] } solana-program = "1.14.16" -spl-governance = { version = "2.2.2", features = ["no-entrypoint"] } -spl-governance-tools= "=0.1.2" +spl-governance = { version = "3.1.1", features = ["no-entrypoint"] } +spl-governance-tools= "0.1.3" spl-token = { version = "3.5", features = [ "no-entrypoint" ] } # The explicit versions are required to compile Anchor <= 0.27.0 diff --git a/programs/nft-voter/src/error.rs b/programs/nft-voter/src/error.rs index f0abbaa3..ab01160e 100644 --- a/programs/nft-voter/src/error.rs +++ b/programs/nft-voter/src/error.rs @@ -73,7 +73,4 @@ pub enum NftVoterError { #[msg("VoterWeightRecord must be expired")] VoterWeightRecordMustBeExpired, - - #[msg("Cannot configure collection with voting proposals")] - CannotConfigureCollectionWithVotingProposals, } diff --git a/programs/nft-voter/src/instructions/cast_nft_vote.rs b/programs/nft-voter/src/instructions/cast_nft_vote.rs index be2c6a7e..c869deb7 100644 --- a/programs/nft-voter/src/instructions/cast_nft_vote.rs +++ b/programs/nft-voter/src/instructions/cast_nft_vote.rs @@ -116,6 +116,7 @@ pub fn cast_nft_vote<'a, 'b, 'c, 'info>( &id(), &ctx.accounts.system_program.to_account_info(), &rent, + 0, )?; } diff --git a/programs/nft-voter/src/instructions/configure_collection.rs b/programs/nft-voter/src/instructions/configure_collection.rs index 1d62fe30..c217718f 100644 --- a/programs/nft-voter/src/instructions/configure_collection.rs +++ b/programs/nft-voter/src/instructions/configure_collection.rs @@ -65,10 +65,13 @@ pub fn configure_collection( NftVoterError::InvalidRealmAuthority ); + // spl-gov doesn't track voting_proposal_count any longer and we can't enforce the check here + // It's not ideal but acceptable. The proper solution would require proposal queuing in spl-gov + // // Changes to the collections config can accidentally tip the scales for outstanding proposals and hence we disallow it - if realm.voting_proposal_count > 0 { - return err!(NftVoterError::CannotConfigureCollectionWithVotingProposals); - } + // if realm.voting_proposal_count > 0 { + // return err!(NftVoterError::CannotConfigureCollectionWithVotingProposals); + // } let collection = &ctx.accounts.collection; diff --git a/programs/nft-voter/src/instructions/relinquish_nft_vote.rs b/programs/nft-voter/src/instructions/relinquish_nft_vote.rs index 7f0239e8..f395b45c 100644 --- a/programs/nft-voter/src/instructions/relinquish_nft_vote.rs +++ b/programs/nft-voter/src/instructions/relinquish_nft_vote.rs @@ -136,7 +136,7 @@ pub fn relinquish_nft_vote(ctx: Context) -> Result<()> { &governing_token_owner, )?; - dispose_account(nft_vote_record_info, &ctx.accounts.beneficiary); + dispose_account(nft_vote_record_info, &ctx.accounts.beneficiary)?; } // Reset VoterWeightRecord and set expiry to expired to prevent it from being used diff --git a/programs/nft-voter/tests/configure_collection.rs b/programs/nft-voter/tests/configure_collection.rs index 6ff5afbf..4d83f5e3 100644 --- a/programs/nft-voter/tests/configure_collection.rs +++ b/programs/nft-voter/tests/configure_collection.rs @@ -411,62 +411,3 @@ async fn test_configure_collection_with_invalid_max_voter_weight_mint_error( Ok(()) } - -#[tokio::test] -async fn test_configure_collection_with_voting_proposal_error() -> Result<(), TransportError> { - // Arrange - let mut nft_voter_test = NftVoterTest::start_new().await; - - let realm_cookie = nft_voter_test.governance.with_realm().await?; - - let registrar_cookie = nft_voter_test.with_registrar(&realm_cookie).await?; - - let nft_collection_cookie = nft_voter_test.token_metadata.with_nft_collection().await?; - - let max_voter_weight_record_cookie = nft_voter_test - .with_max_voter_weight_record(®istrar_cookie) - .await?; - - nft_voter_test - .with_collection( - ®istrar_cookie, - &nft_collection_cookie, - &max_voter_weight_record_cookie, - Some(ConfigureCollectionArgs { - weight: 10, - size: 20, - }), - ) - .await?; - - nft_voter_test - .governance - .with_proposal(&realm_cookie) - .await?; - - nft_voter_test.bench.advance_clock().await; - - // Act - - let err = nft_voter_test - .with_collection( - ®istrar_cookie, - &nft_collection_cookie, - &max_voter_weight_record_cookie, - Some(ConfigureCollectionArgs { - weight: 10, - size: 20, - }), - ) - .await - .err() - .unwrap(); - - // Assert - assert_nft_voter_err( - err, - NftVoterError::CannotConfigureCollectionWithVotingProposals, - ); - - Ok(()) -} diff --git a/programs/nft-voter/tests/fixtures/spl_governance.so b/programs/nft-voter/tests/fixtures/spl_governance.so index 9a6f5962..84786e9a 100755 Binary files a/programs/nft-voter/tests/fixtures/spl_governance.so and b/programs/nft-voter/tests/fixtures/spl_governance.so differ diff --git a/programs/nft-voter/tests/program_test/governance_test.rs b/programs/nft-voter/tests/program_test/governance_test.rs index 37786c05..31f86fd2 100644 --- a/programs/nft-voter/tests/program_test/governance_test.rs +++ b/programs/nft-voter/tests/program_test/governance_test.rs @@ -10,13 +10,16 @@ use spl_governance::{ }, state::{ enums::{ - GovernanceAccountType, MintMaxVoteWeightSource, ProposalState, VoteThresholdPercentage, + GovernanceAccountType, MintMaxVoterWeightSource, ProposalState, VoteThreshold, VoteTipping, }, governance::get_governance_address, proposal::{get_proposal_address, ProposalV2}, - realm::{get_realm_address, RealmConfig, RealmV2}, - token_owner_record::{get_token_owner_record_address, TokenOwnerRecordV2}, + realm::{get_realm_address, GoverningTokenConfigAccountArgs, RealmConfig, RealmV2}, + realm_config::GoverningTokenType, + token_owner_record::{ + get_token_owner_record_address, TokenOwnerRecordV2, TOKEN_OWNER_RECORD_LAYOUT_VERSION, + }, }, }; @@ -93,21 +96,27 @@ impl GovernanceTest { let realm_name = format!("Realm #{}", self.next_id).to_string(); let min_community_weight_to_create_governance = 1; - let community_mint_max_vote_weight_source = MintMaxVoteWeightSource::FULL_SUPPLY_FRACTION; + let community_mint_max_voter_weight_source = MintMaxVoterWeightSource::FULL_SUPPLY_FRACTION; let realm_key = get_realm_address(&self.program_id, &realm_name); + let community_token_config_args = GoverningTokenConfigAccountArgs { + voter_weight_addin: self.community_voter_weight_addin, + max_voter_weight_addin: self.max_community_voter_weight_addin, + token_type: GoverningTokenType::default(), + }; + let create_realm_ix = create_realm( &self.program_id, &realm_authority.pubkey(), &community_mint_cookie.address, &self.bench.payer.pubkey(), Some(council_mint_cookie.address), - self.community_voter_weight_addin, - self.max_community_voter_weight_addin, + Some(community_token_config_args), + None, realm_name.clone(), min_community_weight_to_create_governance, - community_mint_max_vote_weight_source.clone(), + community_mint_max_voter_weight_source.clone(), ); self.bench @@ -125,12 +134,12 @@ impl GovernanceTest { council_mint: Some(council_mint_cookie.address), reserved: [0; 6], min_community_weight_to_create_governance, - community_mint_max_vote_weight_source, - use_community_voter_weight_addin: false, - use_max_community_voter_weight_addin: false, + community_mint_max_voter_weight_source, + legacy1: 0, + legacy2: 0, }, - voting_proposal_count: 0, reserved_v2: [0; 128], + legacy1: 0, }; Ok(RealmCookie { @@ -208,13 +217,19 @@ impl GovernanceTest { &realm_cookie.realm_authority.pubkey(), None, spl_governance::state::governance::GovernanceConfig { - vote_threshold_percentage: VoteThresholdPercentage::YesVote(60), min_community_weight_to_create_proposal: 1, min_transaction_hold_up_time: 0, - max_voting_time: 600, - vote_tipping: VoteTipping::Disabled, - proposal_cool_off_time: 0, + min_council_weight_to_create_proposal: 1, + community_vote_threshold: VoteThreshold::YesVotePercentage(60), + voting_base_time: 600, + community_vote_tipping: VoteTipping::Strict, + council_vote_threshold: VoteThreshold::YesVotePercentage(60), + council_veto_vote_threshold: VoteThreshold::Disabled, + council_vote_tipping: VoteTipping::Disabled, + community_veto_vote_threshold: VoteThreshold::Disabled, + voting_cool_off_time: 0, + deposit_exempt_proposal_count: 10, }, ); @@ -225,14 +240,14 @@ impl GovernanceTest { ) .await?; - let proposal_index: u32 = 0; let proposal_governing_token_mint = realm_cookie.account.community_mint; + let proposal_seed = Pubkey::new_unique(); let proposal_key = get_proposal_address( &self.program_id, &governance_key, &proposal_governing_token_mint, - &proposal_index.to_le_bytes(), + &proposal_seed, ); let create_proposal_ix = create_proposal( @@ -249,7 +264,7 @@ impl GovernanceTest { spl_governance::state::proposal::VoteType::SingleChoice, vec!["Yes".to_string()], true, - 0_u32, + &proposal_seed, ); let sign_off_proposal_ix = sign_off_proposal( @@ -276,7 +291,7 @@ impl GovernanceTest { vote_type: spl_governance::state::proposal::VoteType::SingleChoice, options: vec![], deny_vote_weight: Some(1), - veto_vote_weight: None, + veto_vote_weight: 0, abstain_vote_weight: None, start_voting_at: None, draft_at: 1, @@ -289,10 +304,11 @@ impl GovernanceTest { execution_flags: spl_governance::state::enums::InstructionExecutionFlags::None, max_vote_weight: None, max_voting_time: None, - vote_threshold_percentage: None, reserved: [0; 64], name: String::from("Proposal #1"), description_link: String::from("Proposal #1 link"), + reserved1: 0, + vote_threshold: None, }; Ok(ProposalCookie { @@ -333,11 +349,11 @@ impl GovernanceTest { governing_token_owner: token_owner_cookie.address, governing_token_deposit_amount: 0, unrelinquished_votes_count: 0, - total_votes_count: 0, outstanding_proposal_count: 0, - reserved: [0; 7], + reserved: [0; 6], governance_delegate: None, reserved_v2: [0; 128], + version: TOKEN_OWNER_RECORD_LAYOUT_VERSION, }; Ok(TokenOwnerRecordCookie { @@ -355,6 +371,7 @@ impl GovernanceTest { ) -> Result<(), TransportError> { let relinquish_vote_ix = relinquish_vote( &self.program_id, + &token_owner_record_cookie.account.realm, &proposal_cookie.account.governance, &proposal_cookie.address, &token_owner_record_cookie.address, diff --git a/programs/realm-voter/Cargo.toml b/programs/realm-voter/Cargo.toml index 1e9bf7d2..7a4f43f0 100644 --- a/programs/realm-voter/Cargo.toml +++ b/programs/realm-voter/Cargo.toml @@ -21,8 +21,8 @@ arrayref = "0.3.6" anchor-lang = { version = "0.26.0" } anchor-spl = "0.26.0" solana-program = "1.14.16" -spl-governance = { version = "2.2.2", features = ["no-entrypoint"] } -spl-governance-tools= "0.1.2" +spl-governance = { version = "3.1.1", features = ["no-entrypoint"] } +spl-governance-tools= "0.1.3" spl-token = { version = "3.3", features = [ "no-entrypoint" ] } [dev-dependencies] diff --git a/programs/realm-voter/tests/fixtures/spl_governance.so b/programs/realm-voter/tests/fixtures/spl_governance.so index 9a6f5962..84786e9a 100755 Binary files a/programs/realm-voter/tests/fixtures/spl_governance.so and b/programs/realm-voter/tests/fixtures/spl_governance.so differ diff --git a/programs/realm-voter/tests/program_test/governance_test.rs b/programs/realm-voter/tests/program_test/governance_test.rs index 1e560ba6..7ed0b7dc 100644 --- a/programs/realm-voter/tests/program_test/governance_test.rs +++ b/programs/realm-voter/tests/program_test/governance_test.rs @@ -10,13 +10,16 @@ use spl_governance::{ }, state::{ enums::{ - GovernanceAccountType, MintMaxVoteWeightSource, ProposalState, VoteThresholdPercentage, + GovernanceAccountType, MintMaxVoterWeightSource, ProposalState, VoteThreshold, VoteTipping, }, governance::get_governance_address, proposal::{get_proposal_address, ProposalV2}, - realm::{get_realm_address, RealmConfig, RealmV2}, - token_owner_record::{get_token_owner_record_address, TokenOwnerRecordV2}, + realm::{get_realm_address, GoverningTokenConfigAccountArgs, RealmConfig, RealmV2}, + realm_config::GoverningTokenType, + token_owner_record::{ + get_token_owner_record_address, TokenOwnerRecordV2, TOKEN_OWNER_RECORD_LAYOUT_VERSION, + }, }, }; @@ -93,21 +96,27 @@ impl GovernanceTest { let realm_name = format!("Realm #{}", self.next_id).to_string(); let min_community_weight_to_create_governance = 1; - let community_mint_max_vote_weight_source = MintMaxVoteWeightSource::FULL_SUPPLY_FRACTION; + let community_mint_max_voter_weight_source = MintMaxVoterWeightSource::FULL_SUPPLY_FRACTION; let realm_key = get_realm_address(&self.program_id, &realm_name); + let community_token_config_args = GoverningTokenConfigAccountArgs { + voter_weight_addin: self.community_voter_weight_addin, + max_voter_weight_addin: self.community_voter_weight_addin, + token_type: GoverningTokenType::default(), + }; + let create_realm_ix = create_realm( &self.program_id, &realm_authority.pubkey(), &community_mint_cookie.address, &self.bench.payer.pubkey(), Some(council_mint_cookie.address), - self.community_voter_weight_addin, - self.max_community_voter_weight_addin, + Some(community_token_config_args), + None, realm_name.clone(), min_community_weight_to_create_governance, - community_mint_max_vote_weight_source.clone(), + community_mint_max_voter_weight_source.clone(), ); self.bench @@ -125,12 +134,12 @@ impl GovernanceTest { council_mint: Some(council_mint_cookie.address), reserved: [0; 6], min_community_weight_to_create_governance, - community_mint_max_vote_weight_source, - use_community_voter_weight_addin: false, - use_max_community_voter_weight_addin: false, + legacy1: 0, + legacy2: 0, + community_mint_max_voter_weight_source, }, - voting_proposal_count: 0, reserved_v2: [0; 128], + legacy1: 0, }; Ok(RealmCookie { @@ -208,13 +217,18 @@ impl GovernanceTest { &realm_cookie.realm_authority.pubkey(), None, spl_governance::state::governance::GovernanceConfig { - vote_threshold_percentage: VoteThresholdPercentage::YesVote(60), min_community_weight_to_create_proposal: 1, min_transaction_hold_up_time: 0, - max_voting_time: 600, - vote_tipping: VoteTipping::Disabled, - proposal_cool_off_time: 0, min_council_weight_to_create_proposal: 1, + community_vote_threshold: VoteThreshold::YesVotePercentage(60), + voting_base_time: 600, + community_vote_tipping: VoteTipping::Strict, + council_vote_threshold: VoteThreshold::YesVotePercentage(60), + council_veto_vote_threshold: VoteThreshold::Disabled, + council_vote_tipping: VoteTipping::Disabled, + community_veto_vote_threshold: VoteThreshold::Disabled, + voting_cool_off_time: 0, + deposit_exempt_proposal_count: 10, }, ); @@ -225,14 +239,14 @@ impl GovernanceTest { ) .await?; - let proposal_index: u32 = 0; let proposal_governing_token_mint = realm_cookie.account.community_mint; + let proposal_seed = Pubkey::new_unique(); let proposal_key = get_proposal_address( &self.program_id, &governance_key, &proposal_governing_token_mint, - &proposal_index.to_le_bytes(), + &proposal_seed, ); let create_proposal_ix = create_proposal( @@ -249,7 +263,7 @@ impl GovernanceTest { spl_governance::state::proposal::VoteType::SingleChoice, vec!["Yes".to_string()], true, - 0_u32, + &proposal_seed, ); let sign_off_proposal_ix = sign_off_proposal( @@ -276,7 +290,7 @@ impl GovernanceTest { vote_type: spl_governance::state::proposal::VoteType::SingleChoice, options: vec![], deny_vote_weight: Some(1), - veto_vote_weight: None, + veto_vote_weight: 0, abstain_vote_weight: None, start_voting_at: None, draft_at: 1, @@ -289,10 +303,11 @@ impl GovernanceTest { execution_flags: spl_governance::state::enums::InstructionExecutionFlags::None, max_vote_weight: None, max_voting_time: None, - vote_threshold_percentage: None, reserved: [0; 64], name: String::from("Proposal #1"), description_link: String::from("Proposal #1 link"), + reserved1: 0, + vote_threshold: None, }; Ok(ProposalCookie { @@ -333,11 +348,12 @@ impl GovernanceTest { governing_token_owner: token_owner_cookie.address, governing_token_deposit_amount: 0, unrelinquished_votes_count: 0, - total_votes_count: 0, + outstanding_proposal_count: 0, - reserved: [0; 7], + reserved: [0; 6], governance_delegate: None, reserved_v2: [0; 128], + version: TOKEN_OWNER_RECORD_LAYOUT_VERSION, }; Ok(TokenOwnerRecordCookie { @@ -355,6 +371,7 @@ impl GovernanceTest { ) -> Result<(), TransportError> { let relinquish_vote_ix = relinquish_vote( &self.program_id, + &token_owner_record_cookie.account.realm, &proposal_cookie.account.governance, &proposal_cookie.address, &token_owner_record_cookie.address,