Browse Source

nicara migration using testing values for proposal periods

Mokhtar Naamani 4 years ago
parent
commit
fe66f264f9

+ 2 - 4
runtime-modules/proposals/codex/src/lib.rs

@@ -1053,11 +1053,9 @@ impl<T: Trait> Module<T> {
         Ok(())
     }
 
-    /// Sets default config values for the proposals.
+    /// Sets config values for the proposals.
     /// Should be called on the migration to the new runtime version.
-    pub fn set_default_config_values() {
-        let p = ProposalsConfigParameters::default();
-
+    pub fn set_config_values(p: ProposalsConfigParameters) {
         <SetValidatorCountProposalVotingPeriod<T>>::put(T::BlockNumber::from(
             p.set_validator_count_proposal_voting_period,
         ));

+ 1 - 0
runtime-modules/proposals/codex/src/proposal_types/mod.rs

@@ -220,6 +220,7 @@ pub struct RoleParameters<Balance, BlockNumber> {
 }
 
 /// Contains proposal config parameters. Default values are used by migration and genesis config.
+#[derive(Copy, Clone)]
 pub struct ProposalsConfigParameters {
     /// 'Set validator count' proposal voting period
     pub set_validator_count_proposal_voting_period: u32,

+ 1 - 1
runtime-modules/proposals/codex/src/tests/mod.rs

@@ -802,7 +802,7 @@ fn set_default_proposal_parameters_succeeded() {
         // nothing is set
         assert_eq!(<SetValidatorCountProposalVotingPeriod<Test>>::get(), 0);
 
-        ProposalCodex::set_default_config_values();
+        ProposalCodex::set_config_values(p);
 
         assert_eq!(
             <SetValidatorCountProposalVotingPeriod<Test>>::get(),

+ 2 - 1
runtime/src/migration.rs

@@ -2,6 +2,7 @@
 #![allow(clippy::redundant_closure_call)] // disable it because of the substrate lib design
 
 use crate::VERSION;
+use proposals_codex::ProposalsConfigParameters;
 use rstd::prelude::*;
 use sr_primitives::{
     print,
@@ -26,7 +27,7 @@ impl<T: Trait> Module<T> {
         Self::initialize_storage_working_group_text_constraints();
         Self::clear_storage_data();
 
-        proposals_codex::Module::<T>::set_default_config_values();
+        proposals_codex::Module::<T>::set_config_values(ProposalsConfigParameters::development());
     }
 }