Browse Source

reset runtime upgrade init code, and remove compiler warnings

Mokhtar Naamani 5 years ago
parent
commit
85c645c0cb
3 changed files with 2 additions and 62 deletions
  1. 0 1
      src/lib.rs
  2. 2 59
      src/migration.rs
  3. 0 2
      src/roles/actors.rs

+ 0 - 1
src/lib.rs

@@ -1,7 +1,6 @@
 //! The Substrate Node Template runtime. This can be compiled with `#[no_std]`, ready for Wasm.
 
 #![cfg_attr(not(feature = "std"), no_std)]
-#![cfg_attr(not(feature = "std"), feature(alloc))]
 // `construct_runtime!` does a lot of recursion and requires us to increase the limit to 256.
 #![recursion_limit = "256"]
 

+ 2 - 59
src/migration.rs

@@ -1,9 +1,8 @@
 use crate::forum;
 use crate::storage;
 use crate::VERSION;
-use rstd::prelude::*;
 use runtime_io::print;
-use srml_support::{decl_event, decl_module, decl_storage, StorageMap, StorageValue};
+use srml_support::{decl_event, decl_module, decl_storage, StorageValue};
 use sudo;
 use system;
 
@@ -12,7 +11,7 @@ use system;
 // the runtime doesn't need to maintain any logic for old migrations. All knowledge about state of the chain and runtime
 // prior to the new runtime taking over is implicit in the migration code implementation. If assumptions are incorrect
 // behaviour is undefined.
-const MIGRATION_FOR_SPEC_VERSION: u32 = 4;
+const MIGRATION_FOR_SPEC_VERSION: u32 = 0;
 
 impl<T: Trait> Module<T> {
     fn runtime_initialization() {
@@ -26,67 +25,11 @@ impl<T: Trait> Module<T> {
         // add initialization of other modules introduced in this runtime
         // ...
 
-        Self::initialize_forum_module();
-
-        Self::initialize_storage_module();
-
         Self::deposit_event(RawEvent::Migrated(
             <system::Module<T>>::block_number(),
             VERSION.spec_version,
         ));
     }
-
-    fn initialize_forum_module() {
-        // next id's
-        <forum::NextCategoryId<T>>::put(1);
-        <forum::NextThreadId<T>>::put(1);
-        <forum::NextPostId<T>>::put(1);
-
-        // sudo key will be used as initial forum sudo key
-        <forum::ForumSudo<T>>::put(<sudo::Module<T>>::key().clone());
-
-        // input validation constraints
-        <forum::CategoryTitleConstraint<T>>::put(Self::create_input_validation_length_constraint(
-            10, 90,
-        ));
-        <forum::CategoryDescriptionConstraint<T>>::put(
-            Self::create_input_validation_length_constraint(10, 490),
-        );
-        <forum::ThreadTitleConstraint<T>>::put(Self::create_input_validation_length_constraint(
-            10, 90,
-        ));
-        <forum::PostTextConstraint<T>>::put(Self::create_input_validation_length_constraint(
-            10, 990,
-        ));
-        <forum::ThreadModerationRationaleConstraint<T>>::put(
-            Self::create_input_validation_length_constraint(10, 290),
-        );
-        <forum::PostModerationRationaleConstraint<T>>::put(
-            Self::create_input_validation_length_constraint(10, 290),
-        );
-    }
-
-    fn create_input_validation_length_constraint(
-        min: u16,
-        max_min_diff: u16,
-    ) -> forum::InputValidationLengthConstraint {
-        return forum::InputValidationLengthConstraint { min, max_min_diff };
-    }
-
-    fn initialize_storage_module() {
-        // Remove hardcoded liaison
-        <storage::data_directory::PrimaryLiaisonAccountId<T>>::take();
-
-        // remove all content
-        for content_id in <storage::data_directory::KnownContentIds<T>>::get().iter() {
-            <storage::data_directory::DataObjectByContentId<T>>::remove(content_id);
-            <storage::data_directory::MetadataByContentId<T>>::remove(content_id);
-            <storage::data_object_storage_registry::RelationshipsByContentId<T>>::remove(
-                content_id,
-            );
-        }
-        <storage::data_directory::KnownContentIds<T>>::put(vec![]);
-    }
 }
 
 pub trait Trait:

+ 0 - 2
src/roles/actors.rs

@@ -11,8 +11,6 @@ use system::{self, ensure_signed};
 
 use crate::traits::Members;
 
-static MSG_NO_ACTOR_FOR_ROLE: &str = "For the specified role, no actor is currently staked.";
-
 const STAKING_ID: LockIdentifier = *b"role_stk";
 
 #[derive(Encode, Decode, Copy, Clone, Eq, PartialEq, Debug)]