Mokhtar Naamani 5 lat temu
rodzic
commit
32da3d32a1

+ 4 - 2
Cargo.toml

@@ -245,7 +245,9 @@ git = 'https://github.com/paritytech/substrate.git'
 default_features = false
 rev = 'polkadot-master'
 
-[dependencies.staking-reward-curve]
+# don't rename the dependency it is causing some strange compiler error:
+# https://github.com/rust-lang/rust/issues/64450
+[dependencies.srml-staking-reward-curve]
 package = 'srml-staking-reward-curve'
 git = 'https://github.com/paritytech/substrate.git'
 default_features = false
@@ -253,7 +255,7 @@ rev = 'polkadot-master'
 
 [build-dependencies.wasm-builder-runner]
 package = 'substrate-wasm-builder-runner'
-version = '1.0.2'
+version = '1.0.4'
 
 [dependencies.forum]
 default_features = false

+ 5 - 5
src/governance/proposals.rs

@@ -4,13 +4,13 @@ use runtime_primitives::{
     print,
     traits::{Hash, SaturatedConversion, Zero},
 };
-#[cfg(feature = "std")]
-use serde::{Deserialize, Serialize};
 use srml_support::traits::{Currency, Get, ReservableCurrency};
 use srml_support::{decl_event, decl_module, decl_storage, dispatch, ensure};
-
 use system::{self, ensure_root, ensure_signed};
 
+#[cfg(feature = "std")]
+use serde::{Deserialize, Serialize};
+
 #[cfg(test)]
 use primitives::storage::well_known_keys;
 
@@ -73,8 +73,8 @@ impl Default for ProposalStatus {
 
 use self::ProposalStatus::*;
 
-#[cfg_attr(feature = "std", derive(Serialize, Deserialize, Debug))]
-#[derive(Encode, Decode, Clone, PartialEq, Eq)]
+#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
+#[derive(Encode, Decode, Clone, PartialEq, Eq, Debug)]
 pub enum VoteKind {
     /// Signals presence, but unwillingness to cast judgment on substance of vote.
     Abstain,

+ 1 - 1
src/lib.rs

@@ -328,7 +328,7 @@ impl session::historical::Trait for Runtime {
     type FullIdentificationOf = staking::ExposureOf<Runtime>;
 }
 
-staking_reward_curve::build! {
+srml_staking_reward_curve::build! {
     const REWARD_CURVE: PiecewiseLinear<'static> = curve!(
         min_inflation: 0_025_000,
         max_inflation: 0_100_000,

+ 0 - 1
src/membership/members.rs

@@ -2,7 +2,6 @@ use crate::currency::{BalanceOf, GovernanceCurrency};
 use codec::{Codec, Decode, Encode};
 
 use rstd::prelude::*;
-#[cfg(feature = "std")]
 use runtime_primitives::traits::{MaybeSerialize, Member, One, SimpleArithmetic};
 use srml_support::traits::{Currency, Get};
 use srml_support::{decl_event, decl_module, decl_storage, dispatch, ensure, Parameter};

+ 1 - 2
src/roles/actors.rs

@@ -13,8 +13,7 @@ pub use membership::members::Role;
 
 const STAKING_ID: LockIdentifier = *b"role_stk";
 
-#[cfg_attr(feature = "std", derive(Debug))]
-#[derive(Encode, Decode, Copy, Clone, Eq, PartialEq)]
+#[derive(Encode, Decode, Copy, Clone, Eq, PartialEq, Debug)]
 pub struct RoleParameters<Balance, BlockNumber> {
     // minium balance required to stake to enter a role
     pub min_stake: Balance,

+ 6 - 13
src/storage/data_directory.rs

@@ -32,15 +32,13 @@ static MSG_CREATOR_MUST_BE_MEMBER: &str = "Only active members may create conten
 static MSG_DO_TYPE_MUST_BE_ACTIVE: &str =
     "Cannot create content for inactive or missing data object type.";
 
-#[derive(Clone, Encode, Decode, PartialEq)]
-#[cfg_attr(feature = "std", derive(Debug))]
+#[derive(Clone, Encode, Decode, PartialEq, Debug)]
 pub struct BlockAndTime<T: Trait> {
     pub block: T::BlockNumber,
     pub time: T::Moment,
 }
 
-#[derive(Clone, Encode, Decode, PartialEq)]
-#[cfg_attr(feature = "std", derive(Debug))]
+#[derive(Clone, Encode, Decode, PartialEq, Debug)]
 pub enum LiaisonJudgement {
     Pending,
     Accepted,
@@ -53,8 +51,7 @@ impl Default for LiaisonJudgement {
     }
 }
 
-#[derive(Clone, Encode, Decode, PartialEq)]
-#[cfg_attr(feature = "std", derive(Debug))]
+#[derive(Clone, Encode, Decode, PartialEq, Debug)]
 pub struct DataObject<T: Trait> {
     pub owner: T::AccountId,
     pub added_at: BlockAndTime<T>,
@@ -70,9 +67,7 @@ pub struct DataObject<T: Trait> {
                                   // pub rejection_reason: Option<Vec<u8>>,
 }
 
-#[derive(Clone, Encode, Decode, PartialEq)]
-#[cfg_attr(feature = "std", derive(Debug))]
-// TODO ContentVisibility
+#[derive(Clone, Encode, Decode, PartialEq, Debug)]
 pub enum ContentVisibility {
     Draft, // TODO rename to Unlisted?
     Public,
@@ -84,8 +79,7 @@ impl Default for ContentVisibility {
     }
 }
 
-#[derive(Clone, Encode, Decode, PartialEq)]
-#[cfg_attr(feature = "std", derive(Debug))]
+#[derive(Clone, Encode, Decode, PartialEq, Debug)]
 pub struct ContentMetadata<T: Trait> {
     pub owner: T::AccountId,
     pub added_at: BlockAndTime<T>,
@@ -95,8 +89,7 @@ pub struct ContentMetadata<T: Trait> {
     pub json: Vec<u8>,
 }
 
-#[derive(Clone, Encode, Decode, PartialEq)]
-#[cfg_attr(feature = "std", derive(Debug))]
+#[derive(Clone, Encode, Decode, PartialEq, Debug)]
 pub struct ContentMetadataUpdate<ContentId, SchemaId> {
     pub children_ids: Option<Vec<ContentId>>,
     pub visibility: Option<ContentVisibility>,

+ 1 - 2
src/storage/data_object_storage_registry.rs

@@ -35,8 +35,7 @@ static MSG_ONLY_STORAGE_PROVIDER_MAY_CLAIM_READY: &str =
 const DEFAULT_FIRST_RELATIONSHIP_ID: u32 = 1;
 
 // TODO deprecated
-#[derive(Clone, Encode, Decode, PartialEq)]
-#[cfg_attr(feature = "std", derive(Debug))]
+#[derive(Clone, Encode, Decode, PartialEq, Debug)]
 pub struct DataObjectStorageRelationship<T: Trait> {
     pub content_id: <T as DDTrait>::ContentId,
     pub storage_provider: T::AccountId,

+ 1 - 2
src/storage/data_object_type_registry.rs

@@ -26,8 +26,7 @@ const CREATE_DETAULT_TYPE: bool = true;
 
 const DEFAULT_FIRST_DATA_OBJECT_TYPE_ID: u32 = 1;
 
-#[derive(Clone, Encode, Decode, PartialEq)]
-#[cfg_attr(feature = "std", derive(Debug))]
+#[derive(Clone, Encode, Decode, PartialEq, Debug)]
 pub struct DataObjectType {
     pub description: Vec<u8>,
     pub active: bool,