Browse Source

runtime: update: proposals default values and comments

conectado 4 years ago
parent
commit
62928f40c3

+ 3 - 0
runtime-modules/council/src/lib.rs

@@ -26,6 +26,9 @@
 //! - [set_candidacy_note](./struct.Module.html#method.set_candidacy_note)
 //! - [set_budget](./struct.Module.html#method.set_budget)
 //! - [plan_budget_refill](./struct.Module.html#method.plan_budget_refill)
+//! - [set_budget_increment](./struct.Module.html#method.set_budget_increment)
+//! - [set_councilor_reward](./struct.Module.html#method.set_councilor_reward)
+//! - [funding_request](./struct.Module.html#method.funding_request)
 //!
 //! ## Important functions
 //! These functions have to be called by the runtime for the council to work properly.

+ 7 - 0
runtime-modules/proposals/codex/src/lib.rs

@@ -525,6 +525,13 @@ decl_module! {
         }
 
         /// Update working group budget
+        /// <weight>
+        ///
+        /// ## Weight
+        /// `O (1)` Doesn't depend on the state or parameters
+        /// - DB:
+        ///    - O(1) doesn't depend on the state or parameters
+        /// # </weight>
         #[weight = Module::<T>::get_update_working_group_budget_weight(&working_group, &balance_kind)]
         pub fn update_working_group_budget(
             origin,

+ 41 - 48
runtime/src/proposals_configuration/defaults.rs

@@ -172,125 +172,118 @@ pub(crate) fn amend_constitution_proposal() -> ProposalParameters<BlockNumber, B
     }
 }
 
-// TODO: decide on parameters
 // Proposal parameters for the 'Cancel Working Group Lead Opening' proposal
 pub(crate) fn cancel_working_group_lead_opening_proposal(
 ) -> ProposalParameters<BlockNumber, Balance> {
     ProposalParameters {
-        voting_period: 72200,
-        grace_period: 72200,
-        approval_quorum_percentage: 80,
-        approval_threshold_percentage: 100,
+        voting_period: 43200,
+        grace_period: 0,
+        approval_quorum_percentage: 60,
+        approval_threshold_percentage: 75,
         slashing_quorum_percentage: 60,
         slashing_threshold_percentage: 80,
-        required_stake: Some(1_000_000),
+        required_stake: Some(50000),
         constitutionality: 1,
     }
 }
 
-// TODO: decide on parameters
 // Proposal parameters for the 'Set Membership Price' proposal
 pub(crate) fn set_membership_price_proposal() -> ProposalParameters<BlockNumber, Balance> {
     ProposalParameters {
-        voting_period: 72200,
-        grace_period: 72200,
-        approval_quorum_percentage: 80,
-        approval_threshold_percentage: 100,
+        voting_period: 43200,
+        grace_period: 14400,
+        approval_quorum_percentage: 60,
+        approval_threshold_percentage: 75,
         slashing_quorum_percentage: 60,
         slashing_threshold_percentage: 80,
-        required_stake: Some(1_000_000),
+        required_stake: Some(50000),
         constitutionality: 1,
     }
 }
 
-// TODO: decide on parameters
 // Proposal parameters for the 'Set Council Budget Increment' proposal
 pub(crate) fn set_council_budget_increment_proposal() -> ProposalParameters<BlockNumber, Balance> {
     ProposalParameters {
-        voting_period: 72200,
-        grace_period: 0,
-        approval_quorum_percentage: 80,
-        approval_threshold_percentage: 100,
+        voting_period: 72000,
+        grace_period: 43200,
+        approval_quorum_percentage: 66,
+        approval_threshold_percentage: 80,
         slashing_quorum_percentage: 60,
         slashing_threshold_percentage: 80,
-        required_stake: Some(1_000_000),
+        required_stake: Some(200_000),
         constitutionality: 1,
     }
 }
 
-// TODO: decide on parameters
 // Proposal parameters for the 'Set Councilor Reward' proposal
 pub(crate) fn set_councilor_reward_proposal() -> ProposalParameters<BlockNumber, Balance> {
     ProposalParameters {
-        voting_period: 72200,
-        grace_period: 0,
-        approval_quorum_percentage: 80,
-        approval_threshold_percentage: 100,
+        voting_period: 72000,
+        grace_period: 201600, // A council term
+        approval_quorum_percentage: 66,
+        approval_threshold_percentage: 80,
         slashing_quorum_percentage: 60,
         slashing_threshold_percentage: 80,
-        required_stake: Some(1_000_000),
+        required_stake: Some(200_000),
         constitutionality: 1,
     }
 }
 
-// TODO: decide on parameters
 // Proposal parameters for the 'Set Initial Invitation Balance' proposal
 pub(crate) fn set_initial_invitation_balance_proposal() -> ProposalParameters<BlockNumber, Balance>
 {
     ProposalParameters {
-        voting_period: 72200,
-        grace_period: 72200,
-        approval_quorum_percentage: 80,
-        approval_threshold_percentage: 100,
+        voting_period: 72000,
+        grace_period: 43200,
+        approval_quorum_percentage: 60,
+        approval_threshold_percentage: 75,
         slashing_quorum_percentage: 60,
         slashing_threshold_percentage: 80,
-        required_stake: Some(1_000_000),
+        required_stake: Some(50_000),
         constitutionality: 1,
     }
 }
 
-// TODO: decide on parameters
 // Proposal parameters for the 'Set Initial Invitation Quota' proposal
+// The parameter for this proposal still have to be more carefully reviewed
 pub(crate) fn set_membership_lead_invitation_quota_proposal(
 ) -> ProposalParameters<BlockNumber, Balance> {
     ProposalParameters {
-        voting_period: 72200,
-        grace_period: 0,
-        approval_quorum_percentage: 80,
-        approval_threshold_percentage: 100,
+        voting_period: 72000,
+        grace_period: 43200,
+        approval_quorum_percentage: 60,
+        approval_threshold_percentage: 75,
         slashing_quorum_percentage: 60,
         slashing_threshold_percentage: 80,
-        required_stake: Some(1_000_000),
+        required_stake: Some(50_000),
         constitutionality: 1,
     }
 }
 
-// TODO: decide on parameters
 // Proposal parameters for the 'Set Referral Cut' proposal
 pub(crate) fn set_referral_cut_proposal() -> ProposalParameters<BlockNumber, Balance> {
     ProposalParameters {
-        voting_period: 72200,
-        grace_period: 0,
-        approval_quorum_percentage: 80,
-        approval_threshold_percentage: 100,
+        voting_period: 43200,
+        grace_period: 14400,
+        approval_quorum_percentage: 60,
+        approval_threshold_percentage: 75,
         slashing_quorum_percentage: 60,
         slashing_threshold_percentage: 80,
-        required_stake: Some(1_000_000),
+        required_stake: Some(50_000),
         constitutionality: 1,
     }
 }
 
-// TODO: decide on parameters
 // Proposal parameters for the 'Set Initial Invitation Count' proposal
 pub(crate) fn set_invitation_count_proposal() -> ProposalParameters<BlockNumber, Balance> {
     ProposalParameters {
-        voting_period: 72200,
-        grace_period: 0,
-        approval_quorum_percentage: 80,
-        approval_threshold_percentage: 100,
+        voting_period: 72000,
+        grace_period: 43200,
+        approval_quorum_percentage: 60,
+        approval_threshold_percentage: 75,
         slashing_quorum_percentage: 60,
         slashing_threshold_percentage: 80,
-        required_stake: Some(1_000_000),
+        required_stake: Some(50_000),
         constitutionality: 1,
     }
 }

+ 13 - 0
runtime/src/tests/proposals_integration/mod.rs

@@ -739,6 +739,8 @@ fn set_initial_invitation_count_proposal_succeeds() {
 
         codex_extrinsic_test_fixture.call_extrinsic_and_assert();
 
+        run_to_block(86410);
+
         assert_eq!(
             Membership::initial_invitation_count(),
             new_default_invite_count
@@ -775,6 +777,8 @@ fn set_membership_leader_invitation_quota_proposal_succeeds() {
 
         codex_extrinsic_test_fixture.call_extrinsic_and_assert();
 
+        run_to_block(86410);
+
         assert_eq!(Membership::membership(lead_id).invites, new_invite_count);
     });
 }
@@ -805,6 +809,8 @@ fn set_referral_cut_proposal_succeeds() {
 
         codex_extrinsic_test_fixture.call_extrinsic_and_assert();
 
+        run_to_block(86410);
+
         assert_eq!(Membership::referral_cut(), referral_cut);
     });
 }
@@ -835,10 +841,15 @@ fn set_budget_increment_proposal_succeds() {
 
         codex_extrinsic_test_fixture.call_extrinsic_and_assert();
 
+        run_to_block(86410);
+
         assert_eq!(Council::budget_increment(), budget_increment);
     });
 }
 
+// We ignore this test because running until the relevant block
+// take too long
+#[ignore]
 #[test]
 fn set_councilor_reward_proposal_succeds() {
     initial_test_ext().execute_with(|| {
@@ -865,6 +876,8 @@ fn set_councilor_reward_proposal_succeds() {
 
         codex_extrinsic_test_fixture.call_extrinsic_and_assert();
 
+        run_to_block(202600);
+
         assert_eq!(Council::councilor_reward(), councilor_reward);
     });
 }