diff --git a/governance/program/src/instruction.rs b/governance/program/src/instruction.rs index deaece081f7..dfa52bb2d8d 100644 --- a/governance/program/src/instruction.rs +++ b/governance/program/src/instruction.rs @@ -139,7 +139,7 @@ pub enum GovernanceInstruction { /// Solana account or asset /// /// 0. `[]` Realm account the created Governance belongs to - /// 1. `[writable]` Account Governance account. + /// 1. `[writable]` Governance account /// * PDA seeds: ['account-governance', realm, governed_account] /// 2. `[]` Account governed by this Governance Note: The account doesn't /// have to exist and can be only used as a unique identifier for the diff --git a/governance/program/tests/migrate_legacy_accounts.rs b/governance/program/tests/migrate_legacy_accounts.rs index 81db08665ae..87efec45e2f 100644 --- a/governance/program/tests/migrate_legacy_accounts.rs +++ b/governance/program/tests/migrate_legacy_accounts.rs @@ -18,7 +18,6 @@ async fn test_create_proposal_and_migrate_governance_v1_to_v2() { let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let token_owner_record_cookie = governance_test .with_community_token_deposit(&realm_cookie) @@ -26,11 +25,7 @@ async fn test_create_proposal_and_migrate_governance_v1_to_v2() { .unwrap(); let mut governance_cookie = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); diff --git a/governance/program/tests/process_add_required_signatory.rs b/governance/program/tests/process_add_required_signatory.rs index d4a197c65af..702df7de212 100644 --- a/governance/program/tests/process_add_required_signatory.rs +++ b/governance/program/tests/process_add_required_signatory.rs @@ -19,7 +19,6 @@ async fn test_add_required_signatory() { let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let signatory = Pubkey::new_unique(); @@ -29,11 +28,7 @@ async fn test_add_required_signatory() { .unwrap(); let mut governance_cookie = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); @@ -154,7 +149,6 @@ pub async fn add_required_signatory_to_governance_without_governance_signer_err( let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let signatory = Pubkey::new_unique(); @@ -164,11 +158,7 @@ pub async fn add_required_signatory_to_governance_without_governance_signer_err( .unwrap(); let governance_cookie = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); diff --git a/governance/program/tests/process_add_signatory.rs b/governance/program/tests/process_add_signatory.rs index cc80679611f..75714808bd7 100644 --- a/governance/program/tests/process_add_signatory.rs +++ b/governance/program/tests/process_add_signatory.rs @@ -19,7 +19,6 @@ async fn test_add_signatory() { let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let token_owner_record_cookie = governance_test .with_community_token_deposit(&realm_cookie) @@ -27,11 +26,7 @@ async fn test_add_signatory() { .unwrap(); let mut governance_cookie = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); @@ -70,7 +65,6 @@ async fn test_add_signatory_with_owner_or_delegate_must_sign_error() { let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let mut token_owner_record_cookie = governance_test .with_community_token_deposit(&realm_cookie) @@ -78,11 +72,7 @@ async fn test_add_signatory_with_owner_or_delegate_must_sign_error() { .unwrap(); let mut governance_cookie = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); @@ -122,7 +112,6 @@ async fn test_add_signatory_with_invalid_proposal_owner_error() { let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let mut token_owner_record_cookie = governance_test .with_community_token_deposit(&realm_cookie) @@ -130,11 +119,7 @@ async fn test_add_signatory_with_invalid_proposal_owner_error() { .unwrap(); let mut governance_cookie = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); @@ -171,7 +156,7 @@ async fn test_add_signatory_for_required_signatory() { let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; + let signatory = Pubkey::new_unique(); let token_owner_record_cookie = governance_test @@ -180,11 +165,7 @@ async fn test_add_signatory_for_required_signatory() { .unwrap(); let mut governance_cookie = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); @@ -269,7 +250,7 @@ async fn test_add_signatory_for_required_signatory_multiple_times_err() { let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; + let signatory = Pubkey::new_unique(); let token_owner_record_cookie = governance_test @@ -278,11 +259,7 @@ async fn test_add_signatory_for_required_signatory_multiple_times_err() { .unwrap(); let mut governance_cookie = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); diff --git a/governance/program/tests/process_cancel_proposal.rs b/governance/program/tests/process_cancel_proposal.rs index 81d68ed2f0c..c7b61f8bd13 100644 --- a/governance/program/tests/process_cancel_proposal.rs +++ b/governance/program/tests/process_cancel_proposal.rs @@ -14,7 +14,6 @@ async fn test_cancel_proposal() { let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let token_owner_record_cookie = governance_test .with_community_token_deposit(&realm_cookie) @@ -22,11 +21,7 @@ async fn test_cancel_proposal() { .unwrap(); let mut governance_cookie = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); @@ -70,7 +65,6 @@ async fn test_cancel_proposal_with_already_completed_error() { let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let token_owner_record_cookie = governance_test .with_community_token_deposit(&realm_cookie) @@ -78,11 +72,7 @@ async fn test_cancel_proposal_with_already_completed_error() { .unwrap(); let mut governance_cookie = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); @@ -117,7 +107,6 @@ async fn test_cancel_proposal_with_owner_or_delegate_must_sign_error() { let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let mut token_owner_record_cookie = governance_test .with_community_token_deposit(&realm_cookie) @@ -125,11 +114,7 @@ async fn test_cancel_proposal_with_owner_or_delegate_must_sign_error() { .unwrap(); let mut governance_cookie = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); @@ -165,7 +150,6 @@ async fn test_cancel_proposal_with_vote_time_expired_error() { let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let token_owner_record_cookie = governance_test .with_community_token_deposit(&realm_cookie) @@ -173,11 +157,7 @@ async fn test_cancel_proposal_with_vote_time_expired_error() { .unwrap(); let mut governance_cookie = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); @@ -214,7 +194,6 @@ async fn test_cancel_proposal_after_voting_cool_off_with_vote_time_expired_error let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let token_owner_record_cookie = governance_test .with_community_token_deposit(&realm_cookie) @@ -228,7 +207,6 @@ async fn test_cancel_proposal_after_voting_cool_off_with_vote_time_expired_error let mut governance_cookie = governance_test .with_governance_using_config( &realm_cookie, - &governed_account_cookie, &token_owner_record_cookie, &governance_config, ) @@ -270,7 +248,6 @@ async fn test_cancel_proposal_in_voting_state() { let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let token_owner_record_cookie = governance_test .with_community_token_deposit(&realm_cookie) @@ -278,11 +255,7 @@ async fn test_cancel_proposal_in_voting_state() { .unwrap(); let mut governance_cookie = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); diff --git a/governance/program/tests/process_cast_vote.rs b/governance/program/tests/process_cast_vote.rs index c9b1a272b99..7d5b5b22757 100644 --- a/governance/program/tests/process_cast_vote.rs +++ b/governance/program/tests/process_cast_vote.rs @@ -22,7 +22,6 @@ async fn test_cast_vote() { let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let token_owner_record_cookie = governance_test .with_community_token_deposit(&realm_cookie) @@ -30,11 +29,7 @@ async fn test_cast_vote() { .unwrap(); let mut governance_cookie = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); @@ -100,7 +95,6 @@ async fn test_cast_vote_with_invalid_governance_error() { let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let token_owner_record_cookie = governance_test .with_community_token_deposit(&realm_cookie) @@ -108,11 +102,7 @@ async fn test_cast_vote_with_invalid_governance_error() { .unwrap(); let mut governance_cookie = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); @@ -121,15 +111,9 @@ async fn test_cast_vote_with_invalid_governance_error() { .await .unwrap(); - // Setup Governance for a different account - let governed_account_cookie2 = governance_test.with_governed_account().await; - + // Setup another Governance let governance_cookie2 = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie2, - &token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); @@ -151,7 +135,6 @@ async fn test_cast_vote_with_invalid_mint_error() { let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let mut token_owner_record_cookie = governance_test .with_community_token_deposit(&realm_cookie) @@ -159,11 +142,7 @@ async fn test_cast_vote_with_invalid_mint_error() { .unwrap(); let mut governance_cookie = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); @@ -192,7 +171,6 @@ async fn test_cast_vote_with_invalid_token_owner_record_mint_error() { let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let mut token_owner_record_cookie = governance_test .with_community_token_deposit(&realm_cookie) @@ -200,11 +178,7 @@ async fn test_cast_vote_with_invalid_token_owner_record_mint_error() { .unwrap(); let mut governance_cookie = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); @@ -240,7 +214,6 @@ async fn test_cast_vote_with_invalid_token_owner_record_from_different_realm_err let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let mut token_owner_record_cookie = governance_test .with_community_token_deposit(&realm_cookie) @@ -248,11 +221,7 @@ async fn test_cast_vote_with_invalid_token_owner_record_from_different_realm_err .unwrap(); let mut governance_cookie = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); @@ -287,7 +256,6 @@ async fn test_cast_vote_with_governance_authority_must_sign_error() { let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let mut token_owner_record_cookie = governance_test .with_community_token_deposit(&realm_cookie) @@ -295,11 +263,7 @@ async fn test_cast_vote_with_governance_authority_must_sign_error() { .unwrap(); let mut governance_cookie = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); @@ -335,7 +299,6 @@ async fn test_cast_vote_with_strict_vote_tipped_to_succeeded() { let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let token_owner_record_cookie1 = governance_test .with_community_token_deposit(&realm_cookie) @@ -343,11 +306,7 @@ async fn test_cast_vote_with_strict_vote_tipped_to_succeeded() { .unwrap(); let mut governance_cookie = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie1, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie1) .await .unwrap(); @@ -433,7 +392,6 @@ async fn test_cast_vote_with_strict_vote_tipped_to_defeated() { let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; // 100 votes let token_owner_record_cookie1 = governance_test @@ -442,11 +400,7 @@ async fn test_cast_vote_with_strict_vote_tipped_to_defeated() { .unwrap(); let mut governance_cookie = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie1, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie1) .await .unwrap(); @@ -531,7 +485,6 @@ async fn test_cast_vote_with_early_vote_tipped_to_succeeded() { let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let mut governance_config = governance_test.get_default_governance_config(); @@ -546,7 +499,6 @@ async fn test_cast_vote_with_early_vote_tipped_to_succeeded() { let mut governance_cookie = governance_test .with_governance_using_config( &realm_cookie, - &governed_account_cookie, &token_owner_record_cookie1, &governance_config, ) @@ -701,7 +653,6 @@ async fn test_cast_vote_with_early_vote_tipped_to_defeated() { let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let mut governance_config = governance_test.get_default_governance_config(); @@ -717,7 +668,6 @@ async fn test_cast_vote_with_early_vote_tipped_to_defeated() { let mut _governance_cookie = governance_test .with_governance_using_config( &realm_cookie, - &governed_account_cookie, &token_owner_record_cookie1, &governance_config, ) @@ -805,7 +755,6 @@ async fn test_cast_vote_with_threshold_below_50_and_vote_not_tipped() { let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let mut governance_config = governance_test.get_default_governance_config(); @@ -819,7 +768,6 @@ async fn test_cast_vote_with_threshold_below_50_and_vote_not_tipped() { let mut governance_cookie = governance_test .with_governance_using_config( &realm_cookie, - &governed_account_cookie, &token_owner_record_cookie, &governance_config, ) @@ -869,7 +817,6 @@ async fn test_cast_vote_with_disabled_tipping_yes_votes() { let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let mut governance_config = governance_test.get_default_governance_config(); @@ -884,7 +831,6 @@ async fn test_cast_vote_with_disabled_tipping_yes_votes() { let mut _governance_cookie = governance_test .with_governance_using_config( &realm_cookie, - &governed_account_cookie, &token_owner_record_cookie1, &governance_config, ) @@ -940,7 +886,6 @@ async fn test_cast_vote_with_disabled_tipping_no_votes() { let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let mut governance_config = governance_test.get_default_governance_config(); @@ -955,7 +900,6 @@ async fn test_cast_vote_with_disabled_tipping_no_votes() { let mut _governance_cookie = governance_test .with_governance_using_config( &realm_cookie, - &governed_account_cookie, &token_owner_record_cookie1, &governance_config, ) @@ -990,7 +934,6 @@ async fn test_cast_vote_with_voting_time_expired_error() { let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let token_owner_record_cookie = governance_test .with_community_token_deposit(&realm_cookie) @@ -998,11 +941,7 @@ async fn test_cast_vote_with_voting_time_expired_error() { .unwrap(); let mut governance_cookie = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); @@ -1041,7 +980,6 @@ async fn test_cast_vote_with_cast_twice_error() { let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let token_owner_record_cookie = governance_test .with_community_token_deposit(&realm_cookie) @@ -1049,11 +987,7 @@ async fn test_cast_vote_with_cast_twice_error() { .unwrap(); let mut governance_cookie = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); @@ -1090,7 +1024,6 @@ async fn test_cast_vote_with_invalid_proposal_owner_error() { let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let token_owner_record_cookie = governance_test .with_community_token_deposit(&realm_cookie) @@ -1098,11 +1031,7 @@ async fn test_cast_vote_with_invalid_proposal_owner_error() { .unwrap(); let mut governance_cookie = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); @@ -1130,7 +1059,6 @@ async fn test_cast_tipping_vote_with_invalid_proposal_owner_error() { let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let token_owner_record_cookie = governance_test .with_community_token_deposit(&realm_cookie) @@ -1138,11 +1066,7 @@ async fn test_cast_tipping_vote_with_invalid_proposal_owner_error() { .unwrap(); let mut governance_cookie = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); @@ -1185,7 +1109,6 @@ async fn test_cast_council_vote() { let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let token_owner_record_cookie = governance_test .with_council_token_deposit(&realm_cookie) @@ -1198,7 +1121,6 @@ async fn test_cast_council_vote() { let mut governance_cookie = governance_test .with_governance_using_config( &realm_cookie, - &governed_account_cookie, &token_owner_record_cookie, &governance_config, ) @@ -1236,7 +1158,6 @@ async fn test_cast_vote_with_invalid_realm_config_account_address_error() { let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let token_owner_record_cookie = governance_test .with_community_token_deposit(&realm_cookie) @@ -1244,11 +1165,7 @@ async fn test_cast_vote_with_invalid_realm_config_account_address_error() { .unwrap(); let mut governance_cookie = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); @@ -1285,7 +1202,6 @@ async fn test_cast_early_council_vote_with_disabled_community_vote_tipping() { let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let token_owner_record_cookie = governance_test .with_council_token_deposit(&realm_cookie) @@ -1300,7 +1216,6 @@ async fn test_cast_early_council_vote_with_disabled_community_vote_tipping() { let mut governance_cookie = governance_test .with_governance_using_config( &realm_cookie, - &governed_account_cookie, &token_owner_record_cookie, &governance_config, ) @@ -1337,7 +1252,6 @@ async fn test_cast_community_vote_with_early_council_and_disabled_community_vote let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let token_owner_record_cookie = governance_test .with_community_token_deposit(&realm_cookie) @@ -1352,7 +1266,6 @@ async fn test_cast_community_vote_with_early_council_and_disabled_community_vote let mut governance_cookie = governance_test .with_governance_using_config( &realm_cookie, - &governed_account_cookie, &token_owner_record_cookie, &governance_config, ) @@ -1389,7 +1302,6 @@ async fn test_cast_vote_with_disabled_tipping_and_max_yes_votes() { let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let mut governance_config = governance_test.get_default_governance_config(); @@ -1404,7 +1316,6 @@ async fn test_cast_vote_with_disabled_tipping_and_max_yes_votes() { let mut _governance_cookie = governance_test .with_governance_using_config( &realm_cookie, - &governed_account_cookie, &token_owner_record_cookie1, &governance_config, ) @@ -1440,7 +1351,6 @@ async fn test_cast_vote_with_disabled_tipping_and_max_no_votes() { let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let mut governance_config = governance_test.get_default_governance_config(); @@ -1455,7 +1365,6 @@ async fn test_cast_vote_with_disabled_tipping_and_max_no_votes() { let mut _governance_cookie = governance_test .with_governance_using_config( &realm_cookie, - &governed_account_cookie, &token_owner_record_cookie1, &governance_config, ) @@ -1498,8 +1407,6 @@ async fn test_cast_vote_with_strict_tipping_and_inflated_max_vote_weight() { .with_realm_using_args(&realm_config_args) .await; - let governed_account_cookie = governance_test.with_governed_account().await; - let governance_config = governance_test.get_default_governance_config(); // Mint and deposit 100 tokens to Member @@ -1517,7 +1424,6 @@ async fn test_cast_vote_with_strict_tipping_and_inflated_max_vote_weight() { let mut _governance_cookie = governance_test .with_governance_using_config( &realm_cookie, - &governed_account_cookie, &token_owner_record_cookie1, &governance_config, ) @@ -1556,7 +1462,6 @@ async fn test_cast_approve_vote_with_cannot_vote_in_cool_off_time_error() { let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let token_owner_record_cookie = governance_test .with_community_token_deposit(&realm_cookie) @@ -1570,7 +1475,6 @@ async fn test_cast_approve_vote_with_cannot_vote_in_cool_off_time_error() { let mut governance_cookie = governance_test .with_governance_using_config( &realm_cookie, - &governed_account_cookie, &token_owner_record_cookie, &governance_config, ) diff --git a/governance/program/tests/process_complete_proposal.rs b/governance/program/tests/process_complete_proposal.rs index beea21983bd..ca0849fafc4 100644 --- a/governance/program/tests/process_complete_proposal.rs +++ b/governance/program/tests/process_complete_proposal.rs @@ -14,7 +14,6 @@ async fn test_complete_proposal() { let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let token_owner_record_cookie = governance_test .with_community_token_deposit(&realm_cookie) @@ -22,11 +21,7 @@ async fn test_complete_proposal() { .unwrap(); let mut governance_cookie = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); @@ -76,7 +71,7 @@ async fn test_complete_proposal_with_wrong_state_error() { .unwrap(); let mut governance_cookie = governance_test - .with_governance2(&realm_cookie, &token_owner_record_cookie) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); @@ -114,7 +109,7 @@ async fn test_complete_proposal_with_completed_state_transaction_exists_error() .unwrap(); let mut governance_cookie = governance_test - .with_governance2(&realm_cookie, &token_owner_record_cookie) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); @@ -180,7 +175,6 @@ async fn test_complete_proposal_with_owner_or_delegate_must_sign_error() { let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let mut token_owner_record_cookie = governance_test .with_community_token_deposit(&realm_cookie) @@ -188,11 +182,7 @@ async fn test_complete_proposal_with_owner_or_delegate_must_sign_error() { .unwrap(); let mut governance_cookie = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); diff --git a/governance/program/tests/process_create_governance.rs b/governance/program/tests/process_create_governance.rs index 220de723d73..ac0562b91a1 100644 --- a/governance/program/tests/process_create_governance.rs +++ b/governance/program/tests/process_create_governance.rs @@ -16,7 +16,6 @@ async fn test_create_governance() { let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let token_owner_record_cookie = governance_test .with_community_token_deposit(&realm_cookie) @@ -25,11 +24,7 @@ async fn test_create_governance() { // Act let governance_cookie = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); @@ -47,7 +42,6 @@ async fn test_create_governance_with_invalid_realm_error() { let mut governance_test = GovernanceProgramTest::start_new().await; let mut realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let token_owner_record_cookie = governance_test .with_community_token_deposit(&realm_cookie) @@ -55,11 +49,7 @@ async fn test_create_governance_with_invalid_realm_error() { .unwrap(); let governance_cookie = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); @@ -67,11 +57,7 @@ async fn test_create_governance_with_invalid_realm_error() { // Act let err = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .err() .unwrap(); @@ -87,7 +73,6 @@ async fn test_create_governance_with_invalid_config_error() { let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let token_owner_record_cookie = governance_test .with_community_token_deposit(&realm_cookie) @@ -100,12 +85,7 @@ async fn test_create_governance_with_invalid_config_error() { // Act let err = governance_test - .with_governance_using_config( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie, - &config, - ) + .with_governance_using_config(&realm_cookie, &token_owner_record_cookie, &config) .await .err() .unwrap(); @@ -120,12 +100,7 @@ async fn test_create_governance_with_invalid_config_error() { // Act let err = governance_test - .with_governance_using_config( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie, - &config, - ) + .with_governance_using_config(&realm_cookie, &token_owner_record_cookie, &config) .await .err() .unwrap(); @@ -141,7 +116,6 @@ async fn test_create_governance_with_not_enough_community_tokens_error() { let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; // Set token deposit amount below the required threshold let token_amount = 4; @@ -153,11 +127,7 @@ async fn test_create_governance_with_not_enough_community_tokens_error() { // Act let err = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .err() .unwrap(); @@ -175,7 +145,6 @@ async fn test_create_governance_with_not_enough_council_tokens_error() { let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; // Set token deposit amount below the required threshold let token_amount: u64 = 0; @@ -187,11 +156,7 @@ async fn test_create_governance_with_not_enough_council_tokens_error() { // Act let err = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .err() .unwrap(); @@ -209,22 +174,13 @@ async fn test_create_governance_using_realm_authority() { let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let config = governance_test.get_default_governance_config(); let realm_authority = realm_cookie.realm_authority.as_ref().unwrap(); // Act let governance_cookie = governance_test - .with_governance_impl( - &realm_cookie, - &governed_account_cookie, - None, - realm_authority, - None, - &config, - None, - ) + .with_governance_impl(&realm_cookie, None, realm_authority, None, &config, None) .await .unwrap(); @@ -242,7 +198,6 @@ async fn test_create_governance_using_realm_authority_with_authority_must_sign_e let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let config = governance_test.get_default_governance_config(); let realm_authority = realm_cookie.realm_authority.as_ref().unwrap(); @@ -251,7 +206,6 @@ async fn test_create_governance_using_realm_authority_with_authority_must_sign_e let err = governance_test .with_governance_impl( &realm_cookie, - &governed_account_cookie, None, realm_authority, None, @@ -273,8 +227,6 @@ async fn test_create_governance_using_realm_authority_with_wrong_authority_sign_ let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; - let token_owner_record_cookie = governance_test .with_community_token_deposit(&realm_cookie) .await @@ -287,7 +239,6 @@ async fn test_create_governance_using_realm_authority_with_wrong_authority_sign_ let err = governance_test .with_governance_impl( &realm_cookie, - &governed_account_cookie, Some(&token_owner_record_cookie.address), &authority, None, @@ -319,8 +270,6 @@ async fn test_create_governance_with_community_disabled_error() { .with_realm_using_args(&realm_config_args) .await; - let governed_account_cookie = governance_test.with_governed_account().await; - // Set token deposit amount to max let token_amount = u64::MAX; @@ -331,11 +280,7 @@ async fn test_create_governance_with_community_disabled_error() { // Act let err = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .err() .unwrap(); diff --git a/governance/program/tests/process_create_native_treasury.rs b/governance/program/tests/process_create_native_treasury.rs index b85fee7e827..384a332f23f 100644 --- a/governance/program/tests/process_create_native_treasury.rs +++ b/governance/program/tests/process_create_native_treasury.rs @@ -12,7 +12,6 @@ async fn test_create_native_treasury() { let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let token_owner_record_cookie = governance_test .with_community_token_deposit(&realm_cookie) @@ -20,11 +19,7 @@ async fn test_create_native_treasury() { .unwrap(); let governance_cookie = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); @@ -48,7 +43,6 @@ async fn test_execute_transfer_from_native_treasury() { let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let token_owner_record_cookie = governance_test .with_community_token_deposit(&realm_cookie) @@ -56,11 +50,7 @@ async fn test_execute_transfer_from_native_treasury() { .unwrap(); let mut governance_cookie = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); diff --git a/governance/program/tests/process_create_proposal.rs b/governance/program/tests/process_create_proposal.rs index 021d66fc949..1d8e241c2ae 100644 --- a/governance/program/tests/process_create_proposal.rs +++ b/governance/program/tests/process_create_proposal.rs @@ -23,7 +23,6 @@ async fn test_create_community_proposal() { let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let token_owner_record_cookie = governance_test .with_community_token_deposit(&realm_cookie) @@ -31,11 +30,7 @@ async fn test_create_community_proposal() { .unwrap(); let mut governance_cookie = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); @@ -71,7 +66,6 @@ async fn test_create_multiple_proposals() { let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let community_token_owner_record_cookie = governance_test .with_community_token_deposit(&realm_cookie) @@ -79,11 +73,7 @@ async fn test_create_multiple_proposals() { .unwrap(); let mut governance_cookie = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &community_token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &community_token_owner_record_cookie) .await .unwrap(); @@ -126,7 +116,6 @@ async fn test_create_proposal_with_not_authorized_governance_authority_error() { let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let mut token_owner_record_cookie = governance_test .with_community_token_deposit(&realm_cookie) @@ -134,11 +123,7 @@ async fn test_create_proposal_with_not_authorized_governance_authority_error() { .unwrap(); let mut governance_cookie = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); @@ -164,7 +149,6 @@ async fn test_create_proposal_with_governance_delegate_signer() { let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let mut token_owner_record_cookie = governance_test .with_community_token_deposit(&realm_cookie) @@ -172,11 +156,7 @@ async fn test_create_proposal_with_governance_delegate_signer() { .unwrap(); let mut governance_cookie = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); @@ -207,7 +187,6 @@ async fn test_create_proposal_with_not_enough_community_tokens_error() { let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let token_owner_record_cookie1 = governance_test .with_community_token_deposit(&realm_cookie) @@ -215,11 +194,7 @@ async fn test_create_proposal_with_not_enough_community_tokens_error() { .unwrap(); let mut governance_cookie = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie1, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie1) .await .unwrap(); @@ -248,7 +223,6 @@ async fn test_create_proposal_with_not_enough_council_tokens_error() { let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; // Set token deposit amount below the required threshold let token_amount = 1; @@ -259,11 +233,7 @@ async fn test_create_proposal_with_not_enough_council_tokens_error() { .unwrap(); let mut governance_cookie = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); @@ -284,7 +254,6 @@ async fn test_create_proposal_with_owner_or_delegate_must_sign_error() { let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let token_owner_record_cookie = governance_test .with_community_token_deposit(&realm_cookie) @@ -292,11 +261,7 @@ async fn test_create_proposal_with_owner_or_delegate_must_sign_error() { .unwrap(); let mut governance_cookie = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); @@ -329,7 +294,6 @@ async fn test_create_proposal_with_invalid_governing_token_mint_error() { let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let mut token_owner_record_cookie = governance_test .with_council_token_deposit(&realm_cookie) @@ -337,11 +301,7 @@ async fn test_create_proposal_with_invalid_governing_token_mint_error() { .unwrap(); let mut governance_cookie = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); @@ -365,7 +325,6 @@ async fn test_create_community_proposal_using_council_tokens() { let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let mut community_token_owner_record_cookie = governance_test .with_community_token_deposit(&realm_cookie) @@ -373,11 +332,7 @@ async fn test_create_community_proposal_using_council_tokens() { .unwrap(); let mut governance_cookie = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &community_token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &community_token_owner_record_cookie) .await .unwrap(); @@ -418,7 +373,6 @@ async fn test_create_council_proposal_using_community_tokens() { let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let mut council_token_owner_record_cookie = governance_test .with_council_token_deposit(&realm_cookie) @@ -426,11 +380,7 @@ async fn test_create_council_proposal_using_community_tokens() { .unwrap(); let mut governance_cookie = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &council_token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &council_token_owner_record_cookie) .await .unwrap(); @@ -471,7 +421,6 @@ async fn test_create_proposal_with_disabled_council_vote_error() { let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let token_owner_record_cookie = governance_test .with_council_token_deposit(&realm_cookie) @@ -484,7 +433,6 @@ async fn test_create_proposal_with_disabled_council_vote_error() { let mut governance_cookie = governance_test .with_governance_using_config( &realm_cookie, - &governed_account_cookie, &token_owner_record_cookie, &governance_config, ) @@ -511,7 +459,6 @@ async fn test_create_proposal_with_disabled_community_vote_error() { let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let token_owner_record_cookie = governance_test .with_community_token_deposit(&realm_cookie) @@ -524,7 +471,6 @@ async fn test_create_proposal_with_disabled_community_vote_error() { let mut governance_cookie = governance_test .with_governance_using_config( &realm_cookie, - &governed_account_cookie, &token_owner_record_cookie, &governance_config, ) @@ -551,7 +497,6 @@ async fn test_create_proposal_with_invalid_realm_config_account_address_error() let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let token_owner_record_cookie = governance_test .with_community_token_deposit(&realm_cookie) @@ -559,11 +504,7 @@ async fn test_create_proposal_with_invalid_realm_config_account_address_error() .unwrap(); let mut governance_cookie = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); @@ -589,7 +530,6 @@ async fn test_create_proposal_with_community_disabled_error() { let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; // Set token deposit amount to max let token_amount = u64::MAX; @@ -605,7 +545,6 @@ async fn test_create_proposal_with_community_disabled_error() { let mut governance_cookie = governance_test .with_governance_using_config( &realm_cookie, - &governed_account_cookie, &token_owner_record_cookie, &governance_config, ) @@ -629,7 +568,6 @@ async fn test_create_proposal_with_security_deposit() { let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let token_owner_record_cookie = governance_test .with_community_token_deposit(&realm_cookie) @@ -643,7 +581,6 @@ async fn test_create_proposal_with_security_deposit() { let mut governance_cookie = governance_test .with_governance_using_config( &realm_cookie, - &governed_account_cookie, &token_owner_record_cookie, &governance_config, ) @@ -688,7 +625,6 @@ async fn test_create_multiple_proposals_with_security_deposits() { let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let token_owner_record_cookie = governance_test .with_community_token_deposit(&realm_cookie) @@ -702,7 +638,6 @@ async fn test_create_multiple_proposals_with_security_deposits() { let mut governance_cookie = governance_test .with_governance_using_config( &realm_cookie, - &governed_account_cookie, &token_owner_record_cookie, &governance_config, ) diff --git a/governance/program/tests/process_execute_transaction.rs b/governance/program/tests/process_execute_transaction.rs index b4cfdfbacec..77893026909 100644 --- a/governance/program/tests/process_execute_transaction.rs +++ b/governance/program/tests/process_execute_transaction.rs @@ -29,7 +29,7 @@ async fn test_execute_mint_transaction() { .unwrap(); let mut governance_cookie = governance_test - .with_governance2(&realm_cookie, &token_owner_record_cookie) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); @@ -131,7 +131,7 @@ async fn test_execute_transfer_transaction() { .unwrap(); let mut governance_cookie = governance_test - .with_governance2(&realm_cookie, &token_owner_record_cookie) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); @@ -237,7 +237,7 @@ async fn test_execute_upgrade_program_transaction() { .unwrap(); let mut governance_cookie = governance_test - .with_governance2(&realm_cookie, &token_owner_record_cookie) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); @@ -366,7 +366,7 @@ async fn test_execute_proposal_transaction_with_invalid_state_errors() { .unwrap(); let mut governance_cookie = governance_test - .with_governance2(&realm_cookie, &token_owner_record_cookie) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); @@ -536,7 +536,7 @@ async fn test_execute_proposal_transaction_for_other_proposal_error() { .unwrap(); let mut governance_cookie = governance_test - .with_governance2(&realm_cookie, &token_owner_record_cookie) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); @@ -623,7 +623,7 @@ async fn test_execute_mint_transaction_twice_error() { .unwrap(); let mut governance_cookie = governance_test - .with_governance2(&realm_cookie, &token_owner_record_cookie) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); @@ -711,7 +711,7 @@ async fn test_execute_transaction_with_create_proposal_and_execute_in_single_slo governance_config.min_transaction_hold_up_time = 0; let mut governance_cookie = governance_test - .with_governance_using_config2( + .with_governance_using_config( &realm_cookie, &token_owner_record_cookie, &governance_config, diff --git a/governance/program/tests/process_finalize_vote.rs b/governance/program/tests/process_finalize_vote.rs index f18de271bb8..c7ea681f6cb 100644 --- a/governance/program/tests/process_finalize_vote.rs +++ b/governance/program/tests/process_finalize_vote.rs @@ -17,7 +17,6 @@ async fn test_finalize_vote_to_succeeded() { let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let mut governance_config = governance_test.get_default_governance_config(); @@ -31,7 +30,6 @@ async fn test_finalize_vote_to_succeeded() { let mut governance_cookie = governance_test .with_governance_using_config( &realm_cookie, - &governed_account_cookie, &token_owner_record_cookie, &governance_config, ) @@ -113,7 +111,6 @@ async fn test_finalize_vote_to_defeated() { let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let token_owner_record_cookie = governance_test .with_community_token_deposit(&realm_cookie) @@ -121,11 +118,7 @@ async fn test_finalize_vote_to_defeated() { .unwrap(); let mut governance_cookie = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); @@ -181,7 +174,6 @@ async fn test_finalize_vote_with_invalid_mint_error() { let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let token_owner_record_cookie = governance_test .with_community_token_deposit(&realm_cookie) @@ -189,11 +181,7 @@ async fn test_finalize_vote_with_invalid_mint_error() { .unwrap(); let mut governance_cookie = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); @@ -241,7 +229,6 @@ async fn test_finalize_vote_with_invalid_governance_error() { let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let token_owner_record_cookie = governance_test .with_community_token_deposit(&realm_cookie) @@ -249,11 +236,7 @@ async fn test_finalize_vote_with_invalid_governance_error() { .unwrap(); let mut governance_cookie = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); @@ -279,15 +262,10 @@ async fn test_finalize_vote_with_invalid_governance_error() { assert_eq!(ProposalState::Voting, proposal_account.state); - // Setup Governance for a different account - let governed_account_cookie2 = governance_test.with_governed_account().await; + // Setup another Governance let governance_cookie2 = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie2, - &token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); @@ -312,7 +290,6 @@ async fn test_finalize_council_vote() { let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let mut governance_config = governance_test.get_default_governance_config(); governance_config.council_vote_threshold = VoteThreshold::YesVotePercentage(40); @@ -327,7 +304,6 @@ async fn test_finalize_council_vote() { let mut governance_cookie = governance_test .with_governance_using_config( &realm_cookie, - &governed_account_cookie, &token_owner_record_cookie, &governance_config, ) @@ -399,7 +375,6 @@ async fn test_finalize_vote_with_cannot_finalize_during_voting_time_error() { let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let token_owner_record_cookie = governance_test .with_community_token_deposit(&realm_cookie) @@ -407,11 +382,7 @@ async fn test_finalize_vote_with_cannot_finalize_during_voting_time_error() { .unwrap(); let mut governance_cookie = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); @@ -451,7 +422,6 @@ async fn test_finalize_vote_with_cannot_finalize_during_cool_off_time_error() { let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let token_owner_record_cookie = governance_test .with_community_token_deposit(&realm_cookie) @@ -465,7 +435,6 @@ async fn test_finalize_vote_with_cannot_finalize_during_cool_off_time_error() { let mut governance_cookie = governance_test .with_governance_using_config( &realm_cookie, - &governed_account_cookie, &token_owner_record_cookie, &governance_config, ) diff --git a/governance/program/tests/process_flag_transaction_error.rs b/governance/program/tests/process_flag_transaction_error.rs index dcbe64f7487..a4a6a6774c8 100644 --- a/governance/program/tests/process_flag_transaction_error.rs +++ b/governance/program/tests/process_flag_transaction_error.rs @@ -17,7 +17,6 @@ async fn test_execute_flag_transaction_error() { let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let token_owner_record_cookie = governance_test .with_community_token_deposit(&realm_cookie) @@ -25,11 +24,7 @@ async fn test_execute_flag_transaction_error() { .unwrap(); let mut governance_cookie = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); @@ -117,7 +112,7 @@ async fn test_execute_proposal_transaction_after_flagged_with_error() { .unwrap(); let mut governance_cookie = governance_test - .with_governance2(&realm_cookie, &token_owner_record_cookie) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); @@ -210,7 +205,7 @@ async fn test_execute_second_transaction_after_first_transaction_flagged_with_er .unwrap(); let mut governance_cookie = governance_test - .with_governance2(&realm_cookie, &token_owner_record_cookie) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); @@ -299,7 +294,7 @@ async fn test_flag_transaction_error_with_proposal_transaction_already_executed_ .unwrap(); let mut governance_cookie = governance_test - .with_governance2(&realm_cookie, &token_owner_record_cookie) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); @@ -381,7 +376,6 @@ async fn test_flag_transaction_error_with_owner_or_delegate_must_sign_error() { let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let mut token_owner_record_cookie = governance_test .with_community_token_deposit(&realm_cookie) @@ -389,11 +383,7 @@ async fn test_flag_transaction_error_with_owner_or_delegate_must_sign_error() { .unwrap(); let mut governance_cookie = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); diff --git a/governance/program/tests/process_insert_transaction.rs b/governance/program/tests/process_insert_transaction.rs index 0cd72283603..1d5480dc0c3 100644 --- a/governance/program/tests/process_insert_transaction.rs +++ b/governance/program/tests/process_insert_transaction.rs @@ -10,7 +10,6 @@ async fn test_insert_transaction() { let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let token_owner_record_cookie = governance_test .with_community_token_deposit(&realm_cookie) @@ -18,11 +17,7 @@ async fn test_insert_transaction() { .unwrap(); let mut governance_cookie = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); @@ -65,7 +60,6 @@ async fn test_insert_multiple_transactions() { let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let token_owner_record_cookie = governance_test .with_community_token_deposit(&realm_cookie) @@ -73,11 +67,7 @@ async fn test_insert_multiple_transactions() { .unwrap(); let mut governance_cookie = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); @@ -116,7 +106,6 @@ async fn test_insert_transaction_with_invalid_index_error() { let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let token_owner_record_cookie = governance_test .with_community_token_deposit(&realm_cookie) @@ -124,11 +113,7 @@ async fn test_insert_transaction_with_invalid_index_error() { .unwrap(); let mut governance_cookie = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); @@ -154,7 +139,6 @@ async fn test_insert_transaction_with_proposal_transaction_already_exists_error( let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let token_owner_record_cookie = governance_test .with_community_token_deposit(&realm_cookie) @@ -162,11 +146,7 @@ async fn test_insert_transaction_with_proposal_transaction_already_exists_error( .unwrap(); let mut governance_cookie = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); @@ -199,7 +179,6 @@ async fn test_insert_transaction_with_invalid_hold_up_time_error() { let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let mut config = governance_test.get_default_governance_config(); @@ -211,12 +190,7 @@ async fn test_insert_transaction_with_invalid_hold_up_time_error() { .unwrap(); let mut governance_cookie = governance_test - .with_governance_using_config( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie, - &config, - ) + .with_governance_using_config(&realm_cookie, &token_owner_record_cookie, &config) .await .unwrap(); @@ -244,7 +218,6 @@ async fn test_insert_transaction_with_not_editable_proposal_error() { let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let token_owner_record_cookie = governance_test .with_community_token_deposit(&realm_cookie) @@ -252,11 +225,7 @@ async fn test_insert_transaction_with_not_editable_proposal_error() { .unwrap(); let mut governance_cookie = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); @@ -285,7 +254,6 @@ async fn test_insert_transaction_with_owner_or_delegate_must_sign_error() { let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let mut token_owner_record_cookie = governance_test .with_community_token_deposit(&realm_cookie) @@ -293,11 +261,7 @@ async fn test_insert_transaction_with_owner_or_delegate_must_sign_error() { .unwrap(); let mut governance_cookie = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); @@ -333,7 +297,6 @@ async fn test_insert_transaction_with_invalid_governance_for_proposal_error() { let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let token_owner_record_cookie = governance_test .with_community_token_deposit(&realm_cookie) @@ -341,11 +304,7 @@ async fn test_insert_transaction_with_invalid_governance_for_proposal_error() { .unwrap(); let mut governance_cookie = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); @@ -356,14 +315,9 @@ async fn test_insert_transaction_with_invalid_governance_for_proposal_error() { // Try to maliciously use a different governance account to use with the // proposal - let governed_account_cookie2 = governance_test.with_governed_account().await; let governance_cookie2 = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie2, - &token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); diff --git a/governance/program/tests/process_refund_proposal_deposit.rs b/governance/program/tests/process_refund_proposal_deposit.rs index a19370cff20..2eec08b950a 100644 --- a/governance/program/tests/process_refund_proposal_deposit.rs +++ b/governance/program/tests/process_refund_proposal_deposit.rs @@ -12,7 +12,6 @@ async fn test_refund_proposal_deposit() { let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let token_owner_record_cookie = governance_test .with_community_token_deposit(&realm_cookie) @@ -25,7 +24,6 @@ async fn test_refund_proposal_deposit() { let mut governance_cookie = governance_test .with_governance_using_config( &realm_cookie, - &governed_account_cookie, &token_owner_record_cookie, &governance_config, ) @@ -64,7 +62,6 @@ async fn test_refund_proposal_deposit_with_cannot_refund_draft_proposal_error() let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let token_owner_record_cookie = governance_test .with_community_token_deposit(&realm_cookie) @@ -77,7 +74,6 @@ async fn test_refund_proposal_deposit_with_cannot_refund_draft_proposal_error() let mut governance_cookie = governance_test .with_governance_using_config( &realm_cookie, - &governed_account_cookie, &token_owner_record_cookie, &governance_config, ) @@ -107,7 +103,6 @@ async fn test_refund_proposal_deposit_with_cannot_refund_voting_proposal_error() let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let token_owner_record_cookie = governance_test .with_community_token_deposit(&realm_cookie) @@ -120,7 +115,6 @@ async fn test_refund_proposal_deposit_with_cannot_refund_voting_proposal_error() let mut governance_cookie = governance_test .with_governance_using_config( &realm_cookie, - &governed_account_cookie, &token_owner_record_cookie, &governance_config, ) @@ -150,7 +144,6 @@ async fn test_refund_proposal_deposit_with_invalid_proposal_deposit_payer_error( let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let token_owner_record_cookie = governance_test .with_community_token_deposit(&realm_cookie) @@ -163,7 +156,6 @@ async fn test_refund_proposal_deposit_with_invalid_proposal_deposit_payer_error( let mut governance_cookie = governance_test .with_governance_using_config( &realm_cookie, - &governed_account_cookie, &token_owner_record_cookie, &governance_config, ) @@ -211,7 +203,6 @@ async fn test_refund_proposal_deposit_with_invalid_proposal_error() { let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let token_owner_record_cookie = governance_test .with_community_token_deposit(&realm_cookie) @@ -224,7 +215,6 @@ async fn test_refund_proposal_deposit_with_invalid_proposal_error() { let mut governance_cookie = governance_test .with_governance_using_config( &realm_cookie, - &governed_account_cookie, &token_owner_record_cookie, &governance_config, ) @@ -275,7 +265,6 @@ async fn test_refund_proposal_deposit_with_invalid_proposal_deposit_account_erro let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let token_owner_record_cookie = governance_test .with_community_token_deposit(&realm_cookie) @@ -288,7 +277,6 @@ async fn test_refund_proposal_deposit_with_invalid_proposal_deposit_account_erro let mut governance_cookie = governance_test .with_governance_using_config( &realm_cookie, - &governed_account_cookie, &token_owner_record_cookie, &governance_config, ) diff --git a/governance/program/tests/process_relinquish_vote.rs b/governance/program/tests/process_relinquish_vote.rs index 682e0aaa668..c3ea41e4d6c 100644 --- a/governance/program/tests/process_relinquish_vote.rs +++ b/governance/program/tests/process_relinquish_vote.rs @@ -23,7 +23,6 @@ async fn test_relinquish_voted_proposal() { let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let token_owner_record_cookie = governance_test .with_community_token_deposit(&realm_cookie) @@ -31,11 +30,7 @@ async fn test_relinquish_voted_proposal() { .unwrap(); let mut governance_cookie = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); @@ -84,7 +79,6 @@ async fn test_relinquish_active_yes_vote() { let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let token_owner_record_cookie = governance_test .with_community_token_deposit(&realm_cookie) @@ -92,11 +86,7 @@ async fn test_relinquish_active_yes_vote() { .unwrap(); let mut governance_cookie = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); @@ -151,7 +141,6 @@ async fn test_relinquish_active_no_vote() { let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let token_owner_record_cookie = governance_test .with_community_token_deposit(&realm_cookie) @@ -159,11 +148,7 @@ async fn test_relinquish_active_no_vote() { .unwrap(); let mut governance_cookie = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); @@ -218,7 +203,6 @@ async fn test_relinquish_vote_with_invalid_mint_error() { let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let mut token_owner_record_cookie = governance_test .with_community_token_deposit(&realm_cookie) @@ -226,11 +210,7 @@ async fn test_relinquish_vote_with_invalid_mint_error() { .unwrap(); let mut governance_cookie = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); @@ -265,7 +245,6 @@ async fn test_relinquish_vote_with_governance_authority_must_sign_error() { let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let mut token_owner_record_cookie = governance_test .with_community_token_deposit(&realm_cookie) @@ -273,11 +252,7 @@ async fn test_relinquish_vote_with_governance_authority_must_sign_error() { .unwrap(); let mut governance_cookie = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); @@ -326,7 +301,6 @@ async fn test_relinquish_vote_with_invalid_vote_record_error() { let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let token_owner_record_cookie = governance_test .with_community_token_deposit(&realm_cookie) @@ -334,11 +308,7 @@ async fn test_relinquish_vote_with_invalid_vote_record_error() { .unwrap(); let mut governance_cookie = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); @@ -396,7 +366,6 @@ async fn test_relinquish_vote_with_already_relinquished_error() { let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let token_owner_record_cookie = governance_test .with_community_token_deposit(&realm_cookie) @@ -404,11 +373,7 @@ async fn test_relinquish_vote_with_already_relinquished_error() { .unwrap(); let mut governance_cookie = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); @@ -458,7 +423,6 @@ async fn test_relinquish_proposal_with_cannot_relinquish_in_finalizing_state_err let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; // Deposit 100 tokens let token_owner_record_cookie = governance_test @@ -472,11 +436,7 @@ async fn test_relinquish_proposal_with_cannot_relinquish_in_finalizing_state_err .await; let mut governance_cookie = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); @@ -520,7 +480,6 @@ async fn test_relinquish_and_cast_vote_in_single_transaction() { let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let token_owner_record_cookie = governance_test .with_community_token_deposit(&realm_cookie) @@ -533,7 +492,6 @@ async fn test_relinquish_and_cast_vote_in_single_transaction() { let mut governance_cookie = governance_test .with_governance_using_config( &realm_cookie, - &governed_account_cookie, &token_owner_record_cookie, &governance_config, ) @@ -603,7 +561,6 @@ async fn test_change_yes_vote_to_no_within_cool_off_time() { let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let token_owner_record_cookie = governance_test .with_community_token_deposit(&realm_cookie) @@ -617,7 +574,6 @@ async fn test_change_yes_vote_to_no_within_cool_off_time() { let mut governance_cookie = governance_test .with_governance_using_config( &realm_cookie, - &governed_account_cookie, &token_owner_record_cookie, &governance_config, ) diff --git a/governance/program/tests/process_remove_required_signatory.rs b/governance/program/tests/process_remove_required_signatory.rs index 12c39a9fed7..082dd85045f 100644 --- a/governance/program/tests/process_remove_required_signatory.rs +++ b/governance/program/tests/process_remove_required_signatory.rs @@ -166,7 +166,6 @@ pub async fn remove_required_signatory_from_governance_without_governance_signer let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let signatory = Pubkey::new_unique(); @@ -176,11 +175,7 @@ pub async fn remove_required_signatory_from_governance_without_governance_signer .unwrap(); let governance_cookie = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); diff --git a/governance/program/tests/process_remove_transaction.rs b/governance/program/tests/process_remove_transaction.rs index 520ab8444e0..6908b616ebf 100644 --- a/governance/program/tests/process_remove_transaction.rs +++ b/governance/program/tests/process_remove_transaction.rs @@ -10,7 +10,6 @@ async fn test_remove_transaction() { let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let token_owner_record_cookie = governance_test .with_community_token_deposit(&realm_cookie) @@ -18,11 +17,7 @@ async fn test_remove_transaction() { .unwrap(); let mut governance_cookie = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); @@ -73,7 +68,6 @@ async fn test_replace_transaction() { let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let token_owner_record_cookie = governance_test .with_community_token_deposit(&realm_cookie) @@ -81,11 +75,7 @@ async fn test_replace_transaction() { .unwrap(); let mut governance_cookie = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); @@ -146,7 +136,6 @@ async fn test_remove_front_transaction() { let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let token_owner_record_cookie = governance_test .with_community_token_deposit(&realm_cookie) @@ -154,11 +143,7 @@ async fn test_remove_front_transaction() { .unwrap(); let mut governance_cookie = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); @@ -212,7 +197,6 @@ async fn test_remove_transaction_with_owner_or_delegate_must_sign_error() { let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let mut token_owner_record_cookie = governance_test .with_community_token_deposit(&realm_cookie) @@ -220,11 +204,7 @@ async fn test_remove_transaction_with_owner_or_delegate_must_sign_error() { .unwrap(); let mut governance_cookie = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); @@ -269,7 +249,6 @@ async fn test_remove_transaction_with_proposal_not_editable_error() { let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let token_owner_record_cookie = governance_test .with_community_token_deposit(&realm_cookie) @@ -277,11 +256,7 @@ async fn test_remove_transaction_with_proposal_not_editable_error() { .unwrap(); let mut governance_cookie = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); @@ -324,7 +299,6 @@ async fn test_remove_transaction_with_proposal_transaction_from_other_proposal_e let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let token_owner_record_cookie = governance_test .with_community_token_deposit(&realm_cookie) @@ -332,11 +306,7 @@ async fn test_remove_transaction_with_proposal_transaction_from_other_proposal_e .unwrap(); let mut governance_cookie = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); diff --git a/governance/program/tests/process_set_governance_config.rs b/governance/program/tests/process_set_governance_config.rs index 60d20a3bef2..cc913f369eb 100644 --- a/governance/program/tests/process_set_governance_config.rs +++ b/governance/program/tests/process_set_governance_config.rs @@ -19,7 +19,6 @@ async fn test_set_governance_config() { let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let token_owner_record_cookie = governance_test .with_community_token_deposit(&realm_cookie) @@ -27,11 +26,7 @@ async fn test_set_governance_config() { .unwrap(); let mut governance_cookie = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); @@ -160,7 +155,6 @@ async fn test_set_governance_config_with_invalid_governance_authority_error() { let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let token_owner_record_cookie = governance_test .with_community_token_deposit(&realm_cookie) @@ -168,11 +162,7 @@ async fn test_set_governance_config_with_invalid_governance_authority_error() { .unwrap(); let mut governance_cookie = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); @@ -192,14 +182,9 @@ async fn test_set_governance_config_with_invalid_governance_authority_error() { // Try to maliciously use a different governance account to change the given // governance config - let governed_account_cookie2 = governance_test.with_governed_account().await; let governance_cookie2 = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie2, - &token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); diff --git a/governance/program/tests/process_set_realm_authority.rs b/governance/program/tests/process_set_realm_authority.rs index 0a8c0c7f8a9..cdbd639b217 100644 --- a/governance/program/tests/process_set_realm_authority.rs +++ b/governance/program/tests/process_set_realm_authority.rs @@ -16,19 +16,13 @@ async fn test_set_realm_authority() { let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; - let token_owner_record_cookie = governance_test .with_community_token_deposit(&realm_cookie) .await .unwrap(); let governance_cookie = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); @@ -197,19 +191,13 @@ async fn test_set_realm_authority_with_governance_from_other_realm_error() { // Setup other realm let realm_cookie2 = governance_test.with_realm().await; - let governed_account_cookie2 = governance_test.with_governed_account().await; - let token_owner_record_cookie2 = governance_test .with_community_token_deposit(&realm_cookie2) .await .unwrap(); let governance_cookie2 = governance_test - .with_governance( - &realm_cookie2, - &governed_account_cookie2, - &token_owner_record_cookie2, - ) + .with_governance(&realm_cookie2, &token_owner_record_cookie2) .await .unwrap(); diff --git a/governance/program/tests/process_sign_off_proposal.rs b/governance/program/tests/process_sign_off_proposal.rs index bb934c07fd3..07d075f1297 100644 --- a/governance/program/tests/process_sign_off_proposal.rs +++ b/governance/program/tests/process_sign_off_proposal.rs @@ -17,7 +17,6 @@ async fn test_sign_off_proposal() { let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let token_owner_record_cookie = governance_test .with_community_token_deposit(&realm_cookie) @@ -25,11 +24,7 @@ async fn test_sign_off_proposal() { .unwrap(); let mut governance_cookie = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); @@ -80,7 +75,6 @@ async fn test_sign_off_proposal_with_signatory_must_sign_error() { let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let token_owner_record_cookie = governance_test .with_community_token_deposit(&realm_cookie) @@ -88,11 +82,7 @@ async fn test_sign_off_proposal_with_signatory_must_sign_error() { .unwrap(); let mut governance_cookie = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); @@ -132,7 +122,6 @@ async fn test_sign_off_proposal_by_owner() { let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let token_owner_record_cookie = governance_test .with_community_token_deposit(&realm_cookie) @@ -140,11 +129,7 @@ async fn test_sign_off_proposal_by_owner() { .unwrap(); let mut governance_cookie = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); @@ -180,7 +165,6 @@ async fn test_sign_off_proposal_by_owner_with_owner_must_sign_error() { let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let token_owner_record_cookie = governance_test .with_community_token_deposit(&realm_cookie) @@ -188,11 +172,7 @@ async fn test_sign_off_proposal_by_owner_with_owner_must_sign_error() { .unwrap(); let mut governance_cookie = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); @@ -227,7 +207,6 @@ async fn test_sign_off_proposal_by_owner_with_other_proposal_owner_error() { let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let token_owner_record_cookie = governance_test .with_community_token_deposit(&realm_cookie) @@ -235,11 +214,7 @@ async fn test_sign_off_proposal_by_owner_with_other_proposal_owner_error() { .unwrap(); let mut governance_cookie = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); @@ -271,7 +246,6 @@ async fn test_sign_off_proposal_by_owner_with_existing_signatories_error() { let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let token_owner_record_cookie = governance_test .with_community_token_deposit(&realm_cookie) @@ -279,11 +253,7 @@ async fn test_sign_off_proposal_by_owner_with_existing_signatories_error() { .unwrap(); let mut governance_cookie = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); @@ -321,19 +291,13 @@ async fn test_sign_off_proposal_with_non_existing_governance_error() { let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; - let token_owner_record_cookie = governance_test .with_community_token_deposit(&realm_cookie) .await .unwrap(); let mut governance_cookie = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); @@ -373,19 +337,13 @@ async fn test_sign_off_proposal_with_non_existing_realm_error() { let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; - let token_owner_record_cookie = governance_test .with_community_token_deposit(&realm_cookie) .await .unwrap(); let mut governance_cookie = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); @@ -424,7 +382,6 @@ async fn test_sign_off_proposal_with_required_signatory() { let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let signatory = Keypair::new(); @@ -434,11 +391,7 @@ async fn test_sign_off_proposal_with_required_signatory() { .unwrap(); let mut governance_cookie = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); @@ -525,7 +478,6 @@ async fn test_partial_sign_off_proposal_with_two_governance_signatories() { let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let signatory_1 = Keypair::new(); let signatory_2 = Keypair::new(); @@ -536,11 +488,7 @@ async fn test_partial_sign_off_proposal_with_two_governance_signatories() { .unwrap(); let mut governance_cookie = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); @@ -653,7 +601,6 @@ async fn test_repeat_sign_off_proposal_err() { let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let signatory_1 = Keypair::new(); let signatory_2 = Keypair::new(); @@ -664,11 +611,7 @@ async fn test_repeat_sign_off_proposal_err() { .unwrap(); let mut governance_cookie = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); @@ -824,7 +767,6 @@ async fn test_sign_off_without_all_required_signatories_err() { let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let signatory_1 = Keypair::new(); let signatory_2 = Keypair::new(); @@ -835,11 +777,7 @@ async fn test_sign_off_without_all_required_signatories_err() { .unwrap(); let mut governance_cookie = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); diff --git a/governance/program/tests/process_withdraw_governing_tokens.rs b/governance/program/tests/process_withdraw_governing_tokens.rs index 7bc952dc200..7f797770dc7 100644 --- a/governance/program/tests/process_withdraw_governing_tokens.rs +++ b/governance/program/tests/process_withdraw_governing_tokens.rs @@ -192,7 +192,6 @@ async fn test_withdraw_governing_tokens_with_unrelinquished_votes_error() { let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let token_owner_record_cookie = governance_test .with_community_token_deposit(&realm_cookie) @@ -200,11 +199,7 @@ async fn test_withdraw_governing_tokens_with_unrelinquished_votes_error() { .unwrap(); let mut governance_cookie = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); @@ -238,7 +233,6 @@ async fn test_withdraw_governing_tokens_after_relinquishing_vote() { let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let token_owner_record_cookie = governance_test .with_community_token_deposit(&realm_cookie) @@ -246,11 +240,7 @@ async fn test_withdraw_governing_tokens_after_relinquishing_vote() { .unwrap(); let mut governance_cookie = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); @@ -344,7 +334,6 @@ async fn test_withdraw_governing_tokens_with_outstanding_proposals_error() { let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let token_owner_record_cookie = governance_test .with_community_token_deposit(&realm_cookie) @@ -352,11 +341,7 @@ async fn test_withdraw_governing_tokens_with_outstanding_proposals_error() { .unwrap(); let mut governance_cookie = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); @@ -385,7 +370,6 @@ async fn test_withdraw_governing_tokens_after_proposal_cancelled() { let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let token_owner_record_cookie = governance_test .with_community_token_deposit(&realm_cookie) @@ -393,11 +377,7 @@ async fn test_withdraw_governing_tokens_after_proposal_cancelled() { .unwrap(); let mut governance_cookie = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); diff --git a/governance/program/tests/program_test/cookies.rs b/governance/program/tests/program_test/cookies.rs index 7a368a117c8..2b477de00ce 100644 --- a/governance/program/tests/program_test/cookies.rs +++ b/governance/program/tests/program_test/cookies.rs @@ -117,17 +117,6 @@ impl AccountCookie for GovernedTokenAccountCookie { } } -#[derive(Debug)] -pub struct GovernedAccountCookie { - pub address: Pubkey, -} - -impl AccountCookie for GovernedAccountCookie { - fn get_address(&self) -> Pubkey { - self.address - } -} - #[derive(Debug)] pub struct GovernanceCookie { pub address: Pubkey, diff --git a/governance/program/tests/program_test/mod.rs b/governance/program/tests/program_test/mod.rs index c4ca560883d..82fa74c794e 100644 --- a/governance/program/tests/program_test/mod.rs +++ b/governance/program/tests/program_test/mod.rs @@ -82,7 +82,7 @@ use { crate::{ args::{PluginSetupArgs, RealmSetupArgs}, cookies::{ - GovernanceCookie, GovernedAccountCookie, GovernedMintCookie, GovernedProgramCookie, + GovernanceCookie, GovernedMintCookie, GovernedProgramCookie, GovernedTokenAccountCookie, MaxVoterWeightRecordCookie, NativeTreasuryCookie, ProgramMetadataCookie, ProposalCookie, ProposalDepositCookie, ProposalTransactionCookie, RealmCookie, TokenOwnerRecordCookie, @@ -1350,13 +1350,6 @@ impl GovernanceProgramTest { .await } - #[allow(dead_code)] - pub async fn with_governed_account(&mut self) -> GovernedAccountCookie { - GovernedAccountCookie { - address: Pubkey::new_unique(), - } - } - #[allow(dead_code)] pub async fn with_governed_mint( &mut self, @@ -1430,71 +1423,19 @@ impl GovernanceProgramTest { } } - #[allow(dead_code)] - pub async fn with_governance2( - &mut self, - realm_cookie: &RealmCookie, - token_owner_record_cookie: &TokenOwnerRecordCookie, - ) -> Result { - let config = self.get_default_governance_config(); - - let governed_account_cookie = GovernedAccountCookie { - address: Pubkey::new_unique(), - }; - - self.with_governance_using_config( - realm_cookie, - &governed_account_cookie, - token_owner_record_cookie, - &config, - ) - .await - } - #[allow(dead_code)] pub async fn with_governance( &mut self, realm_cookie: &RealmCookie, - governed_account_cookie: &GovernedAccountCookie, token_owner_record_cookie: &TokenOwnerRecordCookie, ) -> Result { let config = self.get_default_governance_config(); - self.with_governance_using_config( - realm_cookie, - governed_account_cookie, - token_owner_record_cookie, - &config, - ) - .await + self.with_governance_using_config(realm_cookie, token_owner_record_cookie, &config) + .await } #[allow(dead_code)] pub async fn with_governance_using_config( - &mut self, - realm_cookie: &RealmCookie, - governed_account_cookie: &GovernedAccountCookie, - token_owner_record_cookie: &TokenOwnerRecordCookie, - governance_config: &GovernanceConfig, - ) -> Result { - let voter_weight_record = token_owner_record_cookie - .voter_weight_record - .as_ref() - .map(|voter_weight_record| voter_weight_record.address); - - self.with_governance_impl( - realm_cookie, - governed_account_cookie, - Some(&token_owner_record_cookie.address), - &token_owner_record_cookie.token_owner, - voter_weight_record, - governance_config, - None, - ) - .await - } - - #[allow(dead_code)] - pub async fn with_governance_using_config2( &mut self, realm_cookie: &RealmCookie, token_owner_record_cookie: &TokenOwnerRecordCookie, @@ -1505,13 +1446,8 @@ impl GovernanceProgramTest { .as_ref() .map(|voter_weight_record| voter_weight_record.address); - let governed_account_cookie = GovernedAccountCookie { - address: Pubkey::new_unique(), - }; - self.with_governance_impl( realm_cookie, - &governed_account_cookie, Some(&token_owner_record_cookie.address), &token_owner_record_cookie.token_owner, voter_weight_record, @@ -1526,17 +1462,18 @@ impl GovernanceProgramTest { pub async fn with_governance_impl( &mut self, realm_cookie: &RealmCookie, - governed_account_cookie: &GovernedAccountCookie, token_owner_record: Option<&Pubkey>, create_authority: &Keypair, voter_weight_record: Option, governance_config: &GovernanceConfig, signers_override: Option<&[&Keypair]>, ) -> Result { + let governed_account = Pubkey::new_unique(); + let mut create_governance_ix = create_governance( &self.program_id, &realm_cookie.address, - Some(&governed_account_cookie.address), + Some(&governed_account), token_owner_record.unwrap_or(&Pubkey::new_unique()), &self.bench.payer.pubkey(), &create_authority.pubkey(), @@ -1547,7 +1484,7 @@ impl GovernanceProgramTest { let account = GovernanceV2 { account_type: GovernanceAccountType::GovernanceV2, realm: realm_cookie.address, - governed_account: governed_account_cookie.address, + governed_account, config: governance_config.clone(), reserved1: 0, reserved_v2: Reserved119::default(), @@ -1566,11 +1503,8 @@ impl GovernanceProgramTest { .process_transaction(&[create_governance_ix], Some(signers)) .await?; - let governance_address = get_governance_address( - &self.program_id, - &realm_cookie.address, - &governed_account_cookie.address, - ); + let governance_address = + get_governance_address(&self.program_id, &realm_cookie.address, &governed_account); Ok(GovernanceCookie { address: governance_address, @@ -2701,7 +2635,6 @@ impl GovernanceProgramTest { Keypair, ) { let realm_cookie = self.with_realm().await; - let governed_account_cookie = self.with_governed_account().await; let signatory = Keypair::new(); @@ -2711,11 +2644,7 @@ impl GovernanceProgramTest { .unwrap(); let mut governance_cookie = self - .with_governance( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); diff --git a/governance/program/tests/use_proposals_with_multiple_options.rs b/governance/program/tests/use_proposals_with_multiple_options.rs index 2450f566dd6..ab25816b54d 100644 --- a/governance/program/tests/use_proposals_with_multiple_options.rs +++ b/governance/program/tests/use_proposals_with_multiple_options.rs @@ -22,7 +22,6 @@ async fn test_create_proposal_with_single_choice_options_and_deny_option() { let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let token_owner_record_cookie = governance_test .with_community_token_deposit(&realm_cookie) @@ -30,11 +29,7 @@ async fn test_create_proposal_with_single_choice_options_and_deny_option() { .unwrap(); let mut governance_cookie = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); @@ -68,7 +63,6 @@ async fn test_create_proposal_with_multiple_choice_options_and_without_deny_opti let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let token_owner_record_cookie = governance_test .with_community_token_deposit(&realm_cookie) @@ -76,11 +70,7 @@ async fn test_create_proposal_with_multiple_choice_options_and_without_deny_opti .unwrap(); let mut governance_cookie = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); @@ -127,7 +117,6 @@ async fn test_insert_transaction_with_proposal_not_executable_error() { let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let token_owner_record_cookie = governance_test .with_community_token_deposit(&realm_cookie) @@ -135,11 +124,7 @@ async fn test_insert_transaction_with_proposal_not_executable_error() { .unwrap(); let mut governance_cookie = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); @@ -171,7 +156,6 @@ async fn test_insert_transactions_for_multiple_options() { let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let token_owner_record_cookie = governance_test .with_community_token_deposit(&realm_cookie) @@ -179,11 +163,7 @@ async fn test_insert_transactions_for_multiple_options() { .unwrap(); let mut governance_cookie = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); @@ -245,7 +225,6 @@ async fn test_vote_on_none_executable_single_choice_proposal_with_multiple_optio let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let token_owner_record_cookie = governance_test .with_community_token_deposit(&realm_cookie) @@ -253,11 +232,7 @@ async fn test_vote_on_none_executable_single_choice_proposal_with_multiple_optio .unwrap(); let mut governance_cookie = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); @@ -343,7 +318,6 @@ async fn test_vote_on_none_executable_multi_choice_proposal_with_multiple_option let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let token_owner_record_cookie = governance_test .with_community_token_deposit(&realm_cookie) @@ -351,11 +325,7 @@ async fn test_vote_on_none_executable_multi_choice_proposal_with_multiple_option .unwrap(); let mut governance_cookie = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); @@ -459,7 +429,6 @@ async fn test_vote_on_executable_proposal_with_multiple_options_and_partial_succ let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; // 100 tokens let token_owner_record_cookie1 = governance_test @@ -486,7 +455,6 @@ async fn test_vote_on_executable_proposal_with_multiple_options_and_partial_succ let mut governance_cookie = governance_test .with_governance_using_config( &realm_cookie, - &governed_account_cookie, &token_owner_record_cookie1, &governance_config, ) @@ -650,7 +618,7 @@ async fn test_execute_proposal_with_multiple_options_and_partial_success() { governance_config.community_vote_threshold = VoteThreshold::YesVotePercentage(30); let mut governance_cookie = governance_test - .with_governance_using_config2( + .with_governance_using_config( &realm_cookie, &token_owner_record_cookie1, &governance_config, @@ -863,7 +831,7 @@ async fn test_try_execute_proposal_with_multiple_options_and_full_deny() { governance_config.community_vote_threshold = VoteThreshold::YesVotePercentage(30); let mut governance_cookie = governance_test - .with_governance_using_config2( + .with_governance_using_config( &realm_cookie, &token_owner_record_cookie1, &governance_config, @@ -1023,7 +991,6 @@ async fn test_create_proposal_with_10_options_and_cast_vote() { let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let token_owner_record_cookie = governance_test .with_community_token_deposit(&realm_cookie) @@ -1031,11 +998,7 @@ async fn test_create_proposal_with_10_options_and_cast_vote() { .unwrap(); let mut governance_cookie = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); @@ -1122,7 +1085,6 @@ async fn test_vote_multi_weighted_choice_proposal_non_executable() { let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let token_owner_record_cookie = governance_test .with_community_token_deposit(&realm_cookie) @@ -1135,7 +1097,6 @@ async fn test_vote_multi_weighted_choice_proposal_non_executable() { let mut governance_cookie = governance_test .with_governance_using_config( &realm_cookie, - &governed_account_cookie, &token_owner_record_cookie, &governance_config, ) @@ -1271,7 +1232,7 @@ async fn test_vote_multi_weighted_choice_proposal_with_partial_success() { governance_config.community_vote_threshold = VoteThreshold::YesVotePercentage(20); let mut governance_cookie = governance_test - .with_governance_using_config2( + .with_governance_using_config( &realm_cookie, &token_owner_record_cookie1, &governance_config, @@ -1493,7 +1454,7 @@ async fn test_vote_multi_weighted_choice_proposal_with_multi_success() { governance_config.community_vote_threshold = VoteThreshold::YesVotePercentage(30); let mut governance_cookie = governance_test - .with_governance_using_config2( + .with_governance_using_config( &realm_cookie, &token_owner_record_cookie1, &governance_config, @@ -1677,7 +1638,7 @@ async fn test_vote_multi_weighted_choice_proposal_executable_with_full_deny() { governance_config.community_vote_threshold = VoteThreshold::YesVotePercentage(3); let mut governance_cookie = governance_test - .with_governance_using_config2( + .with_governance_using_config( &realm_cookie, &token_owner_record_cookie1, &governance_config, diff --git a/governance/program/tests/use_realm_with_all_addins.rs b/governance/program/tests/use_realm_with_all_addins.rs index 4149effceb2..ac2e0858832 100644 --- a/governance/program/tests/use_realm_with_all_addins.rs +++ b/governance/program/tests/use_realm_with_all_addins.rs @@ -34,14 +34,8 @@ async fn test_cast_community_vote_with_all_addin() { .await .unwrap(); - let governed_account_cookie = governance_test.with_governed_account().await; - let mut governance_cookie = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); @@ -96,14 +90,8 @@ async fn test_cast_council_vote_with_all_addin() { .await .unwrap(); - let governed_account_cookie = governance_test.with_governed_account().await; - let mut governance_cookie = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); @@ -158,14 +146,8 @@ async fn test_tip_vote_with_all_addin() { .await .unwrap(); - let governed_account_cookie = governance_test.with_governed_account().await; - let mut governance_cookie = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); @@ -220,14 +202,8 @@ async fn test_finalize_vote_with_all_addin() { .await .unwrap(); - let governed_account_cookie = governance_test.with_governed_account().await; - let mut governance_cookie = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); diff --git a/governance/program/tests/use_realm_with_max_voter_weight_addin.rs b/governance/program/tests/use_realm_with_max_voter_weight_addin.rs index 7e4b7d4039e..511952844e2 100644 --- a/governance/program/tests/use_realm_with_max_voter_weight_addin.rs +++ b/governance/program/tests/use_realm_with_max_voter_weight_addin.rs @@ -13,7 +13,6 @@ use { async fn test_cast_vote_with_community_max_voter_weight_addin() { // Arrange let mut governance_test = GovernanceProgramTest::start_with_max_voter_weight_addin().await; - let governed_account_cookie = governance_test.with_governed_account().await; let realm_cookie = governance_test .with_realm_using_addins(PluginSetupArgs::COMMUNITY_MAX_VOTER_WEIGHT) @@ -32,11 +31,7 @@ async fn test_cast_vote_with_community_max_voter_weight_addin() { .unwrap(); let mut governance_cookie = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); @@ -64,7 +59,6 @@ async fn test_cast_vote_with_community_max_voter_weight_addin() { async fn test_cast_vote_with_council_max_voter_weight_addin() { // Arrange let mut governance_test = GovernanceProgramTest::start_with_max_voter_weight_addin().await; - let governed_account_cookie = governance_test.with_governed_account().await; let realm_cookie = governance_test .with_realm_using_addins(PluginSetupArgs::COUNCIL_MAX_VOTER_WEIGHT) @@ -83,11 +77,7 @@ async fn test_cast_vote_with_council_max_voter_weight_addin() { .unwrap(); let mut governance_cookie = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); @@ -115,7 +105,6 @@ async fn test_cast_vote_with_council_max_voter_weight_addin() { async fn test_tip_vote_with_max_voter_weight_addin() { // Arrange let mut governance_test = GovernanceProgramTest::start_with_max_voter_weight_addin().await; - let governed_account_cookie = governance_test.with_governed_account().await; let realm_cookie = governance_test .with_realm_using_addins(PluginSetupArgs::COMMUNITY_MAX_VOTER_WEIGHT) @@ -134,11 +123,7 @@ async fn test_tip_vote_with_max_voter_weight_addin() { .unwrap(); let mut governance_cookie = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); @@ -167,7 +152,6 @@ async fn test_tip_vote_with_max_voter_weight_addin() { async fn test_tip_vote_with_max_voter_weight_addin_and_max_below_total_cast_votes() { // Arrange let mut governance_test = GovernanceProgramTest::start_with_max_voter_weight_addin().await; - let governed_account_cookie = governance_test.with_governed_account().await; let realm_cookie = governance_test .with_realm_using_addins(PluginSetupArgs::COMMUNITY_MAX_VOTER_WEIGHT) @@ -186,11 +170,7 @@ async fn test_tip_vote_with_max_voter_weight_addin_and_max_below_total_cast_vote .unwrap(); let mut governance_cookie = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); @@ -220,7 +200,6 @@ async fn test_tip_vote_with_max_voter_weight_addin_and_max_below_total_cast_vote async fn test_finalize_vote_with_max_voter_weight_addin() { // Arrange let mut governance_test = GovernanceProgramTest::start_with_max_voter_weight_addin().await; - let governed_account_cookie = governance_test.with_governed_account().await; let realm_cookie = governance_test .with_realm_using_addins(PluginSetupArgs::COMMUNITY_MAX_VOTER_WEIGHT) @@ -239,11 +218,7 @@ async fn test_finalize_vote_with_max_voter_weight_addin() { .unwrap(); let mut governance_cookie = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); @@ -293,7 +268,6 @@ async fn test_finalize_vote_with_max_voter_weight_addin() { async fn test_finalize_vote_with_max_voter_weight_addin_and_max_below_total_cast_votes() { // Arrange let mut governance_test = GovernanceProgramTest::start_with_max_voter_weight_addin().await; - let governed_account_cookie = governance_test.with_governed_account().await; let realm_cookie = governance_test .with_realm_using_addins(PluginSetupArgs::COMMUNITY_MAX_VOTER_WEIGHT) @@ -312,11 +286,7 @@ async fn test_finalize_vote_with_max_voter_weight_addin_and_max_below_total_cast .unwrap(); let mut governance_cookie = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); @@ -367,7 +337,6 @@ async fn test_finalize_vote_with_max_voter_weight_addin_and_max_below_total_cast async fn test_cast_vote_with_max_voter_weight_addin_and_expired_record_error() { // Arrange let mut governance_test = GovernanceProgramTest::start_with_max_voter_weight_addin().await; - let governed_account_cookie = governance_test.with_governed_account().await; let realm_cookie = governance_test .with_realm_using_addins(PluginSetupArgs::COMMUNITY_MAX_VOTER_WEIGHT) @@ -386,11 +355,7 @@ async fn test_cast_vote_with_max_voter_weight_addin_and_expired_record_error() { .unwrap(); let mut governance_cookie = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); diff --git a/governance/program/tests/use_realm_with_voter_weight_addin.rs b/governance/program/tests/use_realm_with_voter_weight_addin.rs index 52b74af4f61..dd66b868aca 100644 --- a/governance/program/tests/use_realm_with_voter_weight_addin.rs +++ b/governance/program/tests/use_realm_with_voter_weight_addin.rs @@ -17,7 +17,6 @@ use { async fn test_create_governance_with_community_voter_weight_addin() { // Arrange let mut governance_test = GovernanceProgramTest::start_with_voter_weight_addin().await; - let governed_account_cookie = governance_test.with_governed_account().await; let realm_cookie = governance_test .with_realm_using_addins(PluginSetupArgs::COMMUNITY_VOTER_WEIGHT) @@ -34,11 +33,7 @@ async fn test_create_governance_with_community_voter_weight_addin() { // Act let governance_cookie = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); @@ -54,7 +49,6 @@ async fn test_create_governance_with_community_voter_weight_addin() { async fn test_create_governance_with_council_voter_weight_addin() { // Arrange let mut governance_test = GovernanceProgramTest::start_with_voter_weight_addin().await; - let governed_account_cookie = governance_test.with_governed_account().await; let realm_cookie = governance_test .with_realm_using_addins(PluginSetupArgs::COUNCIL_VOTER_WEIGHT) @@ -71,11 +65,7 @@ async fn test_create_governance_with_council_voter_weight_addin() { // Act let governance_cookie = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); @@ -91,7 +81,6 @@ async fn test_create_governance_with_council_voter_weight_addin() { async fn test_create_proposal_with_voter_weight_addin() { // Arrange let mut governance_test = GovernanceProgramTest::start_with_voter_weight_addin().await; - let governed_account_cookie = governance_test.with_governed_account().await; let realm_cookie = governance_test .with_realm_using_addins(PluginSetupArgs::COMMUNITY_VOTER_WEIGHT) @@ -107,11 +96,7 @@ async fn test_create_proposal_with_voter_weight_addin() { .unwrap(); let mut governance_cookie = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); @@ -133,7 +118,6 @@ async fn test_create_proposal_with_voter_weight_addin() { async fn test_cast_vote_with_voter_weight_addin() { // Arrange let mut governance_test = GovernanceProgramTest::start_with_voter_weight_addin().await; - let governed_account_cookie = governance_test.with_governed_account().await; let realm_cookie = governance_test .with_realm_using_addins(PluginSetupArgs::COMMUNITY_VOTER_WEIGHT) @@ -149,11 +133,7 @@ async fn test_cast_vote_with_voter_weight_addin() { .unwrap(); let mut governance_cookie = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); @@ -210,7 +190,7 @@ async fn test_create_token_governance_with_voter_weight_addin() { // Act let governance_cookie = governance_test - .with_governance2(&realm_cookie, &token_owner_record_cookie) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); @@ -242,7 +222,7 @@ async fn test_create_governance_with_voter_weight_addin() { // Act let governance_cookie = governance_test - .with_governance2(&realm_cookie, &token_owner_record_cookie) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); @@ -258,7 +238,6 @@ async fn test_create_governance_with_voter_weight_addin() { async fn test_create_governance_with_voter_weight_action_error() { // Arrange let mut governance_test = GovernanceProgramTest::start_with_voter_weight_addin().await; - let governed_account_cookie = governance_test.with_governed_account().await; let realm_cookie = governance_test .with_realm_using_addins(PluginSetupArgs::COMMUNITY_VOTER_WEIGHT) @@ -281,11 +260,7 @@ async fn test_create_governance_with_voter_weight_action_error() { // Act let err = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .err() .unwrap(); @@ -298,7 +273,6 @@ async fn test_create_governance_with_voter_weight_action_error() { async fn test_create_governance_with_voter_weight_expiry_error() { // Arrange let mut governance_test = GovernanceProgramTest::start_with_voter_weight_addin().await; - let governed_account_cookie = governance_test.with_governed_account().await; let realm_cookie = governance_test .with_realm_using_addins(PluginSetupArgs::COMMUNITY_VOTER_WEIGHT) @@ -323,11 +297,7 @@ async fn test_create_governance_with_voter_weight_expiry_error() { // Act let err = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .err() .unwrap(); @@ -340,7 +310,6 @@ async fn test_create_governance_with_voter_weight_expiry_error() { async fn test_cast_vote_with_voter_weight_action_error() { // Arrange let mut governance_test = GovernanceProgramTest::start_with_voter_weight_addin().await; - let governed_account_cookie = governance_test.with_governed_account().await; let realm_cookie = governance_test .with_realm_using_addins(PluginSetupArgs::COMMUNITY_VOTER_WEIGHT) @@ -356,11 +325,7 @@ async fn test_cast_vote_with_voter_weight_action_error() { .unwrap(); let mut governance_cookie = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); @@ -398,7 +363,6 @@ async fn test_cast_vote_with_voter_weight_action_error() { async fn test_create_governance_with_voter_weight_action_target_error() { // Arrange let mut governance_test = GovernanceProgramTest::start_with_voter_weight_addin().await; - let governed_account_cookie = governance_test.with_governed_account().await; let realm_cookie = governance_test .with_realm_using_addins(PluginSetupArgs::COMMUNITY_VOTER_WEIGHT) @@ -423,11 +387,7 @@ async fn test_create_governance_with_voter_weight_action_target_error() { // Act let err = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .err() .unwrap(); @@ -443,7 +403,6 @@ async fn test_create_governance_with_voter_weight_action_target_error() { async fn test_create_proposal_with_voter_weight_action_error() { // Arrange let mut governance_test = GovernanceProgramTest::start_with_voter_weight_addin().await; - let governed_account_cookie = governance_test.with_governed_account().await; let realm_cookie = governance_test .with_realm_using_addins(PluginSetupArgs::COMMUNITY_VOTER_WEIGHT) @@ -465,11 +424,7 @@ async fn test_create_proposal_with_voter_weight_action_error() { .unwrap(); let mut governance_cookie = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); @@ -489,7 +444,6 @@ async fn test_create_proposal_with_voter_weight_action_error() { async fn test_create_governance_with_voter_weight_record() { // Arrange let mut governance_test = GovernanceProgramTest::start_with_voter_weight_addin().await; - let governed_account_cookie = governance_test.with_governed_account().await; let realm_cookie = governance_test .with_realm_using_addins(PluginSetupArgs::COMMUNITY_VOTER_WEIGHT) @@ -515,11 +469,7 @@ async fn test_create_governance_with_voter_weight_record() { // Act let governance_cookie = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); diff --git a/governance/program/tests/use_veto_vote.rs b/governance/program/tests/use_veto_vote.rs index 724830cee70..8c40f221ff5 100644 --- a/governance/program/tests/use_veto_vote.rs +++ b/governance/program/tests/use_veto_vote.rs @@ -22,7 +22,6 @@ async fn test_cast_council_veto_vote() { let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let token_owner_record_cookie = governance_test .with_council_token_deposit(&realm_cookie) @@ -33,11 +32,7 @@ async fn test_cast_council_veto_vote() { governance_test.mint_council_tokens(&realm_cookie, 20).await; let mut governance_cookie = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); @@ -102,7 +97,6 @@ async fn test_cast_community_veto_vote() { let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let token_owner_record_cookie = governance_test .with_community_token_deposit(&realm_cookie) @@ -115,11 +109,7 @@ async fn test_cast_community_veto_vote() { .await; let mut governance_cookie = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); @@ -177,7 +167,6 @@ async fn test_cast_community_veto_vote_with_community_veto_disabled_error() { let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let token_owner_record_cookie = governance_test .with_community_token_deposit(&realm_cookie) @@ -190,7 +179,6 @@ async fn test_cast_community_veto_vote_with_community_veto_disabled_error() { let mut governance_cookie = governance_test .with_governance_using_config( &realm_cookie, - &governed_account_cookie, &token_owner_record_cookie, &governance_config, ) @@ -227,7 +215,6 @@ async fn test_cast_veto_vote_with_invalid_voting_mint_error() { let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let token_owner_record_cookie = governance_test .with_council_token_deposit(&realm_cookie) @@ -235,11 +222,7 @@ async fn test_cast_veto_vote_with_invalid_voting_mint_error() { .unwrap(); let mut governance_cookie = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); @@ -272,7 +255,6 @@ async fn test_cast_veto_vote_with_council_veto_vote_disabled_error() { let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let token_owner_record_cookie = governance_test .with_council_token_deposit(&realm_cookie) @@ -285,7 +267,6 @@ async fn test_cast_veto_vote_with_council_veto_vote_disabled_error() { let mut governance_cookie = governance_test .with_governance_using_config( &realm_cookie, - &governed_account_cookie, &token_owner_record_cookie, &governance_config, ) @@ -322,7 +303,6 @@ async fn test_cast_veto_vote_without_tipping() { let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let token_owner_record_cookie = governance_test .with_council_token_deposit(&realm_cookie) @@ -335,11 +315,7 @@ async fn test_cast_veto_vote_without_tipping() { .await; let mut governance_cookie = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); @@ -386,7 +362,6 @@ async fn test_cast_multiple_veto_votes_for_partially_approved_proposal() { let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let token_owner_record_cookie = governance_test .with_council_token_deposit(&realm_cookie) @@ -403,11 +378,7 @@ async fn test_cast_multiple_veto_votes_for_partially_approved_proposal() { governance_test.mint_council_tokens(&realm_cookie, 10).await; let mut governance_cookie = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); @@ -467,7 +438,6 @@ async fn test_cast_veto_vote_with_no_council_error() { let mut governance_test = GovernanceProgramTest::start_new().await; let mut realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let token_owner_record_cookie = governance_test .with_council_token_deposit(&realm_cookie) @@ -480,7 +450,6 @@ async fn test_cast_veto_vote_with_no_council_error() { let mut governance_cookie = governance_test .with_governance_using_config( &realm_cookie, - &governed_account_cookie, &token_owner_record_cookie, &governance_config, ) @@ -525,7 +494,6 @@ async fn test_relinquish_veto_vote() { let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let token_owner_record_cookie = governance_test .with_council_token_deposit(&realm_cookie) @@ -538,11 +506,7 @@ async fn test_relinquish_veto_vote() { .await; let mut governance_cookie = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); @@ -583,7 +547,6 @@ async fn test_relinquish_veto_vote_with_vote_record_for_different_voting_mint_er let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let council_token_owner_record_cookie = governance_test .with_council_token_deposit(&realm_cookie) @@ -596,11 +559,7 @@ async fn test_relinquish_veto_vote_with_vote_record_for_different_voting_mint_er .await; let mut governance_cookie = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &council_token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &council_token_owner_record_cookie) .await .unwrap(); @@ -675,7 +634,6 @@ async fn test_cast_veto_vote_with_council_only_allowed_to_veto() { let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let token_owner_record_cookie = governance_test .with_council_token_deposit(&realm_cookie) @@ -689,7 +647,6 @@ async fn test_cast_veto_vote_with_council_only_allowed_to_veto() { let mut governance_cookie = governance_test .with_governance_using_config( &realm_cookie, - &governed_account_cookie, &token_owner_record_cookie, &governance_config, ) @@ -726,7 +683,6 @@ async fn test_cast_yes_and_veto_votes_with_yes_as_winning_vote() { let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let token_owner_record_cookie = governance_test .with_council_token_deposit(&realm_cookie) @@ -740,11 +696,7 @@ async fn test_cast_yes_and_veto_votes_with_yes_as_winning_vote() { .await; let mut governance_cookie = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); @@ -791,7 +743,6 @@ async fn test_cast_yes_and_veto_votes_with_yes_as_winning_vote() { async fn test_veto_vote_with_community_voter_weight_addin() { // Arrange let mut governance_test = GovernanceProgramTest::start_with_voter_weight_addin().await; - let governed_account_cookie = governance_test.with_governed_account().await; let realm_cookie = governance_test .with_realm_using_addins(PluginSetupArgs::COMMUNITY_VOTER_WEIGHT) @@ -807,11 +758,7 @@ async fn test_veto_vote_with_community_voter_weight_addin() { .unwrap(); let mut governance_cookie = governance_test - .with_governance( - &realm_cookie, - &governed_account_cookie, - &token_owner_record_cookie, - ) + .with_governance(&realm_cookie, &token_owner_record_cookie) .await .unwrap(); @@ -844,7 +791,6 @@ async fn test_veto_vote_with_community_voter_weight_addin() { async fn test_veto_vote_with_community_max_voter_weight_addin() { // Arrange let mut governance_test = GovernanceProgramTest::start_with_max_voter_weight_addin().await; - let governed_account_cookie = governance_test.with_governed_account().await; let realm_cookie = governance_test .with_realm_using_addins(PluginSetupArgs::COMMUNITY_MAX_VOTER_WEIGHT) @@ -868,7 +814,6 @@ async fn test_veto_vote_with_community_max_voter_weight_addin() { let mut governance_cookie = governance_test .with_governance_using_config( &realm_cookie, - &governed_account_cookie, &token_owner_record_cookie, &governance_config, ) @@ -904,7 +849,6 @@ async fn test_veto_vote_with_community_max_voter_weight_addin() { async fn test_veto_vote_with_community_max_voter_weight_addin_and_veto_not_tipped() { // Arrange let mut governance_test = GovernanceProgramTest::start_with_max_voter_weight_addin().await; - let governed_account_cookie = governance_test.with_governed_account().await; let realm_cookie = governance_test .with_realm_using_addins(PluginSetupArgs::COMMUNITY_MAX_VOTER_WEIGHT) @@ -928,7 +872,6 @@ async fn test_veto_vote_with_community_max_voter_weight_addin_and_veto_not_tippe let mut governance_cookie = governance_test .with_governance_using_config( &realm_cookie, - &governed_account_cookie, &token_owner_record_cookie, &governance_config, ) @@ -966,7 +909,6 @@ async fn test_cast_council_veto_vote_within_cool_off_time() { let mut governance_test = GovernanceProgramTest::start_new().await; let realm_cookie = governance_test.with_realm().await; - let governed_account_cookie = governance_test.with_governed_account().await; let token_owner_record_cookie = governance_test .with_council_token_deposit(&realm_cookie) @@ -983,7 +925,6 @@ async fn test_cast_council_veto_vote_within_cool_off_time() { let mut governance_cookie = governance_test .with_governance_using_config( &realm_cookie, - &governed_account_cookie, &token_owner_record_cookie, &governance_config, )