瀏覽代碼

proposals: integration: update test json

conectado 4 年之前
父節點
當前提交
8338f1155c

+ 191 - 13
runtime/src/proposals_configuration/sample_proposal_parameters.json

@@ -1,6 +1,6 @@
 {
     "_comment": "This is a sample 'Proposal parameters' JSON file to enable conditional runtime compilation.",
-    "set_validator_count_proposal": {
+    "set_max_validator_count_proposal": {
         "voting_period": 1,
         "grace_period": 2,
         "approval_quorum_percentage": 3,
@@ -10,16 +10,194 @@
         "required_stake": 7,
         "constitutionality": 8
     },
-    "runtime_upgrade_proposal": {},
-    "text_proposal": {},
-    "spending_proposal": {},
-    "add_working_group_opening_proposal": {},
-    "fill_working_group_opening_proposal": {},
-    "set_working_group_budget_capacity_proposal": {},
-    "decrease_working_group_leader_stake_proposal": {},
-    "slash_working_group_leader_stake_proposal": {},
-    "set_working_group_leader_reward_proposal": {},
-    "terminate_working_group_leader_role_proposal": {},
-    "amend_constitution_proposal": {},
-    "cancel_working_group_leader_opening": {}
+    "runtime_upgrade_proposal": {
+        "voting_period": 1,
+        "grace_period": 2,
+        "approval_quorum_percentage": 3,
+        "approval_threshold_percentage": 4,
+        "slashing_quorum_percentage": 5,
+        "slashing_threshold_percentage": 6,
+        "required_stake": 7,
+        "constitutionality": 8
+    },
+    "signal_proposal": {
+        "voting_period": 1,
+        "grace_period": 2,
+        "approval_quorum_percentage": 3,
+        "approval_threshold_percentage": 4,
+        "slashing_quorum_percentage": 5,
+        "slashing_threshold_percentage": 6,
+        "required_stake": 7,
+        "constitutionality": 8
+    },
+    "funding_request_proposal": {
+        "voting_period": 1,
+        "grace_period": 2,
+        "approval_quorum_percentage": 3,
+        "approval_threshold_percentage": 4,
+        "slashing_quorum_percentage": 5,
+        "slashing_threshold_percentage": 6,
+        "required_stake": 7,
+        "constitutionality": 8
+    },
+    "create_working_group_lead_opening_proposal": {
+        "voting_period": 1,
+        "grace_period": 2,
+        "approval_quorum_percentage": 3,
+        "approval_threshold_percentage": 4,
+        "slashing_quorum_percentage": 5,
+        "slashing_threshold_percentage": 6,
+        "required_stake": 7,
+        "constitutionality": 8
+    },
+    "fill_working_group_lead_opening_proposal": {
+        "voting_period": 1,
+        "grace_period": 2,
+        "approval_quorum_percentage": 3,
+        "approval_threshold_percentage": 4,
+        "slashing_quorum_percentage": 5,
+        "slashing_threshold_percentage": 6,
+        "required_stake": 7,
+        "constitutionality": 8
+    },
+    "update_working_group_budget_proposal": {
+        "voting_period": 1,
+        "grace_period": 2,
+        "approval_quorum_percentage": 3,
+        "approval_threshold_percentage": 4,
+        "slashing_quorum_percentage": 5,
+        "slashing_threshold_percentage": 6,
+        "required_stake": 7,
+        "constitutionality": 8
+    },
+    "decrease_working_group_lead_stake_proposal": {
+        "voting_period": 1,
+        "grace_period": 2,
+        "approval_quorum_percentage": 3,
+        "approval_threshold_percentage": 4,
+        "slashing_quorum_percentage": 5,
+        "slashing_threshold_percentage": 6,
+        "required_stake": 7,
+        "constitutionality": 8
+    },
+    "slash_working_group_lead_proposal": {
+        "voting_period": 1,
+        "grace_period": 2,
+        "approval_quorum_percentage": 3,
+        "approval_threshold_percentage": 4,
+        "slashing_quorum_percentage": 5,
+        "slashing_threshold_percentage": 6,
+        "required_stake": 7,
+        "constitutionality": 8
+    },
+    "set_working_group_lead_reward_proposal": {
+        "voting_period": 1,
+        "grace_period": 2,
+        "approval_quorum_percentage": 3,
+        "approval_threshold_percentage": 4,
+        "slashing_quorum_percentage": 5,
+        "slashing_threshold_percentage": 6,
+        "required_stake": 7,
+        "constitutionality": 8
+    },
+    "terminate_working_group_lead_proposal": {
+        "voting_period": 1,
+        "grace_period": 2,
+        "approval_quorum_percentage": 3,
+        "approval_threshold_percentage": 4,
+        "slashing_quorum_percentage": 5,
+        "slashing_threshold_percentage": 6,
+        "required_stake": 7,
+        "constitutionality": 8
+    },
+    "amend_constitution_proposal": {
+        "voting_period": 1,
+        "grace_period": 2,
+        "approval_quorum_percentage": 3,
+        "approval_threshold_percentage": 4,
+        "slashing_quorum_percentage": 5,
+        "slashing_threshold_percentage": 6,
+        "required_stake": 7,
+        "constitutionality": 8
+    },
+    "cancel_working_group_lead_opening_proposal": {
+        "voting_period": 1,
+        "grace_period": 2,
+        "approval_quorum_percentage": 3,
+        "approval_threshold_percentage": 4,
+        "slashing_quorum_percentage": 5,
+        "slashing_threshold_percentage": 6,
+        "required_stake": 7,
+        "constitutionality": 8
+    },
+    "set_membership_price_proposal": {
+        "voting_period": 1,
+        "grace_period": 2,
+        "approval_quorum_percentage": 3,
+        "approval_threshold_percentage": 4,
+        "slashing_quorum_percentage": 5,
+        "slashing_threshold_percentage": 6,
+        "required_stake": 7,
+        "constitutionality": 8
+    },
+    "set_council_budget_increment_proposal": {
+        "voting_period": 1,
+        "grace_period": 2,
+        "approval_quorum_percentage": 3,
+        "approval_threshold_percentage": 4,
+        "slashing_quorum_percentage": 5,
+        "slashing_threshold_percentage": 6,
+        "required_stake": 7,
+        "constitutionality": 8
+    },
+    "set_councilor_reward_proposal": {
+        "voting_period": 1,
+        "grace_period": 2,
+        "approval_quorum_percentage": 3,
+        "approval_threshold_percentage": 4,
+        "slashing_quorum_percentage": 5,
+        "slashing_threshold_percentage": 6,
+        "required_stake": 7,
+        "constitutionality": 8
+    },
+    "set_initial_invitation_balance_proposal": {
+        "voting_period": 1,
+        "grace_period": 2,
+        "approval_quorum_percentage": 3,
+        "approval_threshold_percentage": 4,
+        "slashing_quorum_percentage": 5,
+        "slashing_threshold_percentage": 6,
+        "required_stake": 7,
+        "constitutionality": 8
+    },
+    "set_membership_lead_invitation_quota_proposal": {
+        "voting_period": 1,
+        "grace_period": 2,
+        "approval_quorum_percentage": 3,
+        "approval_threshold_percentage": 4,
+        "slashing_quorum_percentage": 5,
+        "slashing_threshold_percentage": 6,
+        "required_stake": 7,
+        "constitutionality": 8
+    },
+    "set_referral_cut_proposal": {
+        "voting_period": 1,
+        "grace_period": 2,
+        "approval_quorum_percentage": 3,
+        "approval_threshold_percentage": 4,
+        "slashing_quorum_percentage": 5,
+        "slashing_threshold_percentage": 6,
+        "required_stake": 7,
+        "constitutionality": 8
+    },
+    "set_invitation_count_proposal": {
+        "voting_period": 1,
+        "grace_period": 2,
+        "approval_quorum_percentage": 3,
+        "approval_threshold_percentage": 4,
+        "slashing_quorum_percentage": 5,
+        "slashing_threshold_percentage": 6,
+        "required_stake": 7,
+        "constitutionality": 8
+    }
 }

+ 363 - 2
runtime/src/proposals_configuration/tests.rs

@@ -1,9 +1,9 @@
 use crate::ProposalParameters;
 
 // Enable during the conditional compilation tests.
-#[ignore]
 #[test]
-fn proposal_parameters_are_initialized() {
+#[ignore]
+fn proposal_parameters_are_initialized_max_validators() {
     let actual_params = super::SetMaxValidatorCountProposalParameters::get();
     let expected_params = ProposalParameters {
         voting_period: 1,
@@ -18,3 +18,364 @@ fn proposal_parameters_are_initialized() {
 
     assert_eq!(expected_params, actual_params);
 }
+
+// Enable during the conditional compilation tests.
+#[test]
+#[ignore]
+fn proposal_parameters_are_initialized_runtime_upgrade() {
+    let actual_params = super::RuntimeUpgradeProposalParameters::get();
+    let expected_params = ProposalParameters {
+        voting_period: 1,
+        grace_period: 2,
+        approval_quorum_percentage: 3,
+        approval_threshold_percentage: 4,
+        slashing_quorum_percentage: 5,
+        slashing_threshold_percentage: 6,
+        required_stake: Some(7),
+        constitutionality: 8,
+    };
+
+    assert_eq!(expected_params, actual_params);
+}
+
+// Enable during the conditional compilation tests.
+#[test]
+#[ignore]
+fn proposal_parameters_are_initialized_signal() {
+    let actual_params = super::SignalProposalParameters::get();
+    let expected_params = ProposalParameters {
+        voting_period: 1,
+        grace_period: 2,
+        approval_quorum_percentage: 3,
+        approval_threshold_percentage: 4,
+        slashing_quorum_percentage: 5,
+        slashing_threshold_percentage: 6,
+        required_stake: Some(7),
+        constitutionality: 8,
+    };
+
+    assert_eq!(expected_params, actual_params);
+}
+
+// Enable during the conditional compilation tests.
+#[test]
+#[ignore]
+fn proposal_parameters_are_initialized_funding_request() {
+    let actual_params = super::FundingRequestProposalParameters::get();
+    let expected_params = ProposalParameters {
+        voting_period: 1,
+        grace_period: 2,
+        approval_quorum_percentage: 3,
+        approval_threshold_percentage: 4,
+        slashing_quorum_percentage: 5,
+        slashing_threshold_percentage: 6,
+        required_stake: Some(7),
+        constitutionality: 8,
+    };
+
+    assert_eq!(expected_params, actual_params);
+}
+
+// Enable during the conditional compilation tests.
+#[test]
+#[ignore]
+fn proposal_parameters_are_initialized_create_wg_lead_opening() {
+    let actual_params = super::CreateWorkingGroupLeadOpeningProposalParameters::get();
+    let expected_params = ProposalParameters {
+        voting_period: 1,
+        grace_period: 2,
+        approval_quorum_percentage: 3,
+        approval_threshold_percentage: 4,
+        slashing_quorum_percentage: 5,
+        slashing_threshold_percentage: 6,
+        required_stake: Some(7),
+        constitutionality: 8,
+    };
+
+    assert_eq!(expected_params, actual_params);
+}
+
+// Enable during the conditional compilation tests.
+#[test]
+#[ignore]
+fn proposal_parameters_are_initialized_wg_fill_lead_opening() {
+    let actual_params = super::FillWorkingGroupLeadOpeningProposalParameters::get();
+    let expected_params = ProposalParameters {
+        voting_period: 1,
+        grace_period: 2,
+        approval_quorum_percentage: 3,
+        approval_threshold_percentage: 4,
+        slashing_quorum_percentage: 5,
+        slashing_threshold_percentage: 6,
+        required_stake: Some(7),
+        constitutionality: 8,
+    };
+
+    assert_eq!(expected_params, actual_params);
+}
+
+// Enable during the conditional compilation tests.
+#[test]
+#[ignore]
+fn proposal_parameters_are_initialized_update_budget() {
+    let actual_params = super::UpdateWorkingGroupBudgetProposalParameters::get();
+    let expected_params = ProposalParameters {
+        voting_period: 1,
+        grace_period: 2,
+        approval_quorum_percentage: 3,
+        approval_threshold_percentage: 4,
+        slashing_quorum_percentage: 5,
+        slashing_threshold_percentage: 6,
+        required_stake: Some(7),
+        constitutionality: 8,
+    };
+
+    assert_eq!(expected_params, actual_params);
+}
+
+// Enable during the conditional compilation tests.
+#[test]
+#[ignore]
+fn proposal_parameters_are_initialized_decrease_wg_lead_stake() {
+    let actual_params = super::DecreaseWorkingGroupLeadStakeProposalParameters::get();
+    let expected_params = ProposalParameters {
+        voting_period: 1,
+        grace_period: 2,
+        approval_quorum_percentage: 3,
+        approval_threshold_percentage: 4,
+        slashing_quorum_percentage: 5,
+        slashing_threshold_percentage: 6,
+        required_stake: Some(7),
+        constitutionality: 8,
+    };
+
+    assert_eq!(expected_params, actual_params);
+}
+
+// Enable during the conditional compilation tests.
+#[test]
+#[ignore]
+fn proposal_parameters_are_initialized_slash_wg_lead() {
+    let actual_params = super::SlashWorkingGroupLeadProposalParameters::get();
+    let expected_params = ProposalParameters {
+        voting_period: 1,
+        grace_period: 2,
+        approval_quorum_percentage: 3,
+        approval_threshold_percentage: 4,
+        slashing_quorum_percentage: 5,
+        slashing_threshold_percentage: 6,
+        required_stake: Some(7),
+        constitutionality: 8,
+    };
+
+    assert_eq!(expected_params, actual_params);
+}
+
+// Enable during the conditional compilation tests.
+#[test]
+#[ignore]
+fn proposal_parameters_are_initialized_set_wg_lead_reward() {
+    let actual_params = super::SetWorkingGroupLeadRewardProposalParameters::get();
+    let expected_params = ProposalParameters {
+        voting_period: 1,
+        grace_period: 2,
+        approval_quorum_percentage: 3,
+        approval_threshold_percentage: 4,
+        slashing_quorum_percentage: 5,
+        slashing_threshold_percentage: 6,
+        required_stake: Some(7),
+        constitutionality: 8,
+    };
+
+    assert_eq!(expected_params, actual_params);
+}
+
+// Enable during the conditional compilation tests.
+#[test]
+#[ignore]
+fn proposal_parameters_are_initialized_terminate_wg_lead() {
+    let actual_params = super::TerminateWorkingGroupLeadProposalParameters::get();
+    let expected_params = ProposalParameters {
+        voting_period: 1,
+        grace_period: 2,
+        approval_quorum_percentage: 3,
+        approval_threshold_percentage: 4,
+        slashing_quorum_percentage: 5,
+        slashing_threshold_percentage: 6,
+        required_stake: Some(7),
+        constitutionality: 8,
+    };
+
+    assert_eq!(expected_params, actual_params);
+}
+
+// Enable during the conditional compilation tests.
+#[test]
+#[ignore]
+fn proposal_parameters_are_initialized_amend_constitution() {
+    let actual_params = super::AmendConstitutionProposalParameters::get();
+    let expected_params = ProposalParameters {
+        voting_period: 1,
+        grace_period: 2,
+        approval_quorum_percentage: 3,
+        approval_threshold_percentage: 4,
+        slashing_quorum_percentage: 5,
+        slashing_threshold_percentage: 6,
+        required_stake: Some(7),
+        constitutionality: 8,
+    };
+
+    assert_eq!(expected_params, actual_params);
+}
+
+// Enable during the conditional compilation tests.
+#[test]
+#[ignore]
+fn proposal_parameters_are_initialized_cancel_wg_lead_opening() {
+    let actual_params = super::CancelWorkingGroupLeadOpeningProposalParameters::get();
+    let expected_params = ProposalParameters {
+        voting_period: 1,
+        grace_period: 2,
+        approval_quorum_percentage: 3,
+        approval_threshold_percentage: 4,
+        slashing_quorum_percentage: 5,
+        slashing_threshold_percentage: 6,
+        required_stake: Some(7),
+        constitutionality: 8,
+    };
+
+    assert_eq!(expected_params, actual_params);
+}
+
+// Enable during the conditional compilation tests.
+#[test]
+#[ignore]
+fn proposal_parameters_are_initialized_set_membership_price() {
+    let actual_params = super::SetMembershipPriceProposalParameters::get();
+    let expected_params = ProposalParameters {
+        voting_period: 1,
+        grace_period: 2,
+        approval_quorum_percentage: 3,
+        approval_threshold_percentage: 4,
+        slashing_quorum_percentage: 5,
+        slashing_threshold_percentage: 6,
+        required_stake: Some(7),
+        constitutionality: 8,
+    };
+
+    assert_eq!(expected_params, actual_params);
+}
+
+// Enable during the conditional compilation tests.
+#[test]
+#[ignore]
+fn proposal_parameters_are_initialized_set_council_budget_increment() {
+    let actual_params = super::SetCouncilBudgetIncrementProposalParameters::get();
+    let expected_params = ProposalParameters {
+        voting_period: 1,
+        grace_period: 2,
+        approval_quorum_percentage: 3,
+        approval_threshold_percentage: 4,
+        slashing_quorum_percentage: 5,
+        slashing_threshold_percentage: 6,
+        required_stake: Some(7),
+        constitutionality: 8,
+    };
+
+    assert_eq!(expected_params, actual_params);
+}
+
+// Enable during the conditional compilation tests.
+#[test]
+#[ignore]
+fn proposal_parameters_are_initialized_set_councilor_reward() {
+    let actual_params = super::SetCouncilorRewardProposalParameters::get();
+    let expected_params = ProposalParameters {
+        voting_period: 1,
+        grace_period: 2,
+        approval_quorum_percentage: 3,
+        approval_threshold_percentage: 4,
+        slashing_quorum_percentage: 5,
+        slashing_threshold_percentage: 6,
+        required_stake: Some(7),
+        constitutionality: 8,
+    };
+
+    assert_eq!(expected_params, actual_params);
+}
+
+// Enable during the conditional compilation tests.
+#[test]
+#[ignore]
+fn proposal_parameters_are_initialized_set_initial_invitation_balance() {
+    let actual_params = super::SetInitialInvitationBalanceProposalParameters::get();
+    let expected_params = ProposalParameters {
+        voting_period: 1,
+        grace_period: 2,
+        approval_quorum_percentage: 3,
+        approval_threshold_percentage: 4,
+        slashing_quorum_percentage: 5,
+        slashing_threshold_percentage: 6,
+        required_stake: Some(7),
+        constitutionality: 8,
+    };
+
+    assert_eq!(expected_params, actual_params);
+}
+
+// Enable during the conditional compilation tests.
+#[test]
+#[ignore]
+fn proposal_parameters_are_initialized_set_membership_invitaiton_quota() {
+    let actual_params = super::SetMembershipLeadInvitationQuotaProposalParameters::get();
+    let expected_params = ProposalParameters {
+        voting_period: 1,
+        grace_period: 2,
+        approval_quorum_percentage: 3,
+        approval_threshold_percentage: 4,
+        slashing_quorum_percentage: 5,
+        slashing_threshold_percentage: 6,
+        required_stake: Some(7),
+        constitutionality: 8,
+    };
+
+    assert_eq!(expected_params, actual_params);
+}
+
+// Enable during the conditional compilation tests.
+#[test]
+#[ignore]
+fn proposal_parameters_are_initialized_set_referral_cut() {
+    let actual_params = super::SetReferralCutProposalParameters::get();
+    let expected_params = ProposalParameters {
+        voting_period: 1,
+        grace_period: 2,
+        approval_quorum_percentage: 3,
+        approval_threshold_percentage: 4,
+        slashing_quorum_percentage: 5,
+        slashing_threshold_percentage: 6,
+        required_stake: Some(7),
+        constitutionality: 8,
+    };
+
+    assert_eq!(expected_params, actual_params);
+}
+
+// Enable during the conditional compilation tests.
+#[test]
+#[ignore]
+fn proposal_parameters_are_initialized_set_invitation_count() {
+    let actual_params = super::SetInvitationCountProposalParameters::get();
+    let expected_params = ProposalParameters {
+        voting_period: 1,
+        grace_period: 2,
+        approval_quorum_percentage: 3,
+        approval_threshold_percentage: 4,
+        slashing_quorum_percentage: 5,
+        slashing_threshold_percentage: 6,
+        required_stake: Some(7),
+        constitutionality: 8,
+    };
+
+    assert_eq!(expected_params, actual_params);
+}

+ 5 - 0
scripts/run-proposal-configuration-tests.sh

@@ -0,0 +1,5 @@
+#!/usr/bin/env bash
+
+
+ALL_PROPOSALS_PARAMETERS_JSON=`cat runtime/src/proposals_configuration/sample_proposal_parameters.json` cargo test proposals_configuration::tests -- --ignored
+