From 43376ab55f62dd70b33f030da5f46ff093d808c0 Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Wed, 13 Mar 2019 10:22:42 +0200 Subject: [PATCH 001/175] adding membership module - storage --- src/lib.rs | 9 ++++ src/membership.rs | 109 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 118 insertions(+) create mode 100644 src/membership.rs diff --git a/src/lib.rs b/src/lib.rs index 77adf189ae..8bf9712edc 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -17,6 +17,7 @@ extern crate parity_codec_derive; pub mod governance; use governance::{election, council, proposals}; mod memo; +mod membership; use rstd::prelude::*; #[cfg(feature = "std")] @@ -224,6 +225,13 @@ impl memo::Trait for Runtime { type Event = Event; } +impl membership::Trait for Runtime { + type Event = Event; + type MemberId = u64; + type PaidTermId = u32; + type SubscriptionId = u32; +} + construct_runtime!( pub enum Runtime with Log(InternalLog: DigestItem) where Block = Block, @@ -244,6 +252,7 @@ construct_runtime!( CouncilElection: election::{Module, Call, Storage, Event, Config}, Council: council::{Module, Call, Storage, Event, Config}, Memo: memo::{Module, Call, Storage, Event}, + Membership: membership, } ); diff --git a/src/membership.rs b/src/membership.rs new file mode 100644 index 0000000000..ec4d9c6cb8 --- /dev/null +++ b/src/membership.rs @@ -0,0 +1,109 @@ +#![cfg_attr(not(feature = "std"), no_std)] + +use rstd::prelude::*; +use parity_codec::Codec; +use parity_codec_derive::{Encode, Decode}; +use srml_support::{StorageMap, dispatch::Result, decl_module, decl_storage, decl_event, ensure, Parameter}; +use srml_support::traits::{Currency}; +use runtime_primitives::traits::{Zero, SimpleArithmetic, As, Member, MaybeSerializeDebug}; +use system::{self, ensure_signed}; +use crate::governance::{GovernanceCurrency, BalanceOf }; + +pub trait Trait: system::Trait + GovernanceCurrency { + type Event: From> + Into<::Event>; + + type MemberId: Parameter + Member + SimpleArithmetic + Codec + Default + Copy + As + As + MaybeSerializeDebug; + + type PaidTermId: Parameter + Member + SimpleArithmetic + Codec + Default + Copy + As + As + MaybeSerializeDebug; + + type SubscriptionId: Parameter + Member + SimpleArithmetic + Codec + Default + Copy + As + As + MaybeSerializeDebug; +} + +#[cfg_attr(feature = "std", derive(Serialize, Deserialize, Debug))] +#[derive(Encode, Decode)] +pub struct Profile { + id: T::MemberId, // is it necessary to have the id in the struct? + handle: u32, + avatarUri: Vec, + description: Vec, + added: T::BlockNumber, + entry: EntryMethod, + suspended: bool, + subscription: Option +} + +#[cfg_attr(feature = "std", derive(Serialize, Deserialize, Debug))] +#[derive(Encode, Decode)] +pub enum EntryMethod { + Paid(T::PaidTermId), + Screening(T::AccountId), +} + +#[cfg_attr(feature = "std", derive(Serialize, Deserialize, Debug))] +#[derive(Encode, Decode)] +pub struct PaidMembershipTerms { + /// Unique identifier - the term id + id: T::PaidTermId, // is it necessary to have id in the struct? + /// Quantity of native tokens which must be provably burned + fee: BalanceOf, + /// String of capped length describing human readable conditions which are being agreed upon + text: Vec +} + +// Start at 1001? instead to reserve first 1000 ids ? +const FIRST_MEMBER_ID: u64 = 1; +const INITIAL_PAID_TERMS_ID: u64 = 1; + +// TEST: do initial values and build methods get called for store items when the runtime is +// an upgrade? if not we need a differnet way to set them... +decl_storage! { + trait Store for Module as MembersipRegistry { + FirstMemberId get(first_member_id) : T::MemberId = T::MemberId::sa(FIRST_MEMBER_ID); + + /// Id to assign to next member that is added to the registry + NextMemberId get(next_member_id) : T::MemberId = T::MemberId::sa(FIRST_MEMBER_ID); + + /// Mapping of member ids to their corresponding accountid + MembersById get(members_by_id) : map T::MemberId => T::AccountId; + + /// Mapping of members' accountid to their member id + MemberByAccount get(members_by_account) : map T::AccountId => T::MemberId; + + /// Mapping of member's id to their membership profile + // Value is Option because it is not meaningful to have a Default value for Profile + MemberProfile get(member_profile_preview) : map T::MemberId => Option>; + + /// Next paid membership terms id - 1 reserved for initial terms, (avoid 0 -> default value) + NextPaidMembershipTermsId get(next_paid_membership_terms_id) : T::PaidTermId = T::PaidTermId::sa(2); + + /// Paid membership terms record + // Value is an Option because it is not meanigful to have a Default value for a PaidMembershipTerms + // build method should return a vector of tuple(key, value) + // will this method even be called for a runtime upgrade? + PaidMembershipTermsById get(paid_membership_terms_by_id) build(|_| vec![(T::PaidTermId::sa(INITIAL_PAID_TERMS_ID), Some(PaidMembershipTerms { + id: T::PaidTermId::sa(INITIAL_PAID_TERMS_ID), + fee: BalanceOf::::sa(100), + text: String::from("Basic Membership TOS").into_bytes() + }))]) : map T::PaidTermId => Option>; + + /// Active Paid membership terms + ActivePaidMembershipTerms get(active_paid_membership_terms) : Vec = vec![T::PaidTermId::sa(INITIAL_PAID_TERMS_ID)]; + + /// Is the platform is accepting new members or not + PlatformAcceptingNewMemberships get(platform_accepting_new_memberships) : bool = true; + } +} + +decl_event! { + pub enum Event where + ::AccountId, + ::MemberId { + MemberAdded(MemberId, AccountId), + } +} + +decl_module! { + pub struct Module for enum Call where origin: T::Origin { + fn deposit_event() = default; + } +} From 216e694afcddeaab01f79d8a6f9f6e36b6d9aab7 Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Wed, 13 Mar 2019 13:47:12 +0200 Subject: [PATCH 002/175] use default implicit value for paid terms instead of initializing map --- src/lib.rs | 4 ++-- src/membership.rs | 33 ++++++++++++++++++++------------- 2 files changed, 22 insertions(+), 15 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 8bf9712edc..08eba2b1c9 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -88,7 +88,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { spec_name: create_runtime_str!("joystream-node"), impl_name: create_runtime_str!("joystream-node"), authoring_version: 3, - spec_version: 4, + spec_version: 5, impl_version: 0, apis: RUNTIME_API_VERSIONS, }; @@ -252,7 +252,7 @@ construct_runtime!( CouncilElection: election::{Module, Call, Storage, Event, Config}, Council: council::{Module, Call, Storage, Event, Config}, Memo: memo::{Module, Call, Storage, Event}, - Membership: membership, + Membership: membership::{Module, Call, Storage, Event}, } ); diff --git a/src/membership.rs b/src/membership.rs index ec4d9c6cb8..33243cb12c 100644 --- a/src/membership.rs +++ b/src/membership.rs @@ -19,6 +19,14 @@ pub trait Trait: system::Trait + GovernanceCurrency { type SubscriptionId: Parameter + Member + SimpleArithmetic + Codec + Default + Copy + As + As + MaybeSerializeDebug; } +const FIRST_MEMBER_ID: u64 = 1; +const FIRST_PAID_TERMS_ID: u64 = 1; + +// Default "implicit" paid terms +const DEFAULT_PAID_TERM_ID: u64 = 0; +const DEFAULT_PAID_TERM_FEE: u64 = 100; +const DEFAULT_PAID_TERM_TEXT: &str = "Default Paid Term TOS..."; + #[cfg_attr(feature = "std", derive(Serialize, Deserialize, Debug))] #[derive(Encode, Decode)] pub struct Profile { @@ -50,9 +58,15 @@ pub struct PaidMembershipTerms { text: Vec } -// Start at 1001? instead to reserve first 1000 ids ? -const FIRST_MEMBER_ID: u64 = 1; -const INITIAL_PAID_TERMS_ID: u64 = 1; +impl Default for PaidMembershipTerms { + fn default() -> Self { + PaidMembershipTerms { + id: T::PaidTermId::sa(DEFAULT_PAID_TERM_ID), + fee: BalanceOf::::sa(DEFAULT_PAID_TERM_FEE), + text: DEFAULT_PAID_TERM_TEXT.as_bytes().to_vec() + } + } +} // TEST: do initial values and build methods get called for store items when the runtime is // an upgrade? if not we need a differnet way to set them... @@ -74,20 +88,13 @@ decl_storage! { MemberProfile get(member_profile_preview) : map T::MemberId => Option>; /// Next paid membership terms id - 1 reserved for initial terms, (avoid 0 -> default value) - NextPaidMembershipTermsId get(next_paid_membership_terms_id) : T::PaidTermId = T::PaidTermId::sa(2); + NextPaidMembershipTermsId get(next_paid_membership_terms_id) : T::PaidTermId = T::PaidTermId::sa(FIRST_PAID_TERMS_ID); /// Paid membership terms record - // Value is an Option because it is not meanigful to have a Default value for a PaidMembershipTerms - // build method should return a vector of tuple(key, value) - // will this method even be called for a runtime upgrade? - PaidMembershipTermsById get(paid_membership_terms_by_id) build(|_| vec![(T::PaidTermId::sa(INITIAL_PAID_TERMS_ID), Some(PaidMembershipTerms { - id: T::PaidTermId::sa(INITIAL_PAID_TERMS_ID), - fee: BalanceOf::::sa(100), - text: String::from("Basic Membership TOS").into_bytes() - }))]) : map T::PaidTermId => Option>; + PaidMembershipTermsById get(paid_membership_terms_by_id) : map T::PaidTermId => PaidMembershipTerms; /// Active Paid membership terms - ActivePaidMembershipTerms get(active_paid_membership_terms) : Vec = vec![T::PaidTermId::sa(INITIAL_PAID_TERMS_ID)]; + ActivePaidMembershipTerms get(active_paid_membership_terms) : Vec = vec![T::PaidTermId::sa(DEFAULT_PAID_TERM_ID)]; /// Is the platform is accepting new members or not PlatformAcceptingNewMemberships get(platform_accepting_new_memberships) : bool = true; From a7d4aac9f130d4e3da1c24b79f91d6c122255202 Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Thu, 14 Mar 2019 02:47:51 +0200 Subject: [PATCH 003/175] add migration --- Cargo.toml | 4 +-- src/lib.rs | 2 +- src/membership.rs | 69 +++++++++++++++++++++++++++++++++++------------ 3 files changed, 55 insertions(+), 20 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 9433296744..75080094ef 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -75,11 +75,11 @@ rev = 'df5e65927780b323482e2e8b5031822f423a032d' [dependencies.parity-codec] default-features = false -version = '3.0' +version = '3.1' [dependencies.parity-codec-derive] default-features = false -version = '3.0' +version = '3.1' [dependencies.primitives] default_features = false diff --git a/src/lib.rs b/src/lib.rs index 08eba2b1c9..b7d70cb892 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -252,7 +252,7 @@ construct_runtime!( CouncilElection: election::{Module, Call, Storage, Event, Config}, Council: council::{Module, Call, Storage, Event, Config}, Memo: memo::{Module, Call, Storage, Event}, - Membership: membership::{Module, Call, Storage, Event}, + Membership: membership::{Module, Call, Storage, Event, Config}, } ); diff --git a/src/membership.rs b/src/membership.rs index 33243cb12c..01f7a418bf 100644 --- a/src/membership.rs +++ b/src/membership.rs @@ -3,11 +3,12 @@ use rstd::prelude::*; use parity_codec::Codec; use parity_codec_derive::{Encode, Decode}; -use srml_support::{StorageMap, dispatch::Result, decl_module, decl_storage, decl_event, ensure, Parameter}; +use srml_support::{StorageMap, StorageValue, dispatch::Result, decl_module, decl_storage, decl_event, ensure, Parameter}; use srml_support::traits::{Currency}; use runtime_primitives::traits::{Zero, SimpleArithmetic, As, Member, MaybeSerializeDebug}; use system::{self, ensure_signed}; use crate::governance::{GovernanceCurrency, BalanceOf }; +use runtime_io::print; pub trait Trait: system::Trait + GovernanceCurrency { type Event: From> + Into<::Event>; @@ -19,20 +20,20 @@ pub trait Trait: system::Trait + GovernanceCurrency { type SubscriptionId: Parameter + Member + SimpleArithmetic + Codec + Default + Copy + As + As + MaybeSerializeDebug; } -const FIRST_MEMBER_ID: u64 = 1; +const DEFAULT_FIRST_MEMBER_ID: u64 = 1; const FIRST_PAID_TERMS_ID: u64 = 1; -// Default "implicit" paid terms +// Default paid membership terms const DEFAULT_PAID_TERM_ID: u64 = 0; -const DEFAULT_PAID_TERM_FEE: u64 = 100; +const DEFAULT_PAID_TERM_FEE: u64 = 100; // Can be overidden in genesis config const DEFAULT_PAID_TERM_TEXT: &str = "Default Paid Term TOS..."; -#[cfg_attr(feature = "std", derive(Serialize, Deserialize, Debug))] +//#[cfg_attr(feature = "std", derive(Serialize, Deserialize, Debug))] #[derive(Encode, Decode)] pub struct Profile { - id: T::MemberId, // is it necessary to have the id in the struct? + id: T::MemberId, handle: u32, - avatarUri: Vec, + avatar_uri: Vec, description: Vec, added: T::BlockNumber, entry: EntryMethod, @@ -40,18 +41,18 @@ pub struct Profile { subscription: Option } -#[cfg_attr(feature = "std", derive(Serialize, Deserialize, Debug))] +//#[cfg_attr(feature = "std", derive(Serialize, Deserialize, Debug))] #[derive(Encode, Decode)] pub enum EntryMethod { Paid(T::PaidTermId), Screening(T::AccountId), } -#[cfg_attr(feature = "std", derive(Serialize, Deserialize, Debug))] +//#[cfg_attr(feature = "std", derive(Serialize, Deserialize, Debug))] #[derive(Encode, Decode)] pub struct PaidMembershipTerms { /// Unique identifier - the term id - id: T::PaidTermId, // is it necessary to have id in the struct? + id: T::PaidTermId, /// Quantity of native tokens which must be provably burned fee: BalanceOf, /// String of capped length describing human readable conditions which are being agreed upon @@ -68,14 +69,12 @@ impl Default for PaidMembershipTerms { } } -// TEST: do initial values and build methods get called for store items when the runtime is -// an upgrade? if not we need a differnet way to set them... decl_storage! { - trait Store for Module as MembersipRegistry { - FirstMemberId get(first_member_id) : T::MemberId = T::MemberId::sa(FIRST_MEMBER_ID); + trait Store for Module as Membership { + FirstMemberId get(first_member_id) config(first_member_id): T::MemberId = T::MemberId::sa(DEFAULT_FIRST_MEMBER_ID); /// Id to assign to next member that is added to the registry - NextMemberId get(next_member_id) : T::MemberId = T::MemberId::sa(FIRST_MEMBER_ID); + NextMemberId get(next_member_id) build(|config: &GenesisConfig| config.first_member_id): T::MemberId = T::MemberId::sa(DEFAULT_FIRST_MEMBER_ID); /// Mapping of member ids to their corresponding accountid MembersById get(members_by_id) : map T::MemberId => T::AccountId; @@ -87,17 +86,35 @@ decl_storage! { // Value is Option because it is not meaningful to have a Default value for Profile MemberProfile get(member_profile_preview) : map T::MemberId => Option>; - /// Next paid membership terms id - 1 reserved for initial terms, (avoid 0 -> default value) + /// Next paid membership terms id NextPaidMembershipTermsId get(next_paid_membership_terms_id) : T::PaidTermId = T::PaidTermId::sa(FIRST_PAID_TERMS_ID); /// Paid membership terms record - PaidMembershipTermsById get(paid_membership_terms_by_id) : map T::PaidTermId => PaidMembershipTerms; + // Remember to add _genesis_phantom_data: std::marker::PhantomData{} to membership + // genesis config if not providing config() or extra_genesis + PaidMembershipTermsById get(paid_membership_terms_by_id) build(|config: &GenesisConfig| { + // This method only gets called when initializing storage, and is + // compiled as native code. (Will be called when building `raw` chainspec) + // So it can't be relied upon to initialize storage for runtimes updates. + // Initialization for updated runtime is done in run_migration() + let mut terms: PaidMembershipTerms = Default::default(); + terms.fee = BalanceOf::::sa(config.default_paid_membership_fee); + vec![(terms.id, terms)] + }) : map T::PaidTermId => Option>; /// Active Paid membership terms ActivePaidMembershipTerms get(active_paid_membership_terms) : Vec = vec![T::PaidTermId::sa(DEFAULT_PAID_TERM_ID)]; /// Is the platform is accepting new members or not PlatformAcceptingNewMemberships get(platform_accepting_new_memberships) : bool = true; + + /// If we should run a migration and initialize new storage values introduced in new runtime + // This will initialize to false if starting at genesis (because the build() method will run), + // for a runtime upgrade it will return the default value when reading the first time. + ShouldRunMigration get(should_run_migration) build(|_| false) : bool = true; + } + add_extra_genesis { + config(default_paid_membership_fee): u64; } } @@ -109,8 +126,26 @@ decl_event! { } } +impl Module { + fn run_migration() { + if Self::should_run_migration() { + let default_terms: PaidMembershipTerms = Default::default(); + >::insert(T::PaidTermId::sa(0), default_terms); + >::put(false); + } + } +} + decl_module! { pub struct Module for enum Call where origin: T::Origin { fn deposit_event() = default; + + fn on_initialise(_now: T::BlockNumber) { + Self::run_migration(); + } + + fn on_finalise(_now: T::BlockNumber) { + + } } } From 6923186c68dccc57c699b21e31d41af1141fc58f Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Thu, 14 Mar 2019 08:59:29 +0200 Subject: [PATCH 004/175] renaming, adding handles map --- src/membership.rs | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/src/membership.rs b/src/membership.rs index 01f7a418bf..903d6928f1 100644 --- a/src/membership.rs +++ b/src/membership.rs @@ -8,9 +8,10 @@ use srml_support::traits::{Currency}; use runtime_primitives::traits::{Zero, SimpleArithmetic, As, Member, MaybeSerializeDebug}; use system::{self, ensure_signed}; use crate::governance::{GovernanceCurrency, BalanceOf }; -use runtime_io::print; +//use runtime_io::print; +use {timestamp}; -pub trait Trait: system::Trait + GovernanceCurrency { +pub trait Trait: system::Trait + GovernanceCurrency + timestamp::Trait { type Event: From> + Into<::Event>; type MemberId: Parameter + Member + SimpleArithmetic + Codec + Default + Copy + As + As + MaybeSerializeDebug; @@ -32,10 +33,11 @@ const DEFAULT_PAID_TERM_TEXT: &str = "Default Paid Term TOS..."; #[derive(Encode, Decode)] pub struct Profile { id: T::MemberId, - handle: u32, + handle: Vec, avatar_uri: Vec, - description: Vec, - added: T::BlockNumber, + about: Vec, + registered_at_block: T::BlockNumber, + registered_at_time: T::Moment, entry: EntryMethod, suspended: bool, subscription: Option @@ -71,21 +73,25 @@ impl Default for PaidMembershipTerms { decl_storage! { trait Store for Module as Membership { + /// MemberId's start at this value FirstMemberId get(first_member_id) config(first_member_id): T::MemberId = T::MemberId::sa(DEFAULT_FIRST_MEMBER_ID); - /// Id to assign to next member that is added to the registry + /// MemberId to assign to next member that is added to the registry NextMemberId get(next_member_id) build(|config: &GenesisConfig| config.first_member_id): T::MemberId = T::MemberId::sa(DEFAULT_FIRST_MEMBER_ID); /// Mapping of member ids to their corresponding accountid - MembersById get(members_by_id) : map T::MemberId => T::AccountId; + AccountIdByMemberId get(account_id_by_member_id) : map T::MemberId => T::AccountId; /// Mapping of members' accountid to their member id - MemberByAccount get(members_by_account) : map T::AccountId => T::MemberId; + MemberIdByAccountId get(member_id_by_account_id) : map T::AccountId => T::MemberId; /// Mapping of member's id to their membership profile // Value is Option because it is not meaningful to have a Default value for Profile MemberProfile get(member_profile_preview) : map T::MemberId => Option>; + /// Registered unique handles and their mapping to their owner + Handles get(handles) : map Vec => Option; + /// Next paid membership terms id NextPaidMembershipTermsId get(next_paid_membership_terms_id) : T::PaidTermId = T::PaidTermId::sa(FIRST_PAID_TERMS_ID); @@ -106,7 +112,7 @@ decl_storage! { ActivePaidMembershipTerms get(active_paid_membership_terms) : Vec = vec![T::PaidTermId::sa(DEFAULT_PAID_TERM_ID)]; /// Is the platform is accepting new members or not - PlatformAcceptingNewMemberships get(platform_accepting_new_memberships) : bool = true; + NewMembershipsAllowed get(new_memberships_allowed) : bool = true; /// If we should run a migration and initialize new storage values introduced in new runtime // This will initialize to false if starting at genesis (because the build() method will run), @@ -122,7 +128,7 @@ decl_event! { pub enum Event where ::AccountId, ::MemberId { - MemberAdded(MemberId, AccountId), + MemberRegistered(MemberId, AccountId), } } @@ -147,5 +153,6 @@ decl_module! { fn on_finalise(_now: T::BlockNumber) { } + } } From 1237df8c8e984b14ae6b47bb65932cc0be80e784 Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Thu, 14 Mar 2019 12:26:56 +0200 Subject: [PATCH 005/175] membership: implement buy_membership --- src/lib.rs | 4 +- src/membership.rs | 127 ++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 125 insertions(+), 6 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index b7d70cb892..b8b0ac8764 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -228,8 +228,8 @@ impl memo::Trait for Runtime { impl membership::Trait for Runtime { type Event = Event; type MemberId = u64; - type PaidTermId = u32; - type SubscriptionId = u32; + type PaidTermId = u64; + type SubscriptionId = u64; } construct_runtime!( diff --git a/src/membership.rs b/src/membership.rs index 903d6928f1..4e91b6255a 100644 --- a/src/membership.rs +++ b/src/membership.rs @@ -3,7 +3,7 @@ use rstd::prelude::*; use parity_codec::Codec; use parity_codec_derive::{Encode, Decode}; -use srml_support::{StorageMap, StorageValue, dispatch::Result, decl_module, decl_storage, decl_event, ensure, Parameter}; +use srml_support::{StorageMap, StorageValue, dispatch, decl_module, decl_storage, decl_event, ensure, Parameter}; use srml_support::traits::{Currency}; use runtime_primitives::traits::{Zero, SimpleArithmetic, As, Member, MaybeSerializeDebug}; use system::{self, ensure_signed}; @@ -14,11 +14,14 @@ use {timestamp}; pub trait Trait: system::Trait + GovernanceCurrency + timestamp::Trait { type Event: From> + Into<::Event>; - type MemberId: Parameter + Member + SimpleArithmetic + Codec + Default + Copy + As + As + MaybeSerializeDebug; + type MemberId: Parameter + Member + SimpleArithmetic + Codec + Default + Copy + + As + As + MaybeSerializeDebug + PartialEq; - type PaidTermId: Parameter + Member + SimpleArithmetic + Codec + Default + Copy + As + As + MaybeSerializeDebug; + type PaidTermId: Parameter + Member + SimpleArithmetic + Codec + Default + Copy + + As + As + MaybeSerializeDebug + PartialEq; - type SubscriptionId: Parameter + Member + SimpleArithmetic + Codec + Default + Copy + As + As + MaybeSerializeDebug; + type SubscriptionId: Parameter + Member + SimpleArithmetic + Codec + Default + Copy + + As + As + MaybeSerializeDebug + PartialEq; } const DEFAULT_FIRST_MEMBER_ID: u64 = 1; @@ -29,8 +32,15 @@ const DEFAULT_PAID_TERM_ID: u64 = 0; const DEFAULT_PAID_TERM_FEE: u64 = 100; // Can be overidden in genesis config const DEFAULT_PAID_TERM_TEXT: &str = "Default Paid Term TOS..."; +// Default user info constraints +const DEFAULT_MIN_HANDLE_LENGTH: u32 = 4; +const DEFAULT_MAX_HANDLE_LENGTH: u32 = 20; +const DEFAULT_MAX_AVATAR_URI_LENGTH: u32 = 512; +const DEFAULT_MAX_ABOUT_TEXT_LENGTH: u32 = 1024; + //#[cfg_attr(feature = "std", derive(Serialize, Deserialize, Debug))] #[derive(Encode, Decode)] +/// Stored information about a registered user pub struct Profile { id: T::MemberId, handle: Vec, @@ -43,6 +53,20 @@ pub struct Profile { subscription: Option } +#[derive(Clone, Debug, Encode, Decode, PartialEq)] +/// Structure used to batch user configurable profile information when registering or updating info +pub struct UserInfo { + handle: Option>, + avatar_uri: Option>, + about: Option>, +} + +struct CheckedUserInfo { + handle: Vec, + avatar_uri: Vec, + about: Vec, +} + //#[cfg_attr(feature = "std", derive(Serialize, Deserialize, Debug))] #[derive(Encode, Decode)] pub enum EntryMethod { @@ -118,6 +142,13 @@ decl_storage! { // This will initialize to false if starting at genesis (because the build() method will run), // for a runtime upgrade it will return the default value when reading the first time. ShouldRunMigration get(should_run_migration) build(|_| false) : bool = true; + + // User Input Validation parameters - do these really need to be state variables + // I don't see a need to adjust these in future? + MinHandleLength get(min_handle_length) : u32 = DEFAULT_MIN_HANDLE_LENGTH; + MaxHandleLength get(max_handle_length) : u32 = DEFAULT_MAX_HANDLE_LENGTH; + MaxAvatarUriLength get(max_avatar_uri_length) : u32 = DEFAULT_MAX_AVATAR_URI_LENGTH; + MaxAboutTextLength get(max_about_text_length) : u32 = DEFAULT_MAX_ABOUT_TEXT_LENGTH; } add_extra_genesis { config(default_paid_membership_fee): u64; @@ -154,5 +185,93 @@ decl_module! { } + /// Non-members can buy membership + fn buy_membership(origin, paid_terms_id: T::PaidTermId, user_info: UserInfo) { + let who = ensure_signed(origin)?; + + // ensure key not associated with an existing membership + Self::ensure_not_member(&who)?; + + // ensure paid_terms_id is active + Self::ensure_terms_id_is_active(paid_terms_id)?; + + let terms = Self::paid_membership_terms_by_id(paid_terms_id).ok_or("paid membership term id does not exist")?; + + // ensure enough free balance to cover terms fees + ensure!(T::Currency::free_balance(&who) >= terms.fee, "not enough balance to buy membership"); + + let user_info = Self::check_user_info(user_info)?; + + let member_id = Self::insert_new_paid_member(&who, paid_terms_id, &user_info)?; + + Self::deposit_event(RawEvent::MemberRegistered(member_id, who.clone())); + } } } + +impl Module { + fn ensure_not_member(who: &T::AccountId) -> dispatch::Result { + ensure!(!>::exists(who), "Account already associated with a membership"); + Ok(()) + } + + fn ensure_terms_id_is_active(terms_id: T::PaidTermId) -> dispatch::Result { + let active_terms = Self::active_paid_membership_terms(); + ensure!(active_terms.iter().any(|&id| id == terms_id), "paid terms id not active"); + Ok(()) + } + + fn ensure_unique_handle(handle: &Vec ) -> dispatch::Result { + ensure!(!>::exists(handle), "handle already registered"); + Ok(()) + } + + /// Basic user input validation + fn check_user_info(user_info: UserInfo) -> Result { + // Handle is required during registration + let handle = user_info.handle.ok_or("handle must be provided during registration")?; + ensure!(handle.len() >= Self::min_handle_length() as usize, "handle too short"); + ensure!(handle.len() <= Self::max_handle_length() as usize, "handle too long"); + + let mut about = user_info.about.unwrap_or_default(); + about.truncate(Self::max_about_text_length() as usize); + + let mut avatar_uri = user_info.avatar_uri.unwrap_or_default(); + avatar_uri.truncate(Self::max_avatar_uri_length() as usize); + + Ok(CheckedUserInfo { + handle, + avatar_uri, + about, + }) + } + + // Mutating methods + + fn insert_new_paid_member(who: &T::AccountId, paid_terms_id: T::PaidTermId, user_info: &CheckedUserInfo) -> Result { + // ensure handle is not already registered + Self::ensure_unique_handle(&user_info.handle)?; + + let new_member_id = Self::next_member_id(); + + let profile: Profile = Profile { + id: new_member_id, + handle: user_info.handle.clone(), + avatar_uri: user_info.avatar_uri.clone(), + about: user_info.about.clone(), + registered_at_block: >::block_number(), + registered_at_time: >::now(), + entry: EntryMethod::Paid(paid_terms_id), + suspended: false, + subscription: None, + }; + + >::insert(who.clone(), new_member_id); + >::insert(new_member_id, who.clone()); + >::insert(new_member_id, profile); + >::insert(user_info.handle.clone(), new_member_id); + >::mutate(|n| { *n += T::MemberId::sa(1); }); + + Ok(new_member_id) + } +} \ No newline at end of file From 918868e1735e2dd6bbd0613032b920f1c1011d55 Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Thu, 14 Mar 2019 13:15:48 +0200 Subject: [PATCH 006/175] make avatar_uri an Option instead of empty string to represent no uri --- src/membership.rs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/membership.rs b/src/membership.rs index 4e91b6255a..4b757b8cc6 100644 --- a/src/membership.rs +++ b/src/membership.rs @@ -44,7 +44,7 @@ const DEFAULT_MAX_ABOUT_TEXT_LENGTH: u32 = 1024; pub struct Profile { id: T::MemberId, handle: Vec, - avatar_uri: Vec, + avatar_uri: Option>, about: Vec, registered_at_block: T::BlockNumber, registered_at_time: T::Moment, @@ -63,7 +63,7 @@ pub struct UserInfo { struct CheckedUserInfo { handle: Vec, - avatar_uri: Vec, + avatar_uri: Option>, about: Vec, } @@ -236,8 +236,11 @@ impl Module { let mut about = user_info.about.unwrap_or_default(); about.truncate(Self::max_about_text_length() as usize); - let mut avatar_uri = user_info.avatar_uri.unwrap_or_default(); - avatar_uri.truncate(Self::max_avatar_uri_length() as usize); + let avatar_uri = user_info.avatar_uri.and_then(|uri: Vec| { + let mut uri = uri.clone(); + uri.truncate(Self::max_avatar_uri_length() as usize); + Some(uri) + }); Ok(CheckedUserInfo { handle, From cb1a3a7d69660fd414900709b2bc80166fb55bf4 Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Thu, 14 Mar 2019 13:16:40 +0200 Subject: [PATCH 007/175] add simple buy membership method --- src/membership.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/membership.rs b/src/membership.rs index 4b757b8cc6..21644ba152 100644 --- a/src/membership.rs +++ b/src/membership.rs @@ -206,6 +206,15 @@ decl_module! { Self::deposit_event(RawEvent::MemberRegistered(member_id, who.clone())); } + + /// Buy the default membership (if it is active) and only provide handle - for testing + fn buy_default_membership_testing(origin, handle: Vec) { + Self::buy_membership(origin, T::PaidTermId::sa(0), UserInfo { + handle: Some(handle.clone()), + avatar_uri: None, + about: None + })?; + } } } From 6e202d9850ce3471fad54f2dc732fc36de1b8169 Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Thu, 14 Mar 2019 13:33:43 +0200 Subject: [PATCH 008/175] burn fee when buying membership --- src/membership.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/membership.rs b/src/membership.rs index 21644ba152..03e38d6fe9 100644 --- a/src/membership.rs +++ b/src/membership.rs @@ -195,11 +195,6 @@ decl_module! { // ensure paid_terms_id is active Self::ensure_terms_id_is_active(paid_terms_id)?; - let terms = Self::paid_membership_terms_by_id(paid_terms_id).ok_or("paid membership term id does not exist")?; - - // ensure enough free balance to cover terms fees - ensure!(T::Currency::free_balance(&who) >= terms.fee, "not enough balance to buy membership"); - let user_info = Self::check_user_info(user_info)?; let member_id = Self::insert_new_paid_member(&who, paid_terms_id, &user_info)?; @@ -260,7 +255,12 @@ impl Module { // Mutating methods - fn insert_new_paid_member(who: &T::AccountId, paid_terms_id: T::PaidTermId, user_info: &CheckedUserInfo) -> Result { + fn insert_new_paid_member(who: &T::AccountId, paid_terms_id: T::PaidTermId, user_info: &CheckedUserInfo) -> Result { + let terms = Self::paid_membership_terms_by_id(paid_terms_id).ok_or("paid membership term id does not exist")?; + // ensure enough free balance to cover terms fees + ensure!(T::Currency::can_slash(&who, terms.fee), "not enough balance to buy membership"); + let _ = T::Currency::slash(&who, terms.fee); + // ensure handle is not already registered Self::ensure_unique_handle(&user_info.handle)?; From 54738e74815055501d573325ee17d04f788cd0ba Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Thu, 14 Mar 2019 13:58:20 +0200 Subject: [PATCH 009/175] keep extrinsic validation outside insert_new_paid_member --- src/membership.rs | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/membership.rs b/src/membership.rs index 03e38d6fe9..0e8e57bc36 100644 --- a/src/membership.rs +++ b/src/membership.rs @@ -195,9 +195,17 @@ decl_module! { // ensure paid_terms_id is active Self::ensure_terms_id_is_active(paid_terms_id)?; + // ensure enough free balance to cover terms fees + let terms = Self::paid_membership_terms_by_id(paid_terms_id).ok_or("paid membership term id does not exist")?; + ensure!(T::Currency::can_slash(&who, terms.fee), "not enough balance to buy membership"); + let user_info = Self::check_user_info(user_info)?; - let member_id = Self::insert_new_paid_member(&who, paid_terms_id, &user_info)?; + // ensure handle is not already registered + Self::ensure_unique_handle(&user_info.handle)?; + + let _ = T::Currency::slash(&who, terms.fee); + let member_id = Self::insert_new_paid_member(&who, paid_terms_id, &user_info); Self::deposit_event(RawEvent::MemberRegistered(member_id, who.clone())); } @@ -255,15 +263,7 @@ impl Module { // Mutating methods - fn insert_new_paid_member(who: &T::AccountId, paid_terms_id: T::PaidTermId, user_info: &CheckedUserInfo) -> Result { - let terms = Self::paid_membership_terms_by_id(paid_terms_id).ok_or("paid membership term id does not exist")?; - // ensure enough free balance to cover terms fees - ensure!(T::Currency::can_slash(&who, terms.fee), "not enough balance to buy membership"); - let _ = T::Currency::slash(&who, terms.fee); - - // ensure handle is not already registered - Self::ensure_unique_handle(&user_info.handle)?; - + fn insert_new_paid_member(who: &T::AccountId, paid_terms_id: T::PaidTermId, user_info: &CheckedUserInfo) -> T::MemberId { let new_member_id = Self::next_member_id(); let profile: Profile = Profile { @@ -284,6 +284,6 @@ impl Module { >::insert(user_info.handle.clone(), new_member_id); >::mutate(|n| { *n += T::MemberId::sa(1); }); - Ok(new_member_id) + new_member_id } } \ No newline at end of file From e99cb532a1ad1e4d50eb48d1439f002150bfd1af Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Thu, 14 Mar 2019 17:22:02 +0200 Subject: [PATCH 010/175] update methods for profile --- src/membership.rs | 104 +++++++++++++++++++++++++++++++++++++--------- 1 file changed, 84 insertions(+), 20 deletions(-) diff --git a/src/membership.rs b/src/membership.rs index 0e8e57bc36..0f06a1c53c 100644 --- a/src/membership.rs +++ b/src/membership.rs @@ -44,7 +44,7 @@ const DEFAULT_MAX_ABOUT_TEXT_LENGTH: u32 = 1024; pub struct Profile { id: T::MemberId, handle: Vec, - avatar_uri: Option>, + avatar_uri: Vec, about: Vec, registered_at_block: T::BlockNumber, registered_at_time: T::Moment, @@ -63,7 +63,7 @@ pub struct UserInfo { struct CheckedUserInfo { handle: Vec, - avatar_uri: Option>, + avatar_uri: Vec, about: Vec, } @@ -107,11 +107,11 @@ decl_storage! { AccountIdByMemberId get(account_id_by_member_id) : map T::MemberId => T::AccountId; /// Mapping of members' accountid to their member id - MemberIdByAccountId get(member_id_by_account_id) : map T::AccountId => T::MemberId; + MemberIdByAccountId get(member_id_by_account_id) : map T::AccountId => Option; /// Mapping of member's id to their membership profile // Value is Option because it is not meaningful to have a Default value for Profile - MemberProfile get(member_profile_preview) : map T::MemberId => Option>; + MemberProfile get(member_profile) : map T::MemberId => Option>; /// Registered unique handles and their mapping to their owner Handles get(handles) : map Vec => Option; @@ -160,6 +160,8 @@ decl_event! { ::AccountId, ::MemberId { MemberRegistered(MemberId, AccountId), + MemberUpdatedAboutText(MemberId), + MemberUpdatedAvatar(MemberId), } } @@ -193,13 +195,12 @@ decl_module! { Self::ensure_not_member(&who)?; // ensure paid_terms_id is active - Self::ensure_terms_id_is_active(paid_terms_id)?; + let terms = Self::ensure_active_terms_id(paid_terms_id)?; // ensure enough free balance to cover terms fees - let terms = Self::paid_membership_terms_by_id(paid_terms_id).ok_or("paid membership term id does not exist")?; ensure!(T::Currency::can_slash(&who, terms.fee), "not enough balance to buy membership"); - let user_info = Self::check_user_info(user_info)?; + let user_info = Self::check_user_registration_info(user_info)?; // ensure handle is not already registered Self::ensure_unique_handle(&user_info.handle)?; @@ -210,6 +211,46 @@ decl_module! { Self::deposit_event(RawEvent::MemberRegistered(member_id, who.clone())); } + fn change_member_about_text(origin, text: Vec) { + let who = ensure_signed(origin)?; + + let mut profile = Self::ensure_has_profile(&who)?; + + let text = Self::validate_text(&text); + + profile.about = text; + + Self::deposit_event(RawEvent::MemberUpdatedAboutText(profile.id)); + >::insert(profile.id, profile); + } + + fn change_member_avatar(origin, uri: Vec) { + let who = ensure_signed(origin)?; + + let mut profile = Self::ensure_has_profile(&who)?; + + let uri = Self::validate_avatar(&uri); + + profile.avatar_uri = uri; + + Self::deposit_event(RawEvent::MemberUpdatedAvatar(profile.id)); + >::insert(profile.id, profile); + } + + /// Change member's handle. + fn change_member_handle(origin, handle: Vec) { + let who = ensure_signed(origin)?; + let mut profile = Self::ensure_has_profile(&who)?; + + Self::validate_handle(&handle)?; + Self::ensure_unique_handle(&handle)?; + + >::remove(&profile.handle); + >::insert(handle.clone(), profile.id); + profile.handle = handle; + >::insert(profile.id, profile); + } + /// Buy the default membership (if it is active) and only provide handle - for testing fn buy_default_membership_testing(origin, handle: Vec) { Self::buy_membership(origin, T::PaidTermId::sa(0), UserInfo { @@ -227,10 +268,22 @@ impl Module { Ok(()) } - fn ensure_terms_id_is_active(terms_id: T::PaidTermId) -> dispatch::Result { + fn ensure_is_member(who: &T::AccountId) -> Result { + let member_id = Self::member_id_by_account_id(who).ok_or("no member id found for accountid")?; + Ok(member_id) + } + + fn ensure_has_profile(who: &T::AccountId) -> Result, &'static str> { + let member_id = Self::ensure_is_member(who)?; + let profile = Self::member_profile(&member_id).ok_or("member profile not found")?; + Ok(profile) + } + + fn ensure_active_terms_id(terms_id: T::PaidTermId) -> Result, &'static str> { let active_terms = Self::active_paid_membership_terms(); ensure!(active_terms.iter().any(|&id| id == terms_id), "paid terms id not active"); - Ok(()) + let terms = Self::paid_membership_terms_by_id(terms_id).ok_or("paid membership term id does not exist")?; + Ok(terms) } fn ensure_unique_handle(handle: &Vec ) -> dispatch::Result { @@ -238,21 +291,32 @@ impl Module { Ok(()) } - /// Basic user input validation - fn check_user_info(user_info: UserInfo) -> Result { - // Handle is required during registration - let handle = user_info.handle.ok_or("handle must be provided during registration")?; + fn validate_handle(handle: &Vec) -> dispatch::Result { ensure!(handle.len() >= Self::min_handle_length() as usize, "handle too short"); ensure!(handle.len() <= Self::max_handle_length() as usize, "handle too long"); + Ok(()) + } - let mut about = user_info.about.unwrap_or_default(); - about.truncate(Self::max_about_text_length() as usize); + fn validate_text(text: &Vec) -> Vec { + let mut text = text.clone(); + text.truncate(Self::max_about_text_length() as usize); + text + } + + fn validate_avatar(uri: &Vec) -> Vec { + let mut uri = uri.clone(); + uri.truncate(Self::max_avatar_uri_length() as usize); + uri + } + + /// Basic user input validation + fn check_user_registration_info(user_info: UserInfo) -> Result { + // Handle is required during registration + let handle = user_info.handle.ok_or("handle must be provided during registration")?; + Self::validate_handle(&handle)?; - let avatar_uri = user_info.avatar_uri.and_then(|uri: Vec| { - let mut uri = uri.clone(); - uri.truncate(Self::max_avatar_uri_length() as usize); - Some(uri) - }); + let about = Self::validate_text(&user_info.about.unwrap_or_default()); + let avatar_uri = Self::validate_avatar(&user_info.avatar_uri.unwrap_or_default()); Ok(CheckedUserInfo { handle, From 6f46ad1cbf55af3a9f5a22e2d8f49cab358de1e4 Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Thu, 14 Mar 2019 21:03:31 +0200 Subject: [PATCH 011/175] add method to change multiple profile user infos in one transaction --- src/membership.rs | 64 ++++++++++++++++++++++++++++------------------- 1 file changed, 38 insertions(+), 26 deletions(-) diff --git a/src/membership.rs b/src/membership.rs index 0f06a1c53c..c4343749e9 100644 --- a/src/membership.rs +++ b/src/membership.rs @@ -213,42 +213,25 @@ decl_module! { fn change_member_about_text(origin, text: Vec) { let who = ensure_signed(origin)?; - - let mut profile = Self::ensure_has_profile(&who)?; - - let text = Self::validate_text(&text); - - profile.about = text; - - Self::deposit_event(RawEvent::MemberUpdatedAboutText(profile.id)); - >::insert(profile.id, profile); + Self::_change_member_about_text(&who, &text)?; } fn change_member_avatar(origin, uri: Vec) { let who = ensure_signed(origin)?; - - let mut profile = Self::ensure_has_profile(&who)?; - - let uri = Self::validate_avatar(&uri); - - profile.avatar_uri = uri; - - Self::deposit_event(RawEvent::MemberUpdatedAvatar(profile.id)); - >::insert(profile.id, profile); + Self::_change_member_avatar(&who, &uri)?; } /// Change member's handle. fn change_member_handle(origin, handle: Vec) { let who = ensure_signed(origin)?; - let mut profile = Self::ensure_has_profile(&who)?; - - Self::validate_handle(&handle)?; - Self::ensure_unique_handle(&handle)?; + Self::_change_member_handle(&who, handle)?; + } - >::remove(&profile.handle); - >::insert(handle.clone(), profile.id); - profile.handle = handle; - >::insert(profile.id, profile); + fn batch_change_member_profile(origin, user_info: UserInfo) { + let who = ensure_signed(origin)?; + user_info.avatar_uri.map(|uri| Self::_change_member_avatar(&who, &uri)).ok_or("uri not changed"); + user_info.about.map(|about| Self::_change_member_about_text(&who, &about)).ok_or("about text not changed"); + user_info.handle.map(|handle| Self::_change_member_handle(&who, handle)).ok_or("handle not changed"); } /// Buy the default membership (if it is active) and only provide handle - for testing @@ -350,4 +333,33 @@ impl Module { new_member_id } + + fn _change_member_about_text (who: &T::AccountId, text: &Vec) -> dispatch::Result { + let mut profile = Self::ensure_has_profile(&who)?; + let text = Self::validate_text(text); + profile.about = text; + Self::deposit_event(RawEvent::MemberUpdatedAboutText(profile.id)); + >::insert(profile.id, profile); + Ok(()) + } + + fn _change_member_avatar(who: &T::AccountId, uri: &Vec) -> dispatch::Result { + let mut profile = Self::ensure_has_profile(who)?; + let uri = Self::validate_avatar(uri); + profile.avatar_uri = uri; + Self::deposit_event(RawEvent::MemberUpdatedAvatar(profile.id)); + >::insert(profile.id, profile); + Ok(()) + } + + fn _change_member_handle(who: &T::AccountId, handle: Vec) -> dispatch::Result { + let mut profile = Self::ensure_has_profile(who)?; + Self::validate_handle(&handle)?; + Self::ensure_unique_handle(&handle)?; + >::remove(&profile.handle); + >::insert(handle.clone(), profile.id); + profile.handle = handle; + >::insert(profile.id, profile); + Ok(()) + } } \ No newline at end of file From ac0c928c7e670dfccb1889d4a43be4de230c85cc Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Thu, 14 Mar 2019 21:13:13 +0200 Subject: [PATCH 012/175] check allowed new members before accepting new members --- src/membership.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/membership.rs b/src/membership.rs index c4343749e9..13791f5af7 100644 --- a/src/membership.rs +++ b/src/membership.rs @@ -191,6 +191,9 @@ decl_module! { fn buy_membership(origin, paid_terms_id: T::PaidTermId, user_info: UserInfo) { let who = ensure_signed(origin)?; + // make sure we are accepting new memberships + ensure!(Self::new_memberships_allowed(), "new members not allowed"); + // ensure key not associated with an existing membership Self::ensure_not_member(&who)?; From f095b673d829b1d78e330074a7d687bc686e0660 Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Thu, 14 Mar 2019 23:52:06 +0200 Subject: [PATCH 013/175] handle runtime uptime by using spec_version --- src/membership.rs | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/src/membership.rs b/src/membership.rs index 13791f5af7..dac8740dc3 100644 --- a/src/membership.rs +++ b/src/membership.rs @@ -8,8 +8,9 @@ use srml_support::traits::{Currency}; use runtime_primitives::traits::{Zero, SimpleArithmetic, As, Member, MaybeSerializeDebug}; use system::{self, ensure_signed}; use crate::governance::{GovernanceCurrency, BalanceOf }; -//use runtime_io::print; +use runtime_io::print; use {timestamp}; +use crate::{VERSION}; pub trait Trait: system::Trait + GovernanceCurrency + timestamp::Trait { type Event: From> + Into<::Event>; @@ -97,6 +98,10 @@ impl Default for PaidMembershipTerms { decl_storage! { trait Store for Module as Membership { + /// Records at what runtime spec version the store was initialized. This allows the runtime + /// to know when to run initialize code if it was installed as an update. + StoreSpecVersion get(store_spec_version) build(|_| Some(VERSION.spec_version)) : Option; + /// MemberId's start at this value FirstMemberId get(first_member_id) config(first_member_id): T::MemberId = T::MemberId::sa(DEFAULT_FIRST_MEMBER_ID); @@ -138,11 +143,6 @@ decl_storage! { /// Is the platform is accepting new members or not NewMembershipsAllowed get(new_memberships_allowed) : bool = true; - /// If we should run a migration and initialize new storage values introduced in new runtime - // This will initialize to false if starting at genesis (because the build() method will run), - // for a runtime upgrade it will return the default value when reading the first time. - ShouldRunMigration get(should_run_migration) build(|_| false) : bool = true; - // User Input Validation parameters - do these really need to be state variables // I don't see a need to adjust these in future? MinHandleLength get(min_handle_length) : u32 = DEFAULT_MIN_HANDLE_LENGTH; @@ -166,11 +166,14 @@ decl_event! { } impl Module { - fn run_migration() { - if Self::should_run_migration() { + /// Initialization step that runs when the runtime is installed as a runtime upgrade + /// Remember to remove this code in next release, or guard the code with the spec version + // Given it is easy to forget to do this, we need a better arrangement. + fn runtime_initialization(spec_version: u32) { + if 5 == spec_version { + print("Running New Runtime Init Code"); let default_terms: PaidMembershipTerms = Default::default(); >::insert(T::PaidTermId::sa(0), default_terms); - >::put(false); } } } @@ -180,7 +183,11 @@ decl_module! { fn deposit_event() = default; fn on_initialise(_now: T::BlockNumber) { - Self::run_migration(); + if Self::store_spec_version().map_or(true, |spec_version| VERSION.spec_version > spec_version) { + // Mark store version with latest so we don't run initialization code again + >::put(VERSION.spec_version); + Self::runtime_initialization(VERSION.spec_version); + } } fn on_finalise(_now: T::BlockNumber) { From 1d63f676b99618eb80c6da8da3ed44e5d300d66c Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Fri, 15 Mar 2019 00:03:53 +0200 Subject: [PATCH 014/175] fix batch profile update --- src/membership.rs | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/membership.rs b/src/membership.rs index dac8740dc3..29d5774c4d 100644 --- a/src/membership.rs +++ b/src/membership.rs @@ -239,14 +239,20 @@ decl_module! { fn batch_change_member_profile(origin, user_info: UserInfo) { let who = ensure_signed(origin)?; - user_info.avatar_uri.map(|uri| Self::_change_member_avatar(&who, &uri)).ok_or("uri not changed"); - user_info.about.map(|about| Self::_change_member_about_text(&who, &about)).ok_or("about text not changed"); - user_info.handle.map(|handle| Self::_change_member_handle(&who, handle)).ok_or("handle not changed"); + if let Some(uri) = user_info.avatar_uri { + Self::_change_member_avatar(&who, &uri)?; + } + if let Some(about) = user_info.about { + Self::_change_member_about_text(&who, &about)?; + } + if let Some(handle) = user_info.handle { + Self::_change_member_handle(&who, handle)?; + } } - /// Buy the default membership (if it is active) and only provide handle - for testing + /// Buy the default membership (if it is active) and only provide handle fn buy_default_membership_testing(origin, handle: Vec) { - Self::buy_membership(origin, T::PaidTermId::sa(0), UserInfo { + Self::buy_membership(origin, T::PaidTermId::sa(DEFAULT_PAID_TERM_ID), UserInfo { handle: Some(handle.clone()), avatar_uri: None, about: None From 7ae24d007d8856a5aa841dc42944a4efc3c8642f Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Sat, 16 Mar 2019 08:03:14 +0200 Subject: [PATCH 015/175] rename update profile method, and don't truncate avatar uri --- src/membership.rs | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/membership.rs b/src/membership.rs index 29d5774c4d..6ee6a69586 100644 --- a/src/membership.rs +++ b/src/membership.rs @@ -162,6 +162,7 @@ decl_event! { MemberRegistered(MemberId, AccountId), MemberUpdatedAboutText(MemberId), MemberUpdatedAvatar(MemberId), + MemberUpdatedHandle(MemberId), } } @@ -237,7 +238,7 @@ decl_module! { Self::_change_member_handle(&who, handle)?; } - fn batch_change_member_profile(origin, user_info: UserInfo) { + fn update_profile(origin, user_info: UserInfo) { let who = ensure_signed(origin)?; if let Some(uri) = user_info.avatar_uri { Self::_change_member_avatar(&who, &uri)?; @@ -302,10 +303,9 @@ impl Module { text } - fn validate_avatar(uri: &Vec) -> Vec { - let mut uri = uri.clone(); - uri.truncate(Self::max_avatar_uri_length() as usize); - uri + fn validate_avatar(uri: &Vec) -> dispatch::Result { + ensure!(uri.len() <= Self::max_avatar_uri_length() as usize, "avatar uri too long"); + Ok(()) } /// Basic user input validation @@ -315,7 +315,8 @@ impl Module { Self::validate_handle(&handle)?; let about = Self::validate_text(&user_info.about.unwrap_or_default()); - let avatar_uri = Self::validate_avatar(&user_info.avatar_uri.unwrap_or_default()); + let avatar_uri = user_info.avatar_uri.unwrap_or_default(); + Self::validate_avatar(&avatar_uri)?; Ok(CheckedUserInfo { handle, @@ -361,8 +362,8 @@ impl Module { fn _change_member_avatar(who: &T::AccountId, uri: &Vec) -> dispatch::Result { let mut profile = Self::ensure_has_profile(who)?; - let uri = Self::validate_avatar(uri); - profile.avatar_uri = uri; + Self::validate_avatar(uri)?; + profile.avatar_uri = uri.clone(); Self::deposit_event(RawEvent::MemberUpdatedAvatar(profile.id)); >::insert(profile.id, profile); Ok(()) @@ -375,6 +376,7 @@ impl Module { >::remove(&profile.handle); >::insert(handle.clone(), profile.id); profile.handle = handle; + Self::deposit_event(RawEvent::MemberUpdatedHandle(profile.id)); >::insert(profile.id, profile); Ok(()) } From 2d3329add5d7e460ab85d9c98b421e962c494daf Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Sat, 16 Mar 2019 09:55:40 +0200 Subject: [PATCH 016/175] member sub accounts --- src/membership.rs | 120 ++++++++++++++++++++++++++++++++++++---------- 1 file changed, 94 insertions(+), 26 deletions(-) diff --git a/src/membership.rs b/src/membership.rs index 6ee6a69586..657e1fee01 100644 --- a/src/membership.rs +++ b/src/membership.rs @@ -51,7 +51,8 @@ pub struct Profile { registered_at_time: T::Moment, entry: EntryMethod, suspended: bool, - subscription: Option + subscription: Option, + sub_accounts: Vec } #[derive(Clone, Debug, Encode, Decode, PartialEq)] @@ -108,10 +109,11 @@ decl_storage! { /// MemberId to assign to next member that is added to the registry NextMemberId get(next_member_id) build(|config: &GenesisConfig| config.first_member_id): T::MemberId = T::MemberId::sa(DEFAULT_FIRST_MEMBER_ID); - /// Mapping of member ids to their corresponding accountid + /// Mapping of member ids to their corresponding primary accountid AccountIdByMemberId get(account_id_by_member_id) : map T::MemberId => T::AccountId; - /// Mapping of members' accountid to their member id + /// Mapping of members' accountid ids to their member id. + /// A member can have one primary account and multiple sub accounts associated with their profile MemberIdByAccountId get(member_id_by_account_id) : map T::AccountId => Option; /// Mapping of member's id to their membership profile @@ -163,6 +165,9 @@ decl_event! { MemberUpdatedAboutText(MemberId), MemberUpdatedAvatar(MemberId), MemberUpdatedHandle(MemberId), + MemberChangedPrimaryAccount(MemberId, AccountId), + MemberAddedSubAccount(MemberId, AccountId), + MemberRemovedSubAccount(MemberId, AccountId), } } @@ -224,30 +229,35 @@ decl_module! { fn change_member_about_text(origin, text: Vec) { let who = ensure_signed(origin)?; - Self::_change_member_about_text(&who, &text)?; + let member_id = Self::ensure_is_member_primary_account(who.clone())?; + Self::_change_member_about_text(member_id, &text)?; } fn change_member_avatar(origin, uri: Vec) { let who = ensure_signed(origin)?; - Self::_change_member_avatar(&who, &uri)?; + let member_id = Self::ensure_is_member_primary_account(who.clone())?; + Self::_change_member_avatar(member_id, &uri)?; } /// Change member's handle. fn change_member_handle(origin, handle: Vec) { let who = ensure_signed(origin)?; - Self::_change_member_handle(&who, handle)?; + let member_id = Self::ensure_is_member_primary_account(who.clone())?; + Self::_change_member_handle(member_id, handle)?; } fn update_profile(origin, user_info: UserInfo) { let who = ensure_signed(origin)?; + let member_id = Self::ensure_is_member_primary_account(who.clone())?; + if let Some(uri) = user_info.avatar_uri { - Self::_change_member_avatar(&who, &uri)?; + Self::_change_member_avatar(member_id, &uri)?; } if let Some(about) = user_info.about { - Self::_change_member_about_text(&who, &about)?; + Self::_change_member_about_text(member_id, &about)?; } if let Some(handle) = user_info.handle { - Self::_change_member_handle(&who, handle)?; + Self::_change_member_handle(member_id, handle)?; } } @@ -259,12 +269,64 @@ decl_module! { about: None })?; } + + fn change_member_primary_account(origin, new_primary_account: T::AccountId) { + let who = ensure_signed(origin)?; + + // only primary account can assign new primary account + let member_id = Self::ensure_is_member_primary_account(who.clone())?; + + // ensure new_primary_account isn't already associated with any existing member + Self::ensure_not_member(&new_primary_account)?; + + // update associated accounts + >::remove(&who); + >::insert(&new_primary_account, member_id); + + // update primary account + >::insert(member_id, new_primary_account.clone()); + Self::deposit_event(RawEvent::MemberChangedPrimaryAccount(member_id, new_primary_account)); + } + + fn add_member_sub_account(origin, sub_account: T::AccountId) { + let who = ensure_signed(origin)?; + // only primary account can manage sub accounts + let member_id = Self::ensure_is_member_primary_account(who.clone())?; + // ensure sub_account isn't already associated with any existing member + Self::ensure_not_member(&sub_account)?; + + let mut profile = Self::ensure_profile(member_id)?; + profile.sub_accounts.push(sub_account.clone()); + >::insert(member_id, profile); + Self::deposit_event(RawEvent::MemberAddedSubAccount(member_id, sub_account)); + } + + fn remove_member_sub_account(origin, sub_account: T::AccountId) { + let who = ensure_signed(origin)?; + // only primary account can manage sub accounts + let member_id = Self::ensure_is_member_primary_account(who.clone())?; + + // ensure account is a sub account + // primary account cannot be added as a subaccount in add_member_sub_account() + ensure!(who != sub_account, "not sub account"); + + // ensure sub_account is associated with member + let sub_account_member_id = Self::ensure_is_member(&sub_account)?; + ensure!(member_id == sub_account_member_id, "not member sub account"); + + let mut profile = Self::ensure_profile(member_id)?; + + profile.sub_accounts = profile.sub_accounts.into_iter().filter(|account| !(*account == sub_account)).collect(); + + >::insert(member_id, profile); + Self::deposit_event(RawEvent::MemberRemovedSubAccount(member_id, sub_account)); + } } } impl Module { fn ensure_not_member(who: &T::AccountId) -> dispatch::Result { - ensure!(!>::exists(who), "Account already associated with a membership"); + ensure!(!>::exists(who), "account already associated with a membership"); Ok(()) } @@ -273,9 +335,14 @@ impl Module { Ok(member_id) } - fn ensure_has_profile(who: &T::AccountId) -> Result, &'static str> { - let member_id = Self::ensure_is_member(who)?; - let profile = Self::member_profile(&member_id).ok_or("member profile not found")?; + fn ensure_is_member_primary_account(who: T::AccountId) -> Result { + let member_id = Self::ensure_is_member(&who)?; + ensure!(Self::account_id_by_member_id(member_id) == who, "not primary account"); + Ok(member_id) + } + + fn ensure_profile(id: T::MemberId) -> Result, &'static str> { + let profile = Self::member_profile(&id).ok_or("member profile not found")?; Ok(profile) } @@ -340,6 +407,7 @@ impl Module { entry: EntryMethod::Paid(paid_terms_id), suspended: false, subscription: None, + sub_accounts: vec![], }; >::insert(who.clone(), new_member_id); @@ -351,33 +419,33 @@ impl Module { new_member_id } - fn _change_member_about_text (who: &T::AccountId, text: &Vec) -> dispatch::Result { - let mut profile = Self::ensure_has_profile(&who)?; + fn _change_member_about_text (id: T::MemberId, text: &Vec) -> dispatch::Result { + let mut profile = Self::ensure_profile(id)?; let text = Self::validate_text(text); profile.about = text; - Self::deposit_event(RawEvent::MemberUpdatedAboutText(profile.id)); - >::insert(profile.id, profile); + Self::deposit_event(RawEvent::MemberUpdatedAboutText(id)); + >::insert(id, profile); Ok(()) } - fn _change_member_avatar(who: &T::AccountId, uri: &Vec) -> dispatch::Result { - let mut profile = Self::ensure_has_profile(who)?; + fn _change_member_avatar(id: T::MemberId, uri: &Vec) -> dispatch::Result { + let mut profile = Self::ensure_profile(id)?; Self::validate_avatar(uri)?; profile.avatar_uri = uri.clone(); - Self::deposit_event(RawEvent::MemberUpdatedAvatar(profile.id)); - >::insert(profile.id, profile); + Self::deposit_event(RawEvent::MemberUpdatedAvatar(id)); + >::insert(id, profile); Ok(()) } - fn _change_member_handle(who: &T::AccountId, handle: Vec) -> dispatch::Result { - let mut profile = Self::ensure_has_profile(who)?; + fn _change_member_handle(id: T::MemberId, handle: Vec) -> dispatch::Result { + let mut profile = Self::ensure_profile(id)?; Self::validate_handle(&handle)?; Self::ensure_unique_handle(&handle)?; >::remove(&profile.handle); - >::insert(handle.clone(), profile.id); + >::insert(handle.clone(), id); profile.handle = handle; - Self::deposit_event(RawEvent::MemberUpdatedHandle(profile.id)); - >::insert(profile.id, profile); + Self::deposit_event(RawEvent::MemberUpdatedHandle(id)); + >::insert(id, profile); Ok(()) } } \ No newline at end of file From da0a0721862db595a11ab57c229bf5bdb4cd4610 Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Sat, 16 Mar 2019 10:56:02 +0200 Subject: [PATCH 017/175] add some notes on sub-accounts --- src/membership.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/membership.rs b/src/membership.rs index 657e1fee01..4891bc3efc 100644 --- a/src/membership.rs +++ b/src/membership.rs @@ -270,6 +270,14 @@ decl_module! { })?; } + // Notes: + // Ability to change primary account and add/remove sub accounts should be restricted + // to accounts that are not actively being used in other roles in the platform? + // Other roles in the platform should be associated directly with member_id instead of an account_id, + // but can still use a seprate account/key to sign extrinsics, have a seprate balance from primary account, + // and a way to limit damage from a compromised sub account. + // Maybe should also not be allowed if member is suspended? + // Main usecase for changing primary account is for identity recoverability fn change_member_primary_account(origin, new_primary_account: T::AccountId) { let who = ensure_signed(origin)?; From 31fd1de32b2af40f673a3f6c6afb25030f5eed62 Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Sat, 16 Mar 2019 11:10:15 +0200 Subject: [PATCH 018/175] default min length of handle 5 chars --- src/membership.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/membership.rs b/src/membership.rs index 4891bc3efc..f08acebc04 100644 --- a/src/membership.rs +++ b/src/membership.rs @@ -34,7 +34,7 @@ const DEFAULT_PAID_TERM_FEE: u64 = 100; // Can be overidden in genesis config const DEFAULT_PAID_TERM_TEXT: &str = "Default Paid Term TOS..."; // Default user info constraints -const DEFAULT_MIN_HANDLE_LENGTH: u32 = 4; +const DEFAULT_MIN_HANDLE_LENGTH: u32 = 5; const DEFAULT_MAX_HANDLE_LENGTH: u32 = 20; const DEFAULT_MAX_AVATAR_URI_LENGTH: u32 = 512; const DEFAULT_MAX_ABOUT_TEXT_LENGTH: u32 = 1024; From 95e4cd38f9ac30753264d3ce5ae6416256c82fdc Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Sat, 16 Mar 2019 11:43:15 +0200 Subject: [PATCH 019/175] adjust avatar, handle and about text default max lengths --- src/membership.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/membership.rs b/src/membership.rs index f08acebc04..c0a6a559f9 100644 --- a/src/membership.rs +++ b/src/membership.rs @@ -35,9 +35,9 @@ const DEFAULT_PAID_TERM_TEXT: &str = "Default Paid Term TOS..."; // Default user info constraints const DEFAULT_MIN_HANDLE_LENGTH: u32 = 5; -const DEFAULT_MAX_HANDLE_LENGTH: u32 = 20; -const DEFAULT_MAX_AVATAR_URI_LENGTH: u32 = 512; -const DEFAULT_MAX_ABOUT_TEXT_LENGTH: u32 = 1024; +const DEFAULT_MAX_HANDLE_LENGTH: u32 = 40; +const DEFAULT_MAX_AVATAR_URI_LENGTH: u32 = 1024; +const DEFAULT_MAX_ABOUT_TEXT_LENGTH: u32 = 2048; //#[cfg_attr(feature = "std", derive(Serialize, Deserialize, Debug))] #[derive(Encode, Decode)] From 478fbe0ed6f0abe6373041b714fa1df5b84b6454 Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Tue, 19 Mar 2019 12:22:10 +0200 Subject: [PATCH 020/175] reorg membership into a module directory --- src/lib.rs | 5 +++-- src/membership/mod.rs | 3 +++ src/{membership.rs => membership/registry.rs} | 0 3 files changed, 6 insertions(+), 2 deletions(-) create mode 100644 src/membership/mod.rs rename src/{membership.rs => membership/registry.rs} (100%) diff --git a/src/lib.rs b/src/lib.rs index b8b0ac8764..b4cf410acc 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -18,6 +18,7 @@ pub mod governance; use governance::{election, council, proposals}; mod memo; mod membership; +use membership::registry; use rstd::prelude::*; #[cfg(feature = "std")] @@ -225,7 +226,7 @@ impl memo::Trait for Runtime { type Event = Event; } -impl membership::Trait for Runtime { +impl membership::registry::Trait for Runtime { type Event = Event; type MemberId = u64; type PaidTermId = u64; @@ -252,7 +253,7 @@ construct_runtime!( CouncilElection: election::{Module, Call, Storage, Event, Config}, Council: council::{Module, Call, Storage, Event, Config}, Memo: memo::{Module, Call, Storage, Event}, - Membership: membership::{Module, Call, Storage, Event, Config}, + Membership: registry::{Module, Call, Storage, Event, Config}, } ); diff --git a/src/membership/mod.rs b/src/membership/mod.rs new file mode 100644 index 0000000000..50578b0286 --- /dev/null +++ b/src/membership/mod.rs @@ -0,0 +1,3 @@ +#![cfg_attr(not(feature = "std"), no_std)] + +pub mod registry; \ No newline at end of file diff --git a/src/membership.rs b/src/membership/registry.rs similarity index 100% rename from src/membership.rs rename to src/membership/registry.rs From a227fa3a3c5ca77255da013c5502c8fde680035d Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Tue, 19 Mar 2019 14:37:33 +0200 Subject: [PATCH 021/175] add tests for membership --- src/membership/mock.rs | 82 +++++++++++++++++++++++++++++++++++++++++ src/membership/mod.rs | 5 ++- src/membership/tests.rs | 15 ++++++++ 3 files changed, 101 insertions(+), 1 deletion(-) create mode 100644 src/membership/mock.rs create mode 100644 src/membership/tests.rs diff --git a/src/membership/mock.rs b/src/membership/mock.rs new file mode 100644 index 0000000000..ec509d607f --- /dev/null +++ b/src/membership/mock.rs @@ -0,0 +1,82 @@ +#![cfg(test)] + +use rstd::prelude::*; +pub use crate::governance::{GovernanceCurrency}; +pub use super::{registry}; +pub use system; + +pub use primitives::{H256, Blake2Hasher}; +pub use runtime_primitives::{ + BuildStorage, + traits::{BlakeTwo256, OnFinalise, IdentityLookup}, + testing::{Digest, DigestItem, Header, UintAuthorityId} +}; + +use srml_support::impl_outer_origin; + +impl_outer_origin! { + pub enum Origin for Test {} +} + +// For testing the module, we construct most of a mock runtime. This means +// first constructing a configuration type (`Test`) which `impl`s each of the +// configuration traits of modules we want to use. +#[derive(Clone, Eq, PartialEq)] +pub struct Test; +impl system::Trait for Test { + type Origin = Origin; + type Index = u64; + type BlockNumber = u64; + type Hash = H256; + type Hashing = BlakeTwo256; + type Digest = Digest; + type AccountId = u64; + type Header = Header; + type Event = (); + type Log = DigestItem; + type Lookup = IdentityLookup; +} +impl timestamp::Trait for Test { + type Moment = u64; + type OnTimestampSet = (); +} +impl consensus::Trait for Test { + type SessionKey = UintAuthorityId; + type InherentOfflineReport = (); + type Log = DigestItem; +} + +impl balances::Trait for Test { + type Event = (); + + /// The balance of an account. + type Balance = u32; + + /// A function which is invoked when the free-balance has fallen below the existential deposit and + /// has been reduced to zero. + /// + /// Gives a chance to clean up resources associated with the given account. + type OnFreeBalanceZero = (); + + /// Handler for when a new account is created. + type OnNewAccount = (); + + /// A function that returns true iff a given account can transfer its funds to another account. + type EnsureAccountLiquid = (); +} + +impl GovernanceCurrency for Test { + type Currency = balances::Module; +} + +// This function basically just builds a genesis storage key/value store according to +// our desired mockup. +pub fn initial_test_ext() -> runtime_io::TestExternalities { + let mut t = system::GenesisConfig::::default().build_storage().unwrap().0; + + runtime_io::TestExternalities::new(t) +} + +pub type System = system::Module; +pub type Balances = balances::Module; +pub type Membership = registry::Module; diff --git a/src/membership/mod.rs b/src/membership/mod.rs index 50578b0286..a07ceef62a 100644 --- a/src/membership/mod.rs +++ b/src/membership/mod.rs @@ -1,3 +1,6 @@ #![cfg_attr(not(feature = "std"), no_std)] -pub mod registry; \ No newline at end of file +pub mod registry; + +mod mock; +mod tests; \ No newline at end of file diff --git a/src/membership/tests.rs b/src/membership/tests.rs new file mode 100644 index 0000000000..498e3abd74 --- /dev/null +++ b/src/membership/tests.rs @@ -0,0 +1,15 @@ +#![cfg(test)] + +use super::*; +use super::mock::*; + +use parity_codec::Encode; +use runtime_io::with_externalities; +use srml_support::*; + +#[test] +fn test_setup() { + with_externalities(&mut initial_test_ext(), || { + assert!(false); + }); +} \ No newline at end of file From 27b784111c90eb1e342b3d12a8ecf2c96eba81b9 Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Wed, 20 Mar 2019 09:10:35 +0200 Subject: [PATCH 022/175] membership tests --- src/membership/mock.rs | 43 ++++++++++-- src/membership/registry.rs | 93 +++++++++++------------- src/membership/tests.rs | 140 ++++++++++++++++++++++++++++++++++++- 3 files changed, 217 insertions(+), 59 deletions(-) diff --git a/src/membership/mock.rs b/src/membership/mock.rs index ec509d607f..89fb228341 100644 --- a/src/membership/mock.rs +++ b/src/membership/mock.rs @@ -69,12 +69,45 @@ impl GovernanceCurrency for Test { type Currency = balances::Module; } -// This function basically just builds a genesis storage key/value store according to -// our desired mockup. -pub fn initial_test_ext() -> runtime_io::TestExternalities { - let mut t = system::GenesisConfig::::default().build_storage().unwrap().0; +impl registry::Trait for Test { + type Event = (); + type MemberId = u32; + type PaidTermId = u32; + type SubscriptionId = u32; +} + +pub struct ExtBuilder { + first_member_id: u32, + default_paid_membership_fee: u32, +} +impl Default for ExtBuilder { + fn default() -> Self { + Self { + first_member_id: 1, + default_paid_membership_fee: 100, + } + } +} + +impl ExtBuilder { + pub fn first_member_id(mut self, first_member_id: u32) -> Self { + self.first_member_id = first_member_id; + self + } + pub fn default_paid_membership_fee(mut self, default_paid_membership_fee: u32) -> Self { + self.default_paid_membership_fee = default_paid_membership_fee; + self + } + pub fn build(self) -> runtime_io::TestExternalities { + let mut t = system::GenesisConfig::::default().build_storage().unwrap().0; + + t.extend(registry::GenesisConfig::{ + first_member_id: self.first_member_id, + default_paid_membership_fee: self.default_paid_membership_fee, + }.build_storage().unwrap().0); - runtime_io::TestExternalities::new(t) + t.into() + } } pub type System = system::Module; diff --git a/src/membership/registry.rs b/src/membership/registry.rs index c0a6a559f9..8263f1b710 100644 --- a/src/membership/registry.rs +++ b/src/membership/registry.rs @@ -43,24 +43,24 @@ const DEFAULT_MAX_ABOUT_TEXT_LENGTH: u32 = 2048; #[derive(Encode, Decode)] /// Stored information about a registered user pub struct Profile { - id: T::MemberId, - handle: Vec, - avatar_uri: Vec, - about: Vec, - registered_at_block: T::BlockNumber, - registered_at_time: T::Moment, - entry: EntryMethod, - suspended: bool, - subscription: Option, - sub_accounts: Vec + pub id: T::MemberId, + pub handle: Vec, + pub avatar_uri: Vec, + pub about: Vec, + pub registered_at_block: T::BlockNumber, + pub registered_at_time: T::Moment, + pub entry: EntryMethod, + pub suspended: bool, + pub subscription: Option, + pub sub_accounts: Vec } #[derive(Clone, Debug, Encode, Decode, PartialEq)] /// Structure used to batch user configurable profile information when registering or updating info pub struct UserInfo { - handle: Option>, - avatar_uri: Option>, - about: Option>, + pub handle: Option>, + pub avatar_uri: Option>, + pub about: Option>, } struct CheckedUserInfo { @@ -77,14 +77,14 @@ pub enum EntryMethod { } //#[cfg_attr(feature = "std", derive(Serialize, Deserialize, Debug))] -#[derive(Encode, Decode)] +#[derive(Encode, Decode, Eq, PartialEq)] pub struct PaidMembershipTerms { /// Unique identifier - the term id - id: T::PaidTermId, + pub id: T::PaidTermId, /// Quantity of native tokens which must be provably burned - fee: BalanceOf, + pub fee: BalanceOf, /// String of capped length describing human readable conditions which are being agreed upon - text: Vec + pub text: Vec } impl Default for PaidMembershipTerms { @@ -101,59 +101,59 @@ decl_storage! { trait Store for Module as Membership { /// Records at what runtime spec version the store was initialized. This allows the runtime /// to know when to run initialize code if it was installed as an update. - StoreSpecVersion get(store_spec_version) build(|_| Some(VERSION.spec_version)) : Option; + pub StoreSpecVersion get(store_spec_version) build(|_| Some(VERSION.spec_version)) : Option; /// MemberId's start at this value - FirstMemberId get(first_member_id) config(first_member_id): T::MemberId = T::MemberId::sa(DEFAULT_FIRST_MEMBER_ID); + pub FirstMemberId get(first_member_id) config(first_member_id): T::MemberId = T::MemberId::sa(DEFAULT_FIRST_MEMBER_ID); /// MemberId to assign to next member that is added to the registry - NextMemberId get(next_member_id) build(|config: &GenesisConfig| config.first_member_id): T::MemberId = T::MemberId::sa(DEFAULT_FIRST_MEMBER_ID); + pub NextMemberId get(next_member_id) build(|config: &GenesisConfig| config.first_member_id): T::MemberId = T::MemberId::sa(DEFAULT_FIRST_MEMBER_ID); /// Mapping of member ids to their corresponding primary accountid - AccountIdByMemberId get(account_id_by_member_id) : map T::MemberId => T::AccountId; + pub AccountIdByMemberId get(account_id_by_member_id) : map T::MemberId => T::AccountId; /// Mapping of members' accountid ids to their member id. /// A member can have one primary account and multiple sub accounts associated with their profile - MemberIdByAccountId get(member_id_by_account_id) : map T::AccountId => Option; + pub MemberIdByAccountId get(member_id_by_account_id) : map T::AccountId => Option; /// Mapping of member's id to their membership profile // Value is Option because it is not meaningful to have a Default value for Profile - MemberProfile get(member_profile) : map T::MemberId => Option>; + pub MemberProfile get(member_profile) : map T::MemberId => Option>; /// Registered unique handles and their mapping to their owner - Handles get(handles) : map Vec => Option; + pub Handles get(handles) : map Vec => Option; /// Next paid membership terms id - NextPaidMembershipTermsId get(next_paid_membership_terms_id) : T::PaidTermId = T::PaidTermId::sa(FIRST_PAID_TERMS_ID); + pub NextPaidMembershipTermsId get(next_paid_membership_terms_id) : T::PaidTermId = T::PaidTermId::sa(FIRST_PAID_TERMS_ID); /// Paid membership terms record // Remember to add _genesis_phantom_data: std::marker::PhantomData{} to membership // genesis config if not providing config() or extra_genesis - PaidMembershipTermsById get(paid_membership_terms_by_id) build(|config: &GenesisConfig| { + pub PaidMembershipTermsById get(paid_membership_terms_by_id) build(|config: &GenesisConfig| { // This method only gets called when initializing storage, and is // compiled as native code. (Will be called when building `raw` chainspec) // So it can't be relied upon to initialize storage for runtimes updates. // Initialization for updated runtime is done in run_migration() let mut terms: PaidMembershipTerms = Default::default(); - terms.fee = BalanceOf::::sa(config.default_paid_membership_fee); + terms.fee = config.default_paid_membership_fee; vec![(terms.id, terms)] }) : map T::PaidTermId => Option>; /// Active Paid membership terms - ActivePaidMembershipTerms get(active_paid_membership_terms) : Vec = vec![T::PaidTermId::sa(DEFAULT_PAID_TERM_ID)]; + pub ActivePaidMembershipTerms get(active_paid_membership_terms) : Vec = vec![T::PaidTermId::sa(DEFAULT_PAID_TERM_ID)]; /// Is the platform is accepting new members or not - NewMembershipsAllowed get(new_memberships_allowed) : bool = true; + pub NewMembershipsAllowed get(new_memberships_allowed) : bool = true; // User Input Validation parameters - do these really need to be state variables // I don't see a need to adjust these in future? - MinHandleLength get(min_handle_length) : u32 = DEFAULT_MIN_HANDLE_LENGTH; - MaxHandleLength get(max_handle_length) : u32 = DEFAULT_MAX_HANDLE_LENGTH; - MaxAvatarUriLength get(max_avatar_uri_length) : u32 = DEFAULT_MAX_AVATAR_URI_LENGTH; - MaxAboutTextLength get(max_about_text_length) : u32 = DEFAULT_MAX_ABOUT_TEXT_LENGTH; + pub MinHandleLength get(min_handle_length) : u32 = DEFAULT_MIN_HANDLE_LENGTH; + pub MaxHandleLength get(max_handle_length) : u32 = DEFAULT_MAX_HANDLE_LENGTH; + pub MaxAvatarUriLength get(max_avatar_uri_length) : u32 = DEFAULT_MAX_AVATAR_URI_LENGTH; + pub MaxAboutTextLength get(max_about_text_length) : u32 = DEFAULT_MAX_ABOUT_TEXT_LENGTH; } add_extra_genesis { - config(default_paid_membership_fee): u64; + config(default_paid_membership_fee): BalanceOf; } } @@ -201,7 +201,7 @@ decl_module! { } /// Non-members can buy membership - fn buy_membership(origin, paid_terms_id: T::PaidTermId, user_info: UserInfo) { + pub fn buy_membership(origin, paid_terms_id: T::PaidTermId, user_info: UserInfo) { let who = ensure_signed(origin)?; // make sure we are accepting new memberships @@ -227,26 +227,26 @@ decl_module! { Self::deposit_event(RawEvent::MemberRegistered(member_id, who.clone())); } - fn change_member_about_text(origin, text: Vec) { + pub fn change_member_about_text(origin, text: Vec) { let who = ensure_signed(origin)?; let member_id = Self::ensure_is_member_primary_account(who.clone())?; Self::_change_member_about_text(member_id, &text)?; } - fn change_member_avatar(origin, uri: Vec) { + pub fn change_member_avatar(origin, uri: Vec) { let who = ensure_signed(origin)?; let member_id = Self::ensure_is_member_primary_account(who.clone())?; Self::_change_member_avatar(member_id, &uri)?; } /// Change member's handle. - fn change_member_handle(origin, handle: Vec) { + pub fn change_member_handle(origin, handle: Vec) { let who = ensure_signed(origin)?; let member_id = Self::ensure_is_member_primary_account(who.clone())?; Self::_change_member_handle(member_id, handle)?; } - fn update_profile(origin, user_info: UserInfo) { + pub fn update_profile(origin, user_info: UserInfo) { let who = ensure_signed(origin)?; let member_id = Self::ensure_is_member_primary_account(who.clone())?; @@ -261,15 +261,6 @@ decl_module! { } } - /// Buy the default membership (if it is active) and only provide handle - fn buy_default_membership_testing(origin, handle: Vec) { - Self::buy_membership(origin, T::PaidTermId::sa(DEFAULT_PAID_TERM_ID), UserInfo { - handle: Some(handle.clone()), - avatar_uri: None, - about: None - })?; - } - // Notes: // Ability to change primary account and add/remove sub accounts should be restricted // to accounts that are not actively being used in other roles in the platform? @@ -278,7 +269,7 @@ decl_module! { // and a way to limit damage from a compromised sub account. // Maybe should also not be allowed if member is suspended? // Main usecase for changing primary account is for identity recoverability - fn change_member_primary_account(origin, new_primary_account: T::AccountId) { + pub fn change_member_primary_account(origin, new_primary_account: T::AccountId) { let who = ensure_signed(origin)?; // only primary account can assign new primary account @@ -296,7 +287,7 @@ decl_module! { Self::deposit_event(RawEvent::MemberChangedPrimaryAccount(member_id, new_primary_account)); } - fn add_member_sub_account(origin, sub_account: T::AccountId) { + pub fn add_member_sub_account(origin, sub_account: T::AccountId) { let who = ensure_signed(origin)?; // only primary account can manage sub accounts let member_id = Self::ensure_is_member_primary_account(who.clone())?; @@ -309,7 +300,7 @@ decl_module! { Self::deposit_event(RawEvent::MemberAddedSubAccount(member_id, sub_account)); } - fn remove_member_sub_account(origin, sub_account: T::AccountId) { + pub fn remove_member_sub_account(origin, sub_account: T::AccountId) { let who = ensure_signed(origin)?; // only primary account can manage sub accounts let member_id = Self::ensure_is_member_primary_account(who.clone())?; diff --git a/src/membership/tests.rs b/src/membership/tests.rs index 498e3abd74..657a1bbc38 100644 --- a/src/membership/tests.rs +++ b/src/membership/tests.rs @@ -7,9 +7,143 @@ use parity_codec::Encode; use runtime_io::with_externalities; use srml_support::*; +fn assert_ok_unwrap(value: Option, err: &'static str) -> T { + match value { + None => { assert!(false, err); value.unwrap() }, + Some(v) => v + } +} + +fn get_alice_info() -> registry::UserInfo { + registry::UserInfo { + handle: Some(String::from("alice").as_bytes().to_vec()), + avatar_uri: Some(String::from("http://avatar-url.com/alice").as_bytes().to_vec()), + about: Some(String::from("my name is alice").as_bytes().to_vec()), + } +} + +const ALICE_ACCOUNT_ID: u64 = 1; +const DEFAULT_TERMS_ID: u32 = 0; + +fn buy_default_membership_as_alice() -> dispatch::Result { + Membership::buy_membership(Origin::signed(ALICE_ACCOUNT_ID), DEFAULT_TERMS_ID, get_alice_info()) +} + +fn set_alice_free_balance(balance: u32) { + Balances::set_free_balance(&ALICE_ACCOUNT_ID, balance); +} + +#[test] +fn initial_state() { + const DEFAULT_FEE: u32 = 500; + const DEFAULT_FIRST_ID: u32 = 1000; + + with_externalities(&mut ExtBuilder::default() + .default_paid_membership_fee(DEFAULT_FEE) + .first_member_id(DEFAULT_FIRST_ID).build(), || + { + assert_eq!(Membership::first_member_id(), DEFAULT_FIRST_ID); + assert_eq!(Membership::next_member_id(), DEFAULT_FIRST_ID); + + let default_terms = assert_ok_unwrap(Membership::paid_membership_terms_by_id(DEFAULT_TERMS_ID), "default terms not initialized"); + + assert_eq!(default_terms.id, DEFAULT_TERMS_ID); + assert_eq!(default_terms.fee, DEFAULT_FEE); + }); +} + #[test] -fn test_setup() { - with_externalities(&mut initial_test_ext(), || { - assert!(false); +fn buy_membership() { + const DEFAULT_FEE: u32 = 500; + const DEFAULT_FIRST_ID: u32 = 1000; + const SURPLUS_BALANCE: u32 = 500; + + with_externalities(&mut ExtBuilder::default() + .default_paid_membership_fee(DEFAULT_FEE) + .first_member_id(DEFAULT_FIRST_ID).build(), || + { + let initial_balance = DEFAULT_FEE + SURPLUS_BALANCE; + set_alice_free_balance(initial_balance); + + assert_ok!(buy_default_membership_as_alice()); + + let member_id = assert_ok_unwrap(Membership::member_id_by_account_id(&ALICE_ACCOUNT_ID), "member id not assigned"); + + let profile = assert_ok_unwrap(Membership::member_profile(&member_id), "member profile created"); + + assert_eq!(Some(profile.handle), get_alice_info().handle); + + assert_eq!(Balances::free_balance(&ALICE_ACCOUNT_ID), SURPLUS_BALANCE); + + }); +} + +#[test] +fn buy_membership_fails_without_enough_balance() { + const DEFAULT_FEE: u32 = 500; + + with_externalities(&mut ExtBuilder::default() + .default_paid_membership_fee(DEFAULT_FEE).build(), || + { + let initial_balance = DEFAULT_FEE - 1; + set_alice_free_balance(initial_balance); + + assert!(buy_default_membership_as_alice().is_err()); + }); +} + +#[test] +fn new_memberships_allowed_flag() { + const DEFAULT_FEE: u32 = 500; + + with_externalities(&mut ExtBuilder::default() + .default_paid_membership_fee(DEFAULT_FEE).build(), || + { + let initial_balance = DEFAULT_FEE + 1; + set_alice_free_balance(initial_balance); + + >::put(false); + + assert!(buy_default_membership_as_alice().is_err()); + }); +} + +#[test] +fn account_cannot_create_multiple_memberships() { + const DEFAULT_FEE: u32 = 500; + const SURPLUS_BALANCE: u32 = 500; + + with_externalities(&mut ExtBuilder::default() + .default_paid_membership_fee(DEFAULT_FEE).build(), || + { + let initial_balance = DEFAULT_FEE + SURPLUS_BALANCE; + set_alice_free_balance(initial_balance); + + // First time it works + assert_ok!(buy_default_membership_as_alice()); + + // second attempt should fail + assert!(buy_default_membership_as_alice().is_err()); + + }); +} + +#[test] +fn unique_handles() { + const DEFAULT_FEE: u32 = 500; + const SURPLUS_BALANCE: u32 = 500; + + with_externalities(&mut ExtBuilder::default() + .default_paid_membership_fee(DEFAULT_FEE).build(), || + { + let initial_balance = DEFAULT_FEE + SURPLUS_BALANCE; + set_alice_free_balance(initial_balance); + + // alice's handle already taken + >::insert(get_alice_info().handle.unwrap(), 1); + + // should not be allowed to buy membership with that handle + assert!(buy_default_membership_as_alice().is_err()); + }); } \ No newline at end of file From 5ba5f86d637a0b6c12b42bca7faa52445ea571ea Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Wed, 20 Mar 2019 09:46:04 +0200 Subject: [PATCH 023/175] membership: more tests --- src/membership/tests.rs | 74 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 72 insertions(+), 2 deletions(-) diff --git a/src/membership/tests.rs b/src/membership/tests.rs index 657a1bbc38..e21bf7acb4 100644 --- a/src/membership/tests.rs +++ b/src/membership/tests.rs @@ -22,6 +22,14 @@ fn get_alice_info() -> registry::UserInfo { } } +fn get_bob_info() -> registry::UserInfo { + registry::UserInfo { + handle: Some(String::from("bobby").as_bytes().to_vec()), + avatar_uri: Some(String::from("http://avatar-url.com/bob").as_bytes().to_vec()), + about: Some(String::from("my name is bob").as_bytes().to_vec()), + } +} + const ALICE_ACCOUNT_ID: u64 = 1; const DEFAULT_TERMS_ID: u32 = 0; @@ -69,9 +77,11 @@ fn buy_membership() { let member_id = assert_ok_unwrap(Membership::member_id_by_account_id(&ALICE_ACCOUNT_ID), "member id not assigned"); - let profile = assert_ok_unwrap(Membership::member_profile(&member_id), "member profile created"); + let profile = assert_ok_unwrap(Membership::member_profile(&member_id), "member profile not created"); assert_eq!(Some(profile.handle), get_alice_info().handle); + assert_eq!(Some(profile.avatar_uri), get_alice_info().avatar_uri); + assert_eq!(Some(profile.about), get_alice_info().about); assert_eq!(Balances::free_balance(&ALICE_ACCOUNT_ID), SURPLUS_BALANCE); @@ -146,4 +156,64 @@ fn unique_handles() { assert!(buy_default_membership_as_alice().is_err()); }); -} \ No newline at end of file +} + +#[test] +fn update_profile() { + const DEFAULT_FEE: u32 = 500; + const SURPLUS_BALANCE: u32 = 500; + + with_externalities(&mut ExtBuilder::default() + .default_paid_membership_fee(DEFAULT_FEE).build(), || + { + let initial_balance = DEFAULT_FEE + SURPLUS_BALANCE; + set_alice_free_balance(initial_balance); + + assert_ok!(buy_default_membership_as_alice()); + + assert_ok!(Membership::update_profile(Origin::signed(ALICE_ACCOUNT_ID), get_bob_info())); + + let member_id = assert_ok_unwrap(Membership::member_id_by_account_id(&ALICE_ACCOUNT_ID), "member id not assigned"); + + let profile = assert_ok_unwrap(Membership::member_profile(&member_id), "member profile created"); + + assert_eq!(Some(profile.handle), get_bob_info().handle); + assert_eq!(Some(profile.avatar_uri), get_bob_info().avatar_uri); + assert_eq!(Some(profile.about), get_bob_info().about); + + }); +} + +#[test] +fn member_sub_accounts() { + with_externalities(&mut ExtBuilder::default().build(), || + { + let initial_balance = 20000; + set_alice_free_balance(initial_balance); + assert_ok!(buy_default_membership_as_alice()); + + let member_id = assert_ok_unwrap(Membership::member_id_by_account_id(&ALICE_ACCOUNT_ID), "member id not assigned"); + + const NEW_PRIMARY_ACCOUNT: u64 = 2; + + assert_ok!(Membership::change_member_primary_account(Origin::signed(ALICE_ACCOUNT_ID), NEW_PRIMARY_ACCOUNT)); + + // new account id should be associated with the member + assert_eq!(assert_ok_unwrap(Membership::member_id_by_account_id(&NEW_PRIMARY_ACCOUNT), "member id not found"), member_id); + + const NEW_SUB_ACCOUNT_1: u64 = 3; + const NEW_SUB_ACCOUNT_2: u64 = 4; + assert_ok!(Membership::add_member_sub_account(Origin::signed(NEW_PRIMARY_ACCOUNT), NEW_SUB_ACCOUNT_1)); + assert_ok!(Membership::add_member_sub_account(Origin::signed(NEW_PRIMARY_ACCOUNT), NEW_SUB_ACCOUNT_2)); + + let profile = assert_ok_unwrap(Membership::member_profile(&member_id), "member profile not found"); + assert_eq!(profile.sub_accounts, vec![NEW_SUB_ACCOUNT_1, NEW_SUB_ACCOUNT_2]); + + assert_ok!(Membership::remove_member_sub_account(Origin::signed(NEW_PRIMARY_ACCOUNT), NEW_SUB_ACCOUNT_1)); + + let profile = assert_ok_unwrap(Membership::member_profile(&member_id), "member profile not found"); + assert_eq!(profile.sub_accounts, vec![NEW_SUB_ACCOUNT_2]); + + }); +} + From 74531d2d6b3686a8bd9b14a1a7eee7b4369de368 Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Wed, 20 Mar 2019 09:46:18 +0200 Subject: [PATCH 024/175] membership sub accounts, fix updating subaccounts --- src/membership/registry.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/membership/registry.rs b/src/membership/registry.rs index 8263f1b710..9596892be9 100644 --- a/src/membership/registry.rs +++ b/src/membership/registry.rs @@ -297,6 +297,7 @@ decl_module! { let mut profile = Self::ensure_profile(member_id)?; profile.sub_accounts.push(sub_account.clone()); >::insert(member_id, profile); + >::insert(&sub_account, member_id); Self::deposit_event(RawEvent::MemberAddedSubAccount(member_id, sub_account)); } @@ -318,6 +319,7 @@ decl_module! { profile.sub_accounts = profile.sub_accounts.into_iter().filter(|account| !(*account == sub_account)).collect(); >::insert(member_id, profile); + >::remove(&sub_account); Self::deposit_event(RawEvent::MemberRemovedSubAccount(member_id, sub_account)); } } From 3328650a397f5aae7654cb442929cce23d4c1d7e Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Wed, 20 Mar 2019 10:07:29 +0200 Subject: [PATCH 025/175] membership tests --- src/membership/tests.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/membership/tests.rs b/src/membership/tests.rs index e21bf7acb4..9c63658227 100644 --- a/src/membership/tests.rs +++ b/src/membership/tests.rs @@ -196,9 +196,13 @@ fn member_sub_accounts() { const NEW_PRIMARY_ACCOUNT: u64 = 2; + // only primary account can change + assert!(Membership::change_member_primary_account(Origin::signed(NEW_PRIMARY_ACCOUNT), NEW_PRIMARY_ACCOUNT).is_err()); + + // primary account should successfully change account assert_ok!(Membership::change_member_primary_account(Origin::signed(ALICE_ACCOUNT_ID), NEW_PRIMARY_ACCOUNT)); - // new account id should be associated with the member + // new account id should be associated with the same member assert_eq!(assert_ok_unwrap(Membership::member_id_by_account_id(&NEW_PRIMARY_ACCOUNT), "member id not found"), member_id); const NEW_SUB_ACCOUNT_1: u64 = 3; From bf2f5d51e6f56e9b710e2f92b62cf6a0e67ee716 Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Wed, 20 Mar 2019 11:12:53 +0200 Subject: [PATCH 026/175] introduce IsActiveMember trait --- src/lib.rs | 5 +++-- src/membership/registry.rs | 12 ++++++++++++ src/traits.rs | 9 +++++++++ 3 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 src/traits.rs diff --git a/src/lib.rs b/src/lib.rs index b4cf410acc..4e7fe9f8f9 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -19,6 +19,7 @@ use governance::{election, council, proposals}; mod memo; mod membership; use membership::registry; +mod traits; use rstd::prelude::*; #[cfg(feature = "std")] @@ -26,7 +27,7 @@ use primitives::bytes; use primitives::{Ed25519AuthorityId, OpaqueMetadata}; use runtime_primitives::{ ApplyResult, transaction_validity::TransactionValidity, Ed25519Signature, generic, - traits::{self, Convert, BlakeTwo256, Block as BlockT, StaticLookup}, create_runtime_str + traits::{self as runtime_traits, Convert, BlakeTwo256, Block as BlockT, StaticLookup}, create_runtime_str }; use client::{ block_builder::api::{CheckInherentsResult, InherentData, self as block_builder_api}, @@ -69,7 +70,7 @@ pub mod opaque { #[derive(PartialEq, Eq, Clone, Default, Encode, Decode)] #[cfg_attr(feature = "std", derive(Serialize, Deserialize, Debug))] pub struct UncheckedExtrinsic(#[cfg_attr(feature = "std", serde(with="bytes"))] pub Vec); - impl traits::Extrinsic for UncheckedExtrinsic { + impl runtime_traits::Extrinsic for UncheckedExtrinsic { fn is_signed(&self) -> Option { None } diff --git a/src/membership/registry.rs b/src/membership/registry.rs index 9596892be9..90c6e786d7 100644 --- a/src/membership/registry.rs +++ b/src/membership/registry.rs @@ -11,6 +11,7 @@ use crate::governance::{GovernanceCurrency, BalanceOf }; use runtime_io::print; use {timestamp}; use crate::{VERSION}; +use crate::traits; pub trait Trait: system::Trait + GovernanceCurrency + timestamp::Trait { type Event: From> + Into<::Event>; @@ -184,6 +185,17 @@ impl Module { } } +impl traits::IsActiveMember for Module { + fn is_active_member(who: T::AccountId) -> bool { + match Self::ensure_is_member(&who) + .and_then(|member_id| Self::ensure_profile(member_id)) + { + Ok(profile) => !profile.suspended, + Err(err) => false + } + } +} + decl_module! { pub struct Module for enum Call where origin: T::Origin { fn deposit_event() = default; diff --git a/src/traits.rs b/src/traits.rs new file mode 100644 index 0000000000..949f7f56f4 --- /dev/null +++ b/src/traits.rs @@ -0,0 +1,9 @@ +#![cfg_attr(not(feature = "std"), no_std)] + +use system; + +pub trait IsActiveMember { + fn is_active_member(account_id: T::AccountId) -> bool { + false + } +} \ No newline at end of file From c8b70cc096bd2d5105a4c79d142890bd55dff098 Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Wed, 20 Mar 2019 12:37:54 +0200 Subject: [PATCH 027/175] use IsActiveMember trait in election and runtime upgrade proposal modules --- src/governance/election.rs | 14 +++++++++----- src/governance/mock.rs | 18 ++++++++++++++---- src/governance/proposals.rs | 18 ++++++++++++++---- src/lib.rs | 2 ++ src/membership/registry.rs | 4 ++-- src/traits.rs | 2 +- 6 files changed, 42 insertions(+), 16 deletions(-) diff --git a/src/governance/election.rs b/src/governance/election.rs index 282247e59f..e6d0f109e7 100644 --- a/src/governance/election.rs +++ b/src/governance/election.rs @@ -17,10 +17,14 @@ use super::sealed_vote::SealedVote; pub use super::{ GovernanceCurrency, BalanceOf }; use super::council; +use crate::traits::{IsActiveMember}; + pub trait Trait: system::Trait + council::Trait + GovernanceCurrency { type Event: From> + Into<::Event>; type CouncilElected: CouncilElected>, Self::BlockNumber>; + + type IsActiveMember: IsActiveMember; } #[derive(Clone, Copy, Encode, Decode)] @@ -148,9 +152,9 @@ impl Module { >::block_number() + length } - // TODO This method should be moved to Membership module once it's created. - fn is_member(sender: T::AccountId) -> bool { - !T::Currency::free_balance(&sender).is_zero() + + fn can_participate(sender: &T::AccountId) -> bool { + !T::Currency::free_balance(sender).is_zero() && T::IsActiveMember::is_active_member(sender) } // PUBLIC IMMUTABLES @@ -651,7 +655,7 @@ decl_module! { // Member can make subsequent calls during announcing stage to increase their stake. fn apply(origin, stake: BalanceOf) { let sender = ensure_signed(origin)?; - ensure!(Self::is_member(sender.clone()), "Only members can apply to be on council"); + ensure!(Self::can_participate(&sender), "Only members can apply to be on council"); let stage = Self::stage(); ensure!(Self::stage().is_some(), "election not running"); @@ -674,7 +678,7 @@ decl_module! { fn vote(origin, commitment: T::Hash, stake: BalanceOf) { let sender = ensure_signed(origin)?; - ensure!(Self::is_member(sender.clone()), "Only members can vote for an applicant"); + ensure!(Self::can_participate(&sender), "Only members can vote for an applicant"); let stage = Self::stage(); ensure!(Self::stage().is_some(), "election not running"); diff --git a/src/governance/mock.rs b/src/governance/mock.rs index 5cb193eddc..ce5bb9bd4a 100644 --- a/src/governance/mock.rs +++ b/src/governance/mock.rs @@ -3,6 +3,7 @@ use rstd::prelude::*; pub use super::{election, council, proposals, GovernanceCurrency}; pub use system; +use crate::traits; pub use primitives::{H256, Blake2Hasher}; pub use runtime_primitives::{ @@ -17,6 +18,16 @@ impl_outer_origin! { pub enum Origin for Test {} } +pub struct AnyAccountIsMember {} +impl traits::IsActiveMember for AnyAccountIsMember { + fn is_active_member(who: &T::AccountId) -> bool { + true + } +} + +// default trait implementation - any account is not a member +// impl traits::IsActiveMember for () {} + // For testing the module, we construct most of a mock runtime. This means // first constructing a configuration type (`Test`) which `impl`s each of the // configuration traits of modules we want to use. @@ -53,10 +64,10 @@ impl election::Trait for Test { type Event = (); type CouncilElected = (Council,); + + type IsActiveMember = AnyAccountIsMember; } -impl proposals::Trait for Test { - type Event = (); -} + impl balances::Trait for Test { type Event = (); @@ -92,6 +103,5 @@ pub fn initial_test_ext() -> runtime_io::TestExternalities { pub type Election = election::Module; pub type Council = council::Module; -pub type Proposals = proposals::Module; pub type System = system::Module; pub type Balances = balances::Module; diff --git a/src/governance/proposals.rs b/src/governance/proposals.rs index 2a08fe19c9..58878dc9e9 100644 --- a/src/governance/proposals.rs +++ b/src/governance/proposals.rs @@ -8,6 +8,7 @@ use rstd::prelude::*; use super::council; pub use super::{ GovernanceCurrency, BalanceOf }; +use crate::traits::{IsActiveMember}; const DEFAULT_APPROVAL_QUORUM: u32 = 60; const DEFAULT_MIN_STAKE: u64 = 100; @@ -115,6 +116,8 @@ pub struct TallyResult { pub trait Trait: timestamp::Trait + council::Trait + GovernanceCurrency { /// The overarching event type. type Event: From> + Into<::Event>; + + type IsActiveMember: IsActiveMember; } decl_event!( @@ -221,7 +224,7 @@ decl_module! { ) { let proposer = ensure_signed(origin)?; - ensure!(Self::is_member(proposer.clone()), MSG_ONLY_MEMBERS_CAN_PROPOSE); + ensure!(Self::can_participate(proposer.clone()), MSG_ONLY_MEMBERS_CAN_PROPOSE); ensure!(stake >= Self::min_stake(), MSG_STAKE_IS_TOO_LOW); ensure!(!name.is_empty(), MSG_EMPTY_NAME_PROVIDED); @@ -345,9 +348,8 @@ impl Module { >::block_number() } - // TODO This method should be moved to Membership module once it's created. - fn is_member(sender: T::AccountId) -> bool { - !T::Currency::free_balance(&sender).is_zero() + fn can_participate(sender: T::AccountId) -> bool { + !T::Currency::free_balance(&sender).is_zero() && T::IsActiveMember::is_active_member(&sender) } fn is_councilor(sender: &T::AccountId) -> bool { @@ -613,6 +615,14 @@ mod tests { impl Trait for Test { type Event = (); + type IsActiveMember = AnyAccountIsMember; + } + + pub struct AnyAccountIsMember {} + impl IsActiveMember for AnyAccountIsMember { + fn is_active_member(who: &T::AccountId) -> bool { + true + } } type System = system::Module; diff --git a/src/lib.rs b/src/lib.rs index 4e7fe9f8f9..0320ce8d76 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -211,11 +211,13 @@ impl governance::GovernanceCurrency for Runtime { impl governance::proposals::Trait for Runtime { type Event = Event; + type IsActiveMember = Membership; } impl governance::election::Trait for Runtime { type Event = Event; type CouncilElected = (Council,); + type IsActiveMember = Membership; } impl governance::council::Trait for Runtime { diff --git a/src/membership/registry.rs b/src/membership/registry.rs index 90c6e786d7..dfd289fa1e 100644 --- a/src/membership/registry.rs +++ b/src/membership/registry.rs @@ -186,8 +186,8 @@ impl Module { } impl traits::IsActiveMember for Module { - fn is_active_member(who: T::AccountId) -> bool { - match Self::ensure_is_member(&who) + fn is_active_member(who: &T::AccountId) -> bool { + match Self::ensure_is_member(who) .and_then(|member_id| Self::ensure_profile(member_id)) { Ok(profile) => !profile.suspended, diff --git a/src/traits.rs b/src/traits.rs index 949f7f56f4..8b24b830da 100644 --- a/src/traits.rs +++ b/src/traits.rs @@ -3,7 +3,7 @@ use system; pub trait IsActiveMember { - fn is_active_member(account_id: T::AccountId) -> bool { + fn is_active_member(account_id: &T::AccountId) -> bool { false } } \ No newline at end of file From c7326e167d7aeeb7cd9fbc2d2df5841b6fd1aee5 Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Wed, 20 Mar 2019 15:57:32 +0200 Subject: [PATCH 028/175] factor our migration to its own module --- src/lib.rs | 6 ++++ src/membership/registry.rs | 33 ++++--------------- src/migration.rs | 65 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 77 insertions(+), 27 deletions(-) create mode 100644 src/migration.rs diff --git a/src/lib.rs b/src/lib.rs index 0320ce8d76..93e6ba1afc 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -20,6 +20,7 @@ mod memo; mod membership; use membership::registry; mod traits; +mod migration; use rstd::prelude::*; #[cfg(feature = "std")] @@ -236,6 +237,10 @@ impl membership::registry::Trait for Runtime { type SubscriptionId = u64; } +impl migration::Trait for Runtime { + type Event = Event; +} + construct_runtime!( pub enum Runtime with Log(InternalLog: DigestItem) where Block = Block, @@ -257,6 +262,7 @@ construct_runtime!( Council: council::{Module, Call, Storage, Event, Config}, Memo: memo::{Module, Call, Storage, Event}, Membership: registry::{Module, Call, Storage, Event, Config}, + Migration: migration::{Module, Call, Storage, Event}, } ); diff --git a/src/membership/registry.rs b/src/membership/registry.rs index dfd289fa1e..1da6611fa4 100644 --- a/src/membership/registry.rs +++ b/src/membership/registry.rs @@ -8,9 +8,7 @@ use srml_support::traits::{Currency}; use runtime_primitives::traits::{Zero, SimpleArithmetic, As, Member, MaybeSerializeDebug}; use system::{self, ensure_signed}; use crate::governance::{GovernanceCurrency, BalanceOf }; -use runtime_io::print; use {timestamp}; -use crate::{VERSION}; use crate::traits; pub trait Trait: system::Trait + GovernanceCurrency + timestamp::Trait { @@ -100,10 +98,6 @@ impl Default for PaidMembershipTerms { decl_storage! { trait Store for Module as Membership { - /// Records at what runtime spec version the store was initialized. This allows the runtime - /// to know when to run initialize code if it was installed as an update. - pub StoreSpecVersion get(store_spec_version) build(|_| Some(VERSION.spec_version)) : Option; - /// MemberId's start at this value pub FirstMemberId get(first_member_id) config(first_member_id): T::MemberId = T::MemberId::sa(DEFAULT_FIRST_MEMBER_ID); @@ -172,16 +166,13 @@ decl_event! { } } +/// Initialization step that runs when the runtime is installed as a runtime upgrade +/// This will and should ONLY be called from the migration module that keeps track of +/// the store version! impl Module { - /// Initialization step that runs when the runtime is installed as a runtime upgrade - /// Remember to remove this code in next release, or guard the code with the spec version - // Given it is easy to forget to do this, we need a better arrangement. - fn runtime_initialization(spec_version: u32) { - if 5 == spec_version { - print("Running New Runtime Init Code"); - let default_terms: PaidMembershipTerms = Default::default(); - >::insert(T::PaidTermId::sa(0), default_terms); - } + pub fn initialize_storage() { + let default_terms: PaidMembershipTerms = Default::default(); + >::insert(default_terms.id, default_terms); } } @@ -200,18 +191,6 @@ decl_module! { pub struct Module for enum Call where origin: T::Origin { fn deposit_event() = default; - fn on_initialise(_now: T::BlockNumber) { - if Self::store_spec_version().map_or(true, |spec_version| VERSION.spec_version > spec_version) { - // Mark store version with latest so we don't run initialization code again - >::put(VERSION.spec_version); - Self::runtime_initialization(VERSION.spec_version); - } - } - - fn on_finalise(_now: T::BlockNumber) { - - } - /// Non-members can buy membership pub fn buy_membership(origin, paid_terms_id: T::PaidTermId, user_info: UserInfo) { let who = ensure_signed(origin)?; diff --git a/src/migration.rs b/src/migration.rs new file mode 100644 index 0000000000..fe25cd8a60 --- /dev/null +++ b/src/migration.rs @@ -0,0 +1,65 @@ +#![cfg_attr(not(feature = "std"), no_std)] + +use srml_support::{StorageValue, dispatch::Result, decl_module, decl_storage, decl_event, ensure}; +use system; +use rstd::prelude::*; +use runtime_io::print; +use crate::{VERSION}; +use crate::membership::registry; + +pub trait Trait: system::Trait + registry::Trait { + type Event: From> + Into<::Event>; +} + +decl_storage! { + trait Store for Module as Migration { + /// Records at what runtime spec version the store was initialized. This allows the runtime + /// to know when to run initialize code if it was installed as an update. + pub SpecVersion get(spec_version) build(|_| Some(VERSION.spec_version)) : Option; + } +} + +decl_event! { + pub enum Event where ::BlockNumber { + Migrated(BlockNumber, u32), + } +} + +// When preparing a new major runtime release version bump this value to match it and update +// the initialization code in runtime_initialization(). Because of the way substrate runs runtime code +// 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 = 5; + +impl Module { + fn runtime_initialization() { + if VERSION.spec_version != MIGRATION_FOR_SPEC_VERSION { return } + + print("running runtime initializers"); + + >::initialize_storage(); + + // ... + // add initialization of other modules introduced in this runtime + // ... + + Self::deposit_event(RawEvent::Migrated(>::block_number(), VERSION.spec_version)); + } +} + +decl_module! { + pub struct Module for enum Call where origin: T::Origin { + fn deposit_event() = default; + + fn on_initialise(_now: T::BlockNumber) { + if Self::spec_version().map_or(true, |spec_version| VERSION.spec_version > spec_version) { + // mark store version with current version of the runtime + >::put(VERSION.spec_version); + + // run migrations and store initializers + Self::runtime_initialization(); + } + } + } +} From 53e54b6bbc67e552c14ddbb601ef8479a6d30c97 Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Wed, 20 Mar 2019 16:04:58 +0200 Subject: [PATCH 029/175] additional comments on membership methods --- src/membership/registry.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/membership/registry.rs b/src/membership/registry.rs index 1da6611fa4..cf661a1e46 100644 --- a/src/membership/registry.rs +++ b/src/membership/registry.rs @@ -218,25 +218,29 @@ decl_module! { Self::deposit_event(RawEvent::MemberRegistered(member_id, who.clone())); } + /// Change member's about text pub fn change_member_about_text(origin, text: Vec) { let who = ensure_signed(origin)?; let member_id = Self::ensure_is_member_primary_account(who.clone())?; Self::_change_member_about_text(member_id, &text)?; } + /// Change member's avatar pub fn change_member_avatar(origin, uri: Vec) { let who = ensure_signed(origin)?; let member_id = Self::ensure_is_member_primary_account(who.clone())?; Self::_change_member_avatar(member_id, &uri)?; } - /// Change member's handle. + /// Change member's handle. Will ensure new handle is unique and old one will be available + /// for other members to use. pub fn change_member_handle(origin, handle: Vec) { let who = ensure_signed(origin)?; let member_id = Self::ensure_is_member_primary_account(who.clone())?; Self::_change_member_handle(member_id, handle)?; } + /// Update member's all or some of handle, avatar and about text. pub fn update_profile(origin, user_info: UserInfo) { let who = ensure_signed(origin)?; let member_id = Self::ensure_is_member_primary_account(who.clone())?; From 3fab73d456c4126024454110c99298a1c9430c95 Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Thu, 21 Mar 2019 13:24:27 +0200 Subject: [PATCH 030/175] membership sub accounts - revert (move to staked roles) --- src/membership/registry.rs | 70 +------------------------------------- src/membership/tests.rs | 37 -------------------- 2 files changed, 1 insertion(+), 106 deletions(-) diff --git a/src/membership/registry.rs b/src/membership/registry.rs index cf661a1e46..0e2acfa97b 100644 --- a/src/membership/registry.rs +++ b/src/membership/registry.rs @@ -51,7 +51,6 @@ pub struct Profile { pub entry: EntryMethod, pub suspended: bool, pub subscription: Option, - pub sub_accounts: Vec } #[derive(Clone, Debug, Encode, Decode, PartialEq)] @@ -107,8 +106,7 @@ decl_storage! { /// Mapping of member ids to their corresponding primary accountid pub AccountIdByMemberId get(account_id_by_member_id) : map T::MemberId => T::AccountId; - /// Mapping of members' accountid ids to their member id. - /// A member can have one primary account and multiple sub accounts associated with their profile + /// Mapping of members' account ids to their member id. pub MemberIdByAccountId get(member_id_by_account_id) : map T::AccountId => Option; /// Mapping of member's id to their membership profile @@ -160,9 +158,6 @@ decl_event! { MemberUpdatedAboutText(MemberId), MemberUpdatedAvatar(MemberId), MemberUpdatedHandle(MemberId), - MemberChangedPrimaryAccount(MemberId, AccountId), - MemberAddedSubAccount(MemberId, AccountId), - MemberRemovedSubAccount(MemberId, AccountId), } } @@ -255,68 +250,6 @@ decl_module! { Self::_change_member_handle(member_id, handle)?; } } - - // Notes: - // Ability to change primary account and add/remove sub accounts should be restricted - // to accounts that are not actively being used in other roles in the platform? - // Other roles in the platform should be associated directly with member_id instead of an account_id, - // but can still use a seprate account/key to sign extrinsics, have a seprate balance from primary account, - // and a way to limit damage from a compromised sub account. - // Maybe should also not be allowed if member is suspended? - // Main usecase for changing primary account is for identity recoverability - pub fn change_member_primary_account(origin, new_primary_account: T::AccountId) { - let who = ensure_signed(origin)?; - - // only primary account can assign new primary account - let member_id = Self::ensure_is_member_primary_account(who.clone())?; - - // ensure new_primary_account isn't already associated with any existing member - Self::ensure_not_member(&new_primary_account)?; - - // update associated accounts - >::remove(&who); - >::insert(&new_primary_account, member_id); - - // update primary account - >::insert(member_id, new_primary_account.clone()); - Self::deposit_event(RawEvent::MemberChangedPrimaryAccount(member_id, new_primary_account)); - } - - pub fn add_member_sub_account(origin, sub_account: T::AccountId) { - let who = ensure_signed(origin)?; - // only primary account can manage sub accounts - let member_id = Self::ensure_is_member_primary_account(who.clone())?; - // ensure sub_account isn't already associated with any existing member - Self::ensure_not_member(&sub_account)?; - - let mut profile = Self::ensure_profile(member_id)?; - profile.sub_accounts.push(sub_account.clone()); - >::insert(member_id, profile); - >::insert(&sub_account, member_id); - Self::deposit_event(RawEvent::MemberAddedSubAccount(member_id, sub_account)); - } - - pub fn remove_member_sub_account(origin, sub_account: T::AccountId) { - let who = ensure_signed(origin)?; - // only primary account can manage sub accounts - let member_id = Self::ensure_is_member_primary_account(who.clone())?; - - // ensure account is a sub account - // primary account cannot be added as a subaccount in add_member_sub_account() - ensure!(who != sub_account, "not sub account"); - - // ensure sub_account is associated with member - let sub_account_member_id = Self::ensure_is_member(&sub_account)?; - ensure!(member_id == sub_account_member_id, "not member sub account"); - - let mut profile = Self::ensure_profile(member_id)?; - - profile.sub_accounts = profile.sub_accounts.into_iter().filter(|account| !(*account == sub_account)).collect(); - - >::insert(member_id, profile); - >::remove(&sub_account); - Self::deposit_event(RawEvent::MemberRemovedSubAccount(member_id, sub_account)); - } } } @@ -403,7 +336,6 @@ impl Module { entry: EntryMethod::Paid(paid_terms_id), suspended: false, subscription: None, - sub_accounts: vec![], }; >::insert(who.clone(), new_member_id); diff --git a/src/membership/tests.rs b/src/membership/tests.rs index 9c63658227..c4f842403c 100644 --- a/src/membership/tests.rs +++ b/src/membership/tests.rs @@ -184,40 +184,3 @@ fn update_profile() { }); } -#[test] -fn member_sub_accounts() { - with_externalities(&mut ExtBuilder::default().build(), || - { - let initial_balance = 20000; - set_alice_free_balance(initial_balance); - assert_ok!(buy_default_membership_as_alice()); - - let member_id = assert_ok_unwrap(Membership::member_id_by_account_id(&ALICE_ACCOUNT_ID), "member id not assigned"); - - const NEW_PRIMARY_ACCOUNT: u64 = 2; - - // only primary account can change - assert!(Membership::change_member_primary_account(Origin::signed(NEW_PRIMARY_ACCOUNT), NEW_PRIMARY_ACCOUNT).is_err()); - - // primary account should successfully change account - assert_ok!(Membership::change_member_primary_account(Origin::signed(ALICE_ACCOUNT_ID), NEW_PRIMARY_ACCOUNT)); - - // new account id should be associated with the same member - assert_eq!(assert_ok_unwrap(Membership::member_id_by_account_id(&NEW_PRIMARY_ACCOUNT), "member id not found"), member_id); - - const NEW_SUB_ACCOUNT_1: u64 = 3; - const NEW_SUB_ACCOUNT_2: u64 = 4; - assert_ok!(Membership::add_member_sub_account(Origin::signed(NEW_PRIMARY_ACCOUNT), NEW_SUB_ACCOUNT_1)); - assert_ok!(Membership::add_member_sub_account(Origin::signed(NEW_PRIMARY_ACCOUNT), NEW_SUB_ACCOUNT_2)); - - let profile = assert_ok_unwrap(Membership::member_profile(&member_id), "member profile not found"); - assert_eq!(profile.sub_accounts, vec![NEW_SUB_ACCOUNT_1, NEW_SUB_ACCOUNT_2]); - - assert_ok!(Membership::remove_member_sub_account(Origin::signed(NEW_PRIMARY_ACCOUNT), NEW_SUB_ACCOUNT_1)); - - let profile = assert_ok_unwrap(Membership::member_profile(&member_id), "member profile not found"); - assert_eq!(profile.sub_accounts, vec![NEW_SUB_ACCOUNT_2]); - - }); -} - From 9f07751ee02042ddce6646895cbf09db2527b2e6 Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Thu, 21 Mar 2019 14:47:53 +0200 Subject: [PATCH 031/175] add member through screener --- src/membership/mock.rs | 2 +- src/membership/registry.rs | 59 +++++++++++++++++++++++++++++++++++++- src/membership/tests.rs | 20 +++++++++++++ 3 files changed, 79 insertions(+), 2 deletions(-) diff --git a/src/membership/mock.rs b/src/membership/mock.rs index 89fb228341..c85efaf4c6 100644 --- a/src/membership/mock.rs +++ b/src/membership/mock.rs @@ -21,7 +21,7 @@ impl_outer_origin! { // For testing the module, we construct most of a mock runtime. This means // first constructing a configuration type (`Test`) which `impl`s each of the // configuration traits of modules we want to use. -#[derive(Clone, Eq, PartialEq)] +#[derive(Clone, Eq, PartialEq, Debug)] pub struct Test; impl system::Trait for Test { type Origin = Origin; diff --git a/src/membership/registry.rs b/src/membership/registry.rs index 0e2acfa97b..a088ce275a 100644 --- a/src/membership/registry.rs +++ b/src/membership/registry.rs @@ -68,7 +68,7 @@ struct CheckedUserInfo { } //#[cfg_attr(feature = "std", derive(Serialize, Deserialize, Debug))] -#[derive(Encode, Decode)] +#[derive(Encode, Decode, Debug, PartialEq)] pub enum EntryMethod { Paid(T::PaidTermId), Screening(T::AccountId), @@ -138,6 +138,8 @@ decl_storage! { /// Is the platform is accepting new members or not pub NewMembershipsAllowed get(new_memberships_allowed) : bool = true; + pub ScreeningAuthority get(screening_authority) : Option; + // User Input Validation parameters - do these really need to be state variables // I don't see a need to adjust these in future? pub MinHandleLength get(min_handle_length) : u32 = DEFAULT_MIN_HANDLE_LENGTH; @@ -250,6 +252,37 @@ decl_module! { Self::_change_member_handle(member_id, handle)?; } } + + pub fn add_screened_member(origin, new_member: T::AccountId, user_info: UserInfo) { + // ensure sender is screening authority + let sender = ensure_signed(origin)?; + + if let Some(screening_authority) = Self::screening_authority() { + ensure!(sender == screening_authority, "not screener"); + } else { + // no screening authority defined. Cannot accept this request + return Err("no screening authority defined"); + } + + // make sure we are accepting new memberships + ensure!(Self::new_memberships_allowed(), "new members not allowed"); + + // ensure key not associated with an existing membership + Self::ensure_not_member(&new_member)?; + + let user_info = Self::check_user_registration_info(user_info)?; + + // ensure handle is not already registered + Self::ensure_unique_handle(&user_info.handle)?; + + let member_id = Self::insert_new_screened_member(sender, &new_member, &user_info); + + Self::deposit_event(RawEvent::MemberRegistered(member_id, new_member.clone())); + } + + pub fn set_screening_authority(authority: T::AccountId) { + >::put(authority); + } } } @@ -347,6 +380,30 @@ impl Module { new_member_id } + fn insert_new_screened_member(authority: T::AccountId, who: &T::AccountId, user_info: &CheckedUserInfo) -> T::MemberId { + let new_member_id = Self::next_member_id(); + + let profile: Profile = Profile { + id: new_member_id, + handle: user_info.handle.clone(), + avatar_uri: user_info.avatar_uri.clone(), + about: user_info.about.clone(), + registered_at_block: >::block_number(), + registered_at_time: >::now(), + entry: EntryMethod::Screening(authority), + suspended: false, + subscription: None, + }; + + >::insert(who.clone(), new_member_id); + >::insert(new_member_id, who.clone()); + >::insert(new_member_id, profile); + >::insert(user_info.handle.clone(), new_member_id); + >::mutate(|n| { *n += T::MemberId::sa(1); }); + + new_member_id + } + fn _change_member_about_text (id: T::MemberId, text: &Vec) -> dispatch::Result { let mut profile = Self::ensure_profile(id)?; let text = Self::validate_text(text); diff --git a/src/membership/tests.rs b/src/membership/tests.rs index c4f842403c..0de04124a3 100644 --- a/src/membership/tests.rs +++ b/src/membership/tests.rs @@ -184,3 +184,23 @@ fn update_profile() { }); } +#[test] +fn add_screened_member() { + with_externalities(&mut ExtBuilder::default().build(), || + { + let screening_authority = 5; + >::put(&screening_authority); + + assert_ok!(Membership::add_screened_member(Origin::signed(screening_authority), ALICE_ACCOUNT_ID, get_alice_info())); + + let member_id = assert_ok_unwrap(Membership::member_id_by_account_id(&ALICE_ACCOUNT_ID), "member id not assigned"); + + let profile = assert_ok_unwrap(Membership::member_profile(&member_id), "member profile created"); + + assert_eq!(Some(profile.handle), get_alice_info().handle); + assert_eq!(Some(profile.avatar_uri), get_alice_info().avatar_uri); + assert_eq!(Some(profile.about), get_alice_info().about); + assert_eq!(registry::EntryMethod::Screening(screening_authority), profile.entry); + + }); +} From d09cfbc70c397b7431923d3d6f46431584ca21b1 Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Fri, 22 Mar 2019 08:56:09 +0200 Subject: [PATCH 032/175] refactor IsActiveMember trait to Members --- src/governance/election.rs | 6 +++--- src/governance/mock.rs | 10 +++------- src/governance/proposals.rs | 16 ++++++---------- src/lib.rs | 4 ++-- src/traits.rs | 4 ++-- 5 files changed, 16 insertions(+), 24 deletions(-) diff --git a/src/governance/election.rs b/src/governance/election.rs index e6d0f109e7..0cc47a5c49 100644 --- a/src/governance/election.rs +++ b/src/governance/election.rs @@ -17,14 +17,14 @@ use super::sealed_vote::SealedVote; pub use super::{ GovernanceCurrency, BalanceOf }; use super::council; -use crate::traits::{IsActiveMember}; +use crate::traits::{Members}; pub trait Trait: system::Trait + council::Trait + GovernanceCurrency { type Event: From> + Into<::Event>; type CouncilElected: CouncilElected>, Self::BlockNumber>; - type IsActiveMember: IsActiveMember; + type Members: Members; } #[derive(Clone, Copy, Encode, Decode)] @@ -154,7 +154,7 @@ impl Module { fn can_participate(sender: &T::AccountId) -> bool { - !T::Currency::free_balance(sender).is_zero() && T::IsActiveMember::is_active_member(sender) + !T::Currency::free_balance(sender).is_zero() && T::Members::is_active_member(sender) } // PUBLIC IMMUTABLES diff --git a/src/governance/mock.rs b/src/governance/mock.rs index ce5bb9bd4a..5f9025b0fa 100644 --- a/src/governance/mock.rs +++ b/src/governance/mock.rs @@ -18,12 +18,8 @@ impl_outer_origin! { pub enum Origin for Test {} } -pub struct AnyAccountIsMember {} -impl traits::IsActiveMember for AnyAccountIsMember { - fn is_active_member(who: &T::AccountId) -> bool { - true - } -} +pub struct MockMembers {} +impl traits::Members for MockMembers {} // default implementation // default trait implementation - any account is not a member // impl traits::IsActiveMember for () {} @@ -65,7 +61,7 @@ impl election::Trait for Test { type CouncilElected = (Council,); - type IsActiveMember = AnyAccountIsMember; + type Members = MockMembers; } impl balances::Trait for Test { diff --git a/src/governance/proposals.rs b/src/governance/proposals.rs index 58878dc9e9..1e9482511a 100644 --- a/src/governance/proposals.rs +++ b/src/governance/proposals.rs @@ -8,7 +8,7 @@ use rstd::prelude::*; use super::council; pub use super::{ GovernanceCurrency, BalanceOf }; -use crate::traits::{IsActiveMember}; +use crate::traits::{Members}; const DEFAULT_APPROVAL_QUORUM: u32 = 60; const DEFAULT_MIN_STAKE: u64 = 100; @@ -117,7 +117,7 @@ pub trait Trait: timestamp::Trait + council::Trait + GovernanceCurrency { /// The overarching event type. type Event: From> + Into<::Event>; - type IsActiveMember: IsActiveMember; + type Members: Members; } decl_event!( @@ -349,7 +349,7 @@ impl Module { } fn can_participate(sender: T::AccountId) -> bool { - !T::Currency::free_balance(&sender).is_zero() && T::IsActiveMember::is_active_member(&sender) + !T::Currency::free_balance(&sender).is_zero() && T::Members::is_active_member(&sender) } fn is_councilor(sender: &T::AccountId) -> bool { @@ -615,15 +615,11 @@ mod tests { impl Trait for Test { type Event = (); - type IsActiveMember = AnyAccountIsMember; + type Members = MockMembership; } - pub struct AnyAccountIsMember {} - impl IsActiveMember for AnyAccountIsMember { - fn is_active_member(who: &T::AccountId) -> bool { - true - } - } + pub struct MockMembership {} + impl Members for MockMembership {} // default implementation type System = system::Module; type Balances = balances::Module; diff --git a/src/lib.rs b/src/lib.rs index 93e6ba1afc..3b4ba8f8fa 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -212,13 +212,13 @@ impl governance::GovernanceCurrency for Runtime { impl governance::proposals::Trait for Runtime { type Event = Event; - type IsActiveMember = Membership; + type Members = Membership; } impl governance::election::Trait for Runtime { type Event = Event; type CouncilElected = (Council,); - type IsActiveMember = Membership; + type Members = Membership; } impl governance::council::Trait for Runtime { diff --git a/src/traits.rs b/src/traits.rs index 8b24b830da..1aedc627c3 100644 --- a/src/traits.rs +++ b/src/traits.rs @@ -2,8 +2,8 @@ use system; -pub trait IsActiveMember { +pub trait Members { fn is_active_member(account_id: &T::AccountId) -> bool { - false + true } } \ No newline at end of file From af5863075a640a33e6c07dcfaafc54dadc81c9ff Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Fri, 22 Mar 2019 10:51:35 +0200 Subject: [PATCH 033/175] staked roles --- src/governance/mock.rs | 8 ++- src/governance/proposals.rs | 4 +- src/lib.rs | 12 +++- src/membership/registry.rs | 15 ++++- src/roles/actors.rs | 128 ++++++++++++++++++++++++++++++++++++ src/roles/mod.rs | 6 ++ src/traits.rs | 10 +++ 7 files changed, 175 insertions(+), 8 deletions(-) create mode 100644 src/roles/actors.rs create mode 100644 src/roles/mod.rs diff --git a/src/governance/mock.rs b/src/governance/mock.rs index 5f9025b0fa..6929474c9c 100644 --- a/src/governance/mock.rs +++ b/src/governance/mock.rs @@ -18,8 +18,10 @@ impl_outer_origin! { pub enum Origin for Test {} } -pub struct MockMembers {} -impl traits::Members for MockMembers {} // default implementation +pub struct MockMembership {} +impl traits::Members for MockMembership { + type Id = u32; +} // default trait implementation - any account is not a member // impl traits::IsActiveMember for () {} @@ -61,7 +63,7 @@ impl election::Trait for Test { type CouncilElected = (Council,); - type Members = MockMembers; + type Members = MockMembership; } impl balances::Trait for Test { diff --git a/src/governance/proposals.rs b/src/governance/proposals.rs index 1e9482511a..892d355c52 100644 --- a/src/governance/proposals.rs +++ b/src/governance/proposals.rs @@ -619,7 +619,9 @@ mod tests { } pub struct MockMembership {} - impl Members for MockMembership {} // default implementation + impl Members for MockMembership { + type Id = u32; + } type System = system::Module; type Balances = balances::Module; diff --git a/src/lib.rs b/src/lib.rs index 3b4ba8f8fa..0ea2c94861 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -21,6 +21,8 @@ mod membership; use membership::registry; mod traits; mod migration; +mod roles; +use roles::actors; use rstd::prelude::*; #[cfg(feature = "std")] @@ -180,11 +182,11 @@ impl balances::Trait for Runtime { /// The type for recording an account's balance. type Balance = u128; /// What to do if an account's free balance gets zeroed. - type OnFreeBalanceZero = Staking; + type OnFreeBalanceZero = Staking; // + roles /// What to do if a new account is created. type OnNewAccount = Indices; /// Restrict whether an account can transfer funds. We don't place any further restrictions. - type EnsureAccountLiquid = Staking; + type EnsureAccountLiquid = Staking; // Change this to look at both staking and roles::actors /// The uniquitous event type. type Event = Event; } @@ -241,6 +243,11 @@ impl migration::Trait for Runtime { type Event = Event; } +impl actors::Trait for Runtime { + type Event = Event; + type Members = Membership; +} + construct_runtime!( pub enum Runtime with Log(InternalLog: DigestItem) where Block = Block, @@ -263,6 +270,7 @@ construct_runtime!( Memo: memo::{Module, Call, Storage, Event}, Membership: registry::{Module, Call, Storage, Event, Config}, Migration: migration::{Module, Call, Storage, Event}, + Actors: actors::{Module, Call, Storage, Event}, } ); diff --git a/src/membership/registry.rs b/src/membership/registry.rs index a088ce275a..65aa8021c5 100644 --- a/src/membership/registry.rs +++ b/src/membership/registry.rs @@ -173,7 +173,9 @@ impl Module { } } -impl traits::IsActiveMember for Module { +impl traits::Members for Module { + type Id = T::MemberId; + fn is_active_member(who: &T::AccountId) -> bool { match Self::ensure_is_member(who) .and_then(|member_id| Self::ensure_profile(member_id)) @@ -182,6 +184,11 @@ impl traits::IsActiveMember for Module { Err(err) => false } } + + fn lookup_member_id(who: &T::AccountId) -> Result { + let id = Self::ensure_is_member(who)?; + Ok(id) + } } decl_module! { @@ -198,6 +205,8 @@ decl_module! { // ensure key not associated with an existing membership Self::ensure_not_member(&who)?; + // ensure account is not in a bonded role + // ensure paid_terms_id is active let terms = Self::ensure_active_terms_id(paid_terms_id)?; @@ -270,6 +279,8 @@ decl_module! { // ensure key not associated with an existing membership Self::ensure_not_member(&new_member)?; + // ensure account is not in a bonded role + let user_info = Self::check_user_registration_info(user_info)?; // ensure handle is not already registered @@ -292,7 +303,7 @@ impl Module { Ok(()) } - fn ensure_is_member(who: &T::AccountId) -> Result { + pub fn ensure_is_member(who: &T::AccountId) -> Result { let member_id = Self::member_id_by_account_id(who).ok_or("no member id found for accountid")?; Ok(member_id) } diff --git a/src/roles/actors.rs b/src/roles/actors.rs new file mode 100644 index 0000000000..b7bed380c6 --- /dev/null +++ b/src/roles/actors.rs @@ -0,0 +1,128 @@ +#![cfg_attr(not(feature = "std"), no_std)] + +use rstd::prelude::*; +use parity_codec::Codec; +use parity_codec_derive::{Encode, Decode}; +use srml_support::{StorageMap, StorageValue, dispatch, decl_module, decl_storage, decl_event, ensure, Parameter}; +use srml_support::traits::{Currency}; +use runtime_primitives::traits::{Zero, Bounded, SimpleArithmetic, As, Member, MaybeSerializeDebug}; +use system::{self, ensure_signed}; +use crate::governance::{GovernanceCurrency, BalanceOf }; +use crate::membership::registry; + +use crate::traits::{Members}; + +#[derive(Encode, Decode, Copy, Clone, Eq, PartialEq, Debug)] +pub enum Role { + Storage, +} + +#[derive(Encode, Decode, Clone)] +pub struct RoleParameters { + min_stake: BalanceOf, + max_actors: u32, + // minimum actors to maintain - if role is unstaking + // and remaining actors would be less that this value - prevent or punish for unstaking + min_actors: u32, + // fixed amount of tokens paid to actors' primary account + reward_per_block: BalanceOf, + // payouts are made at this block interval + reward_period: T::BlockNumber, + unbonding_period: T::BlockNumber, + // "startup" time allowed for roles that need to sync their infrastructure + // with other providers before they are considered in service and punishable for + // not delivering required level of service. + //startup_grace_period: T::BlockNumber, +} + +#[derive(Encode, Decode, Clone)] +pub struct Actor { + member_id: >::Id, + role: Role, + role_key: T::AccountId, + joined_at: T::BlockNumber, + //startup_grace_period_ends_at: T::BlockNumber, +} + +pub trait Trait: system::Trait + GovernanceCurrency { + type Event: From> + Into<::Event>; + + type Members: Members; +} + +decl_storage! { + trait Store for Module as Actors { + /// requirements to enter and maintain status in roles + Parameters get(parameters) : map Role => Option>; + + /// roles members can enter into + AvailableRoles get(available_roles) : Vec = vec![Role::Storage]; + + /// role keys mapped to their actor + Actors get(actors) : map T::AccountId => Option>; + + /// active actors for each role + ActorsByRole get(actors_by_role) : map Role => Vec; + + /// role keys associated with a member id + MemberRoleKeys get(member_role_keys) : map >::Id => Vec; + + /// tokens bonded until given block number + Bondage get(bondage) : map T::AccountId => T::BlockNumber; + } +} + +decl_event! { + pub enum Event where + ::AccountId { + ActorJoined(AccountId, Role), + } +} + +impl Module { + fn role_is_available(role: Role) -> bool { + Self::available_roles().into_iter().any(|r| role == r) + } +} + +decl_module! { + pub struct Module for enum Call where origin: T::Origin { + fn deposit_event() = default; + + /// Member staking to enter a role + pub fn stake(origin, role: Role, role_key: T::AccountId) { + let sender = ensure_signed(origin)?; + let member_id = T::Members::lookup_member_id(&sender)?; + ensure!(!>::exists(&sender), ""); + + ensure!(Self::role_is_available(role), ""); + + let role_parameters = Self::parameters(role); + ensure!(role_parameters.is_some(), ""); + let role_parameters = role_parameters.unwrap(); + + let actors_in_role = Self::actors_by_role(role); + + // ensure there is an empty slot for the role + ensure!(actors_in_role.len() < role_parameters.max_actors as usize, ""); + + // ensure the role key has enough balance + ensure!(T::Currency::free_balance(&role_key) >= role_parameters.min_stake, ""); + + >::mutate(role, |actors| actors.push(role_key.clone())); + >::mutate(&member_id, |keys| keys.push(role_key.clone())); + >::insert(&role_key, T::BlockNumber::max_value()); + >::insert(&role_key, Actor { + member_id, + role_key: role_key.clone(), + role, + joined_at: >::block_number() + }); + + Self::deposit_event(RawEvent::ActorJoined(role_key, role)); + } + + // pub fn set_role_parameters(role: Role, params: RoleParameters) {} + // pub fn set_available_roles(Vec) {} + } +} \ No newline at end of file diff --git a/src/roles/mod.rs b/src/roles/mod.rs new file mode 100644 index 0000000000..c878c3a215 --- /dev/null +++ b/src/roles/mod.rs @@ -0,0 +1,6 @@ +#![cfg_attr(not(feature = "std"), no_std)] + +pub mod actors; + +//mod mock; +//mod tests; \ No newline at end of file diff --git a/src/traits.rs b/src/traits.rs index 1aedc627c3..cefa908ec5 100644 --- a/src/traits.rs +++ b/src/traits.rs @@ -1,9 +1,19 @@ #![cfg_attr(not(feature = "std"), no_std)] use system; +use parity_codec::Codec; +use srml_support::{Parameter}; +use runtime_primitives::traits::{SimpleArithmetic, As, Member, MaybeSerializeDebug}; pub trait Members { + type Id : Parameter + Member + SimpleArithmetic + Codec + Default + Copy + + As + As + MaybeSerializeDebug + PartialEq; + fn is_active_member(account_id: &T::AccountId) -> bool { true } + + fn lookup_member_id(account_id: &T::AccountId) -> Result { + Err("member not found") + } } \ No newline at end of file From d46fc636596dab36646f3a2902a47ae900b0edc6 Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Fri, 22 Mar 2019 12:41:21 +0200 Subject: [PATCH 034/175] update Members and Roles traits --- src/governance/mock.rs | 16 +++++++++++----- src/governance/proposals.rs | 29 +++++++++++++++++++---------- src/lib.rs | 1 + src/membership/mock.rs | 1 + src/membership/registry.rs | 8 ++++++-- src/roles/actors.rs | 8 +++++++- src/traits.rs | 20 ++++++++++++++++++-- 7 files changed, 63 insertions(+), 20 deletions(-) diff --git a/src/governance/mock.rs b/src/governance/mock.rs index 6929474c9c..8cd1a604f2 100644 --- a/src/governance/mock.rs +++ b/src/governance/mock.rs @@ -3,7 +3,7 @@ use rstd::prelude::*; pub use super::{election, council, proposals, GovernanceCurrency}; pub use system; -use crate::traits; +use crate::traits::{Members}; pub use primitives::{H256, Blake2Hasher}; pub use runtime_primitives::{ @@ -19,13 +19,19 @@ impl_outer_origin! { } pub struct MockMembership {} -impl traits::Members for MockMembership { +impl Members for MockMembership { type Id = u32; + fn is_active_member(who: &T::AccountId) -> bool { + // all accounts are considered members. + // There is currently no test coverage for non-members. + // Should add some coverage, and update this method to reflect which accounts are or are not members + true + } + fn lookup_member_id(account_id: &T::AccountId) -> Result { + Err("not implemented!") + } } -// default trait implementation - any account is not a member -// impl traits::IsActiveMember for () {} - // For testing the module, we construct most of a mock runtime. This means // first constructing a configuration type (`Test`) which `impl`s each of the // configuration traits of modules we want to use. diff --git a/src/governance/proposals.rs b/src/governance/proposals.rs index 892d355c52..de3a69b93f 100644 --- a/src/governance/proposals.rs +++ b/src/governance/proposals.rs @@ -1,4 +1,4 @@ -use srml_support::{StorageValue, StorageMap, dispatch::Result, decl_module, decl_event, decl_storage, ensure}; +use srml_support::{StorageValue, StorageMap, dispatch, decl_module, decl_event, decl_storage, ensure}; use srml_support::traits::{Currency}; use primitives::{storage::well_known_keys}; use runtime_primitives::traits::{As, Hash, Zero}; @@ -368,7 +368,7 @@ impl Module { Self::current_block() >= proposed_at + Self::voting_period() } - fn _process_vote(voter: T::AccountId, proposal_id: u32, vote: VoteKind) -> Result { + fn _process_vote(voter: T::AccountId, proposal_id: u32, vote: VoteKind) -> dispatch::Result { let new_vote = (voter.clone(), vote.clone()); if >::exists(proposal_id) { // Append a new vote to other votes on this proposal: @@ -382,7 +382,7 @@ impl Module { Ok(()) } - fn end_block(now: T::BlockNumber) -> Result { + fn end_block(now: T::BlockNumber) -> dispatch::Result { // TODO refactor this method @@ -395,7 +395,7 @@ impl Module { } /// Get the voters for the current proposal. - pub fn tally(/* proposal_id: u32 */) -> Result { + pub fn tally(/* proposal_id: u32 */) -> dispatch::Result { let councilors: u32 = Self::councilors_count(); let quorum: u32 = Self::approval_quorum_seats(); @@ -475,7 +475,7 @@ impl Module { } /// Updates proposal status and removes proposal from active ids. - fn _update_proposal_status(proposal_id: u32, new_status: ProposalStatus) -> Result { + fn _update_proposal_status(proposal_id: u32, new_status: ProposalStatus) -> dispatch::Result { let all_active_ids = Self::active_proposal_ids(); let all_len = all_active_ids.len(); let other_active_ids: Vec = all_active_ids @@ -503,7 +503,7 @@ impl Module { } /// Slash a proposal. The staked deposit will be slashed. - fn _slash_proposal(proposal_id: u32) -> Result { + fn _slash_proposal(proposal_id: u32) -> dispatch::Result { let proposal = Self::proposals(proposal_id); // Slash proposer's stake: @@ -513,7 +513,7 @@ impl Module { } /// Reject a proposal. The staked deposit will be returned to a proposer. - fn _reject_proposal(proposal_id: u32) -> Result { + fn _reject_proposal(proposal_id: u32) -> dispatch::Result { let proposal = Self::proposals(proposal_id); let proposer = proposal.proposer; @@ -529,7 +529,7 @@ impl Module { } /// Approve a proposal. The staked deposit will be returned. - fn _approve_proposal(proposal_id: u32) -> Result { + fn _approve_proposal(proposal_id: u32) -> dispatch::Result { let proposal = Self::proposals(proposal_id); let wasm_code = Self::wasm_code_by_hash(proposal.wasm_hash); @@ -621,6 +621,15 @@ mod tests { pub struct MockMembership {} impl Members for MockMembership { type Id = u32; + fn is_active_member(who: &T::AccountId) -> bool { + // all accounts are considered members. + // There is currently no test coverage for non-members. + // Should add some coverage, and update this method to reflect which accounts are or are not members + true + } + fn lookup_member_id(account_id: &T::AccountId) -> Result { + Err("not implemented!") + } } type System = system::Module; @@ -714,7 +723,7 @@ mod tests { b"Proposal Wasm Code".to_vec() } - fn _create_default_proposal() -> Result { + fn _create_default_proposal() -> dispatch::Result { _create_proposal(None, None, None, None, None) } @@ -724,7 +733,7 @@ mod tests { name: Option>, description: Option>, wasm_code: Option> - ) -> Result { + ) -> dispatch::Result { Proposals::create_proposal( Origin::signed(origin.unwrap_or(PROPOSER1)), stake.unwrap_or(min_stake()), diff --git a/src/lib.rs b/src/lib.rs index 0ea2c94861..d042139edb 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -237,6 +237,7 @@ impl membership::registry::Trait for Runtime { type MemberId = u64; type PaidTermId = u64; type SubscriptionId = u64; + type Roles = Actors; } impl migration::Trait for Runtime { diff --git a/src/membership/mock.rs b/src/membership/mock.rs index c85efaf4c6..0d05bb03b2 100644 --- a/src/membership/mock.rs +++ b/src/membership/mock.rs @@ -74,6 +74,7 @@ impl registry::Trait for Test { type MemberId = u32; type PaidTermId = u32; type SubscriptionId = u32; + type Roles = (); } pub struct ExtBuilder { diff --git a/src/membership/registry.rs b/src/membership/registry.rs index 65aa8021c5..af8f1d5a53 100644 --- a/src/membership/registry.rs +++ b/src/membership/registry.rs @@ -9,7 +9,7 @@ use runtime_primitives::traits::{Zero, SimpleArithmetic, As, Member, MaybeSerial use system::{self, ensure_signed}; use crate::governance::{GovernanceCurrency, BalanceOf }; use {timestamp}; -use crate::traits; +use crate::traits::{Members, Roles}; pub trait Trait: system::Trait + GovernanceCurrency + timestamp::Trait { type Event: From> + Into<::Event>; @@ -22,6 +22,8 @@ pub trait Trait: system::Trait + GovernanceCurrency + timestamp::Trait { type SubscriptionId: Parameter + Member + SimpleArithmetic + Codec + Default + Copy + As + As + MaybeSerializeDebug + PartialEq; + + type Roles: Roles; } const DEFAULT_FIRST_MEMBER_ID: u64 = 1; @@ -173,7 +175,7 @@ impl Module { } } -impl traits::Members for Module { +impl Members for Module { type Id = T::MemberId; fn is_active_member(who: &T::AccountId) -> bool { @@ -206,6 +208,7 @@ decl_module! { Self::ensure_not_member(&who)?; // ensure account is not in a bonded role + ensure!(!T::Roles::is_role_key(&who), "role key cannot be used for membership"); // ensure paid_terms_id is active let terms = Self::ensure_active_terms_id(paid_terms_id)?; @@ -280,6 +283,7 @@ decl_module! { Self::ensure_not_member(&new_member)?; // ensure account is not in a bonded role + ensure!(!T::Roles::is_role_key(&new_member), "role key cannot be used for membership"); let user_info = Self::check_user_registration_info(user_info)?; diff --git a/src/roles/actors.rs b/src/roles/actors.rs index b7bed380c6..728a695bd1 100644 --- a/src/roles/actors.rs +++ b/src/roles/actors.rs @@ -10,7 +10,7 @@ use system::{self, ensure_signed}; use crate::governance::{GovernanceCurrency, BalanceOf }; use crate::membership::registry; -use crate::traits::{Members}; +use crate::traits::{Members, Roles}; #[derive(Encode, Decode, Copy, Clone, Eq, PartialEq, Debug)] pub enum Role { @@ -85,6 +85,12 @@ impl Module { } } +impl Roles for Module { + fn is_role_key(account_id: &T::AccountId) -> bool { + Self::actors(account_id).is_some() + } +} + decl_module! { pub struct Module for enum Call where origin: T::Origin { fn deposit_event() = default; diff --git a/src/traits.rs b/src/traits.rs index cefa908ec5..06d59512cd 100644 --- a/src/traits.rs +++ b/src/traits.rs @@ -5,15 +5,31 @@ use parity_codec::Codec; use srml_support::{Parameter}; use runtime_primitives::traits::{SimpleArithmetic, As, Member, MaybeSerializeDebug}; +// Members pub trait Members { type Id : Parameter + Member + SimpleArithmetic + Codec + Default + Copy + As + As + MaybeSerializeDebug + PartialEq; + fn is_active_member(account_id: &T::AccountId) -> bool; + + fn lookup_member_id(account_id: &T::AccountId) -> Result; +} + +impl Members for () { + type Id = u32; fn is_active_member(account_id: &T::AccountId) -> bool { - true + false } - fn lookup_member_id(account_id: &T::AccountId) -> Result { Err("member not found") } +} + +// Roles +pub trait Roles { + fn is_role_key(account_id: &T::AccountId) -> bool; +} + +impl Roles for () { + fn is_role_key(_who: &T::AccountId) -> bool { false } } \ No newline at end of file From 14f7cf5b18b821c55ebd45bf5a38382af65e0ec8 Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Fri, 22 Mar 2019 13:16:19 +0200 Subject: [PATCH 035/175] staked role accounts illiquid --- src/lib.rs | 4 ++-- src/roles/actors.rs | 12 +++++++++++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index d042139edb..8bb3f8e333 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -182,11 +182,11 @@ impl balances::Trait for Runtime { /// The type for recording an account's balance. type Balance = u128; /// What to do if an account's free balance gets zeroed. - type OnFreeBalanceZero = Staking; // + roles + type OnFreeBalanceZero = Staking; /// What to do if a new account is created. type OnNewAccount = Indices; /// Restrict whether an account can transfer funds. We don't place any further restrictions. - type EnsureAccountLiquid = Staking; // Change this to look at both staking and roles::actors + type EnsureAccountLiquid = (Staking, Actors); /// The uniquitous event type. type Event = Event; } diff --git a/src/roles/actors.rs b/src/roles/actors.rs index 728a695bd1..d0b95d9394 100644 --- a/src/roles/actors.rs +++ b/src/roles/actors.rs @@ -4,7 +4,7 @@ use rstd::prelude::*; use parity_codec::Codec; use parity_codec_derive::{Encode, Decode}; use srml_support::{StorageMap, StorageValue, dispatch, decl_module, decl_storage, decl_event, ensure, Parameter}; -use srml_support::traits::{Currency}; +use srml_support::traits::{Currency, EnsureAccountLiquid}; use runtime_primitives::traits::{Zero, Bounded, SimpleArithmetic, As, Member, MaybeSerializeDebug}; use system::{self, ensure_signed}; use crate::governance::{GovernanceCurrency, BalanceOf }; @@ -131,4 +131,14 @@ decl_module! { // pub fn set_role_parameters(role: Role, params: RoleParameters) {} // pub fn set_available_roles(Vec) {} } +} + +impl EnsureAccountLiquid for Module { + fn ensure_account_liquid(who: &T::AccountId) -> dispatch::Result { + if Self::bondage(who) <= >::block_number() { + Ok(()) + } else { + Err("cannot transfer illiquid funds") + } + } } \ No newline at end of file From c1a06772aeef0048eee707b813dbd7c90647b2b3 Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Fri, 22 Mar 2019 18:58:04 +0200 Subject: [PATCH 036/175] refactored staked roles --- src/membership/registry.rs | 4 +- src/roles/actors.rs | 157 +++++++++++++++++++++++++++++-------- src/traits.rs | 4 +- 3 files changed, 130 insertions(+), 35 deletions(-) diff --git a/src/membership/registry.rs b/src/membership/registry.rs index af8f1d5a53..c20377ee4f 100644 --- a/src/membership/registry.rs +++ b/src/membership/registry.rs @@ -208,7 +208,7 @@ decl_module! { Self::ensure_not_member(&who)?; // ensure account is not in a bonded role - ensure!(!T::Roles::is_role_key(&who), "role key cannot be used for membership"); + ensure!(!T::Roles::is_role_account(&who), "role key cannot be used for membership"); // ensure paid_terms_id is active let terms = Self::ensure_active_terms_id(paid_terms_id)?; @@ -283,7 +283,7 @@ decl_module! { Self::ensure_not_member(&new_member)?; // ensure account is not in a bonded role - ensure!(!T::Roles::is_role_key(&new_member), "role key cannot be used for membership"); + ensure!(!T::Roles::is_role_account(&new_member), "role key cannot be used for membership"); let user_info = Self::check_user_registration_info(user_info)?; diff --git a/src/roles/actors.rs b/src/roles/actors.rs index d0b95d9394..3de8cec77b 100644 --- a/src/roles/actors.rs +++ b/src/roles/actors.rs @@ -19,29 +19,46 @@ pub enum Role { #[derive(Encode, Decode, Clone)] pub struct RoleParameters { + // minium balance required to stake to enter a role min_stake: BalanceOf, + + // the maximum number of spots available to fill for a role max_actors: u32, + // minimum actors to maintain - if role is unstaking // and remaining actors would be less that this value - prevent or punish for unstaking min_actors: u32, + // fixed amount of tokens paid to actors' primary account reward_per_block: BalanceOf, + // payouts are made at this block interval reward_period: T::BlockNumber, + + // how long tokens remain locked for after unstaking unbonding_period: T::BlockNumber, + + // minimum amount of time before being able to unstake + bonding_time: T::BlockNumber, + + // minimum period required to be in service. unbonding before this time is highly penalized + min_service_period: T::BlockNumber, + // "startup" time allowed for roles that need to sync their infrastructure // with other providers before they are considered in service and punishable for // not delivering required level of service. - //startup_grace_period: T::BlockNumber, + startup_grace_period: T::BlockNumber, + + // entry_request_fee: BalanceOf, } #[derive(Encode, Decode, Clone)] pub struct Actor { member_id: >::Id, role: Role, - role_key: T::AccountId, + account: T::AccountId, joined_at: T::BlockNumber, - //startup_grace_period_ends_at: T::BlockNumber, + // startup_grace_period_ends_at: T::BlockNumber, } pub trait Trait: system::Trait + GovernanceCurrency { @@ -55,27 +72,35 @@ decl_storage! { /// requirements to enter and maintain status in roles Parameters get(parameters) : map Role => Option>; - /// roles members can enter into - AvailableRoles get(available_roles) : Vec = vec![Role::Storage]; + /// the roles members can enter into + AvailableRoles get(available_roles) : Vec; // = vec![Role::Storage]; - /// role keys mapped to their actor + /// actor accounts mapped to their actor Actors get(actors) : map T::AccountId => Option>; - /// active actors for each role - ActorsByRole get(actors_by_role) : map Role => Vec; + /// actor accounts associated with a role + AccountsByRole get(accounts_by_role) : map Role => Vec; - /// role keys associated with a member id - MemberRoleKeys get(member_role_keys) : map >::Id => Vec; + /// actor accounts associated with a member id + AccountsByMember get(accounts_by_member) : map >::Id => Vec; - /// tokens bonded until given block number + /// tokens locked until given block number Bondage get(bondage) : map T::AccountId => T::BlockNumber; + + /// First step before enter a role is registering intent with a new account/key. + /// This is done by sending a role_entry_request() from the new account. + /// The member must then send a stake() transaction to approve the request and enter the desired role. + /// This list is cleared every N blocks.. the account making the request will be bonded and must have + /// sufficient balance to cover the minimum stake for the role. + /// Bonding only occurs after successful entry into a role. + RoleEntryRequests get(role_entry_requests) : map T::AccountId => Option<(>::Id, Role)>; } } decl_event! { pub enum Event where ::AccountId { - ActorJoined(AccountId, Role), + Staked(AccountId, Role), } } @@ -83,11 +108,30 @@ impl Module { fn role_is_available(role: Role) -> bool { Self::available_roles().into_iter().any(|r| role == r) } + + fn ensure_actor(role_key: &T::AccountId) -> Result, &'static str> { + Self::actors(role_key).ok_or("not role key") + } + + fn ensure_actor_is_member(role_key: &T::AccountId, member_id: >::Id) + -> Result, &'static str> + { + let actor = Self::ensure_actor(role_key)?; + if actor.member_id == member_id { + Ok(actor) + } else { + Err("actor not owned by member") + } + } + + fn ensure_role_parameters(role: Role) -> Result, &'static str> { + Self::parameters(role).ok_or("no parameters for role") + } } impl Roles for Module { - fn is_role_key(account_id: &T::AccountId) -> bool { - Self::actors(account_id).is_some() + fn is_role_account(account_id: &T::AccountId) -> bool { + >::exists(account_id) || >::exists(account_id) || >::exists(account_id) } } @@ -95,37 +139,88 @@ decl_module! { pub struct Module for enum Call where origin: T::Origin { fn deposit_event() = default; - /// Member staking to enter a role - pub fn stake(origin, role: Role, role_key: T::AccountId) { + fn on_finalize(now: T::BlockNumber) { + // clear >::kill() every N blocks + + // payout rewards to actors + + // clear unbonded accounts + } + + pub fn role_entry_request(origin, role: Role, member_id: >::Id) { + let sender = ensure_signed(origin)?; + + ensure!(T::Members::lookup_member_id(&sender).is_err(), "account is a member"); + ensure!(!Self::is_role_account(&sender), "account already used"); + + ensure!(Self::role_is_available(role), "inactive role"); + + let role_parameters = Self::ensure_role_parameters(role)?; + + >::insert(&sender, (member_id, role)); + } + + /// Member activating entry request + pub fn stake(origin, role: Role, actor_account: T::AccountId) { let sender = ensure_signed(origin)?; let member_id = T::Members::lookup_member_id(&sender)?; - ensure!(!>::exists(&sender), ""); - ensure!(Self::role_is_available(role), ""); + ensure!(>::exists(&actor_account), "no role entry request matches"); + if let Some(entry_request) = Self::role_entry_requests(&actor_account) { + ensure!(entry_request.0 == member_id, "role entry mismatch - member id"); + ensure!(entry_request.1 == role, "role entry mismatch - role"); + } - let role_parameters = Self::parameters(role); - ensure!(role_parameters.is_some(), ""); - let role_parameters = role_parameters.unwrap(); + // make sure role is still available + ensure!(Self::role_is_available(role), ""); + let role_parameters = Self::ensure_role_parameters(role)?; - let actors_in_role = Self::actors_by_role(role); + let accounts_in_role = Self::accounts_by_role(role); // ensure there is an empty slot for the role - ensure!(actors_in_role.len() < role_parameters.max_actors as usize, ""); + ensure!(accounts_in_role.len() < role_parameters.max_actors as usize, "role slots full"); - // ensure the role key has enough balance - ensure!(T::Currency::free_balance(&role_key) >= role_parameters.min_stake, ""); + // ensure the actor account has enough balance + ensure!(T::Currency::free_balance(&actor_account) >= role_parameters.min_stake, ""); - >::mutate(role, |actors| actors.push(role_key.clone())); - >::mutate(&member_id, |keys| keys.push(role_key.clone())); - >::insert(&role_key, T::BlockNumber::max_value()); - >::insert(&role_key, Actor { + >::mutate(role, |accounts| accounts.push(actor_account.clone())); + >::mutate(&member_id, |accounts| accounts.push(actor_account.clone())); + >::insert(&actor_account, T::BlockNumber::max_value()); + >::insert(&actor_account, Actor { member_id, - role_key: role_key.clone(), + account: actor_account.clone(), role, joined_at: >::block_number() }); + >::remove(&actor_account); + + Self::deposit_event(RawEvent::Staked(actor_account, role)); + } + + pub fn unstake(origin, actor_account: T::AccountId) { + let sender = ensure_signed(origin)?; + let member_id = T::Members::lookup_member_id(&sender)?; + + let actor = Self::ensure_actor_is_member(&actor_account, member_id)?; + + let role_parameters = Self::ensure_role_parameters(actor.role)?; + + // simple unstaking ...only applying unbonding period + let accounts: Vec = Self::accounts_by_role(actor.role) + .into_iter() + .filter(|account| !(*account == actor.account)) + .collect(); + >::insert(actor.role, accounts); + + let accounts: Vec = Self::accounts_by_member(&member_id) + .into_iter() + .filter(|account| !(*account == actor.account)) + .collect(); + >::insert(&member_id, accounts); + + >::insert(&actor_account, >::block_number() + role_parameters.unbonding_period); - Self::deposit_event(RawEvent::ActorJoined(role_key, role)); + >::remove(&actor_account); } // pub fn set_role_parameters(role: Role, params: RoleParameters) {} diff --git a/src/traits.rs b/src/traits.rs index 06d59512cd..46d3db8671 100644 --- a/src/traits.rs +++ b/src/traits.rs @@ -27,9 +27,9 @@ impl Members for () { // Roles pub trait Roles { - fn is_role_key(account_id: &T::AccountId) -> bool; + fn is_role_account(account_id: &T::AccountId) -> bool; } impl Roles for () { - fn is_role_key(_who: &T::AccountId) -> bool { false } + fn is_role_account(_who: &T::AccountId) -> bool { false } } \ No newline at end of file From e16cef9fbf5fa616be4d75e8581b1f2869abe464 Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Sun, 24 Mar 2019 00:01:05 +0200 Subject: [PATCH 037/175] admin methods for roles --- src/roles/actors.rs | 42 +++++++++++++++++++++++++++++------------- 1 file changed, 29 insertions(+), 13 deletions(-) diff --git a/src/roles/actors.rs b/src/roles/actors.rs index 3de8cec77b..3454f62a03 100644 --- a/src/roles/actors.rs +++ b/src/roles/actors.rs @@ -17,10 +17,10 @@ pub enum Role { Storage, } -#[derive(Encode, Decode, Clone)] -pub struct RoleParameters { +#[derive(Encode, Decode, Copy, Clone, Debug, Eq, PartialEq)] +pub struct RoleParameters { // minium balance required to stake to enter a role - min_stake: BalanceOf, + min_stake: Balance, // the maximum number of spots available to fill for a role max_actors: u32, @@ -30,24 +30,24 @@ pub struct RoleParameters { min_actors: u32, // fixed amount of tokens paid to actors' primary account - reward_per_block: BalanceOf, + reward_per_block: Balance, // payouts are made at this block interval - reward_period: T::BlockNumber, + reward_period: BlockNumber, // how long tokens remain locked for after unstaking - unbonding_period: T::BlockNumber, + unbonding_period: BlockNumber, // minimum amount of time before being able to unstake - bonding_time: T::BlockNumber, + bonding_time: BlockNumber, // minimum period required to be in service. unbonding before this time is highly penalized - min_service_period: T::BlockNumber, + min_service_period: BlockNumber, // "startup" time allowed for roles that need to sync their infrastructure // with other providers before they are considered in service and punishable for // not delivering required level of service. - startup_grace_period: T::BlockNumber, + startup_grace_period: BlockNumber, // entry_request_fee: BalanceOf, } @@ -70,7 +70,7 @@ pub trait Trait: system::Trait + GovernanceCurrency { decl_storage! { trait Store for Module as Actors { /// requirements to enter and maintain status in roles - Parameters get(parameters) : map Role => Option>; + Parameters get(parameters) : map Role => Option, T::BlockNumber>>; /// the roles members can enter into AvailableRoles get(available_roles) : Vec; // = vec![Role::Storage]; @@ -124,7 +124,7 @@ impl Module { } } - fn ensure_role_parameters(role: Role) -> Result, &'static str> { + fn ensure_role_parameters(role: Role) -> Result, T::BlockNumber>, &'static str> { Self::parameters(role).ok_or("no parameters for role") } } @@ -223,8 +223,24 @@ decl_module! { >::remove(&actor_account); } - // pub fn set_role_parameters(role: Role, params: RoleParameters) {} - // pub fn set_available_roles(Vec) {} + pub fn set_role_parameters(role: Role, params: RoleParameters, T::BlockNumber>) { + >::insert(role, params); + } + + pub fn set_available_roles(roles: Vec) { + >::put(roles); + } + + pub fn add_to_available_roles(role: Role) { + if !Self::available_roles().into_iter().any(|r| r == role) { + >::mutate(|roles| roles.push(role)); + } + } + + pub fn remove_from_available_roles(role: Role) { + let roles: Vec = Self::available_roles().into_iter().filter(|r| role != *r).collect(); + >::put(roles); + } } } From 389619411ce1f705881a5248b50d7588fcfe084d Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Mon, 25 Mar 2019 10:37:05 +0200 Subject: [PATCH 038/175] staked roles: clear entry requests every N blocks --- src/roles/actors.rs | 38 ++++++++++++++++++++++++++++---------- 1 file changed, 28 insertions(+), 10 deletions(-) diff --git a/src/roles/actors.rs b/src/roles/actors.rs index 3454f62a03..ff9c248c97 100644 --- a/src/roles/actors.rs +++ b/src/roles/actors.rs @@ -67,6 +67,9 @@ pub trait Trait: system::Trait + GovernanceCurrency { type Members: Members; } +pub type Request = (T::AccountId, >::Id, Role); +pub type Requests = Vec>; + decl_storage! { trait Store for Module as Actors { /// requirements to enter and maintain status in roles @@ -93,7 +96,7 @@ decl_storage! { /// This list is cleared every N blocks.. the account making the request will be bonded and must have /// sufficient balance to cover the minimum stake for the role. /// Bonding only occurs after successful entry into a role. - RoleEntryRequests get(role_entry_requests) : map T::AccountId => Option<(>::Id, Role)>; + RoleEntryRequests get(role_entry_requests) : Requests; } } @@ -131,7 +134,7 @@ impl Module { impl Roles for Module { fn is_role_account(account_id: &T::AccountId) -> bool { - >::exists(account_id) || >::exists(account_id) || >::exists(account_id) + >::exists(account_id) || >::exists(account_id) } } @@ -139,12 +142,19 @@ decl_module! { pub struct Module for enum Call where origin: T::Origin { fn deposit_event() = default; - fn on_finalize(now: T::BlockNumber) { - // clear >::kill() every N blocks + fn on_initialize(now: T::BlockNumber) { + // clear requests + if now % T::BlockNumber::sa(300) == T::BlockNumber::zero() { + >::put(vec![]); + } + } + fn on_finalize(now: T::BlockNumber) { // payout rewards to actors // clear unbonded accounts + + // eject actors not staking the minimum } pub fn role_entry_request(origin, role: Role, member_id: >::Id) { @@ -157,7 +167,7 @@ decl_module! { let role_parameters = Self::ensure_role_parameters(role)?; - >::insert(&sender, (member_id, role)); + >::mutate(|requests| requests.push((sender, member_id, role))); } /// Member activating entry request @@ -165,12 +175,16 @@ decl_module! { let sender = ensure_signed(origin)?; let member_id = T::Members::lookup_member_id(&sender)?; - ensure!(>::exists(&actor_account), "no role entry request matches"); - if let Some(entry_request) = Self::role_entry_requests(&actor_account) { - ensure!(entry_request.0 == member_id, "role entry mismatch - member id"); - ensure!(entry_request.1 == role, "role entry mismatch - role"); + if !Self::role_entry_requests() + .iter() + .any(|request| request.0 == actor_account && request.1 == member_id && request.2 == role) + { + return Err("no role entry request matches"); } + ensure!(T::Members::lookup_member_id(&actor_account).is_err(), "account is a member"); + ensure!(!Self::is_role_account(&actor_account), "account already used"); + // make sure role is still available ensure!(Self::role_is_available(role), ""); let role_parameters = Self::ensure_role_parameters(role)?; @@ -192,7 +206,11 @@ decl_module! { role, joined_at: >::block_number() }); - >::remove(&actor_account); + let requests: Requests = Self::role_entry_requests() + .into_iter() + .filter(|request| request.0 != actor_account) + .collect(); + >::put(requests); Self::deposit_event(RawEvent::Staked(actor_account, role)); } From 8e43956e0b6974165dea0324deee1358c863cee7 Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Mon, 25 Mar 2019 11:24:37 +0200 Subject: [PATCH 039/175] staked roles: add expiery to entry requests --- src/roles/actors.rs | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/src/roles/actors.rs b/src/roles/actors.rs index ff9c248c97..69f214a8aa 100644 --- a/src/roles/actors.rs +++ b/src/roles/actors.rs @@ -67,9 +67,12 @@ pub trait Trait: system::Trait + GovernanceCurrency { type Members: Members; } -pub type Request = (T::AccountId, >::Id, Role); +pub type Request = (T::AccountId, >::Id, Role, T::BlockNumber); // actor account, memberid, role, expires pub type Requests = Vec>; +const REQUEST_LIFETIME: u64 = 300; +const DEFAULT_REQUEST_CLEARING_INTERVAL: u64 = 100; + decl_storage! { trait Store for Module as Actors { /// requirements to enter and maintain status in roles @@ -93,9 +96,10 @@ decl_storage! { /// First step before enter a role is registering intent with a new account/key. /// This is done by sending a role_entry_request() from the new account. /// The member must then send a stake() transaction to approve the request and enter the desired role. - /// This list is cleared every N blocks.. the account making the request will be bonded and must have + /// The account making the request will be bonded and must have /// sufficient balance to cover the minimum stake for the role. /// Bonding only occurs after successful entry into a role. + /// The request expires after REQUEST_LIFETIME blocks RoleEntryRequests get(role_entry_requests) : Requests; } } @@ -143,9 +147,14 @@ decl_module! { fn deposit_event() = default; fn on_initialize(now: T::BlockNumber) { - // clear requests - if now % T::BlockNumber::sa(300) == T::BlockNumber::zero() { - >::put(vec![]); + // clear expired requests + if now % T::BlockNumber::sa(DEFAULT_REQUEST_CLEARING_INTERVAL) == T::BlockNumber::zero() { + let requests: Requests = Self::role_entry_requests() + .into_iter() + .filter(|request| request.3 < now) + .collect(); + + >::put(requests); } } @@ -167,7 +176,10 @@ decl_module! { let role_parameters = Self::ensure_role_parameters(role)?; - >::mutate(|requests| requests.push((sender, member_id, role))); + >::mutate(|requests| { + let expires = >::block_number()+ T::BlockNumber::sa(REQUEST_LIFETIME); + requests.push((sender, member_id, role, expires)); + }); } /// Member activating entry request From a4c152f9533ac20fc1fff6179d72cdd68483c81f Mon Sep 17 00:00:00 2001 From: Jens Finkhaeuser Date: Mon, 25 Mar 2019 10:43:10 +0100 Subject: [PATCH 040/175] For #7, implment simple Data Object Type registry --- src/lib.rs | 13 ++++- src/storage/mod.rs | 3 + src/storage/types.rs | 135 +++++++++++++++++++++++++++++++++++++++++++ src/traits.rs | 11 ++++ 4 files changed, 160 insertions(+), 2 deletions(-) create mode 100644 src/storage/mod.rs create mode 100644 src/storage/types.rs create mode 100644 src/traits.rs diff --git a/src/lib.rs b/src/lib.rs index 77adf189ae..c728fb6734 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -16,7 +16,10 @@ extern crate parity_codec_derive; pub mod governance; use governance::{election, council, proposals}; +pub mod storage; +use storage::{types}; mod memo; +mod traits; use rstd::prelude::*; #[cfg(feature = "std")] @@ -24,7 +27,7 @@ use primitives::bytes; use primitives::{Ed25519AuthorityId, OpaqueMetadata}; use runtime_primitives::{ ApplyResult, transaction_validity::TransactionValidity, Ed25519Signature, generic, - traits::{self, Convert, BlakeTwo256, Block as BlockT, StaticLookup}, create_runtime_str + traits::{self as runtime_traits, Convert, BlakeTwo256, Block as BlockT, StaticLookup}, create_runtime_str }; use client::{ block_builder::api::{CheckInherentsResult, InherentData, self as block_builder_api}, @@ -67,7 +70,7 @@ pub mod opaque { #[derive(PartialEq, Eq, Clone, Default, Encode, Decode)] #[cfg_attr(feature = "std", derive(Serialize, Deserialize, Debug))] pub struct UncheckedExtrinsic(#[cfg_attr(feature = "std", serde(with="bytes"))] pub Vec); - impl traits::Extrinsic for UncheckedExtrinsic { + impl runtime_traits::Extrinsic for UncheckedExtrinsic { fn is_signed(&self) -> Option { None } @@ -224,6 +227,11 @@ impl memo::Trait for Runtime { type Event = Event; } +impl storage::types::Trait for Runtime { + type Event = Event; + type DataObjectTypeID = u64; +} + construct_runtime!( pub enum Runtime with Log(InternalLog: DigestItem) where Block = Block, @@ -244,6 +252,7 @@ construct_runtime!( CouncilElection: election::{Module, Call, Storage, Event, Config}, Council: council::{Module, Call, Storage, Event, Config}, Memo: memo::{Module, Call, Storage, Event}, + DataObjectType: types::{Module, Call, Storage, Event, Config}, } ); diff --git a/src/storage/mod.rs b/src/storage/mod.rs new file mode 100644 index 0000000000..3d799e20b0 --- /dev/null +++ b/src/storage/mod.rs @@ -0,0 +1,3 @@ +#![cfg_attr(not(feature = "std"), no_std)] + +pub mod types; diff --git a/src/storage/types.rs b/src/storage/types.rs new file mode 100644 index 0000000000..44dbec0c4e --- /dev/null +++ b/src/storage/types.rs @@ -0,0 +1,135 @@ +#![cfg_attr(not(feature = "std"), no_std)] + +use rstd::prelude::*; +use parity_codec::Codec; +use parity_codec_derive::{Encode, Decode}; +use srml_support::{StorageMap, StorageValue, decl_module, decl_storage, decl_event, ensure, Parameter}; +use runtime_primitives::traits::{SimpleArithmetic, As, Member, MaybeSerializeDebug}; +use system::{self}; +use crate::governance::GovernanceCurrency; +use crate::traits; + +pub trait Trait: system::Trait + GovernanceCurrency +{ + type Event: From> + Into<::Event>; + + type DataObjectTypeID: Parameter + Member + SimpleArithmetic + Codec + Default + Copy + + As + As + MaybeSerializeDebug + PartialEq; +} + +static MSG_REQUIRE_NEW_DOT: &str = "New Data Object Type required; the provided one seems to be in use already!"; +static MSG_DOT_NOT_FOUND: &str = "Data Object Type with the given ID not found!"; +static MSG_REQUIRE_DOT_ID: &str = "Can only update Data Object Types that are already registered (with an ID)!"; +static MSG_REQUIRE_EXISTING_DOT: &str = "Can only update Data Object Types that are already registered!"; + +const DEFAULT_FIRST_DATA_OBJECT_TYPE_ID: u64 = 1; + +#[derive(Encode, Decode, Clone, PartialEq)] +pub struct ObjectType +{ + // If the OT is registered, an ID must exist, otherwise it's a new OT. + pub id: Option, + pub description: Vec, + pub active: bool, + + // TODO in future releases + // - replication factor + // - storage trances (empty is ok) +} + +decl_storage! { + trait Store for Module as DataObjectTypeRegistry + { + // Start at this value + pub FirstDataObjectTypeID get(first_data_object_type_id) config(first_data_object_type_id): T::DataObjectTypeID = T::DataObjectTypeID::sa(DEFAULT_FIRST_DATA_OBJECT_TYPE_ID); + + // Increment + pub NextDataObjectTypeID get(next_data_object_type_id) build(|config: &GenesisConfig| config.first_data_object_type_id): T::DataObjectTypeID = T::DataObjectTypeID::sa(DEFAULT_FIRST_DATA_OBJECT_TYPE_ID); + + // Mapping of Data object types + pub DataObjectType get(data_object_type): map T::DataObjectTypeID => Option>; + } +} + +decl_event! { + pub enum Event where + ::DataObjectTypeID + { + DataObjectTypeAdded(DataObjectTypeID), + DataObjectTypeUpdated(DataObjectTypeID), + } +} + + + +impl traits::IsActiveDataObjectType for Module +{ + fn is_active_data_object_type(which: &T::DataObjectTypeID) -> bool + { + match Self::ensure_data_object_type(*which) + { + Ok(dot) => dot.active, + Err(err) => false + } + } +} + + +decl_module! { + pub struct Module for enum Call where origin: T::Origin + { + fn deposit_event() = default; + + fn register_data_object_type(data_object_type: ObjectType) + { + ensure!(data_object_type.id.is_none(), MSG_REQUIRE_NEW_DOT); + + let new_dot_id = Self::next_data_object_type_id(); + let dot: ObjectType = ObjectType { + id: Some(new_dot_id), + description: data_object_type.description.clone(), + active: data_object_type.active, + }; + + >::insert(new_dot_id, dot); + >::mutate(|n| { *n += T::DataObjectTypeID::sa(1); }); + + Self::deposit_event(RawEvent::DataObjectTypeAdded(new_dot_id)); + } + + fn update_data_object_type(data_object_type: ObjectType) + { + ensure!(data_object_type.id.is_some(), MSG_REQUIRE_DOT_ID); + + let id = data_object_type.id.unwrap(); + let mut dot = Self::ensure_data_object_type(id)?; + + dot.description = data_object_type.description.clone(); + dot.active = data_object_type.active; + + >::insert(id, dot); + + Self::deposit_event(RawEvent::DataObjectTypeUpdated(id)); + } + + fn activate_data_object_type(id: T::DataObjectTypeID, active: bool) + { + let mut dot = Self::ensure_data_object_type(id)?; + + dot.active = active; + + >::insert(id, dot); + + Self::deposit_event(RawEvent::DataObjectTypeUpdated(id)); + } + } +} + +impl Module +{ + fn ensure_data_object_type(id: T::DataObjectTypeID) -> Result, &'static str> + { + let dot = Self::data_object_type(&id).ok_or(MSG_DOT_NOT_FOUND)?; + Ok(dot) + } +} diff --git a/src/traits.rs b/src/traits.rs new file mode 100644 index 0000000000..d5533c70e3 --- /dev/null +++ b/src/traits.rs @@ -0,0 +1,11 @@ +#![cfg_attr(not(feature = "std"), no_std)] + +use crate::storage::types; + +pub trait IsActiveDataObjectType +{ + fn is_active_data_object_type(which: &T::DataObjectTypeID) -> bool + { + false + } +} From 8668f1b1c8625c7320724def05eb11fff8f25e99 Mon Sep 17 00:00:00 2001 From: Jens Finkhaeuser Date: Mon, 25 Mar 2019 10:45:46 +0100 Subject: [PATCH 041/175] Fix comment typo --- src/storage/types.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/storage/types.rs b/src/storage/types.rs index 44dbec0c4e..8b7a7bbc09 100644 --- a/src/storage/types.rs +++ b/src/storage/types.rs @@ -34,7 +34,7 @@ pub struct ObjectType // TODO in future releases // - replication factor - // - storage trances (empty is ok) + // - storage tranches (empty is ok) } decl_storage! { From 1e35b213b998df4fb613b6f254980a5631859dba Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Mon, 25 Mar 2019 12:48:35 +0200 Subject: [PATCH 042/175] staked roles: admin remove actor function --- src/roles/actors.rs | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/src/roles/actors.rs b/src/roles/actors.rs index 69f214a8aa..e8765ca40e 100644 --- a/src/roles/actors.rs +++ b/src/roles/actors.rs @@ -54,7 +54,7 @@ pub struct RoleParameters { #[derive(Encode, Decode, Clone)] pub struct Actor { - member_id: >::Id, + member_id: MemberId, role: Role, account: T::AccountId, joined_at: T::BlockNumber, @@ -67,7 +67,8 @@ pub trait Trait: system::Trait + GovernanceCurrency { type Members: Members; } -pub type Request = (T::AccountId, >::Id, Role, T::BlockNumber); // actor account, memberid, role, expires +pub type MemberId = >::Id; +pub type Request = (T::AccountId, MemberId, Role, T::BlockNumber); // actor account, memberid, role, expires pub type Requests = Vec>; const REQUEST_LIFETIME: u64 = 300; @@ -88,7 +89,7 @@ decl_storage! { AccountsByRole get(accounts_by_role) : map Role => Vec; /// actor accounts associated with a member id - AccountsByMember get(accounts_by_member) : map >::Id => Vec; + AccountsByMember get(accounts_by_member) : map MemberId => Vec; /// tokens locked until given block number Bondage get(bondage) : map T::AccountId => T::BlockNumber; @@ -120,7 +121,7 @@ impl Module { Self::actors(role_key).ok_or("not role key") } - fn ensure_actor_is_member(role_key: &T::AccountId, member_id: >::Id) + fn ensure_actor_is_member(role_key: &T::AccountId, member_id: MemberId) -> Result, &'static str> { let actor = Self::ensure_actor(role_key)?; @@ -166,7 +167,7 @@ decl_module! { // eject actors not staking the minimum } - pub fn role_entry_request(origin, role: Role, member_id: >::Id) { + pub fn role_entry_request(origin, role: Role, member_id: MemberId) { let sender = ensure_signed(origin)?; ensure!(T::Members::lookup_member_id(&sender).is_err(), "account is a member"); @@ -235,20 +236,24 @@ decl_module! { let role_parameters = Self::ensure_role_parameters(actor.role)?; + Self::apply_unstake(actor.account, actor.role, actor.member_id, role_parameters.unbonding_period); + } + + fn apply_unstake(actor_account: T::AccountId, role: Role, member_id: MemberId, unbonding_period: T::BlockNumber) { // simple unstaking ...only applying unbonding period - let accounts: Vec = Self::accounts_by_role(actor.role) + let accounts: Vec = Self::accounts_by_role(role) .into_iter() - .filter(|account| !(*account == actor.account)) + .filter(|account| !(*account == actor_account)) .collect(); - >::insert(actor.role, accounts); + >::insert(role, accounts); let accounts: Vec = Self::accounts_by_member(&member_id) .into_iter() - .filter(|account| !(*account == actor.account)) + .filter(|account| !(*account == actor_account)) .collect(); >::insert(&member_id, accounts); - >::insert(&actor_account, >::block_number() + role_parameters.unbonding_period); + >::insert(&actor_account, >::block_number() + unbonding_period); >::remove(&actor_account); } @@ -271,6 +276,13 @@ decl_module! { let roles: Vec = Self::available_roles().into_iter().filter(|r| role != *r).collect(); >::put(roles); } + + pub fn remove_actor(actor_account: T::AccountId) { + let member_id = T::Members::lookup_member_id(&actor_account)?; + let actor = Self::ensure_actor_is_member(&actor_account, member_id)?; + let role_parameters = Self::ensure_role_parameters(actor.role)?; + Self::apply_unstake(actor.account, actor.role, actor.member_id, role_parameters.unbonding_period); + } } } From 8d66c1204c58517388d273a3aa1b54ac2a77c80d Mon Sep 17 00:00:00 2001 From: Jens Finkhaeuser Date: Mon, 25 Mar 2019 14:48:19 +0100 Subject: [PATCH 043/175] These extrinsics should be public --- src/storage/types.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/storage/types.rs b/src/storage/types.rs index 8b7a7bbc09..b0da249d28 100644 --- a/src/storage/types.rs +++ b/src/storage/types.rs @@ -80,7 +80,7 @@ decl_module! { { fn deposit_event() = default; - fn register_data_object_type(data_object_type: ObjectType) + pub fn register_data_object_type(data_object_type: ObjectType) { ensure!(data_object_type.id.is_none(), MSG_REQUIRE_NEW_DOT); @@ -97,7 +97,7 @@ decl_module! { Self::deposit_event(RawEvent::DataObjectTypeAdded(new_dot_id)); } - fn update_data_object_type(data_object_type: ObjectType) + pub fn update_data_object_type(data_object_type: ObjectType) { ensure!(data_object_type.id.is_some(), MSG_REQUIRE_DOT_ID); @@ -112,7 +112,7 @@ decl_module! { Self::deposit_event(RawEvent::DataObjectTypeUpdated(id)); } - fn activate_data_object_type(id: T::DataObjectTypeID, active: bool) + pub fn activate_data_object_type(id: T::DataObjectTypeID, active: bool) { let mut dot = Self::ensure_data_object_type(id)?; From 79ef28c38f49e64ad02d81783025622a604f0085 Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Mon, 25 Mar 2019 15:50:17 +0200 Subject: [PATCH 044/175] staked roles: factor out deleting actor --- src/roles/actors.rs | 49 +++++++++++++++++++++++++++++---------------- 1 file changed, 32 insertions(+), 17 deletions(-) diff --git a/src/roles/actors.rs b/src/roles/actors.rs index e8765ca40e..3fd348491e 100644 --- a/src/roles/actors.rs +++ b/src/roles/actors.rs @@ -82,8 +82,11 @@ decl_storage! { /// the roles members can enter into AvailableRoles get(available_roles) : Vec; // = vec![Role::Storage]; + /// All active actors + Actors get(actors) : Vec; + /// actor accounts mapped to their actor - Actors get(actors) : map T::AccountId => Option>; + ActorsByAccountId get(actors_by_account_id) : map T::AccountId => Option>; /// actor accounts associated with a role AccountsByRole get(accounts_by_role) : map Role => Vec; @@ -118,7 +121,7 @@ impl Module { } fn ensure_actor(role_key: &T::AccountId) -> Result, &'static str> { - Self::actors(role_key).ok_or("not role key") + Self::actors_by_account_id(role_key).ok_or("not role key") } fn ensure_actor_is_member(role_key: &T::AccountId, member_id: MemberId) @@ -135,11 +138,33 @@ impl Module { fn ensure_role_parameters(role: Role) -> Result, T::BlockNumber>, &'static str> { Self::parameters(role).ok_or("no parameters for role") } + + fn delete_actor(actor_account: T::AccountId, role: Role, member_id: MemberId) { + let accounts: Vec = Self::accounts_by_role(role) + .into_iter() + .filter(|account| !(*account == actor_account)) + .collect(); + >::insert(role, accounts); + + let accounts: Vec = Self::accounts_by_member(&member_id) + .into_iter() + .filter(|account| !(*account == actor_account)) + .collect(); + >::insert(&member_id, accounts); + + let actors: Vec = Self::actors() + .into_iter() + .filter(|account| !(*account == actor_account)) + .collect(); + >::put(actors); + + >::remove(&actor_account); + } } impl Roles for Module { fn is_role_account(account_id: &T::AccountId) -> bool { - >::exists(account_id) || >::exists(account_id) + >::exists(account_id) || >::exists(account_id) } } @@ -213,12 +238,14 @@ decl_module! { >::mutate(role, |accounts| accounts.push(actor_account.clone())); >::mutate(&member_id, |accounts| accounts.push(actor_account.clone())); >::insert(&actor_account, T::BlockNumber::max_value()); - >::insert(&actor_account, Actor { + >::insert(&actor_account, Actor { member_id, account: actor_account.clone(), role, joined_at: >::block_number() }); + >::mutate(|actors| actors.push(actor_account.clone())); + let requests: Requests = Self::role_entry_requests() .into_iter() .filter(|request| request.0 != actor_account) @@ -241,21 +268,9 @@ decl_module! { fn apply_unstake(actor_account: T::AccountId, role: Role, member_id: MemberId, unbonding_period: T::BlockNumber) { // simple unstaking ...only applying unbonding period - let accounts: Vec = Self::accounts_by_role(role) - .into_iter() - .filter(|account| !(*account == actor_account)) - .collect(); - >::insert(role, accounts); - - let accounts: Vec = Self::accounts_by_member(&member_id) - .into_iter() - .filter(|account| !(*account == actor_account)) - .collect(); - >::insert(&member_id, accounts); - >::insert(&actor_account, >::block_number() + unbonding_period); - >::remove(&actor_account); + Self::delete_actor(actor_account, role, member_id); } pub fn set_role_parameters(role: Role, params: RoleParameters, T::BlockNumber>) { From ff33136d05551d3f64327cad95a94e42d6e3a33b Mon Sep 17 00:00:00 2001 From: Jens Finkhaeuser Date: Mon, 25 Mar 2019 14:54:43 +0100 Subject: [PATCH 045/175] Be explicit about requiring root. IMHO this is better style. --- src/storage/types.rs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/storage/types.rs b/src/storage/types.rs index b0da249d28..989824f2ad 100644 --- a/src/storage/types.rs +++ b/src/storage/types.rs @@ -5,7 +5,7 @@ use parity_codec::Codec; use parity_codec_derive::{Encode, Decode}; use srml_support::{StorageMap, StorageValue, decl_module, decl_storage, decl_event, ensure, Parameter}; use runtime_primitives::traits::{SimpleArithmetic, As, Member, MaybeSerializeDebug}; -use system::{self}; +use system::{self, ensure_root}; use crate::governance::GovernanceCurrency; use crate::traits; @@ -80,8 +80,9 @@ decl_module! { { fn deposit_event() = default; - pub fn register_data_object_type(data_object_type: ObjectType) + pub fn register_data_object_type(origin, data_object_type: ObjectType) { + ensure_root(origin); ensure!(data_object_type.id.is_none(), MSG_REQUIRE_NEW_DOT); let new_dot_id = Self::next_data_object_type_id(); @@ -97,8 +98,9 @@ decl_module! { Self::deposit_event(RawEvent::DataObjectTypeAdded(new_dot_id)); } - pub fn update_data_object_type(data_object_type: ObjectType) + pub fn update_data_object_type(origin, data_object_type: ObjectType) { + ensure_root(origin); ensure!(data_object_type.id.is_some(), MSG_REQUIRE_DOT_ID); let id = data_object_type.id.unwrap(); @@ -112,8 +114,9 @@ decl_module! { Self::deposit_event(RawEvent::DataObjectTypeUpdated(id)); } - pub fn activate_data_object_type(id: T::DataObjectTypeID, active: bool) + pub fn activate_data_object_type(origin, id: T::DataObjectTypeID, active: bool) { + ensure_root(origin); let mut dot = Self::ensure_data_object_type(id)?; dot.active = active; From 82643451e484f11757c00fc4074688efb1d89701 Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Mon, 25 Mar 2019 17:13:56 +0200 Subject: [PATCH 046/175] staked roles: clear unbonded accounts --- src/roles/actors.rs | 45 ++++++++++++++++++++++++++++++--------------- 1 file changed, 30 insertions(+), 15 deletions(-) diff --git a/src/roles/actors.rs b/src/roles/actors.rs index 3fd348491e..85ea36136d 100644 --- a/src/roles/actors.rs +++ b/src/roles/actors.rs @@ -82,7 +82,7 @@ decl_storage! { /// the roles members can enter into AvailableRoles get(available_roles) : Vec; // = vec![Role::Storage]; - /// All active actors + /// Actors list Actors get(actors) : Vec; /// actor accounts mapped to their actor @@ -139,7 +139,9 @@ impl Module { Self::parameters(role).ok_or("no parameters for role") } - fn delete_actor(actor_account: T::AccountId, role: Role, member_id: MemberId) { + // Mutating + + fn remove_actor_from_service(actor_account: T::AccountId, role: Role, member_id: MemberId) { let accounts: Vec = Self::accounts_by_role(role) .into_iter() .filter(|account| !(*account == actor_account)) @@ -152,14 +154,15 @@ impl Module { .collect(); >::insert(&member_id, accounts); - let actors: Vec = Self::actors() - .into_iter() - .filter(|account| !(*account == actor_account)) - .collect(); - >::put(actors); - >::remove(&actor_account); } + + fn apply_unstake(actor_account: T::AccountId, role: Role, member_id: MemberId, unbonding_period: T::BlockNumber) { + // simple unstaking ...only applying unbonding period + >::insert(&actor_account, >::block_number() + unbonding_period); + + Self::remove_actor_from_service(actor_account, role, member_id); + } } impl Roles for Module { @@ -188,8 +191,27 @@ decl_module! { // payout rewards to actors // clear unbonded accounts + if now % T::BlockNumber::sa(100) == T::BlockNumber::zero() { + let actors: Vec = Self::actors() + .into_iter() + .filter(|account| { + if >::exists(account) { + if Self::bondage(account) > now { + true + } else { + >::remove(account); + false + } + } else { + true + } + }) + .collect(); + >::put(actors); + } // eject actors not staking the minimum + } pub fn role_entry_request(origin, role: Role, member_id: MemberId) { @@ -266,13 +288,6 @@ decl_module! { Self::apply_unstake(actor.account, actor.role, actor.member_id, role_parameters.unbonding_period); } - fn apply_unstake(actor_account: T::AccountId, role: Role, member_id: MemberId, unbonding_period: T::BlockNumber) { - // simple unstaking ...only applying unbonding period - >::insert(&actor_account, >::block_number() + unbonding_period); - - Self::delete_actor(actor_account, role, member_id); - } - pub fn set_role_parameters(role: Role, params: RoleParameters, T::BlockNumber>) { >::insert(role, params); } From ba3413d61ace8dda349797f02afebdfda87e9b1f Mon Sep 17 00:00:00 2001 From: Jens Finkhaeuser Date: Mon, 25 Mar 2019 16:57:32 +0100 Subject: [PATCH 047/175] Unit test setup for storage module --- src/storage/mock.rs | 53 ++++++++++++++++++++++++++++++++++++++++++++ src/storage/mod.rs | 2 ++ src/storage/tests.rs | 24 ++++++++++++++++++++ src/storage/types.rs | 8 +++---- 4 files changed, 83 insertions(+), 4 deletions(-) create mode 100644 src/storage/mock.rs create mode 100644 src/storage/tests.rs diff --git a/src/storage/mock.rs b/src/storage/mock.rs new file mode 100644 index 0000000000..799d36129b --- /dev/null +++ b/src/storage/mock.rs @@ -0,0 +1,53 @@ +#![cfg(test)] + +use rstd::prelude::*; +pub use super::{types}; +pub use system; + +pub use primitives::{H256, Blake2Hasher}; +pub use runtime_primitives::{ + BuildStorage, + traits::{BlakeTwo256, OnFinalise, IdentityLookup}, + testing::{Digest, DigestItem, Header, UintAuthorityId} +}; + +use srml_support::impl_outer_origin; + +impl_outer_origin! { + pub enum Origin for Test {} +} + +// For testing the module, we construct most of a mock runtime. This means +// first constructing a configuration type (`Test`) which `impl`s each of the +// configuration traits of modules we want to use. +#[derive(Clone, Eq, PartialEq, Debug)] +pub struct Test; +impl system::Trait for Test +{ + type Origin = Origin; + type Index = u64; + type BlockNumber = u64; + type Hash = H256; + type Hashing = BlakeTwo256; + type Digest = Digest; + type AccountId = u64; + type Header = Header; + type Event = (); + type Log = DigestItem; + type Lookup = IdentityLookup; +} +impl types::Trait for Test +{ + type Event = (); + type DataObjectTypeID = u64; +} + +// This function basically just builds a genesis storage key/value store according to +// our desired mockup. +pub fn initial_test_ext() -> runtime_io::TestExternalities { + let mut t = system::GenesisConfig::::default().build_storage().unwrap().0; + + runtime_io::TestExternalities::new(t) +} + +pub type Types = types::Module; diff --git a/src/storage/mod.rs b/src/storage/mod.rs index 3d799e20b0..84d813f0ad 100644 --- a/src/storage/mod.rs +++ b/src/storage/mod.rs @@ -1,3 +1,5 @@ #![cfg_attr(not(feature = "std"), no_std)] pub mod types; + +mod mock; diff --git a/src/storage/tests.rs b/src/storage/tests.rs new file mode 100644 index 0000000000..d5323dad9a --- /dev/null +++ b/src/storage/tests.rs @@ -0,0 +1,24 @@ +#![cfg(test)] + +use super::*; +use super::mock::*; + +use parity_codec::Encode; +use runtime_io::with_externalities; +use srml_support::*; + +#[test] +fn initial_state() +{ + const DEFAULT_FIRST_ID: u32 = 1000; + + with_externalities(&mut ExtBuilder::default() + .first_data_object_id(DEFAULT_FIRST_ID).build(), || + { + assert_eq!(DataObjectType::first_data_object_id(), DEFAULT_FIRST_ID); + + // TODO + + assert_ok!(false); + }); +} diff --git a/src/storage/types.rs b/src/storage/types.rs index 989824f2ad..bd6de688dd 100644 --- a/src/storage/types.rs +++ b/src/storage/types.rs @@ -6,10 +6,10 @@ use parity_codec_derive::{Encode, Decode}; use srml_support::{StorageMap, StorageValue, decl_module, decl_storage, decl_event, ensure, Parameter}; use runtime_primitives::traits::{SimpleArithmetic, As, Member, MaybeSerializeDebug}; use system::{self, ensure_root}; -use crate::governance::GovernanceCurrency; +use std::fmt; use crate::traits; -pub trait Trait: system::Trait + GovernanceCurrency +pub trait Trait: system::Trait + fmt::Debug { type Event: From> + Into<::Event>; @@ -17,14 +17,14 @@ pub trait Trait: system::Trait + GovernanceCurrency + As + As + MaybeSerializeDebug + PartialEq; } + static MSG_REQUIRE_NEW_DOT: &str = "New Data Object Type required; the provided one seems to be in use already!"; static MSG_DOT_NOT_FOUND: &str = "Data Object Type with the given ID not found!"; static MSG_REQUIRE_DOT_ID: &str = "Can only update Data Object Types that are already registered (with an ID)!"; -static MSG_REQUIRE_EXISTING_DOT: &str = "Can only update Data Object Types that are already registered!"; const DEFAULT_FIRST_DATA_OBJECT_TYPE_ID: u64 = 1; -#[derive(Encode, Decode, Clone, PartialEq)] +#[derive(Clone, Debug, Encode, Decode, PartialEq)] pub struct ObjectType { // If the OT is registered, an ID must exist, otherwise it's a new OT. From 913538b40a8d1db45706c0741e75b86bd96b3810 Mon Sep 17 00:00:00 2001 From: Jens Finkhaeuser Date: Mon, 25 Mar 2019 17:12:41 +0100 Subject: [PATCH 048/175] Get unit tests to run --- src/storage/mock.rs | 37 ++++++++++++++++++++++++++++++++----- src/storage/mod.rs | 1 + src/storage/tests.rs | 8 ++++---- 3 files changed, 37 insertions(+), 9 deletions(-) diff --git a/src/storage/mock.rs b/src/storage/mock.rs index 799d36129b..e30b4d1a34 100644 --- a/src/storage/mock.rs +++ b/src/storage/mock.rs @@ -42,12 +42,39 @@ impl types::Trait for Test type DataObjectTypeID = u64; } -// This function basically just builds a genesis storage key/value store according to -// our desired mockup. -pub fn initial_test_ext() -> runtime_io::TestExternalities { - let mut t = system::GenesisConfig::::default().build_storage().unwrap().0; +pub struct ExtBuilder +{ + first_data_object_type_id: u64, +} - runtime_io::TestExternalities::new(t) +impl Default for ExtBuilder +{ + fn default() -> Self + { + Self { + first_data_object_type_id: 1, + } + } } +impl ExtBuilder +{ + pub fn first_data_object_type_id(mut self, first_data_object_type_id: u64) -> Self + { + self.first_data_object_type_id = first_data_object_type_id; + self + } + pub fn build(self) -> runtime_io::TestExternalities + { + let mut t = system::GenesisConfig::::default().build_storage().unwrap().0; + + t.extend(types::GenesisConfig::{ + first_data_object_type_id: self.first_data_object_type_id, + }.build_storage().unwrap().0); + + t.into() + } +} + + pub type Types = types::Module; diff --git a/src/storage/mod.rs b/src/storage/mod.rs index 84d813f0ad..f50e2661c0 100644 --- a/src/storage/mod.rs +++ b/src/storage/mod.rs @@ -3,3 +3,4 @@ pub mod types; mod mock; +mod tests; diff --git a/src/storage/tests.rs b/src/storage/tests.rs index d5323dad9a..5cd08bdcd3 100644 --- a/src/storage/tests.rs +++ b/src/storage/tests.rs @@ -10,15 +10,15 @@ use srml_support::*; #[test] fn initial_state() { - const DEFAULT_FIRST_ID: u32 = 1000; + const DEFAULT_FIRST_ID: u64 = 1000; with_externalities(&mut ExtBuilder::default() - .first_data_object_id(DEFAULT_FIRST_ID).build(), || + .first_data_object_type_id(DEFAULT_FIRST_ID).build(), || { - assert_eq!(DataObjectType::first_data_object_id(), DEFAULT_FIRST_ID); + assert_eq!(Types::first_data_object_type_id(), DEFAULT_FIRST_ID); // TODO - assert_ok!(false); + assert_ok!(Err(123)); }); } From 6c14ac713e878eb507ad26df0972d3a1564e3cd9 Mon Sep 17 00:00:00 2001 From: Jens Finkhaeuser Date: Mon, 25 Mar 2019 17:46:05 +0100 Subject: [PATCH 049/175] Make unit tests work, but still allow building wasm runtime. --- src/storage/tests.rs | 1 - src/storage/types.rs | 8 ++++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/storage/tests.rs b/src/storage/tests.rs index 5cd08bdcd3..fbec019da7 100644 --- a/src/storage/tests.rs +++ b/src/storage/tests.rs @@ -3,7 +3,6 @@ use super::*; use super::mock::*; -use parity_codec::Encode; use runtime_io::with_externalities; use srml_support::*; diff --git a/src/storage/types.rs b/src/storage/types.rs index bd6de688dd..802b9f3e92 100644 --- a/src/storage/types.rs +++ b/src/storage/types.rs @@ -4,12 +4,11 @@ use rstd::prelude::*; use parity_codec::Codec; use parity_codec_derive::{Encode, Decode}; use srml_support::{StorageMap, StorageValue, decl_module, decl_storage, decl_event, ensure, Parameter}; -use runtime_primitives::traits::{SimpleArithmetic, As, Member, MaybeSerializeDebug}; +use runtime_primitives::traits::{SimpleArithmetic, As, Member, MaybeSerializeDebug, MaybeDebug}; use system::{self, ensure_root}; -use std::fmt; use crate::traits; -pub trait Trait: system::Trait + fmt::Debug +pub trait Trait: system::Trait + MaybeDebug { type Event: From> + Into<::Event>; @@ -24,7 +23,8 @@ static MSG_REQUIRE_DOT_ID: &str = "Can only update Data Object Types that are al const DEFAULT_FIRST_DATA_OBJECT_TYPE_ID: u64 = 1; -#[derive(Clone, Debug, Encode, Decode, PartialEq)] +#[derive(Clone, Encode, Decode, PartialEq)] +#[cfg_attr(feature = "std", derive(Debug))] pub struct ObjectType { // If the OT is registered, an ID must exist, otherwise it's a new OT. From c928b8866df478757736919fe7cbc18784cacb54 Mon Sep 17 00:00:00 2001 From: Jens Finkhaeuser Date: Mon, 25 Mar 2019 17:48:43 +0100 Subject: [PATCH 050/175] Silence warning --- src/storage/types.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/storage/types.rs b/src/storage/types.rs index 802b9f3e92..ee633a7311 100644 --- a/src/storage/types.rs +++ b/src/storage/types.rs @@ -69,7 +69,7 @@ impl traits::IsActiveDataObjectType for Module match Self::ensure_data_object_type(*which) { Ok(dot) => dot.active, - Err(err) => false + Err(_err) => false } } } From 854378a46f21e875784c4dc72fd53a7f4437c639 Mon Sep 17 00:00:00 2001 From: Jens Finkhaeuser Date: Mon, 25 Mar 2019 18:41:17 +0100 Subject: [PATCH 051/175] Cover extrinsics with unit tests --- src/storage/mock.rs | 15 ++++- src/storage/tests.rs | 143 ++++++++++++++++++++++++++++++++++++++++++- src/storage/types.rs | 6 +- 3 files changed, 156 insertions(+), 8 deletions(-) diff --git a/src/storage/mock.rs b/src/storage/mock.rs index e30b4d1a34..b30135d8f9 100644 --- a/src/storage/mock.rs +++ b/src/storage/mock.rs @@ -11,12 +11,19 @@ pub use runtime_primitives::{ testing::{Digest, DigestItem, Header, UintAuthorityId} }; -use srml_support::impl_outer_origin; +use srml_support::{impl_outer_origin, impl_outer_event}; impl_outer_origin! { pub enum Origin for Test {} } +impl_outer_event! { + pub enum MetaEvent for Test + { + types, + } +} + // For testing the module, we construct most of a mock runtime. This means // first constructing a configuration type (`Test`) which `impl`s each of the // configuration traits of modules we want to use. @@ -32,13 +39,13 @@ impl system::Trait for Test type Digest = Digest; type AccountId = u64; type Header = Header; - type Event = (); + type Event = MetaEvent; type Log = DigestItem; type Lookup = IdentityLookup; } impl types::Trait for Test { - type Event = (); + type Event = MetaEvent; type DataObjectTypeID = u64; } @@ -77,4 +84,6 @@ impl ExtBuilder } +pub type System = system::Module; pub type Types = types::Module; +pub type TestDataObjectType = types::ObjectType; diff --git a/src/storage/tests.rs b/src/storage/tests.rs index fbec019da7..2f9df21172 100644 --- a/src/storage/tests.rs +++ b/src/storage/tests.rs @@ -5,6 +5,7 @@ use super::mock::*; use runtime_io::with_externalities; use srml_support::*; +use system::{self, Phase, EventRecord}; #[test] fn initial_state() @@ -15,9 +16,147 @@ fn initial_state() .first_data_object_type_id(DEFAULT_FIRST_ID).build(), || { assert_eq!(Types::first_data_object_type_id(), DEFAULT_FIRST_ID); + }); +} + +#[test] +fn fail_register_without_root() +{ + const DEFAULT_FIRST_ID: u64 = 1000; + + with_externalities(&mut ExtBuilder::default() + .first_data_object_type_id(DEFAULT_FIRST_ID).build(), || + { + let data: TestDataObjectType = TestDataObjectType { + id: None, + description: "foo".as_bytes().to_vec(), + active: false, + }; + let res = Types::register_data_object_type(Origin::signed(1), data); + assert!(res.is_err()); + }); +} + +#[test] +fn succeed_register_as_root() +{ + const DEFAULT_FIRST_ID: u64 = 1000; + + with_externalities(&mut ExtBuilder::default() + .first_data_object_type_id(DEFAULT_FIRST_ID).build(), || + { + let data: TestDataObjectType = TestDataObjectType { + id: None, + description: "foo".as_bytes().to_vec(), + active: false, + }; + let res = Types::register_data_object_type(Origin::ROOT, data); + assert!(res.is_ok()); + }); +} + +#[test] +fn update_existing() +{ + const DEFAULT_FIRST_ID: u64 = 1000; + + with_externalities(&mut ExtBuilder::default() + .first_data_object_type_id(DEFAULT_FIRST_ID).build(), || + { + // First register a type + let data: TestDataObjectType = TestDataObjectType { + id: None, + description: "foo".as_bytes().to_vec(), + active: false, + }; + let id_res = Types::register_data_object_type(Origin::ROOT, data); + assert!(id_res.is_ok()); + assert_eq!(*System::events().last().unwrap(), + EventRecord { + phase: Phase::ApplyExtrinsic(0), + event: MetaEvent::types(types::RawEvent::DataObjectTypeAdded(DEFAULT_FIRST_ID)), + } + ); + + + // Now update it with new data - we need the ID to be the same as in + // returned by the previous call. First, though, try and fail without + let updated1: TestDataObjectType = TestDataObjectType { + id: None, + description: "bar".as_bytes().to_vec(), + active: false, + }; + let res = Types::update_data_object_type(Origin::ROOT, updated1); + assert!(res.is_err()); + + // Now try with a bad ID + let updated2: TestDataObjectType = TestDataObjectType { + id: Some(DEFAULT_FIRST_ID + 1), + description: "bar".as_bytes().to_vec(), + active: false, + }; + let res = Types::update_data_object_type(Origin::ROOT, updated2); + assert!(res.is_err()); + + // Finally with an existing ID, it should work. + let updated3: TestDataObjectType = TestDataObjectType { + id: Some(DEFAULT_FIRST_ID), + description: "bar".as_bytes().to_vec(), + active: false, + }; + let res = Types::update_data_object_type(Origin::ROOT, updated3); + assert!(res.is_ok()); + assert_eq!(*System::events().last().unwrap(), + EventRecord { + phase: Phase::ApplyExtrinsic(0), + event: MetaEvent::types(types::RawEvent::DataObjectTypeUpdated(DEFAULT_FIRST_ID)), + } + ); + }); +} + + +#[test] +fn activate_existing() +{ + const DEFAULT_FIRST_ID: u64 = 1000; + + with_externalities(&mut ExtBuilder::default() + .first_data_object_type_id(DEFAULT_FIRST_ID).build(), || + { + // First register a type + let data: TestDataObjectType = TestDataObjectType { + id: None, + description: "foo".as_bytes().to_vec(), + active: false, + }; + let id_res = Types::register_data_object_type(Origin::ROOT, data); + assert!(id_res.is_ok()); + assert_eq!(*System::events().last().unwrap(), + EventRecord { + phase: Phase::ApplyExtrinsic(0), + event: MetaEvent::types(types::RawEvent::DataObjectTypeAdded(DEFAULT_FIRST_ID)), + } + ); + + // Retrieve, and ensure it's not active. + let data = Types::data_object_type(DEFAULT_FIRST_ID); + assert!(data.is_some()); + assert!(!data.unwrap().active); - // TODO + // Now activate the data object type + let res = Types::activate_data_object_type(Origin::ROOT, DEFAULT_FIRST_ID, true); + assert!(res.is_ok()); + assert_eq!(*System::events().last().unwrap(), + EventRecord { + phase: Phase::ApplyExtrinsic(0), + event: MetaEvent::types(types::RawEvent::DataObjectTypeUpdated(DEFAULT_FIRST_ID)), + } + ); - assert_ok!(Err(123)); + // Ensure that the item is actually activated. + let data = Types::data_object_type(DEFAULT_FIRST_ID); + assert!(data.is_some()); + assert!(data.unwrap().active); }); } diff --git a/src/storage/types.rs b/src/storage/types.rs index ee633a7311..41c9dfd79f 100644 --- a/src/storage/types.rs +++ b/src/storage/types.rs @@ -82,7 +82,7 @@ decl_module! { pub fn register_data_object_type(origin, data_object_type: ObjectType) { - ensure_root(origin); + ensure_root(origin)?; ensure!(data_object_type.id.is_none(), MSG_REQUIRE_NEW_DOT); let new_dot_id = Self::next_data_object_type_id(); @@ -100,7 +100,7 @@ decl_module! { pub fn update_data_object_type(origin, data_object_type: ObjectType) { - ensure_root(origin); + ensure_root(origin)?; ensure!(data_object_type.id.is_some(), MSG_REQUIRE_DOT_ID); let id = data_object_type.id.unwrap(); @@ -116,7 +116,7 @@ decl_module! { pub fn activate_data_object_type(origin, id: T::DataObjectTypeID, active: bool) { - ensure_root(origin); + ensure_root(origin)?; let mut dot = Self::ensure_data_object_type(id)?; dot.active = active; From 0286059dc984e095c627a223ae4a10054f722a5c Mon Sep 17 00:00:00 2001 From: Jens Finkhaeuser Date: Mon, 25 Mar 2019 18:47:31 +0100 Subject: [PATCH 052/175] Improve naming --- src/storage/mock.rs | 2 +- src/storage/types.rs | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/storage/mock.rs b/src/storage/mock.rs index b30135d8f9..c9b5b8ab84 100644 --- a/src/storage/mock.rs +++ b/src/storage/mock.rs @@ -86,4 +86,4 @@ impl ExtBuilder pub type System = system::Module; pub type Types = types::Module; -pub type TestDataObjectType = types::ObjectType; +pub type TestDataObjectType = types::DataObjectType; diff --git a/src/storage/types.rs b/src/storage/types.rs index 41c9dfd79f..90855a3c54 100644 --- a/src/storage/types.rs +++ b/src/storage/types.rs @@ -25,7 +25,7 @@ const DEFAULT_FIRST_DATA_OBJECT_TYPE_ID: u64 = 1; #[derive(Clone, Encode, Decode, PartialEq)] #[cfg_attr(feature = "std", derive(Debug))] -pub struct ObjectType +pub struct DataObjectType { // If the OT is registered, an ID must exist, otherwise it's a new OT. pub id: Option, @@ -47,7 +47,7 @@ decl_storage! { pub NextDataObjectTypeID get(next_data_object_type_id) build(|config: &GenesisConfig| config.first_data_object_type_id): T::DataObjectTypeID = T::DataObjectTypeID::sa(DEFAULT_FIRST_DATA_OBJECT_TYPE_ID); // Mapping of Data object types - pub DataObjectType get(data_object_type): map T::DataObjectTypeID => Option>; + pub DataObjectTypeMap get(data_object_type): map T::DataObjectTypeID => Option>; } } @@ -80,25 +80,25 @@ decl_module! { { fn deposit_event() = default; - pub fn register_data_object_type(origin, data_object_type: ObjectType) + pub fn register_data_object_type(origin, data_object_type: DataObjectType) { ensure_root(origin)?; ensure!(data_object_type.id.is_none(), MSG_REQUIRE_NEW_DOT); let new_dot_id = Self::next_data_object_type_id(); - let dot: ObjectType = ObjectType { + let dot: DataObjectType = DataObjectType { id: Some(new_dot_id), description: data_object_type.description.clone(), active: data_object_type.active, }; - >::insert(new_dot_id, dot); + >::insert(new_dot_id, dot); >::mutate(|n| { *n += T::DataObjectTypeID::sa(1); }); Self::deposit_event(RawEvent::DataObjectTypeAdded(new_dot_id)); } - pub fn update_data_object_type(origin, data_object_type: ObjectType) + pub fn update_data_object_type(origin, data_object_type: DataObjectType) { ensure_root(origin)?; ensure!(data_object_type.id.is_some(), MSG_REQUIRE_DOT_ID); @@ -109,7 +109,7 @@ decl_module! { dot.description = data_object_type.description.clone(); dot.active = data_object_type.active; - >::insert(id, dot); + >::insert(id, dot); Self::deposit_event(RawEvent::DataObjectTypeUpdated(id)); } @@ -121,7 +121,7 @@ decl_module! { dot.active = active; - >::insert(id, dot); + >::insert(id, dot); Self::deposit_event(RawEvent::DataObjectTypeUpdated(id)); } @@ -130,7 +130,7 @@ decl_module! { impl Module { - fn ensure_data_object_type(id: T::DataObjectTypeID) -> Result, &'static str> + fn ensure_data_object_type(id: T::DataObjectTypeID) -> Result, &'static str> { let dot = Self::data_object_type(&id).ok_or(MSG_DOT_NOT_FOUND)?; Ok(dot) From 3e43d9ed364803c70513e94d8860f156cfee1c11 Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Mon, 25 Mar 2019 23:14:26 +0200 Subject: [PATCH 053/175] refactor membership: renamed registry module to members --- src/lib.rs | 10 +++--- src/membership/{registry.rs => members.rs} | 0 src/membership/mock.rs | 8 ++--- src/membership/mod.rs | 2 +- src/membership/tests.rs | 40 +++++++++++----------- src/migration.rs | 6 ++-- 6 files changed, 33 insertions(+), 33 deletions(-) rename src/membership/{registry.rs => members.rs} (100%) diff --git a/src/lib.rs b/src/lib.rs index 93e6ba1afc..99fef0a8a3 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -18,7 +18,7 @@ pub mod governance; use governance::{election, council, proposals}; mod memo; mod membership; -use membership::registry; +use membership::members; mod traits; mod migration; @@ -212,13 +212,13 @@ impl governance::GovernanceCurrency for Runtime { impl governance::proposals::Trait for Runtime { type Event = Event; - type IsActiveMember = Membership; + type IsActiveMember = Members; } impl governance::election::Trait for Runtime { type Event = Event; type CouncilElected = (Council,); - type IsActiveMember = Membership; + type IsActiveMember = Members; } impl governance::council::Trait for Runtime { @@ -230,7 +230,7 @@ impl memo::Trait for Runtime { type Event = Event; } -impl membership::registry::Trait for Runtime { +impl members::Trait for Runtime { type Event = Event; type MemberId = u64; type PaidTermId = u64; @@ -261,7 +261,7 @@ construct_runtime!( CouncilElection: election::{Module, Call, Storage, Event, Config}, Council: council::{Module, Call, Storage, Event, Config}, Memo: memo::{Module, Call, Storage, Event}, - Membership: registry::{Module, Call, Storage, Event, Config}, + Members: members::{Module, Call, Storage, Event, Config}, Migration: migration::{Module, Call, Storage, Event}, } ); diff --git a/src/membership/registry.rs b/src/membership/members.rs similarity index 100% rename from src/membership/registry.rs rename to src/membership/members.rs diff --git a/src/membership/mock.rs b/src/membership/mock.rs index c85efaf4c6..b4e42c1be2 100644 --- a/src/membership/mock.rs +++ b/src/membership/mock.rs @@ -2,7 +2,7 @@ use rstd::prelude::*; pub use crate::governance::{GovernanceCurrency}; -pub use super::{registry}; +pub use super::{members}; pub use system; pub use primitives::{H256, Blake2Hasher}; @@ -69,7 +69,7 @@ impl GovernanceCurrency for Test { type Currency = balances::Module; } -impl registry::Trait for Test { +impl members::Trait for Test { type Event = (); type MemberId = u32; type PaidTermId = u32; @@ -101,7 +101,7 @@ impl ExtBuilder { pub fn build(self) -> runtime_io::TestExternalities { let mut t = system::GenesisConfig::::default().build_storage().unwrap().0; - t.extend(registry::GenesisConfig::{ + t.extend(members::GenesisConfig::{ first_member_id: self.first_member_id, default_paid_membership_fee: self.default_paid_membership_fee, }.build_storage().unwrap().0); @@ -112,4 +112,4 @@ impl ExtBuilder { pub type System = system::Module; pub type Balances = balances::Module; -pub type Membership = registry::Module; +pub type Members = members::Module; diff --git a/src/membership/mod.rs b/src/membership/mod.rs index a07ceef62a..35c272c7ad 100644 --- a/src/membership/mod.rs +++ b/src/membership/mod.rs @@ -1,6 +1,6 @@ #![cfg_attr(not(feature = "std"), no_std)] -pub mod registry; +pub mod members; mod mock; mod tests; \ No newline at end of file diff --git a/src/membership/tests.rs b/src/membership/tests.rs index 0de04124a3..5b159d433e 100644 --- a/src/membership/tests.rs +++ b/src/membership/tests.rs @@ -14,16 +14,16 @@ fn assert_ok_unwrap(value: Option, err: &'static str) -> T { } } -fn get_alice_info() -> registry::UserInfo { - registry::UserInfo { +fn get_alice_info() -> members::UserInfo { + members::UserInfo { handle: Some(String::from("alice").as_bytes().to_vec()), avatar_uri: Some(String::from("http://avatar-url.com/alice").as_bytes().to_vec()), about: Some(String::from("my name is alice").as_bytes().to_vec()), } } -fn get_bob_info() -> registry::UserInfo { - registry::UserInfo { +fn get_bob_info() -> members::UserInfo { + members::UserInfo { handle: Some(String::from("bobby").as_bytes().to_vec()), avatar_uri: Some(String::from("http://avatar-url.com/bob").as_bytes().to_vec()), about: Some(String::from("my name is bob").as_bytes().to_vec()), @@ -34,7 +34,7 @@ const ALICE_ACCOUNT_ID: u64 = 1; const DEFAULT_TERMS_ID: u32 = 0; fn buy_default_membership_as_alice() -> dispatch::Result { - Membership::buy_membership(Origin::signed(ALICE_ACCOUNT_ID), DEFAULT_TERMS_ID, get_alice_info()) + Members::buy_membership(Origin::signed(ALICE_ACCOUNT_ID), DEFAULT_TERMS_ID, get_alice_info()) } fn set_alice_free_balance(balance: u32) { @@ -50,10 +50,10 @@ fn initial_state() { .default_paid_membership_fee(DEFAULT_FEE) .first_member_id(DEFAULT_FIRST_ID).build(), || { - assert_eq!(Membership::first_member_id(), DEFAULT_FIRST_ID); - assert_eq!(Membership::next_member_id(), DEFAULT_FIRST_ID); + assert_eq!(Members::first_member_id(), DEFAULT_FIRST_ID); + assert_eq!(Members::next_member_id(), DEFAULT_FIRST_ID); - let default_terms = assert_ok_unwrap(Membership::paid_membership_terms_by_id(DEFAULT_TERMS_ID), "default terms not initialized"); + let default_terms = assert_ok_unwrap(Members::paid_membership_terms_by_id(DEFAULT_TERMS_ID), "default terms not initialized"); assert_eq!(default_terms.id, DEFAULT_TERMS_ID); assert_eq!(default_terms.fee, DEFAULT_FEE); @@ -75,9 +75,9 @@ fn buy_membership() { assert_ok!(buy_default_membership_as_alice()); - let member_id = assert_ok_unwrap(Membership::member_id_by_account_id(&ALICE_ACCOUNT_ID), "member id not assigned"); + let member_id = assert_ok_unwrap(Members::member_id_by_account_id(&ALICE_ACCOUNT_ID), "member id not assigned"); - let profile = assert_ok_unwrap(Membership::member_profile(&member_id), "member profile not created"); + let profile = assert_ok_unwrap(Members::member_profile(&member_id), "member profile not created"); assert_eq!(Some(profile.handle), get_alice_info().handle); assert_eq!(Some(profile.avatar_uri), get_alice_info().avatar_uri); @@ -112,7 +112,7 @@ fn new_memberships_allowed_flag() { let initial_balance = DEFAULT_FEE + 1; set_alice_free_balance(initial_balance); - >::put(false); + >::put(false); assert!(buy_default_membership_as_alice().is_err()); }); @@ -150,7 +150,7 @@ fn unique_handles() { set_alice_free_balance(initial_balance); // alice's handle already taken - >::insert(get_alice_info().handle.unwrap(), 1); + >::insert(get_alice_info().handle.unwrap(), 1); // should not be allowed to buy membership with that handle assert!(buy_default_membership_as_alice().is_err()); @@ -171,11 +171,11 @@ fn update_profile() { assert_ok!(buy_default_membership_as_alice()); - assert_ok!(Membership::update_profile(Origin::signed(ALICE_ACCOUNT_ID), get_bob_info())); + assert_ok!(Members::update_profile(Origin::signed(ALICE_ACCOUNT_ID), get_bob_info())); - let member_id = assert_ok_unwrap(Membership::member_id_by_account_id(&ALICE_ACCOUNT_ID), "member id not assigned"); + let member_id = assert_ok_unwrap(Members::member_id_by_account_id(&ALICE_ACCOUNT_ID), "member id not assigned"); - let profile = assert_ok_unwrap(Membership::member_profile(&member_id), "member profile created"); + let profile = assert_ok_unwrap(Members::member_profile(&member_id), "member profile created"); assert_eq!(Some(profile.handle), get_bob_info().handle); assert_eq!(Some(profile.avatar_uri), get_bob_info().avatar_uri); @@ -189,18 +189,18 @@ fn add_screened_member() { with_externalities(&mut ExtBuilder::default().build(), || { let screening_authority = 5; - >::put(&screening_authority); + >::put(&screening_authority); - assert_ok!(Membership::add_screened_member(Origin::signed(screening_authority), ALICE_ACCOUNT_ID, get_alice_info())); + assert_ok!(Members::add_screened_member(Origin::signed(screening_authority), ALICE_ACCOUNT_ID, get_alice_info())); - let member_id = assert_ok_unwrap(Membership::member_id_by_account_id(&ALICE_ACCOUNT_ID), "member id not assigned"); + let member_id = assert_ok_unwrap(Members::member_id_by_account_id(&ALICE_ACCOUNT_ID), "member id not assigned"); - let profile = assert_ok_unwrap(Membership::member_profile(&member_id), "member profile created"); + let profile = assert_ok_unwrap(Members::member_profile(&member_id), "member profile created"); assert_eq!(Some(profile.handle), get_alice_info().handle); assert_eq!(Some(profile.avatar_uri), get_alice_info().avatar_uri); assert_eq!(Some(profile.about), get_alice_info().about); - assert_eq!(registry::EntryMethod::Screening(screening_authority), profile.entry); + assert_eq!(members::EntryMethod::Screening(screening_authority), profile.entry); }); } diff --git a/src/migration.rs b/src/migration.rs index fe25cd8a60..d835e0a17d 100644 --- a/src/migration.rs +++ b/src/migration.rs @@ -5,9 +5,9 @@ use system; use rstd::prelude::*; use runtime_io::print; use crate::{VERSION}; -use crate::membership::registry; +use crate::membership::members; -pub trait Trait: system::Trait + registry::Trait { +pub trait Trait: system::Trait + members::Trait { type Event: From> + Into<::Event>; } @@ -38,7 +38,7 @@ impl Module { print("running runtime initializers"); - >::initialize_storage(); + >::initialize_storage(); // ... // add initialization of other modules introduced in this runtime From 85d1f330f0a30a333220171d1030a3d57edae28e Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Mon, 25 Mar 2019 23:36:49 +0200 Subject: [PATCH 054/175] remove unecessary use statement --- src/roles/actors.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/roles/actors.rs b/src/roles/actors.rs index 85ea36136d..607704176a 100644 --- a/src/roles/actors.rs +++ b/src/roles/actors.rs @@ -8,7 +8,6 @@ use srml_support::traits::{Currency, EnsureAccountLiquid}; use runtime_primitives::traits::{Zero, Bounded, SimpleArithmetic, As, Member, MaybeSerializeDebug}; use system::{self, ensure_signed}; use crate::governance::{GovernanceCurrency, BalanceOf }; -use crate::membership::registry; use crate::traits::{Members, Roles}; From 75d835d4f02bb5579cf81c2b99fd6e1aa66f2b31 Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Tue, 26 Mar 2019 00:12:36 +0200 Subject: [PATCH 055/175] members: refactor insert members method --- src/membership/members.rs | 33 ++++----------------------------- 1 file changed, 4 insertions(+), 29 deletions(-) diff --git a/src/membership/members.rs b/src/membership/members.rs index a088ce275a..68faed9917 100644 --- a/src/membership/members.rs +++ b/src/membership/members.rs @@ -210,7 +210,7 @@ decl_module! { Self::ensure_unique_handle(&user_info.handle)?; let _ = T::Currency::slash(&who, terms.fee); - let member_id = Self::insert_new_paid_member(&who, paid_terms_id, &user_info); + let member_id = Self::insert_member(&who, &user_info, EntryMethod::Paid(paid_terms_id)); Self::deposit_event(RawEvent::MemberRegistered(member_id, who.clone())); } @@ -275,7 +275,7 @@ decl_module! { // ensure handle is not already registered Self::ensure_unique_handle(&user_info.handle)?; - let member_id = Self::insert_new_screened_member(sender, &new_member, &user_info); + let member_id = Self::insert_member(&new_member, &user_info, EntryMethod::Screening(sender)); Self::deposit_event(RawEvent::MemberRegistered(member_id, new_member.clone())); } @@ -355,32 +355,7 @@ impl Module { } // Mutating methods - - fn insert_new_paid_member(who: &T::AccountId, paid_terms_id: T::PaidTermId, user_info: &CheckedUserInfo) -> T::MemberId { - let new_member_id = Self::next_member_id(); - - let profile: Profile = Profile { - id: new_member_id, - handle: user_info.handle.clone(), - avatar_uri: user_info.avatar_uri.clone(), - about: user_info.about.clone(), - registered_at_block: >::block_number(), - registered_at_time: >::now(), - entry: EntryMethod::Paid(paid_terms_id), - suspended: false, - subscription: None, - }; - - >::insert(who.clone(), new_member_id); - >::insert(new_member_id, who.clone()); - >::insert(new_member_id, profile); - >::insert(user_info.handle.clone(), new_member_id); - >::mutate(|n| { *n += T::MemberId::sa(1); }); - - new_member_id - } - - fn insert_new_screened_member(authority: T::AccountId, who: &T::AccountId, user_info: &CheckedUserInfo) -> T::MemberId { + fn insert_member(who: &T::AccountId, user_info: &CheckedUserInfo, entry_method: EntryMethod) -> T::MemberId { let new_member_id = Self::next_member_id(); let profile: Profile = Profile { @@ -390,7 +365,7 @@ impl Module { about: user_info.about.clone(), registered_at_block: >::block_number(), registered_at_time: >::now(), - entry: EntryMethod::Screening(authority), + entry: entry_method, suspended: false, subscription: None, }; From a4b502e34267f291b2c8438e558c72af0d80d898 Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Tue, 26 Mar 2019 01:45:53 +0200 Subject: [PATCH 056/175] staked role payouts --- src/roles/actors.rs | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/src/roles/actors.rs b/src/roles/actors.rs index 607704176a..b126c6b3e6 100644 --- a/src/roles/actors.rs +++ b/src/roles/actors.rs @@ -29,7 +29,7 @@ pub struct RoleParameters { min_actors: u32, // fixed amount of tokens paid to actors' primary account - reward_per_block: Balance, + reward: Balance, // payouts are made at this block interval reward_period: BlockNumber, @@ -187,10 +187,24 @@ decl_module! { } fn on_finalize(now: T::BlockNumber) { + // payout rewards to actors + for role in Self::available_roles().iter() { + if let Some(params) = Self::parameters(role) { + if !(now % params.reward_period == T::BlockNumber::zero()) { continue } + let accounts = Self::accounts_by_role(role); + for actor in accounts.into_iter().map(|account| Self::actors_by_account_id(account)) { + if let Some(actor) = actor { + if now > actor.joined_at + params.reward_period { + T::Currency::reward(&actor.account, params.reward); + } + } + } + } + } - // clear unbonded accounts if now % T::BlockNumber::sa(100) == T::BlockNumber::zero() { + // clear unbonded accounts let actors: Vec = Self::actors() .into_iter() .filter(|account| { @@ -210,6 +224,13 @@ decl_module! { } // eject actors not staking the minimum + // iterating over available roles, so if a role has been removed at some point + // and an actor hasn't unstaked .. this will not apply to them.. which doesn't really matter + // because they are no longer incentivised to stay in the role anyway + // TODO: this needs a bit more preparation. The right time to check for each actor is different, as they enter + // role at different times. + // for role in Self::available_roles().iter() { + // } } @@ -302,6 +323,7 @@ decl_module! { } pub fn remove_from_available_roles(role: Role) { + // Should we eject actors in the role being removed? let roles: Vec = Self::available_roles().into_iter().filter(|r| role != *r).collect(); >::put(roles); } From 4ef307e4fe75f1aa21dd24bf66b222005a7bb5da Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Tue, 26 Mar 2019 10:23:37 +0200 Subject: [PATCH 057/175] MaybeDebug needed on trait --- src/roles/actors.rs | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/src/roles/actors.rs b/src/roles/actors.rs index b126c6b3e6..b603006a69 100644 --- a/src/roles/actors.rs +++ b/src/roles/actors.rs @@ -5,7 +5,7 @@ use parity_codec::Codec; use parity_codec_derive::{Encode, Decode}; use srml_support::{StorageMap, StorageValue, dispatch, decl_module, decl_storage, decl_event, ensure, Parameter}; use srml_support::traits::{Currency, EnsureAccountLiquid}; -use runtime_primitives::traits::{Zero, Bounded, SimpleArithmetic, As, Member, MaybeSerializeDebug}; +use runtime_primitives::traits::{Zero, Bounded, SimpleArithmetic, As, Member, MaybeSerializeDebug, MaybeDebug}; use system::{self, ensure_signed}; use crate::governance::{GovernanceCurrency, BalanceOf }; @@ -16,10 +16,12 @@ pub enum Role { Storage, } -#[derive(Encode, Decode, Copy, Clone, Debug, Eq, PartialEq)] -pub struct RoleParameters { + +#[cfg_attr(feature = "std", derive(Debug))] +#[derive(Encode, Decode, Copy, Clone, Eq, PartialEq)] +pub struct RoleParameters { // minium balance required to stake to enter a role - min_stake: Balance, + min_stake: BalanceOf, // the maximum number of spots available to fill for a role max_actors: u32, @@ -29,24 +31,24 @@ pub struct RoleParameters { min_actors: u32, // fixed amount of tokens paid to actors' primary account - reward: Balance, + reward: BalanceOf, // payouts are made at this block interval - reward_period: BlockNumber, + reward_period: T::BlockNumber, // how long tokens remain locked for after unstaking - unbonding_period: BlockNumber, + unbonding_period: T::BlockNumber, // minimum amount of time before being able to unstake - bonding_time: BlockNumber, + bonding_time: T::BlockNumber, // minimum period required to be in service. unbonding before this time is highly penalized - min_service_period: BlockNumber, + min_service_period: T::BlockNumber, // "startup" time allowed for roles that need to sync their infrastructure // with other providers before they are considered in service and punishable for // not delivering required level of service. - startup_grace_period: BlockNumber, + startup_grace_period: T::BlockNumber, // entry_request_fee: BalanceOf, } @@ -60,7 +62,7 @@ pub struct Actor { // startup_grace_period_ends_at: T::BlockNumber, } -pub trait Trait: system::Trait + GovernanceCurrency { +pub trait Trait: system::Trait + GovernanceCurrency + MaybeDebug { type Event: From> + Into<::Event>; type Members: Members; @@ -76,7 +78,7 @@ const DEFAULT_REQUEST_CLEARING_INTERVAL: u64 = 100; decl_storage! { trait Store for Module as Actors { /// requirements to enter and maintain status in roles - Parameters get(parameters) : map Role => Option, T::BlockNumber>>; + Parameters get(parameters) : map Role => Option>; /// the roles members can enter into AvailableRoles get(available_roles) : Vec; // = vec![Role::Storage]; @@ -134,7 +136,7 @@ impl Module { } } - fn ensure_role_parameters(role: Role) -> Result, T::BlockNumber>, &'static str> { + fn ensure_role_parameters(role: Role) -> Result, &'static str> { Self::parameters(role).ok_or("no parameters for role") } @@ -308,7 +310,7 @@ decl_module! { Self::apply_unstake(actor.account, actor.role, actor.member_id, role_parameters.unbonding_period); } - pub fn set_role_parameters(role: Role, params: RoleParameters, T::BlockNumber>) { + pub fn set_role_parameters(role: Role, params: RoleParameters) { >::insert(role, params); } From cbab82b9893e43675ac01505ca1cd98e45b8ecea Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Tue, 26 Mar 2019 10:43:52 +0200 Subject: [PATCH 058/175] staked roles: initialize runtime allowing Storage role --- src/migration.rs | 55 ++++++++++++++++++++++++++++++--------------- src/roles/actors.rs | 18 +++++++-------- 2 files changed, 46 insertions(+), 27 deletions(-) diff --git a/src/migration.rs b/src/migration.rs index d835e0a17d..a360c3a311 100644 --- a/src/migration.rs +++ b/src/migration.rs @@ -6,24 +6,9 @@ use rstd::prelude::*; use runtime_io::print; use crate::{VERSION}; use crate::membership::members; - -pub trait Trait: system::Trait + members::Trait { - type Event: From> + Into<::Event>; -} - -decl_storage! { - trait Store for Module as Migration { - /// Records at what runtime spec version the store was initialized. This allows the runtime - /// to know when to run initialize code if it was installed as an update. - pub SpecVersion get(spec_version) build(|_| Some(VERSION.spec_version)) : Option; - } -} - -decl_event! { - pub enum Event where ::BlockNumber { - Migrated(BlockNumber, u32), - } -} +use crate::roles::actors; +use crate::governance::{GovernanceCurrency, BalanceOf }; +use runtime_primitives::traits::{Zero, Bounded, SimpleArithmetic, As}; // When preparing a new major runtime release version bump this value to match it and update // the initialization code in runtime_initialization(). Because of the way substrate runs runtime code @@ -40,6 +25,22 @@ impl Module { >::initialize_storage(); + // Initialize Storage provider role parameters + >::set_role_parameters(actors::Role::Storage, actors::RoleParameters { + min_stake: BalanceOf::::sa(3000), + max_actors: 10, + reward: BalanceOf::::sa(10), + reward_period: T::BlockNumber::sa(600), + unbonding_period: T::BlockNumber::sa(600), + + // not currently used + min_actors: 5, + bonding_time: T::BlockNumber::sa(600), + min_service_period: T::BlockNumber::sa(600), + startup_grace_period: T::BlockNumber::sa(600), + }); + >::set_available_roles(vec![actors::Role::Storage]); + // ... // add initialization of other modules introduced in this runtime // ... @@ -48,6 +49,24 @@ impl Module { } } +pub trait Trait: system::Trait + members::Trait + actors::Trait { + type Event: From> + Into<::Event>; +} + +decl_storage! { + trait Store for Module as Migration { + /// Records at what runtime spec version the store was initialized. This allows the runtime + /// to know when to run initialize code if it was installed as an update. + pub SpecVersion get(spec_version) build(|_| Some(VERSION.spec_version)) : Option; + } +} + +decl_event! { + pub enum Event where ::BlockNumber { + Migrated(BlockNumber, u32), + } +} + decl_module! { pub struct Module for enum Call where origin: T::Origin { fn deposit_event() = default; diff --git a/src/roles/actors.rs b/src/roles/actors.rs index b603006a69..464f76faa3 100644 --- a/src/roles/actors.rs +++ b/src/roles/actors.rs @@ -21,34 +21,34 @@ pub enum Role { #[derive(Encode, Decode, Copy, Clone, Eq, PartialEq)] pub struct RoleParameters { // minium balance required to stake to enter a role - min_stake: BalanceOf, + pub min_stake: BalanceOf, // the maximum number of spots available to fill for a role - max_actors: u32, + pub max_actors: u32, // minimum actors to maintain - if role is unstaking // and remaining actors would be less that this value - prevent or punish for unstaking - min_actors: u32, + pub min_actors: u32, // fixed amount of tokens paid to actors' primary account - reward: BalanceOf, + pub reward: BalanceOf, // payouts are made at this block interval - reward_period: T::BlockNumber, + pub reward_period: T::BlockNumber, // how long tokens remain locked for after unstaking - unbonding_period: T::BlockNumber, + pub unbonding_period: T::BlockNumber, // minimum amount of time before being able to unstake - bonding_time: T::BlockNumber, + pub bonding_time: T::BlockNumber, // minimum period required to be in service. unbonding before this time is highly penalized - min_service_period: T::BlockNumber, + pub min_service_period: T::BlockNumber, // "startup" time allowed for roles that need to sync their infrastructure // with other providers before they are considered in service and punishable for // not delivering required level of service. - startup_grace_period: T::BlockNumber, + pub startup_grace_period: T::BlockNumber, // entry_request_fee: BalanceOf, } From 61dfc3ca442a48833cb04d93637b30f47744f7e5 Mon Sep 17 00:00:00 2001 From: Jens Finkhaeuser Date: Tue, 26 Mar 2019 14:11:26 +0100 Subject: [PATCH 059/175] Fixes #14 --- src/storage/types.rs | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/src/storage/types.rs b/src/storage/types.rs index 90855a3c54..316b221fb4 100644 --- a/src/storage/types.rs +++ b/src/storage/types.rs @@ -17,9 +17,9 @@ pub trait Trait: system::Trait + MaybeDebug } -static MSG_REQUIRE_NEW_DOT: &str = "New Data Object Type required; the provided one seems to be in use already!"; -static MSG_DOT_NOT_FOUND: &str = "Data Object Type with the given ID not found!"; -static MSG_REQUIRE_DOT_ID: &str = "Can only update Data Object Types that are already registered (with an ID)!"; +static MSG_REQUIRE_NEW_DO_TYPE: &str = "New Data Object Type required; the provided one seems to be in use already!"; +static MSG_DO_TYPE_NOT_FOUND: &str = "Data Object Type with the given ID not found!"; +static MSG_REQUIRE_DO_TYPE_ID: &str = "Can only update Data Object Types that are already registered (with an ID)!"; const DEFAULT_FIRST_DATA_OBJECT_TYPE_ID: u64 = 1; @@ -68,7 +68,7 @@ impl traits::IsActiveDataObjectType for Module { match Self::ensure_data_object_type(*which) { - Ok(dot) => dot.active, + Ok(do_type) => do_type.active, Err(_err) => false } } @@ -83,33 +83,33 @@ decl_module! { pub fn register_data_object_type(origin, data_object_type: DataObjectType) { ensure_root(origin)?; - ensure!(data_object_type.id.is_none(), MSG_REQUIRE_NEW_DOT); + ensure!(data_object_type.id.is_none(), MSG_REQUIRE_NEW_DO_TYPE); - let new_dot_id = Self::next_data_object_type_id(); - let dot: DataObjectType = DataObjectType { - id: Some(new_dot_id), + let new_do_type_id = Self::next_data_object_type_id(); + let do_type: DataObjectType = DataObjectType { + id: Some(new_do_type_id), description: data_object_type.description.clone(), active: data_object_type.active, }; - >::insert(new_dot_id, dot); + >::insert(new_do_type_id, do_type); >::mutate(|n| { *n += T::DataObjectTypeID::sa(1); }); - Self::deposit_event(RawEvent::DataObjectTypeAdded(new_dot_id)); + Self::deposit_event(RawEvent::DataObjectTypeAdded(new_do_type_id)); } pub fn update_data_object_type(origin, data_object_type: DataObjectType) { ensure_root(origin)?; - ensure!(data_object_type.id.is_some(), MSG_REQUIRE_DOT_ID); + ensure!(data_object_type.id.is_some(), MSG_REQUIRE_DO_TYPE_ID); let id = data_object_type.id.unwrap(); - let mut dot = Self::ensure_data_object_type(id)?; + let mut do_type = Self::ensure_data_object_type(id)?; - dot.description = data_object_type.description.clone(); - dot.active = data_object_type.active; + do_type.description = data_object_type.description.clone(); + do_type.active = data_object_type.active; - >::insert(id, dot); + >::insert(id, do_type); Self::deposit_event(RawEvent::DataObjectTypeUpdated(id)); } @@ -117,11 +117,11 @@ decl_module! { pub fn activate_data_object_type(origin, id: T::DataObjectTypeID, active: bool) { ensure_root(origin)?; - let mut dot = Self::ensure_data_object_type(id)?; + let mut do_type = Self::ensure_data_object_type(id)?; - dot.active = active; + do_type.active = active; - >::insert(id, dot); + >::insert(id, do_type); Self::deposit_event(RawEvent::DataObjectTypeUpdated(id)); } @@ -132,7 +132,7 @@ impl Module { fn ensure_data_object_type(id: T::DataObjectTypeID) -> Result, &'static str> { - let dot = Self::data_object_type(&id).ok_or(MSG_DOT_NOT_FOUND)?; - Ok(dot) + let do_type = Self::data_object_type(&id).ok_or(MSG_DO_TYPE_NOT_FOUND)?; + Ok(do_type) } } From a695dd27fcc09be0babcbe183b2f0eb578a9ad2b Mon Sep 17 00:00:00 2001 From: Jens Finkhaeuser Date: Tue, 26 Mar 2019 14:15:28 +0100 Subject: [PATCH 060/175] Respond to comment about consistent naming. I think the best compromise is to call the module file `type_registry`, and the use the full `DataObjectTypeRegistry` name for the Module. --- src/lib.rs | 6 ++--- src/storage/mock.rs | 12 ++++----- src/storage/mod.rs | 2 +- src/storage/tests.rs | 30 +++++++++++----------- src/storage/{types.rs => type_registry.rs} | 0 src/traits.rs | 4 +-- 6 files changed, 27 insertions(+), 27 deletions(-) rename src/storage/{types.rs => type_registry.rs} (100%) diff --git a/src/lib.rs b/src/lib.rs index c728fb6734..82f3e2f638 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -17,7 +17,7 @@ extern crate parity_codec_derive; pub mod governance; use governance::{election, council, proposals}; pub mod storage; -use storage::{types}; +use storage::{type_registry}; mod memo; mod traits; @@ -227,7 +227,7 @@ impl memo::Trait for Runtime { type Event = Event; } -impl storage::types::Trait for Runtime { +impl storage::type_registry::Trait for Runtime { type Event = Event; type DataObjectTypeID = u64; } @@ -252,7 +252,7 @@ construct_runtime!( CouncilElection: election::{Module, Call, Storage, Event, Config}, Council: council::{Module, Call, Storage, Event, Config}, Memo: memo::{Module, Call, Storage, Event}, - DataObjectType: types::{Module, Call, Storage, Event, Config}, + DataObjectTypeRegistry: type_registry::{Module, Call, Storage, Event, Config}, } ); diff --git a/src/storage/mock.rs b/src/storage/mock.rs index c9b5b8ab84..1c4b6d8521 100644 --- a/src/storage/mock.rs +++ b/src/storage/mock.rs @@ -1,7 +1,7 @@ #![cfg(test)] use rstd::prelude::*; -pub use super::{types}; +pub use super::{type_registry}; pub use system; pub use primitives::{H256, Blake2Hasher}; @@ -20,7 +20,7 @@ impl_outer_origin! { impl_outer_event! { pub enum MetaEvent for Test { - types, + type_registry, } } @@ -43,7 +43,7 @@ impl system::Trait for Test type Log = DigestItem; type Lookup = IdentityLookup; } -impl types::Trait for Test +impl type_registry::Trait for Test { type Event = MetaEvent; type DataObjectTypeID = u64; @@ -75,7 +75,7 @@ impl ExtBuilder { let mut t = system::GenesisConfig::::default().build_storage().unwrap().0; - t.extend(types::GenesisConfig::{ + t.extend(type_registry::GenesisConfig::{ first_data_object_type_id: self.first_data_object_type_id, }.build_storage().unwrap().0); @@ -85,5 +85,5 @@ impl ExtBuilder pub type System = system::Module; -pub type Types = types::Module; -pub type TestDataObjectType = types::DataObjectType; +pub type TestDataObjectTypeRegistry = type_registry::Module; +pub type TestDataObjectType = type_registry::DataObjectType; diff --git a/src/storage/mod.rs b/src/storage/mod.rs index f50e2661c0..ac6f28c54d 100644 --- a/src/storage/mod.rs +++ b/src/storage/mod.rs @@ -1,6 +1,6 @@ #![cfg_attr(not(feature = "std"), no_std)] -pub mod types; +pub mod type_registry; mod mock; mod tests; diff --git a/src/storage/tests.rs b/src/storage/tests.rs index 2f9df21172..50e474fa5e 100644 --- a/src/storage/tests.rs +++ b/src/storage/tests.rs @@ -15,7 +15,7 @@ fn initial_state() with_externalities(&mut ExtBuilder::default() .first_data_object_type_id(DEFAULT_FIRST_ID).build(), || { - assert_eq!(Types::first_data_object_type_id(), DEFAULT_FIRST_ID); + assert_eq!(DataObjectTypeRegistry::first_data_object_type_id(), DEFAULT_FIRST_ID); }); } @@ -32,7 +32,7 @@ fn fail_register_without_root() description: "foo".as_bytes().to_vec(), active: false, }; - let res = Types::register_data_object_type(Origin::signed(1), data); + let res = DataObjectTypeRegistry::register_data_object_type(Origin::signed(1), data); assert!(res.is_err()); }); } @@ -50,7 +50,7 @@ fn succeed_register_as_root() description: "foo".as_bytes().to_vec(), active: false, }; - let res = Types::register_data_object_type(Origin::ROOT, data); + let res = DataObjectTypeRegistry::register_data_object_type(Origin::ROOT, data); assert!(res.is_ok()); }); } @@ -69,12 +69,12 @@ fn update_existing() description: "foo".as_bytes().to_vec(), active: false, }; - let id_res = Types::register_data_object_type(Origin::ROOT, data); + let id_res = DataObjectTypeRegistry::register_data_object_type(Origin::ROOT, data); assert!(id_res.is_ok()); assert_eq!(*System::events().last().unwrap(), EventRecord { phase: Phase::ApplyExtrinsic(0), - event: MetaEvent::types(types::RawEvent::DataObjectTypeAdded(DEFAULT_FIRST_ID)), + event: MetaEvent::types(DataObjectTypeRegistry::RawEvent::DataObjectTypeAdded(DEFAULT_FIRST_ID)), } ); @@ -86,7 +86,7 @@ fn update_existing() description: "bar".as_bytes().to_vec(), active: false, }; - let res = Types::update_data_object_type(Origin::ROOT, updated1); + let res = DataObjectTypeRegistry::update_data_object_type(Origin::ROOT, updated1); assert!(res.is_err()); // Now try with a bad ID @@ -95,7 +95,7 @@ fn update_existing() description: "bar".as_bytes().to_vec(), active: false, }; - let res = Types::update_data_object_type(Origin::ROOT, updated2); + let res = DataObjectTypeRegistry::update_data_object_type(Origin::ROOT, updated2); assert!(res.is_err()); // Finally with an existing ID, it should work. @@ -104,12 +104,12 @@ fn update_existing() description: "bar".as_bytes().to_vec(), active: false, }; - let res = Types::update_data_object_type(Origin::ROOT, updated3); + let res = DataObjectTypeRegistry::update_data_object_type(Origin::ROOT, updated3); assert!(res.is_ok()); assert_eq!(*System::events().last().unwrap(), EventRecord { phase: Phase::ApplyExtrinsic(0), - event: MetaEvent::types(types::RawEvent::DataObjectTypeUpdated(DEFAULT_FIRST_ID)), + event: MetaEvent::types(DataObjectTypeRegistry::RawEvent::DataObjectTypeUpdated(DEFAULT_FIRST_ID)), } ); }); @@ -130,32 +130,32 @@ fn activate_existing() description: "foo".as_bytes().to_vec(), active: false, }; - let id_res = Types::register_data_object_type(Origin::ROOT, data); + let id_res = DataObjectTypeRegistry::register_data_object_type(Origin::ROOT, data); assert!(id_res.is_ok()); assert_eq!(*System::events().last().unwrap(), EventRecord { phase: Phase::ApplyExtrinsic(0), - event: MetaEvent::types(types::RawEvent::DataObjectTypeAdded(DEFAULT_FIRST_ID)), + event: MetaEvent::types(DataObjectTypeRegistry::RawEvent::DataObjectTypeAdded(DEFAULT_FIRST_ID)), } ); // Retrieve, and ensure it's not active. - let data = Types::data_object_type(DEFAULT_FIRST_ID); + let data = DataObjectTypeRegistry::data_object_type(DEFAULT_FIRST_ID); assert!(data.is_some()); assert!(!data.unwrap().active); // Now activate the data object type - let res = Types::activate_data_object_type(Origin::ROOT, DEFAULT_FIRST_ID, true); + let res = DataObjectTypeRegistry::activate_data_object_type(Origin::ROOT, DEFAULT_FIRST_ID, true); assert!(res.is_ok()); assert_eq!(*System::events().last().unwrap(), EventRecord { phase: Phase::ApplyExtrinsic(0), - event: MetaEvent::types(types::RawEvent::DataObjectTypeUpdated(DEFAULT_FIRST_ID)), + event: MetaEvent::types(DataObjectTypeRegistry::RawEvent::DataObjectTypeUpdated(DEFAULT_FIRST_ID)), } ); // Ensure that the item is actually activated. - let data = Types::data_object_type(DEFAULT_FIRST_ID); + let data = DataObjectTypeRegistry::data_object_type(DEFAULT_FIRST_ID); assert!(data.is_some()); assert!(data.unwrap().active); }); diff --git a/src/storage/types.rs b/src/storage/type_registry.rs similarity index 100% rename from src/storage/types.rs rename to src/storage/type_registry.rs diff --git a/src/traits.rs b/src/traits.rs index d5533c70e3..a4cb028663 100644 --- a/src/traits.rs +++ b/src/traits.rs @@ -1,8 +1,8 @@ #![cfg_attr(not(feature = "std"), no_std)] -use crate::storage::types; +use crate::storage::type_registry; -pub trait IsActiveDataObjectType +pub trait IsActiveDataObjectType { fn is_active_data_object_type(which: &T::DataObjectTypeID) -> bool { From 701e2b075a9a89f1004568517c181a5a68a7244f Mon Sep 17 00:00:00 2001 From: Jens Finkhaeuser Date: Tue, 26 Mar 2019 15:07:41 +0100 Subject: [PATCH 061/175] More renaming (debated in rocket chat); works for WASM build, but not yet for unit tests. --- src/lib.rs | 6 +++--- .../{type_registry.rs => data_object_type_registry.rs} | 0 src/storage/mod.rs | 2 +- src/traits.rs | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) rename src/storage/{type_registry.rs => data_object_type_registry.rs} (100%) diff --git a/src/lib.rs b/src/lib.rs index 82f3e2f638..53c03f2d5d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -17,7 +17,7 @@ extern crate parity_codec_derive; pub mod governance; use governance::{election, council, proposals}; pub mod storage; -use storage::{type_registry}; +use storage::{data_object_type_registry}; mod memo; mod traits; @@ -227,7 +227,7 @@ impl memo::Trait for Runtime { type Event = Event; } -impl storage::type_registry::Trait for Runtime { +impl storage::data_object_type_registry::Trait for Runtime { type Event = Event; type DataObjectTypeID = u64; } @@ -252,7 +252,7 @@ construct_runtime!( CouncilElection: election::{Module, Call, Storage, Event, Config}, Council: council::{Module, Call, Storage, Event, Config}, Memo: memo::{Module, Call, Storage, Event}, - DataObjectTypeRegistry: type_registry::{Module, Call, Storage, Event, Config}, + DataObjectTypeRegistry: data_object_type_registry::{Module, Call, Storage, Event, Config}, } ); diff --git a/src/storage/type_registry.rs b/src/storage/data_object_type_registry.rs similarity index 100% rename from src/storage/type_registry.rs rename to src/storage/data_object_type_registry.rs diff --git a/src/storage/mod.rs b/src/storage/mod.rs index ac6f28c54d..c2255437b7 100644 --- a/src/storage/mod.rs +++ b/src/storage/mod.rs @@ -1,6 +1,6 @@ #![cfg_attr(not(feature = "std"), no_std)] -pub mod type_registry; +pub mod data_object_type_registry; mod mock; mod tests; diff --git a/src/traits.rs b/src/traits.rs index a4cb028663..e146692de7 100644 --- a/src/traits.rs +++ b/src/traits.rs @@ -1,8 +1,8 @@ #![cfg_attr(not(feature = "std"), no_std)] -use crate::storage::type_registry; +use crate::storage::data_object_type_registry; -pub trait IsActiveDataObjectType +pub trait IsActiveDataObjectType { fn is_active_data_object_type(which: &T::DataObjectTypeID) -> bool { From 32b659a819050eb65495acdc29c0dc5ba8b86974 Mon Sep 17 00:00:00 2001 From: Jens Finkhaeuser Date: Tue, 26 Mar 2019 15:13:42 +0100 Subject: [PATCH 062/175] Adjust renaming to unit tests --- src/storage/mock.rs | 12 ++++++------ src/storage/tests.rs | 30 +++++++++++++++--------------- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/storage/mock.rs b/src/storage/mock.rs index 1c4b6d8521..96191c1610 100644 --- a/src/storage/mock.rs +++ b/src/storage/mock.rs @@ -1,7 +1,7 @@ #![cfg(test)] use rstd::prelude::*; -pub use super::{type_registry}; +pub use super::{data_object_type_registry}; pub use system; pub use primitives::{H256, Blake2Hasher}; @@ -20,7 +20,7 @@ impl_outer_origin! { impl_outer_event! { pub enum MetaEvent for Test { - type_registry, + data_object_type_registry, } } @@ -43,7 +43,7 @@ impl system::Trait for Test type Log = DigestItem; type Lookup = IdentityLookup; } -impl type_registry::Trait for Test +impl data_object_type_registry::Trait for Test { type Event = MetaEvent; type DataObjectTypeID = u64; @@ -75,7 +75,7 @@ impl ExtBuilder { let mut t = system::GenesisConfig::::default().build_storage().unwrap().0; - t.extend(type_registry::GenesisConfig::{ + t.extend(data_object_type_registry::GenesisConfig::{ first_data_object_type_id: self.first_data_object_type_id, }.build_storage().unwrap().0); @@ -85,5 +85,5 @@ impl ExtBuilder pub type System = system::Module; -pub type TestDataObjectTypeRegistry = type_registry::Module; -pub type TestDataObjectType = type_registry::DataObjectType; +pub type TestDataObjectTypeRegistry = data_object_type_registry::Module; +pub type TestDataObjectType = data_object_type_registry::DataObjectType; diff --git a/src/storage/tests.rs b/src/storage/tests.rs index 50e474fa5e..8ffd2771f5 100644 --- a/src/storage/tests.rs +++ b/src/storage/tests.rs @@ -15,7 +15,7 @@ fn initial_state() with_externalities(&mut ExtBuilder::default() .first_data_object_type_id(DEFAULT_FIRST_ID).build(), || { - assert_eq!(DataObjectTypeRegistry::first_data_object_type_id(), DEFAULT_FIRST_ID); + assert_eq!(TestDataObjectTypeRegistry::first_data_object_type_id(), DEFAULT_FIRST_ID); }); } @@ -32,7 +32,7 @@ fn fail_register_without_root() description: "foo".as_bytes().to_vec(), active: false, }; - let res = DataObjectTypeRegistry::register_data_object_type(Origin::signed(1), data); + let res = TestDataObjectTypeRegistry::register_data_object_type(Origin::signed(1), data); assert!(res.is_err()); }); } @@ -50,7 +50,7 @@ fn succeed_register_as_root() description: "foo".as_bytes().to_vec(), active: false, }; - let res = DataObjectTypeRegistry::register_data_object_type(Origin::ROOT, data); + let res = TestDataObjectTypeRegistry::register_data_object_type(Origin::ROOT, data); assert!(res.is_ok()); }); } @@ -69,12 +69,12 @@ fn update_existing() description: "foo".as_bytes().to_vec(), active: false, }; - let id_res = DataObjectTypeRegistry::register_data_object_type(Origin::ROOT, data); + let id_res = TestDataObjectTypeRegistry::register_data_object_type(Origin::ROOT, data); assert!(id_res.is_ok()); assert_eq!(*System::events().last().unwrap(), EventRecord { phase: Phase::ApplyExtrinsic(0), - event: MetaEvent::types(DataObjectTypeRegistry::RawEvent::DataObjectTypeAdded(DEFAULT_FIRST_ID)), + event: MetaEvent::data_object_type_registry(data_object_type_registry::RawEvent::DataObjectTypeAdded(DEFAULT_FIRST_ID)), } ); @@ -86,7 +86,7 @@ fn update_existing() description: "bar".as_bytes().to_vec(), active: false, }; - let res = DataObjectTypeRegistry::update_data_object_type(Origin::ROOT, updated1); + let res = TestDataObjectTypeRegistry::update_data_object_type(Origin::ROOT, updated1); assert!(res.is_err()); // Now try with a bad ID @@ -95,7 +95,7 @@ fn update_existing() description: "bar".as_bytes().to_vec(), active: false, }; - let res = DataObjectTypeRegistry::update_data_object_type(Origin::ROOT, updated2); + let res = TestDataObjectTypeRegistry::update_data_object_type(Origin::ROOT, updated2); assert!(res.is_err()); // Finally with an existing ID, it should work. @@ -104,12 +104,12 @@ fn update_existing() description: "bar".as_bytes().to_vec(), active: false, }; - let res = DataObjectTypeRegistry::update_data_object_type(Origin::ROOT, updated3); + let res = TestDataObjectTypeRegistry::update_data_object_type(Origin::ROOT, updated3); assert!(res.is_ok()); assert_eq!(*System::events().last().unwrap(), EventRecord { phase: Phase::ApplyExtrinsic(0), - event: MetaEvent::types(DataObjectTypeRegistry::RawEvent::DataObjectTypeUpdated(DEFAULT_FIRST_ID)), + event: MetaEvent::data_object_type_registry(data_object_type_registry::RawEvent::DataObjectTypeUpdated(DEFAULT_FIRST_ID)), } ); }); @@ -130,32 +130,32 @@ fn activate_existing() description: "foo".as_bytes().to_vec(), active: false, }; - let id_res = DataObjectTypeRegistry::register_data_object_type(Origin::ROOT, data); + let id_res = TestDataObjectTypeRegistry::register_data_object_type(Origin::ROOT, data); assert!(id_res.is_ok()); assert_eq!(*System::events().last().unwrap(), EventRecord { phase: Phase::ApplyExtrinsic(0), - event: MetaEvent::types(DataObjectTypeRegistry::RawEvent::DataObjectTypeAdded(DEFAULT_FIRST_ID)), + event: MetaEvent::data_object_type_registry(data_object_type_registry::RawEvent::DataObjectTypeAdded(DEFAULT_FIRST_ID)), } ); // Retrieve, and ensure it's not active. - let data = DataObjectTypeRegistry::data_object_type(DEFAULT_FIRST_ID); + let data = TestDataObjectTypeRegistry::data_object_type(DEFAULT_FIRST_ID); assert!(data.is_some()); assert!(!data.unwrap().active); // Now activate the data object type - let res = DataObjectTypeRegistry::activate_data_object_type(Origin::ROOT, DEFAULT_FIRST_ID, true); + let res = TestDataObjectTypeRegistry::activate_data_object_type(Origin::ROOT, DEFAULT_FIRST_ID, true); assert!(res.is_ok()); assert_eq!(*System::events().last().unwrap(), EventRecord { phase: Phase::ApplyExtrinsic(0), - event: MetaEvent::types(DataObjectTypeRegistry::RawEvent::DataObjectTypeUpdated(DEFAULT_FIRST_ID)), + event: MetaEvent::data_object_type_registry(data_object_type_registry::RawEvent::DataObjectTypeUpdated(DEFAULT_FIRST_ID)), } ); // Ensure that the item is actually activated. - let data = DataObjectTypeRegistry::data_object_type(DEFAULT_FIRST_ID); + let data = TestDataObjectTypeRegistry::data_object_type(DEFAULT_FIRST_ID); assert!(data.is_some()); assert!(data.unwrap().active); }); From cb73509a4295e8d451840863f6639f2c332ba316 Mon Sep 17 00:00:00 2001 From: Jens Finkhaeuser Date: Tue, 26 Mar 2019 15:17:06 +0100 Subject: [PATCH 063/175] Simplify ensure_data_object_type() --- src/storage/data_object_type_registry.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/storage/data_object_type_registry.rs b/src/storage/data_object_type_registry.rs index 316b221fb4..cfc6e8227a 100644 --- a/src/storage/data_object_type_registry.rs +++ b/src/storage/data_object_type_registry.rs @@ -132,7 +132,6 @@ impl Module { fn ensure_data_object_type(id: T::DataObjectTypeID) -> Result, &'static str> { - let do_type = Self::data_object_type(&id).ok_or(MSG_DO_TYPE_NOT_FOUND)?; - Ok(do_type) + return Self::data_object_type(&id).ok_or(MSG_DO_TYPE_NOT_FOUND); } } From f7440326863fc9b95675b5c5a41da2ce4025a822 Mon Sep 17 00:00:00 2001 From: Jens Finkhaeuser Date: Tue, 26 Mar 2019 15:20:04 +0100 Subject: [PATCH 064/175] Separate activate and deactivate functions for DO types --- src/storage/data_object_type_registry.rs | 20 ++++++++++++++++++-- src/storage/tests.rs | 9 ++++++++- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/src/storage/data_object_type_registry.rs b/src/storage/data_object_type_registry.rs index cfc6e8227a..8e09c8ec2d 100644 --- a/src/storage/data_object_type_registry.rs +++ b/src/storage/data_object_type_registry.rs @@ -114,17 +114,33 @@ decl_module! { Self::deposit_event(RawEvent::DataObjectTypeUpdated(id)); } - pub fn activate_data_object_type(origin, id: T::DataObjectTypeID, active: bool) + // Activate and deactivate functions as separate functions, because + // toggling DO types is likely a more common operation than updating + // other aspects. + pub fn activate_data_object_type(origin, id: T::DataObjectTypeID) { ensure_root(origin)?; let mut do_type = Self::ensure_data_object_type(id)?; - do_type.active = active; + do_type.active = true; >::insert(id, do_type); Self::deposit_event(RawEvent::DataObjectTypeUpdated(id)); } + + pub fn deactivate_data_object_type(origin, id: T::DataObjectTypeID) + { + ensure_root(origin)?; + let mut do_type = Self::ensure_data_object_type(id)?; + + do_type.active = false; + + >::insert(id, do_type); + + Self::deposit_event(RawEvent::DataObjectTypeUpdated(id)); + } + } } diff --git a/src/storage/tests.rs b/src/storage/tests.rs index 8ffd2771f5..dbacde2ee3 100644 --- a/src/storage/tests.rs +++ b/src/storage/tests.rs @@ -145,7 +145,7 @@ fn activate_existing() assert!(!data.unwrap().active); // Now activate the data object type - let res = TestDataObjectTypeRegistry::activate_data_object_type(Origin::ROOT, DEFAULT_FIRST_ID, true); + let res = TestDataObjectTypeRegistry::activate_data_object_type(Origin::ROOT, DEFAULT_FIRST_ID); assert!(res.is_ok()); assert_eq!(*System::events().last().unwrap(), EventRecord { @@ -158,5 +158,12 @@ fn activate_existing() let data = TestDataObjectTypeRegistry::data_object_type(DEFAULT_FIRST_ID); assert!(data.is_some()); assert!(data.unwrap().active); + + // Deactivate again. + let res = TestDataObjectTypeRegistry::deactivate_data_object_type(Origin::ROOT, DEFAULT_FIRST_ID); + assert!(res.is_ok()); + let data = TestDataObjectTypeRegistry::data_object_type(DEFAULT_FIRST_ID); + assert!(data.is_some()); + assert!(!data.unwrap().active); }); } From b3e5ff2c7be2b7c755b108d8ce26f8d9527cff7f Mon Sep 17 00:00:00 2001 From: Jens Finkhaeuser Date: Tue, 26 Mar 2019 15:21:45 +0100 Subject: [PATCH 065/175] Add comment about future field in DO types --- src/storage/data_object_type_registry.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/storage/data_object_type_registry.rs b/src/storage/data_object_type_registry.rs index 8e09c8ec2d..7b87d219e4 100644 --- a/src/storage/data_object_type_registry.rs +++ b/src/storage/data_object_type_registry.rs @@ -33,6 +33,7 @@ pub struct DataObjectType pub active: bool, // TODO in future releases + // - maximum size // - replication factor // - storage tranches (empty is ok) } From 88031146ec6eea62c6d687e13fb9273e6aa7e015 Mon Sep 17 00:00:00 2001 From: Jens Finkhaeuser Date: Wed, 27 Mar 2019 10:59:18 +0100 Subject: [PATCH 066/175] Might as well make my life easier --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index 3ad15560bd..75761209f5 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,6 @@ # JetBrains IDEs .idea + +# Vim +.*.sw* From 6f19e1cf6d08401326903df1cd644b31545a9c1e Mon Sep 17 00:00:00 2001 From: Jens Finkhaeuser Date: Wed, 27 Mar 2019 10:59:33 +0100 Subject: [PATCH 067/175] Fix brace style --- src/storage/data_object_type_registry.rs | 42 ++++++++---------------- src/storage/mock.rs | 27 +++++---------- src/storage/tests.rs | 30 ++++++----------- src/traits.rs | 6 ++-- 4 files changed, 35 insertions(+), 70 deletions(-) diff --git a/src/storage/data_object_type_registry.rs b/src/storage/data_object_type_registry.rs index 7b87d219e4..b7e69f427d 100644 --- a/src/storage/data_object_type_registry.rs +++ b/src/storage/data_object_type_registry.rs @@ -8,8 +8,7 @@ use runtime_primitives::traits::{SimpleArithmetic, As, Member, MaybeSerializeDeb use system::{self, ensure_root}; use crate::traits; -pub trait Trait: system::Trait + MaybeDebug -{ +pub trait Trait: system::Trait + MaybeDebug { type Event: From> + Into<::Event>; type DataObjectTypeID: Parameter + Member + SimpleArithmetic + Codec + Default + Copy @@ -25,8 +24,7 @@ const DEFAULT_FIRST_DATA_OBJECT_TYPE_ID: u64 = 1; #[derive(Clone, Encode, Decode, PartialEq)] #[cfg_attr(feature = "std", derive(Debug))] -pub struct DataObjectType -{ +pub struct DataObjectType { // If the OT is registered, an ID must exist, otherwise it's a new OT. pub id: Option, pub description: Vec, @@ -39,8 +37,7 @@ pub struct DataObjectType } decl_storage! { - trait Store for Module as DataObjectTypeRegistry - { + trait Store for Module as DataObjectTypeRegistry { // Start at this value pub FirstDataObjectTypeID get(first_data_object_type_id) config(first_data_object_type_id): T::DataObjectTypeID = T::DataObjectTypeID::sa(DEFAULT_FIRST_DATA_OBJECT_TYPE_ID); @@ -54,8 +51,7 @@ decl_storage! { decl_event! { pub enum Event where - ::DataObjectTypeID - { + ::DataObjectTypeID { DataObjectTypeAdded(DataObjectTypeID), DataObjectTypeUpdated(DataObjectTypeID), } @@ -63,12 +59,9 @@ decl_event! { -impl traits::IsActiveDataObjectType for Module -{ - fn is_active_data_object_type(which: &T::DataObjectTypeID) -> bool - { - match Self::ensure_data_object_type(*which) - { +impl traits::IsActiveDataObjectType for Module { + fn is_active_data_object_type(which: &T::DataObjectTypeID) -> bool { + match Self::ensure_data_object_type(*which) { Ok(do_type) => do_type.active, Err(_err) => false } @@ -77,12 +70,10 @@ impl traits::IsActiveDataObjectType for Module decl_module! { - pub struct Module for enum Call where origin: T::Origin - { + pub struct Module for enum Call where origin: T::Origin { fn deposit_event() = default; - pub fn register_data_object_type(origin, data_object_type: DataObjectType) - { + pub fn register_data_object_type(origin, data_object_type: DataObjectType) { ensure_root(origin)?; ensure!(data_object_type.id.is_none(), MSG_REQUIRE_NEW_DO_TYPE); @@ -99,8 +90,7 @@ decl_module! { Self::deposit_event(RawEvent::DataObjectTypeAdded(new_do_type_id)); } - pub fn update_data_object_type(origin, data_object_type: DataObjectType) - { + pub fn update_data_object_type(origin, data_object_type: DataObjectType) { ensure_root(origin)?; ensure!(data_object_type.id.is_some(), MSG_REQUIRE_DO_TYPE_ID); @@ -118,8 +108,7 @@ decl_module! { // Activate and deactivate functions as separate functions, because // toggling DO types is likely a more common operation than updating // other aspects. - pub fn activate_data_object_type(origin, id: T::DataObjectTypeID) - { + pub fn activate_data_object_type(origin, id: T::DataObjectTypeID) { ensure_root(origin)?; let mut do_type = Self::ensure_data_object_type(id)?; @@ -130,8 +119,7 @@ decl_module! { Self::deposit_event(RawEvent::DataObjectTypeUpdated(id)); } - pub fn deactivate_data_object_type(origin, id: T::DataObjectTypeID) - { + pub fn deactivate_data_object_type(origin, id: T::DataObjectTypeID) { ensure_root(origin)?; let mut do_type = Self::ensure_data_object_type(id)?; @@ -145,10 +133,8 @@ decl_module! { } } -impl Module -{ - fn ensure_data_object_type(id: T::DataObjectTypeID) -> Result, &'static str> - { +impl Module { + fn ensure_data_object_type(id: T::DataObjectTypeID) -> Result, &'static str> { return Self::data_object_type(&id).ok_or(MSG_DO_TYPE_NOT_FOUND); } } diff --git a/src/storage/mock.rs b/src/storage/mock.rs index 96191c1610..4476d30140 100644 --- a/src/storage/mock.rs +++ b/src/storage/mock.rs @@ -18,8 +18,7 @@ impl_outer_origin! { } impl_outer_event! { - pub enum MetaEvent for Test - { + pub enum MetaEvent for Test { data_object_type_registry, } } @@ -29,8 +28,7 @@ impl_outer_event! { // configuration traits of modules we want to use. #[derive(Clone, Eq, PartialEq, Debug)] pub struct Test; -impl system::Trait for Test -{ +impl system::Trait for Test { type Origin = Origin; type Index = u64; type BlockNumber = u64; @@ -43,36 +41,29 @@ impl system::Trait for Test type Log = DigestItem; type Lookup = IdentityLookup; } -impl data_object_type_registry::Trait for Test -{ +impl data_object_type_registry::Trait for Test { type Event = MetaEvent; type DataObjectTypeID = u64; } -pub struct ExtBuilder -{ +pub struct ExtBuilder { first_data_object_type_id: u64, } -impl Default for ExtBuilder -{ - fn default() -> Self - { +impl Default for ExtBuilder { + fn default() -> Self { Self { first_data_object_type_id: 1, } } } -impl ExtBuilder -{ - pub fn first_data_object_type_id(mut self, first_data_object_type_id: u64) -> Self - { +impl ExtBuilder { + pub fn first_data_object_type_id(mut self, first_data_object_type_id: u64) -> Self { self.first_data_object_type_id = first_data_object_type_id; self } - pub fn build(self) -> runtime_io::TestExternalities - { + pub fn build(self) -> runtime_io::TestExternalities { let mut t = system::GenesisConfig::::default().build_storage().unwrap().0; t.extend(data_object_type_registry::GenesisConfig::{ diff --git a/src/storage/tests.rs b/src/storage/tests.rs index dbacde2ee3..ddf0d15e57 100644 --- a/src/storage/tests.rs +++ b/src/storage/tests.rs @@ -8,25 +8,21 @@ use srml_support::*; use system::{self, Phase, EventRecord}; #[test] -fn initial_state() -{ +fn initial_state() { const DEFAULT_FIRST_ID: u64 = 1000; with_externalities(&mut ExtBuilder::default() - .first_data_object_type_id(DEFAULT_FIRST_ID).build(), || - { + .first_data_object_type_id(DEFAULT_FIRST_ID).build(), || { assert_eq!(TestDataObjectTypeRegistry::first_data_object_type_id(), DEFAULT_FIRST_ID); }); } #[test] -fn fail_register_without_root() -{ +fn fail_register_without_root() { const DEFAULT_FIRST_ID: u64 = 1000; with_externalities(&mut ExtBuilder::default() - .first_data_object_type_id(DEFAULT_FIRST_ID).build(), || - { + .first_data_object_type_id(DEFAULT_FIRST_ID).build(), || { let data: TestDataObjectType = TestDataObjectType { id: None, description: "foo".as_bytes().to_vec(), @@ -38,13 +34,11 @@ fn fail_register_without_root() } #[test] -fn succeed_register_as_root() -{ +fn succeed_register_as_root() { const DEFAULT_FIRST_ID: u64 = 1000; with_externalities(&mut ExtBuilder::default() - .first_data_object_type_id(DEFAULT_FIRST_ID).build(), || - { + .first_data_object_type_id(DEFAULT_FIRST_ID).build(), || { let data: TestDataObjectType = TestDataObjectType { id: None, description: "foo".as_bytes().to_vec(), @@ -56,13 +50,11 @@ fn succeed_register_as_root() } #[test] -fn update_existing() -{ +fn update_existing() { const DEFAULT_FIRST_ID: u64 = 1000; with_externalities(&mut ExtBuilder::default() - .first_data_object_type_id(DEFAULT_FIRST_ID).build(), || - { + .first_data_object_type_id(DEFAULT_FIRST_ID).build(), || { // First register a type let data: TestDataObjectType = TestDataObjectType { id: None, @@ -117,13 +109,11 @@ fn update_existing() #[test] -fn activate_existing() -{ +fn activate_existing() { const DEFAULT_FIRST_ID: u64 = 1000; with_externalities(&mut ExtBuilder::default() - .first_data_object_type_id(DEFAULT_FIRST_ID).build(), || - { + .first_data_object_type_id(DEFAULT_FIRST_ID).build(), || { // First register a type let data: TestDataObjectType = TestDataObjectType { id: None, diff --git a/src/traits.rs b/src/traits.rs index 96185de357..8523a06746 100644 --- a/src/traits.rs +++ b/src/traits.rs @@ -3,10 +3,8 @@ use crate::storage::data_object_type_registry; use system; -pub trait IsActiveDataObjectType -{ - fn is_active_data_object_type(which: &T::DataObjectTypeID) -> bool - { +pub trait IsActiveDataObjectType { + fn is_active_data_object_type(which: &T::DataObjectTypeID) -> bool { false } } From 0e26e9c612fd684041b9266bf160cd508207c3ed Mon Sep 17 00:00:00 2001 From: Jens Finkhaeuser Date: Wed, 27 Mar 2019 11:01:47 +0100 Subject: [PATCH 068/175] Change capitalization of ID to Id --- src/lib.rs | 2 +- src/storage/data_object_type_registry.rs | 26 ++++++++++++------------ src/storage/mock.rs | 2 +- src/traits.rs | 2 +- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 24cb66350c..bf8bba4662 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -234,7 +234,7 @@ impl memo::Trait for Runtime { impl storage::data_object_type_registry::Trait for Runtime { type Event = Event; - type DataObjectTypeID = u64; + type DataObjectTypeId = u64; } impl members::Trait for Runtime { diff --git a/src/storage/data_object_type_registry.rs b/src/storage/data_object_type_registry.rs index b7e69f427d..f67e2adb7e 100644 --- a/src/storage/data_object_type_registry.rs +++ b/src/storage/data_object_type_registry.rs @@ -11,7 +11,7 @@ use crate::traits; pub trait Trait: system::Trait + MaybeDebug { type Event: From> + Into<::Event>; - type DataObjectTypeID: Parameter + Member + SimpleArithmetic + Codec + Default + Copy + type DataObjectTypeId: Parameter + Member + SimpleArithmetic + Codec + Default + Copy + As + As + MaybeSerializeDebug + PartialEq; } @@ -26,7 +26,7 @@ const DEFAULT_FIRST_DATA_OBJECT_TYPE_ID: u64 = 1; #[cfg_attr(feature = "std", derive(Debug))] pub struct DataObjectType { // If the OT is registered, an ID must exist, otherwise it's a new OT. - pub id: Option, + pub id: Option, pub description: Vec, pub active: bool, @@ -39,28 +39,28 @@ pub struct DataObjectType { decl_storage! { trait Store for Module as DataObjectTypeRegistry { // Start at this value - pub FirstDataObjectTypeID get(first_data_object_type_id) config(first_data_object_type_id): T::DataObjectTypeID = T::DataObjectTypeID::sa(DEFAULT_FIRST_DATA_OBJECT_TYPE_ID); + pub FirstDataObjectTypeId get(first_data_object_type_id) config(first_data_object_type_id): T::DataObjectTypeId = T::DataObjectTypeId::sa(DEFAULT_FIRST_DATA_OBJECT_TYPE_ID); // Increment - pub NextDataObjectTypeID get(next_data_object_type_id) build(|config: &GenesisConfig| config.first_data_object_type_id): T::DataObjectTypeID = T::DataObjectTypeID::sa(DEFAULT_FIRST_DATA_OBJECT_TYPE_ID); + pub NextDataObjectTypeId get(next_data_object_type_id) build(|config: &GenesisConfig| config.first_data_object_type_id): T::DataObjectTypeId = T::DataObjectTypeId::sa(DEFAULT_FIRST_DATA_OBJECT_TYPE_ID); // Mapping of Data object types - pub DataObjectTypeMap get(data_object_type): map T::DataObjectTypeID => Option>; + pub DataObjectTypeMap get(data_object_type): map T::DataObjectTypeId => Option>; } } decl_event! { pub enum Event where - ::DataObjectTypeID { - DataObjectTypeAdded(DataObjectTypeID), - DataObjectTypeUpdated(DataObjectTypeID), + ::DataObjectTypeId { + DataObjectTypeAdded(DataObjectTypeId), + DataObjectTypeUpdated(DataObjectTypeId), } } impl traits::IsActiveDataObjectType for Module { - fn is_active_data_object_type(which: &T::DataObjectTypeID) -> bool { + fn is_active_data_object_type(which: &T::DataObjectTypeId) -> bool { match Self::ensure_data_object_type(*which) { Ok(do_type) => do_type.active, Err(_err) => false @@ -85,7 +85,7 @@ decl_module! { }; >::insert(new_do_type_id, do_type); - >::mutate(|n| { *n += T::DataObjectTypeID::sa(1); }); + >::mutate(|n| { *n += T::DataObjectTypeId::sa(1); }); Self::deposit_event(RawEvent::DataObjectTypeAdded(new_do_type_id)); } @@ -108,7 +108,7 @@ decl_module! { // Activate and deactivate functions as separate functions, because // toggling DO types is likely a more common operation than updating // other aspects. - pub fn activate_data_object_type(origin, id: T::DataObjectTypeID) { + pub fn activate_data_object_type(origin, id: T::DataObjectTypeId) { ensure_root(origin)?; let mut do_type = Self::ensure_data_object_type(id)?; @@ -119,7 +119,7 @@ decl_module! { Self::deposit_event(RawEvent::DataObjectTypeUpdated(id)); } - pub fn deactivate_data_object_type(origin, id: T::DataObjectTypeID) { + pub fn deactivate_data_object_type(origin, id: T::DataObjectTypeId) { ensure_root(origin)?; let mut do_type = Self::ensure_data_object_type(id)?; @@ -134,7 +134,7 @@ decl_module! { } impl Module { - fn ensure_data_object_type(id: T::DataObjectTypeID) -> Result, &'static str> { + fn ensure_data_object_type(id: T::DataObjectTypeId) -> Result, &'static str> { return Self::data_object_type(&id).ok_or(MSG_DO_TYPE_NOT_FOUND); } } diff --git a/src/storage/mock.rs b/src/storage/mock.rs index 4476d30140..a81d247c1f 100644 --- a/src/storage/mock.rs +++ b/src/storage/mock.rs @@ -43,7 +43,7 @@ impl system::Trait for Test { } impl data_object_type_registry::Trait for Test { type Event = MetaEvent; - type DataObjectTypeID = u64; + type DataObjectTypeId = u64; } pub struct ExtBuilder { diff --git a/src/traits.rs b/src/traits.rs index 8523a06746..d6c2a4ef47 100644 --- a/src/traits.rs +++ b/src/traits.rs @@ -4,7 +4,7 @@ use crate::storage::data_object_type_registry; use system; pub trait IsActiveDataObjectType { - fn is_active_data_object_type(which: &T::DataObjectTypeID) -> bool { + fn is_active_data_object_type(which: &T::DataObjectTypeId) -> bool { false } } From 57a342879aca2c254fab17fb5ef6ffd1cb9d7549 Mon Sep 17 00:00:00 2001 From: Jens Finkhaeuser Date: Wed, 27 Mar 2019 11:03:17 +0100 Subject: [PATCH 069/175] DataObjectTypeAdded -> DataObjectTypeRegistered --- src/storage/data_object_type_registry.rs | 5 ++--- src/storage/tests.rs | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/storage/data_object_type_registry.rs b/src/storage/data_object_type_registry.rs index f67e2adb7e..646d4e85d5 100644 --- a/src/storage/data_object_type_registry.rs +++ b/src/storage/data_object_type_registry.rs @@ -25,7 +25,6 @@ const DEFAULT_FIRST_DATA_OBJECT_TYPE_ID: u64 = 1; #[derive(Clone, Encode, Decode, PartialEq)] #[cfg_attr(feature = "std", derive(Debug))] pub struct DataObjectType { - // If the OT is registered, an ID must exist, otherwise it's a new OT. pub id: Option, pub description: Vec, pub active: bool, @@ -52,7 +51,7 @@ decl_storage! { decl_event! { pub enum Event where ::DataObjectTypeId { - DataObjectTypeAdded(DataObjectTypeId), + DataObjectTypeRegistered(DataObjectTypeId), DataObjectTypeUpdated(DataObjectTypeId), } } @@ -87,7 +86,7 @@ decl_module! { >::insert(new_do_type_id, do_type); >::mutate(|n| { *n += T::DataObjectTypeId::sa(1); }); - Self::deposit_event(RawEvent::DataObjectTypeAdded(new_do_type_id)); + Self::deposit_event(RawEvent::DataObjectTypeRegistered(new_do_type_id)); } pub fn update_data_object_type(origin, data_object_type: DataObjectType) { diff --git a/src/storage/tests.rs b/src/storage/tests.rs index ddf0d15e57..7f3dfd8d34 100644 --- a/src/storage/tests.rs +++ b/src/storage/tests.rs @@ -66,7 +66,7 @@ fn update_existing() { assert_eq!(*System::events().last().unwrap(), EventRecord { phase: Phase::ApplyExtrinsic(0), - event: MetaEvent::data_object_type_registry(data_object_type_registry::RawEvent::DataObjectTypeAdded(DEFAULT_FIRST_ID)), + event: MetaEvent::data_object_type_registry(data_object_type_registry::RawEvent::DataObjectTypeRegistered(DEFAULT_FIRST_ID)), } ); @@ -125,7 +125,7 @@ fn activate_existing() { assert_eq!(*System::events().last().unwrap(), EventRecord { phase: Phase::ApplyExtrinsic(0), - event: MetaEvent::data_object_type_registry(data_object_type_registry::RawEvent::DataObjectTypeAdded(DEFAULT_FIRST_ID)), + event: MetaEvent::data_object_type_registry(data_object_type_registry::RawEvent::DataObjectTypeRegistered(DEFAULT_FIRST_ID)), } ); From d81f8aa10e484707252a9c0dd1c87ae5d81b12c9 Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Wed, 27 Mar 2019 12:26:15 +0200 Subject: [PATCH 070/175] fix spelling on_finalise, on_initialise --- src/roles/actors.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/roles/actors.rs b/src/roles/actors.rs index 464f76faa3..50e9a29a16 100644 --- a/src/roles/actors.rs +++ b/src/roles/actors.rs @@ -176,7 +176,7 @@ decl_module! { pub struct Module for enum Call where origin: T::Origin { fn deposit_event() = default; - fn on_initialize(now: T::BlockNumber) { + fn on_initialise(now: T::BlockNumber) { // clear expired requests if now % T::BlockNumber::sa(DEFAULT_REQUEST_CLEARING_INTERVAL) == T::BlockNumber::zero() { let requests: Requests = Self::role_entry_requests() @@ -188,7 +188,7 @@ decl_module! { } } - fn on_finalize(now: T::BlockNumber) { + fn on_finalise(now: T::BlockNumber) { // payout rewards to actors for role in Self::available_roles().iter() { From 522c189c0ccd33908244796115085b8aa6f3a651 Mon Sep 17 00:00:00 2001 From: Jens Finkhaeuser Date: Wed, 27 Mar 2019 12:09:40 +0100 Subject: [PATCH 071/175] Proposal for not having Option in the DO type struct. We have no reason in the runtime to store it as part of the struct. --- src/storage/data_object_type_registry.rs | 21 +++++------------ src/storage/mock.rs | 2 +- src/storage/tests.rs | 30 ++++-------------------- 3 files changed, 12 insertions(+), 41 deletions(-) diff --git a/src/storage/data_object_type_registry.rs b/src/storage/data_object_type_registry.rs index 646d4e85d5..18d74dd664 100644 --- a/src/storage/data_object_type_registry.rs +++ b/src/storage/data_object_type_registry.rs @@ -15,17 +15,13 @@ pub trait Trait: system::Trait + MaybeDebug { + As + As + MaybeSerializeDebug + PartialEq; } - -static MSG_REQUIRE_NEW_DO_TYPE: &str = "New Data Object Type required; the provided one seems to be in use already!"; static MSG_DO_TYPE_NOT_FOUND: &str = "Data Object Type with the given ID not found!"; -static MSG_REQUIRE_DO_TYPE_ID: &str = "Can only update Data Object Types that are already registered (with an ID)!"; const DEFAULT_FIRST_DATA_OBJECT_TYPE_ID: u64 = 1; #[derive(Clone, Encode, Decode, PartialEq)] #[cfg_attr(feature = "std", derive(Debug))] -pub struct DataObjectType { - pub id: Option, +pub struct DataObjectType { pub description: Vec, pub active: bool, @@ -44,7 +40,7 @@ decl_storage! { pub NextDataObjectTypeId get(next_data_object_type_id) build(|config: &GenesisConfig| config.first_data_object_type_id): T::DataObjectTypeId = T::DataObjectTypeId::sa(DEFAULT_FIRST_DATA_OBJECT_TYPE_ID); // Mapping of Data object types - pub DataObjectTypeMap get(data_object_type): map T::DataObjectTypeId => Option>; + pub DataObjectTypeMap get(data_object_type): map T::DataObjectTypeId => Option; } } @@ -72,13 +68,11 @@ decl_module! { pub struct Module for enum Call where origin: T::Origin { fn deposit_event() = default; - pub fn register_data_object_type(origin, data_object_type: DataObjectType) { + pub fn register_data_object_type(origin, data_object_type: DataObjectType) { ensure_root(origin)?; - ensure!(data_object_type.id.is_none(), MSG_REQUIRE_NEW_DO_TYPE); let new_do_type_id = Self::next_data_object_type_id(); - let do_type: DataObjectType = DataObjectType { - id: Some(new_do_type_id), + let do_type: DataObjectType = DataObjectType { description: data_object_type.description.clone(), active: data_object_type.active, }; @@ -89,11 +83,8 @@ decl_module! { Self::deposit_event(RawEvent::DataObjectTypeRegistered(new_do_type_id)); } - pub fn update_data_object_type(origin, data_object_type: DataObjectType) { + pub fn update_data_object_type(origin, id: T::DataObjectTypeId, data_object_type: DataObjectType) { ensure_root(origin)?; - ensure!(data_object_type.id.is_some(), MSG_REQUIRE_DO_TYPE_ID); - - let id = data_object_type.id.unwrap(); let mut do_type = Self::ensure_data_object_type(id)?; do_type.description = data_object_type.description.clone(); @@ -133,7 +124,7 @@ decl_module! { } impl Module { - fn ensure_data_object_type(id: T::DataObjectTypeId) -> Result, &'static str> { + fn ensure_data_object_type(id: T::DataObjectTypeId) -> Result { return Self::data_object_type(&id).ok_or(MSG_DO_TYPE_NOT_FOUND); } } diff --git a/src/storage/mock.rs b/src/storage/mock.rs index a81d247c1f..9529d6cfa6 100644 --- a/src/storage/mock.rs +++ b/src/storage/mock.rs @@ -77,4 +77,4 @@ impl ExtBuilder { pub type System = system::Module; pub type TestDataObjectTypeRegistry = data_object_type_registry::Module; -pub type TestDataObjectType = data_object_type_registry::DataObjectType; +pub type TestDataObjectType = data_object_type_registry::DataObjectType; diff --git a/src/storage/tests.rs b/src/storage/tests.rs index 7f3dfd8d34..c418470442 100644 --- a/src/storage/tests.rs +++ b/src/storage/tests.rs @@ -24,7 +24,6 @@ fn fail_register_without_root() { with_externalities(&mut ExtBuilder::default() .first_data_object_type_id(DEFAULT_FIRST_ID).build(), || { let data: TestDataObjectType = TestDataObjectType { - id: None, description: "foo".as_bytes().to_vec(), active: false, }; @@ -40,7 +39,6 @@ fn succeed_register_as_root() { with_externalities(&mut ExtBuilder::default() .first_data_object_type_id(DEFAULT_FIRST_ID).build(), || { let data: TestDataObjectType = TestDataObjectType { - id: None, description: "foo".as_bytes().to_vec(), active: false, }; @@ -57,7 +55,6 @@ fn update_existing() { .first_data_object_type_id(DEFAULT_FIRST_ID).build(), || { // First register a type let data: TestDataObjectType = TestDataObjectType { - id: None, description: "foo".as_bytes().to_vec(), active: false, }; @@ -70,33 +67,17 @@ fn update_existing() { } ); - - // Now update it with new data - we need the ID to be the same as in - // returned by the previous call. First, though, try and fail without - let updated1: TestDataObjectType = TestDataObjectType { - id: None, + // Try updating with a bad ID + let updated: TestDataObjectType = TestDataObjectType { description: "bar".as_bytes().to_vec(), active: false, }; - let res = TestDataObjectTypeRegistry::update_data_object_type(Origin::ROOT, updated1); - assert!(res.is_err()); - - // Now try with a bad ID - let updated2: TestDataObjectType = TestDataObjectType { - id: Some(DEFAULT_FIRST_ID + 1), - description: "bar".as_bytes().to_vec(), - active: false, - }; - let res = TestDataObjectTypeRegistry::update_data_object_type(Origin::ROOT, updated2); + let updated2 = updated.clone(); + let res = TestDataObjectTypeRegistry::update_data_object_type(Origin::ROOT, DEFAULT_FIRST_ID + 1, updated); assert!(res.is_err()); // Finally with an existing ID, it should work. - let updated3: TestDataObjectType = TestDataObjectType { - id: Some(DEFAULT_FIRST_ID), - description: "bar".as_bytes().to_vec(), - active: false, - }; - let res = TestDataObjectTypeRegistry::update_data_object_type(Origin::ROOT, updated3); + let res = TestDataObjectTypeRegistry::update_data_object_type(Origin::ROOT, DEFAULT_FIRST_ID, updated2); assert!(res.is_ok()); assert_eq!(*System::events().last().unwrap(), EventRecord { @@ -116,7 +97,6 @@ fn activate_existing() { .first_data_object_type_id(DEFAULT_FIRST_ID).build(), || { // First register a type let data: TestDataObjectType = TestDataObjectType { - id: None, description: "foo".as_bytes().to_vec(), active: false, }; From f31673371f2e9c265ac92b517cc7c4f0ba6d1e08 Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Thu, 28 Mar 2019 17:01:12 +0200 Subject: [PATCH 072/175] error message when not enough balance to stake --- src/roles/actors.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/roles/actors.rs b/src/roles/actors.rs index 50e9a29a16..87a090c1cc 100644 --- a/src/roles/actors.rs +++ b/src/roles/actors.rs @@ -277,7 +277,7 @@ decl_module! { ensure!(accounts_in_role.len() < role_parameters.max_actors as usize, "role slots full"); // ensure the actor account has enough balance - ensure!(T::Currency::free_balance(&actor_account) >= role_parameters.min_stake, ""); + ensure!(T::Currency::free_balance(&actor_account) >= role_parameters.min_stake, "not enough balance to stake"); >::mutate(role, |accounts| accounts.push(actor_account.clone())); >::mutate(&member_id, |accounts| accounts.push(actor_account.clone())); From 9c9a49a2f3575b40d860d083969048a326df459b Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Thu, 28 Mar 2019 17:12:07 +0200 Subject: [PATCH 073/175] burn role entry request fee --- src/migration.rs | 1 + src/roles/actors.rs | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/migration.rs b/src/migration.rs index a360c3a311..af060ff432 100644 --- a/src/migration.rs +++ b/src/migration.rs @@ -38,6 +38,7 @@ impl Module { bonding_time: T::BlockNumber::sa(600), min_service_period: T::BlockNumber::sa(600), startup_grace_period: T::BlockNumber::sa(600), + entry_request_fee: BalanceOf::::sa(50), }); >::set_available_roles(vec![actors::Role::Storage]); diff --git a/src/roles/actors.rs b/src/roles/actors.rs index 87a090c1cc..9a3c6f355c 100644 --- a/src/roles/actors.rs +++ b/src/roles/actors.rs @@ -50,7 +50,8 @@ pub struct RoleParameters { // not delivering required level of service. pub startup_grace_period: T::BlockNumber, - // entry_request_fee: BalanceOf, + // small fee burned to make a request to enter role + pub entry_request_fee: BalanceOf, } #[derive(Encode, Decode, Clone)] @@ -246,6 +247,11 @@ decl_module! { let role_parameters = Self::ensure_role_parameters(role)?; + // pay (burn) entry fee - spam filter + let fee = role_parameters.entry_request_fee; + ensure!(T::Currency::can_slash(&sender, fee), "cannot pay role entry request fee"); + let _ = T::Currency::slash(&sender, fee); + >::mutate(|requests| { let expires = >::block_number()+ T::BlockNumber::sa(REQUEST_LIFETIME); requests.push((sender, member_id, role, expires)); From baffb0b68f686fe04247d1b905613ffe146bff0b Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Fri, 29 Mar 2019 00:43:50 +0200 Subject: [PATCH 074/175] rename role parameters field bonding_time -> bonding_period --- src/migration.rs | 4 ++-- src/roles/actors.rs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/migration.rs b/src/migration.rs index af060ff432..10eb7413f4 100644 --- a/src/migration.rs +++ b/src/migration.rs @@ -32,13 +32,13 @@ impl Module { reward: BalanceOf::::sa(10), reward_period: T::BlockNumber::sa(600), unbonding_period: T::BlockNumber::sa(600), + entry_request_fee: BalanceOf::::sa(50), // not currently used min_actors: 5, - bonding_time: T::BlockNumber::sa(600), + bonding_period: T::BlockNumber::sa(600), min_service_period: T::BlockNumber::sa(600), startup_grace_period: T::BlockNumber::sa(600), - entry_request_fee: BalanceOf::::sa(50), }); >::set_available_roles(vec![actors::Role::Storage]); diff --git a/src/roles/actors.rs b/src/roles/actors.rs index 9a3c6f355c..411caecd90 100644 --- a/src/roles/actors.rs +++ b/src/roles/actors.rs @@ -40,7 +40,7 @@ pub struct RoleParameters { pub unbonding_period: T::BlockNumber, // minimum amount of time before being able to unstake - pub bonding_time: T::BlockNumber, + pub bonding_period: T::BlockNumber, // minimum period required to be in service. unbonding before this time is highly penalized pub min_service_period: T::BlockNumber, From b5a49daa18ec2ed374b591b1c0812acebe6e84cc Mon Sep 17 00:00:00 2001 From: Jens Finkhaeuser Date: Fri, 29 Mar 2019 17:48:55 +0100 Subject: [PATCH 075/175] Looks like the data directory implementation we need. --- src/lib.rs | 11 ++- src/storage/data_directory.rs | 151 ++++++++++++++++++++++++++++++++++ src/storage/mod.rs | 1 + 3 files changed, 162 insertions(+), 1 deletion(-) create mode 100644 src/storage/data_directory.rs diff --git a/src/lib.rs b/src/lib.rs index bf8bba4662..27491f6785 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -17,7 +17,7 @@ extern crate parity_codec_derive; pub mod governance; use governance::{election, council, proposals}; pub mod storage; -use storage::{data_object_type_registry}; +use storage::{data_object_type_registry, data_directory}; mod memo; mod traits; mod membership; @@ -52,6 +52,7 @@ pub use srml_support::{StorageValue, construct_runtime}; /// Alias to Ed25519 pubkey that identifies an account on the chain. pub type AccountId = primitives::H256; +pub type ContentId = primitives::H256; /// A hash of some data used by the chain. pub type Hash = primitives::H256; @@ -237,6 +238,13 @@ impl storage::data_object_type_registry::Trait for Runtime { type DataObjectTypeId = u64; } +impl storage::data_directory::Trait for Runtime +{ + type Event = Event; + type ContentId = ContentId; + type IsActiveMember = Members; +} + impl members::Trait for Runtime { type Event = Event; type MemberId = u64; @@ -271,6 +279,7 @@ construct_runtime!( Members: members::{Module, Call, Storage, Event, Config}, Migration: migration::{Module, Call, Storage, Event}, DataObjectTypeRegistry: data_object_type_registry::{Module, Call, Storage, Event, Config}, + DataDirectory: data_directory::{Module, Call, Storage, Event}, } ); diff --git a/src/storage/data_directory.rs b/src/storage/data_directory.rs new file mode 100644 index 0000000000..0b2e4b6214 --- /dev/null +++ b/src/storage/data_directory.rs @@ -0,0 +1,151 @@ +#![cfg_attr(not(feature = "std"), no_std)] + +use rstd::prelude::*; +use parity_codec::Codec; +use parity_codec_derive::{Encode, Decode}; +use srml_support::{StorageMap, decl_module, decl_storage, decl_event, ensure, Parameter, dispatch}; +use runtime_primitives::traits::{SimpleArithmetic, As, Member, MaybeSerializeDebug, MaybeDebug}; +use system::{self, ensure_signed}; +use primitives::{Ed25519AuthorityId}; +use crate::traits::{IsActiveMember}; +use crate::membership::{members}; +use crate::storage::data_object_type_registry::Trait as DOTRTrait; + +pub trait Trait: timestamp::Trait + system::Trait + DOTRTrait + MaybeDebug { + type Event: From> + Into<::Event>; + + type ContentId: Parameter + Member + Codec + Default + Copy + + MaybeSerializeDebug + PartialEq; + + type IsActiveMember: IsActiveMember; +} + +static MSG_DUPLICATE_CID: &str = "Content with this ID already exists!"; +static MSG_CID_NOT_FOUND: &str = "Content with this ID not found!"; +static MSG_LIAISON_REQUIRED: &str = "Only the liaison for the content may modify its status!"; + +#[derive(Clone, Encode, Decode, PartialEq)] +#[cfg_attr(feature = "std", derive(Debug))] +pub enum LiaisonJudgement +{ + Pending, + Rejected, + Accepted, +} + +impl Default for LiaisonJudgement { + fn default() -> Self { + LiaisonJudgement::Pending + } +} + +#[derive(Clone, Encode, Decode, PartialEq)] +#[cfg_attr(feature = "std", derive(Debug))] +pub struct DataObject { + pub data_object_type: ::DataObjectTypeId, + pub size: u64, + pub added_at_block: T::BlockNumber, + pub added_at_time: T::Moment, + pub origin: T::AccountId, + pub liaison: T::AccountId, + pub liaison_judgement: LiaisonJudgement, +} + +decl_storage! { + trait Store for Module as DataDirectory { + // Mapping of Content ID to Data Object + pub ContentMap get(content): map T::ContentId => Option>; + } +} + +decl_event! { + pub enum Event where + ::ContentId, + ::AccountId + { + ContentAdded(ContentId, AccountId), + ContentAccepted(ContentId), + ContentRejected(ContentId), + } +} + + +decl_module! { + pub struct Module for enum Call where origin: T::Origin { + fn deposit_event() = default; + + pub fn add_content(origin, data_object_type_id: ::DataObjectTypeId, + id: T::ContentId, size: u64) { + // Origin has to be a member + let who = ensure_signed(origin).clone().unwrap(); + T::IsActiveMember::is_active_member(&who); + // TODO Self::is_active_member(&who); + + // Data object type has to be active + // TODO + + // We essentially accept the content ID and size at face value. All we + // need to know is that it doesn't yet exist. + let found = Self::content(&id); + ensure!(found.is_none(), MSG_DUPLICATE_CID); + + // The liaison is something we need to take from staked roles. The idea + // is to select the liaison, for now randomly. + // FIXME without that module, we're currently hardcoding it, to the + // origin, which is wrong on many levels. + let liaison = who.clone(); + + // Let's create the entry then + let data: DataObject = DataObject { + data_object_type: data_object_type_id, + size: size, + added_at_block: >::block_number(), + added_at_time: >::now(), + origin: who, + liaison: liaison.clone(), + liaison_judgement: LiaisonJudgement::Pending, + }; + + // If we've constructed the data, we can store it and send an event. + >::insert(id, data); + Self::deposit_event(RawEvent::ContentAdded(id, liaison)); + } + + // The LiaisonJudgement can be updated, but only by the liaison. + fn accept_content(origin, id: T::ContentId) + { + Self::update_content_judgement(origin, id, LiaisonJudgement::Accepted)?; + Self::deposit_event(RawEvent::ContentAccepted(id)); + } + + fn reject_content(origin, id: T::ContentId) + { + Self::update_content_judgement(origin, id, LiaisonJudgement::Rejected)?; + Self::deposit_event(RawEvent::ContentAccepted(id)); + } + } +} + +impl Module { + fn update_content_judgement(origin: T::Origin, id: T::ContentId, judgement: LiaisonJudgement) -> dispatch::Result + { + let who = ensure_signed(origin); + + // Find the data + let found = Self::content(&id).ok_or(MSG_CID_NOT_FOUND); + + // Make sure the liaison matches + let mut data = found.unwrap(); + if data.liaison != who.unwrap() { + return Err(MSG_LIAISON_REQUIRED); + } + + // At this point we can update the data. + data.liaison_judgement = judgement; + + // Update and send event. + >::insert(id, data); + + Ok(()) + } +} diff --git a/src/storage/mod.rs b/src/storage/mod.rs index c2255437b7..a7de02a643 100644 --- a/src/storage/mod.rs +++ b/src/storage/mod.rs @@ -1,6 +1,7 @@ #![cfg_attr(not(feature = "std"), no_std)] pub mod data_object_type_registry; +pub mod data_directory; mod mock; mod tests; From 1dec5985132e3a7b9e9a6f8f26f27ad41aeb3d00 Mon Sep 17 00:00:00 2001 From: Jens Finkhaeuser Date: Fri, 29 Mar 2019 18:13:40 +0100 Subject: [PATCH 076/175] Implement checks for parameters when adding content --- src/lib.rs | 1 + src/storage/data_directory.rs | 14 ++++++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 27491f6785..28dcafe628 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -243,6 +243,7 @@ impl storage::data_directory::Trait for Runtime type Event = Event; type ContentId = ContentId; type IsActiveMember = Members; + type IsActiveDataObjectType = DataObjectTypeRegistry; } impl members::Trait for Runtime { diff --git a/src/storage/data_directory.rs b/src/storage/data_directory.rs index 0b2e4b6214..3072ab10d2 100644 --- a/src/storage/data_directory.rs +++ b/src/storage/data_directory.rs @@ -7,7 +7,7 @@ use srml_support::{StorageMap, decl_module, decl_storage, decl_event, ensure, Pa use runtime_primitives::traits::{SimpleArithmetic, As, Member, MaybeSerializeDebug, MaybeDebug}; use system::{self, ensure_signed}; use primitives::{Ed25519AuthorityId}; -use crate::traits::{IsActiveMember}; +use crate::traits::{IsActiveMember, IsActiveDataObjectType}; use crate::membership::{members}; use crate::storage::data_object_type_registry::Trait as DOTRTrait; @@ -18,11 +18,14 @@ pub trait Trait: timestamp::Trait + system::Trait + DOTRTrait + MaybeDebug { + MaybeSerializeDebug + PartialEq; type IsActiveMember: IsActiveMember; + type IsActiveDataObjectType: IsActiveDataObjectType; } static MSG_DUPLICATE_CID: &str = "Content with this ID already exists!"; static MSG_CID_NOT_FOUND: &str = "Content with this ID not found!"; static MSG_LIAISON_REQUIRED: &str = "Only the liaison for the content may modify its status!"; +static MSG_CREATOR_MUST_BE_MEMBER: &str = "Only active members may create content!"; +static MSG_DO_TYPE_MUST_BE_ACTIVE: &str = "Cannot create content for inactive of missing data object type!"; #[derive(Clone, Encode, Decode, PartialEq)] #[cfg_attr(feature = "std", derive(Debug))] @@ -78,11 +81,14 @@ decl_module! { id: T::ContentId, size: u64) { // Origin has to be a member let who = ensure_signed(origin).clone().unwrap(); - T::IsActiveMember::is_active_member(&who); - // TODO Self::is_active_member(&who); + if !T::IsActiveMember::is_active_member(&who) { + return Err(MSG_CREATOR_MUST_BE_MEMBER); + } // Data object type has to be active - // TODO + if !T::IsActiveDataObjectType::is_active_data_object_type(&data_object_type_id) { + return Err(MSG_DO_TYPE_MUST_BE_ACTIVE); + } // We essentially accept the content ID and size at face value. All we // need to know is that it doesn't yet exist. From a2f0b11e8f754ee1c2ed4b45e00b083f6db3ed7f Mon Sep 17 00:00:00 2001 From: Jens Finkhaeuser Date: Fri, 29 Mar 2019 18:39:11 +0100 Subject: [PATCH 077/175] Add data object storage relationship registry (WIP) --- src/lib.rs | 12 ++- src/storage/data_directory.rs | 10 ++- src/storage/data_object_storage_registry.rs | 98 +++++++++++++++++++++ src/storage/mod.rs | 1 + src/traits.rs | 8 +- 5 files changed, 126 insertions(+), 3 deletions(-) create mode 100644 src/storage/data_object_storage_registry.rs diff --git a/src/lib.rs b/src/lib.rs index 28dcafe628..4355cd706a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -17,7 +17,7 @@ extern crate parity_codec_derive; pub mod governance; use governance::{election, council, proposals}; pub mod storage; -use storage::{data_object_type_registry, data_directory}; +use storage::{data_object_type_registry, data_directory, data_object_storage_registry}; mod memo; mod traits; mod membership; @@ -246,6 +246,15 @@ impl storage::data_directory::Trait for Runtime type IsActiveDataObjectType = DataObjectTypeRegistry; } +impl storage::data_object_storage_registry::Trait for Runtime +{ + type Event = Event; + type DataObjectStorageRelationshipId = u64; + type IsActiveMember = Members; + type ContentIdExists = DataDirectory; +} + + impl members::Trait for Runtime { type Event = Event; type MemberId = u64; @@ -281,6 +290,7 @@ construct_runtime!( Migration: migration::{Module, Call, Storage, Event}, DataObjectTypeRegistry: data_object_type_registry::{Module, Call, Storage, Event, Config}, DataDirectory: data_directory::{Module, Call, Storage, Event}, + DataObjectStorageRegistry: data_object_storage_registry::{Module, Call, Storage, Event, Config}, } ); diff --git a/src/storage/data_directory.rs b/src/storage/data_directory.rs index 3072ab10d2..452632c4dc 100644 --- a/src/storage/data_directory.rs +++ b/src/storage/data_directory.rs @@ -7,7 +7,7 @@ use srml_support::{StorageMap, decl_module, decl_storage, decl_event, ensure, Pa use runtime_primitives::traits::{SimpleArithmetic, As, Member, MaybeSerializeDebug, MaybeDebug}; use system::{self, ensure_signed}; use primitives::{Ed25519AuthorityId}; -use crate::traits::{IsActiveMember, IsActiveDataObjectType}; +use crate::traits::{IsActiveMember, IsActiveDataObjectType, ContentIdExists}; use crate::membership::{members}; use crate::storage::data_object_type_registry::Trait as DOTRTrait; @@ -72,6 +72,14 @@ decl_event! { } } +impl ContentIdExists for Module { + fn has_content(which: &T::ContentId) -> bool { + match Self::content(*which) { + Some(_content) => true, + None => false, + } + } +} decl_module! { pub struct Module for enum Call where origin: T::Origin { diff --git a/src/storage/data_object_storage_registry.rs b/src/storage/data_object_storage_registry.rs new file mode 100644 index 0000000000..90c70035aa --- /dev/null +++ b/src/storage/data_object_storage_registry.rs @@ -0,0 +1,98 @@ +#![cfg_attr(not(feature = "std"), no_std)] + +use rstd::prelude::*; +use parity_codec::Codec; +use parity_codec_derive::{Encode, Decode}; +use srml_support::{StorageMap, StorageValue, decl_module, decl_storage, decl_event, ensure, Parameter, dispatch}; +use runtime_primitives::traits::{SimpleArithmetic, As, Member, MaybeSerializeDebug, MaybeDebug}; +use system::{self, ensure_signed}; +use primitives::{Ed25519AuthorityId}; +use crate::traits::{IsActiveMember, ContentIdExists}; +use crate::membership::{members}; +use crate::storage::data_directory::Trait as DDTrait; + +pub trait Trait: timestamp::Trait + system::Trait + DDTrait + MaybeDebug { + type Event: From> + Into<::Event>; + + type DataObjectStorageRelationshipId: Parameter + Member + SimpleArithmetic + Codec + Default + Copy + + As + As + MaybeSerializeDebug + PartialEq; + + type IsActiveMember: IsActiveMember; + type ContentIdExists: ContentIdExists; +} + +static MSG_CID_NOT_FOUND: &str = "Content with this ID not found!"; + +const DEFAULT_FIRST_DATA_OBJECT_STORAGE_RELATIONSHIP_ID: u64 = 1; + +#[derive(Clone, Encode, Decode, PartialEq)] +#[cfg_attr(feature = "std", derive(Debug))] +pub struct DataObjectStorageRelationship { + pub content_id: ::ContentId, + pub storage_provider: T::AccountId, + pub ready: bool, +} + +decl_storage! { + trait Store for Module as DataObjectStorageRegistry { + // Start at this value + pub FirstDataObjectStorageRelationshipId get(first_data_object_storage_relationship_id) config(first_data_object_storage_relationship_id): T::DataObjectStorageRelationshipId = T::DataObjectStorageRelationshipId::sa(DEFAULT_FIRST_DATA_OBJECT_STORAGE_RELATIONSHIP_ID); + + // Increment + pub NextDataObjectStorageRelationshipId get(next_data_object_storage_relationship_id) build(|config: &GenesisConfig| config.first_data_object_storage_relationship_id): T::DataObjectStorageRelationshipId = T::DataObjectStorageRelationshipId::sa(DEFAULT_FIRST_DATA_OBJECT_STORAGE_RELATIONSHIP_ID); + + // Mapping of Data object types + pub DataObjectStorageRelationshipMap get(data_object_storage_relationship): map T::DataObjectStorageRelationshipId => Option>; + } +} + +decl_event! { + pub enum Event where + ::ContentId, + ::DataObjectStorageRelationshipId, + ::AccountId + { + DataObjectStorageRelationshipAdded(DataObjectStorageRelationshipId, ContentId, AccountId), + DataObjectStorageRelationshipReadyUpdated(DataObjectStorageRelationshipId, bool), + } +} + + +decl_module! { + pub struct Module for enum Call where origin: T::Origin { + fn deposit_event() = default; + + pub fn add_data_object_storage_relationship(origin, cid: T::ContentId) { + // Origin has to be a storage provider + let who = ensure_signed(origin).clone().unwrap(); + // TODO + // if !T::IsActiveMember::is_active_member(&who) { + // return Err(MSG_CREATOR_MUST_BE_MEMBER); + // } + + // Content ID must exist + if !T::ContentIdExists::has_content(&cid) { + return Err(MSG_CID_NOT_FOUND); + } + + // Create new ID, data. + let new_id = Self::next_data_object_storage_relationship_id(); + let dosr: DataObjectStorageRelationship = DataObjectStorageRelationship { + content_id: cid.clone(), + storage_provider: who.clone(), + ready: false, + }; + + >::insert(new_id, dosr); + >::mutate(|n| { *n += T::DataObjectStorageRelationshipId::sa(1); }); + + // Emit event + Self::deposit_event(RawEvent::DataObjectStorageRelationshipAdded(new_id, cid, who)); + } + } + + // TODO storage provider may flip their own ready state +} + +impl Module { +} diff --git a/src/storage/mod.rs b/src/storage/mod.rs index a7de02a643..4b95091dfb 100644 --- a/src/storage/mod.rs +++ b/src/storage/mod.rs @@ -2,6 +2,7 @@ pub mod data_object_type_registry; pub mod data_directory; +pub mod data_object_storage_registry; mod mock; mod tests; diff --git a/src/traits.rs b/src/traits.rs index d6c2a4ef47..69fc06820b 100644 --- a/src/traits.rs +++ b/src/traits.rs @@ -1,6 +1,6 @@ #![cfg_attr(not(feature = "std"), no_std)] -use crate::storage::data_object_type_registry; +use crate::storage::{data_object_type_registry, data_directory}; use system; pub trait IsActiveDataObjectType { @@ -9,6 +9,12 @@ pub trait IsActiveDataObjectType { } } +pub trait ContentIdExists { + fn has_content(which: &T::ContentId) -> bool { + false + } +} + pub trait IsActiveMember { fn is_active_member(account_id: &T::AccountId) -> bool { false From fd30145fb5e43c8e9a5dab5694c0ea79a9c6146f Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Sat, 30 Mar 2019 10:28:29 +0200 Subject: [PATCH 078/175] renaming storage values --- src/roles/actors.rs | 54 ++++++++++++++++++++++----------------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/src/roles/actors.rs b/src/roles/actors.rs index 411caecd90..121d9319d7 100644 --- a/src/roles/actors.rs +++ b/src/roles/actors.rs @@ -23,25 +23,25 @@ pub struct RoleParameters { // minium balance required to stake to enter a role pub min_stake: BalanceOf, - // the maximum number of spots available to fill for a role - pub max_actors: u32, - // minimum actors to maintain - if role is unstaking // and remaining actors would be less that this value - prevent or punish for unstaking pub min_actors: u32, + // the maximum number of spots available to fill for a role + pub max_actors: u32, + // fixed amount of tokens paid to actors' primary account pub reward: BalanceOf, // payouts are made at this block interval pub reward_period: T::BlockNumber, - // how long tokens remain locked for after unstaking - pub unbonding_period: T::BlockNumber, - // minimum amount of time before being able to unstake pub bonding_period: T::BlockNumber, + // how long tokens remain locked for after unstaking + pub unbonding_period: T::BlockNumber, + // minimum period required to be in service. unbonding before this time is highly penalized pub min_service_period: T::BlockNumber, @@ -82,19 +82,19 @@ decl_storage! { Parameters get(parameters) : map Role => Option>; /// the roles members can enter into - AvailableRoles get(available_roles) : Vec; // = vec![Role::Storage]; + AvailableRoles get(available_roles) : Vec; /// Actors list - Actors get(actors) : Vec; + ActorAccountIds get(actor_account_ids) : Vec; /// actor accounts mapped to their actor - ActorsByAccountId get(actors_by_account_id) : map T::AccountId => Option>; + ActorByAccountId get(actor_by_account_id) : map T::AccountId => Option>; /// actor accounts associated with a role - AccountsByRole get(accounts_by_role) : map Role => Vec; + AccountIdsByRole get(account_ids_by_role) : map Role => Vec; /// actor accounts associated with a member id - AccountsByMember get(accounts_by_member) : map MemberId => Vec; + AccountIdsByMemberId get(account_ids_by_member_id) : map MemberId => Vec; /// tokens locked until given block number Bondage get(bondage) : map T::AccountId => T::BlockNumber; @@ -123,7 +123,7 @@ impl Module { } fn ensure_actor(role_key: &T::AccountId) -> Result, &'static str> { - Self::actors_by_account_id(role_key).ok_or("not role key") + Self::actor_by_account_id(role_key).ok_or("not role key") } fn ensure_actor_is_member(role_key: &T::AccountId, member_id: MemberId) @@ -144,19 +144,19 @@ impl Module { // Mutating fn remove_actor_from_service(actor_account: T::AccountId, role: Role, member_id: MemberId) { - let accounts: Vec = Self::accounts_by_role(role) + let accounts: Vec = Self::account_ids_by_role(role) .into_iter() .filter(|account| !(*account == actor_account)) .collect(); - >::insert(role, accounts); + >::insert(role, accounts); - let accounts: Vec = Self::accounts_by_member(&member_id) + let accounts: Vec = Self::account_ids_by_member_id(&member_id) .into_iter() .filter(|account| !(*account == actor_account)) .collect(); - >::insert(&member_id, accounts); + >::insert(&member_id, accounts); - >::remove(&actor_account); + >::remove(&actor_account); } fn apply_unstake(actor_account: T::AccountId, role: Role, member_id: MemberId, unbonding_period: T::BlockNumber) { @@ -169,7 +169,7 @@ impl Module { impl Roles for Module { fn is_role_account(account_id: &T::AccountId) -> bool { - >::exists(account_id) || >::exists(account_id) + >::exists(account_id) || >::exists(account_id) } } @@ -195,8 +195,8 @@ decl_module! { for role in Self::available_roles().iter() { if let Some(params) = Self::parameters(role) { if !(now % params.reward_period == T::BlockNumber::zero()) { continue } - let accounts = Self::accounts_by_role(role); - for actor in accounts.into_iter().map(|account| Self::actors_by_account_id(account)) { + let accounts = Self::account_ids_by_role(role); + for actor in accounts.into_iter().map(|account| Self::actor_by_account_id(account)) { if let Some(actor) = actor { if now > actor.joined_at + params.reward_period { T::Currency::reward(&actor.account, params.reward); @@ -208,7 +208,7 @@ decl_module! { if now % T::BlockNumber::sa(100) == T::BlockNumber::zero() { // clear unbonded accounts - let actors: Vec = Self::actors() + let actor_accounts: Vec = Self::actor_account_ids() .into_iter() .filter(|account| { if >::exists(account) { @@ -223,7 +223,7 @@ decl_module! { } }) .collect(); - >::put(actors); + >::put(actor_accounts); } // eject actors not staking the minimum @@ -277,7 +277,7 @@ decl_module! { ensure!(Self::role_is_available(role), ""); let role_parameters = Self::ensure_role_parameters(role)?; - let accounts_in_role = Self::accounts_by_role(role); + let accounts_in_role = Self::account_ids_by_role(role); // ensure there is an empty slot for the role ensure!(accounts_in_role.len() < role_parameters.max_actors as usize, "role slots full"); @@ -285,16 +285,16 @@ decl_module! { // ensure the actor account has enough balance ensure!(T::Currency::free_balance(&actor_account) >= role_parameters.min_stake, "not enough balance to stake"); - >::mutate(role, |accounts| accounts.push(actor_account.clone())); - >::mutate(&member_id, |accounts| accounts.push(actor_account.clone())); + >::mutate(role, |accounts| accounts.push(actor_account.clone())); + >::mutate(&member_id, |accounts| accounts.push(actor_account.clone())); >::insert(&actor_account, T::BlockNumber::max_value()); - >::insert(&actor_account, Actor { + >::insert(&actor_account, Actor { member_id, account: actor_account.clone(), role, joined_at: >::block_number() }); - >::mutate(|actors| actors.push(actor_account.clone())); + >::mutate(|accounts| accounts.push(actor_account.clone())); let requests: Requests = Self::role_entry_requests() .into_iter() From d800e17721f97d1da5a59d53a4a89364f7b5e561 Mon Sep 17 00:00:00 2001 From: Jens Finkhaeuser Date: Sat, 30 Mar 2019 12:12:18 +0100 Subject: [PATCH 079/175] Add DataObjectStorageRelationshipRegistry implementation --- src/storage/data_object_storage_registry.rs | 36 +++++++++++++++++++-- 1 file changed, 33 insertions(+), 3 deletions(-) diff --git a/src/storage/data_object_storage_registry.rs b/src/storage/data_object_storage_registry.rs index 90c70035aa..99c4788f23 100644 --- a/src/storage/data_object_storage_registry.rs +++ b/src/storage/data_object_storage_registry.rs @@ -22,6 +22,8 @@ pub trait Trait: timestamp::Trait + system::Trait + DDTrait + MaybeDebug { } static MSG_CID_NOT_FOUND: &str = "Content with this ID not found!"; +static MSG_DOSR_NOT_FOUND: &str = "No data object storage relationship found for this ID."; +static MSG_ONLY_STORAGE_PROVIDER_MAY_CLAIM_READY: &str = "Only the storage provider in a DOSR can decide whether they're ready."; const DEFAULT_FIRST_DATA_OBJECT_STORAGE_RELATIONSHIP_ID: u64 = 1; @@ -65,7 +67,7 @@ decl_module! { pub fn add_data_object_storage_relationship(origin, cid: T::ContentId) { // Origin has to be a storage provider let who = ensure_signed(origin).clone().unwrap(); - // TODO + // TODO check for being staked as a storage provider // if !T::IsActiveMember::is_active_member(&who) { // return Err(MSG_CREATOR_MUST_BE_MEMBER); // } @@ -89,10 +91,38 @@ decl_module! { // Emit event Self::deposit_event(RawEvent::DataObjectStorageRelationshipAdded(new_id, cid, who)); } - } - // TODO storage provider may flip their own ready state + // A storage provider may flip their own ready state, but nobody else. + pub fn set_data_object_storage_relationship_ready(origin, id: T::DataObjectStorageRelationshipId) { + Self::toggle_dosr_ready(origin, id, true); + } + + pub fn unset_data_object_storage_relationship_ready(origin, id: T::DataObjectStorageRelationshipId) { + Self::toggle_dosr_ready(origin, id, false); + } + } } impl Module { + fn toggle_dosr_ready(origin: T::Origin, id: T::DataObjectStorageRelationshipId, ready: bool) -> dispatch::Result + { + // Origin has to be the storage provider mentioned in the DOSR + let who = ensure_signed(origin).clone().unwrap(); + + // For that, we need to fetch the identified DOSR + let found = Self::data_object_storage_relationship(id).ok_or(MSG_DOSR_NOT_FOUND); + let mut dosr = found.unwrap(); + if dosr.storage_provider != who { + return Err(MSG_ONLY_STORAGE_PROVIDER_MAY_CLAIM_READY); + } + + // Flip to ready + dosr.ready = ready; + + // Update DOSR and fire event. + >::insert(id, dosr); + Self::deposit_event(RawEvent::DataObjectStorageRelationshipReadyUpdated(id, true)); + + Ok(()) + } } From 8a2268410d61b6576d1f7565d3975f43d7fec73c Mon Sep 17 00:00:00 2001 From: Jens Finkhaeuser Date: Sat, 30 Mar 2019 12:17:01 +0100 Subject: [PATCH 080/175] Fix passing on of results --- src/storage/data_object_storage_registry.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/storage/data_object_storage_registry.rs b/src/storage/data_object_storage_registry.rs index 99c4788f23..957b46fc6e 100644 --- a/src/storage/data_object_storage_registry.rs +++ b/src/storage/data_object_storage_registry.rs @@ -94,11 +94,11 @@ decl_module! { // A storage provider may flip their own ready state, but nobody else. pub fn set_data_object_storage_relationship_ready(origin, id: T::DataObjectStorageRelationshipId) { - Self::toggle_dosr_ready(origin, id, true); + Self::toggle_dosr_ready(origin, id, true)?; } pub fn unset_data_object_storage_relationship_ready(origin, id: T::DataObjectStorageRelationshipId) { - Self::toggle_dosr_ready(origin, id, false); + Self::toggle_dosr_ready(origin, id, false)?; } } } From bf479adabf120a0967c7f82403826ca789ad26d8 Mon Sep 17 00:00:00 2001 From: Jens Finkhaeuser Date: Sat, 30 Mar 2019 12:19:28 +0100 Subject: [PATCH 081/175] Silence warnings --- src/storage/data_directory.rs | 4 +--- src/storage/data_object_storage_registry.rs | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/src/storage/data_directory.rs b/src/storage/data_directory.rs index 452632c4dc..142b53695a 100644 --- a/src/storage/data_directory.rs +++ b/src/storage/data_directory.rs @@ -4,11 +4,9 @@ use rstd::prelude::*; use parity_codec::Codec; use parity_codec_derive::{Encode, Decode}; use srml_support::{StorageMap, decl_module, decl_storage, decl_event, ensure, Parameter, dispatch}; -use runtime_primitives::traits::{SimpleArithmetic, As, Member, MaybeSerializeDebug, MaybeDebug}; +use runtime_primitives::traits::{Member, MaybeSerializeDebug, MaybeDebug}; use system::{self, ensure_signed}; -use primitives::{Ed25519AuthorityId}; use crate::traits::{IsActiveMember, IsActiveDataObjectType, ContentIdExists}; -use crate::membership::{members}; use crate::storage::data_object_type_registry::Trait as DOTRTrait; pub trait Trait: timestamp::Trait + system::Trait + DOTRTrait + MaybeDebug { diff --git a/src/storage/data_object_storage_registry.rs b/src/storage/data_object_storage_registry.rs index 957b46fc6e..8e521af402 100644 --- a/src/storage/data_object_storage_registry.rs +++ b/src/storage/data_object_storage_registry.rs @@ -3,12 +3,10 @@ use rstd::prelude::*; use parity_codec::Codec; use parity_codec_derive::{Encode, Decode}; -use srml_support::{StorageMap, StorageValue, decl_module, decl_storage, decl_event, ensure, Parameter, dispatch}; +use srml_support::{StorageMap, StorageValue, decl_module, decl_storage, decl_event, Parameter, dispatch}; use runtime_primitives::traits::{SimpleArithmetic, As, Member, MaybeSerializeDebug, MaybeDebug}; use system::{self, ensure_signed}; -use primitives::{Ed25519AuthorityId}; use crate::traits::{IsActiveMember, ContentIdExists}; -use crate::membership::{members}; use crate::storage::data_directory::Trait as DDTrait; pub trait Trait: timestamp::Trait + system::Trait + DDTrait + MaybeDebug { From afc031bbf5fab851d24dc69f3874414dd36f010a Mon Sep 17 00:00:00 2001 From: Jens Finkhaeuser Date: Sat, 30 Mar 2019 15:29:34 +0100 Subject: [PATCH 082/175] Add more traits for storage --- src/traits.rs | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/traits.rs b/src/traits.rs index 69fc06820b..4cfb09ff91 100644 --- a/src/traits.rs +++ b/src/traits.rs @@ -1,8 +1,10 @@ #![cfg_attr(not(feature = "std"), no_std)] -use crate::storage::{data_object_type_registry, data_directory}; +use crate::storage::{data_object_type_registry, data_directory, data_object_storage_registry}; use system; +// Storage + pub trait IsActiveDataObjectType { fn is_active_data_object_type(which: &T::DataObjectTypeId) -> bool { false @@ -13,8 +15,24 @@ pub trait ContentIdExists { fn has_content(which: &T::ContentId) -> bool { false } + + fn get_data_object(which: &T::ContentId) -> Result, &'static str> { + Err("not implemented") + } } +pub trait ContentHasStorage { + fn has_storage_provider(which: &T::ContentId) -> bool { + false + } + + fn is_ready_at_storage_provider(which: &T::ContentId, provider: &T::AccountId) -> bool { + false + } +} + +// Membership + pub trait IsActiveMember { fn is_active_member(account_id: &T::AccountId) -> bool { false From ea54fea4314d62d73f8deb5217e57d0d93cf0418 Mon Sep 17 00:00:00 2001 From: Jens Finkhaeuser Date: Sat, 30 Mar 2019 15:30:11 +0100 Subject: [PATCH 083/175] Finish ContentIdExists implementation --- src/storage/data_directory.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/storage/data_directory.rs b/src/storage/data_directory.rs index 142b53695a..64e35c2fa3 100644 --- a/src/storage/data_directory.rs +++ b/src/storage/data_directory.rs @@ -72,9 +72,13 @@ decl_event! { impl ContentIdExists for Module { fn has_content(which: &T::ContentId) -> bool { + Self::content(*which).is_some() + } + + fn get_data_object(which: &T::ContentId) -> Result, &'static str> { match Self::content(*which) { - Some(_content) => true, - None => false, + None => Err(MSG_CID_NOT_FOUND), + Some(data) => Ok(data), } } } From 1c0b4ff809acd80fee01a61a4bb5e9f7946c2c16 Mon Sep 17 00:00:00 2001 From: Jens Finkhaeuser Date: Sat, 30 Mar 2019 15:30:36 +0100 Subject: [PATCH 084/175] Add storage (and trait) for determining whether a storage relationship exists for a content ID and a provider --- src/storage/data_object_storage_registry.rs | 26 ++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/src/storage/data_object_storage_registry.rs b/src/storage/data_object_storage_registry.rs index 8e521af402..1e35c75b1e 100644 --- a/src/storage/data_object_storage_registry.rs +++ b/src/storage/data_object_storage_registry.rs @@ -6,7 +6,7 @@ use parity_codec_derive::{Encode, Decode}; use srml_support::{StorageMap, StorageValue, decl_module, decl_storage, decl_event, Parameter, dispatch}; use runtime_primitives::traits::{SimpleArithmetic, As, Member, MaybeSerializeDebug, MaybeDebug}; use system::{self, ensure_signed}; -use crate::traits::{IsActiveMember, ContentIdExists}; +use crate::traits::{IsActiveMember, ContentIdExists, ContentHasStorage}; use crate::storage::data_directory::Trait as DDTrait; pub trait Trait: timestamp::Trait + system::Trait + DDTrait + MaybeDebug { @@ -43,6 +43,9 @@ decl_storage! { // Mapping of Data object types pub DataObjectStorageRelationshipMap get(data_object_storage_relationship): map T::DataObjectStorageRelationshipId => Option>; + + // Keep a list of storage relationships per CID + pub DataObjectStorageRelationships get(data_object_storage_relationships): map T::ContentId => Vec; } } @@ -57,6 +60,22 @@ decl_event! { } } +impl ContentHasStorage for Module { + fn has_storage_provider(which: &T::ContentId) -> bool { + let dosr_list = Self::data_object_storage_relationships(which); + return dosr_list.iter().any(|&dosr_id| Self::data_object_storage_relationship(dosr_id).unwrap().ready); + } + + fn is_ready_at_storage_provider(which: &T::ContentId, provider: &T::AccountId) -> bool { + let dosr_list = Self::data_object_storage_relationships(which); + return dosr_list.iter().any(|&dosr_id| { + let dosr = Self::data_object_storage_relationship(dosr_id).unwrap(); + dosr.storage_provider == *provider && dosr.ready + }); + } +} + + decl_module! { pub struct Module for enum Call where origin: T::Origin { @@ -86,6 +105,11 @@ decl_module! { >::insert(new_id, dosr); >::mutate(|n| { *n += T::DataObjectStorageRelationshipId::sa(1); }); + // Also add the DOSR to the list of DOSRs for the CID. Uniqueness is guaranteed + // by the map, so we can just append the new_id to the list. + let mut dosr_list = Self::data_object_storage_relationships(cid); + dosr_list.push(new_id); + // Emit event Self::deposit_event(RawEvent::DataObjectStorageRelationshipAdded(new_id, cid, who)); } From 527d4e24cc254c73d36c90f76cd2510267f59ef6 Mon Sep 17 00:00:00 2001 From: Jens Finkhaeuser Date: Sat, 30 Mar 2019 15:31:13 +0100 Subject: [PATCH 085/175] Add download sessions --- src/lib.rs | 10 ++- src/storage/downloads.rs | 167 +++++++++++++++++++++++++++++++++++++++ src/storage/mod.rs | 1 + 3 files changed, 177 insertions(+), 1 deletion(-) create mode 100644 src/storage/downloads.rs diff --git a/src/lib.rs b/src/lib.rs index 4355cd706a..3b5480b8c7 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -17,7 +17,7 @@ extern crate parity_codec_derive; pub mod governance; use governance::{election, council, proposals}; pub mod storage; -use storage::{data_object_type_registry, data_directory, data_object_storage_registry}; +use storage::{data_object_type_registry, data_directory, data_object_storage_registry, downloads}; mod memo; mod traits; mod membership; @@ -246,6 +246,13 @@ impl storage::data_directory::Trait for Runtime type IsActiveDataObjectType = DataObjectTypeRegistry; } +impl storage::downloads::Trait for Runtime +{ + type Event = Event; + type DownloadSessionId = u64; + type ContentHasStorage = DataObjectStorageRegistry; +} + impl storage::data_object_storage_registry::Trait for Runtime { type Event = Event; @@ -291,6 +298,7 @@ construct_runtime!( DataObjectTypeRegistry: data_object_type_registry::{Module, Call, Storage, Event, Config}, DataDirectory: data_directory::{Module, Call, Storage, Event}, DataObjectStorageRegistry: data_object_storage_registry::{Module, Call, Storage, Event, Config}, + DownloadSessions: downloads::{Module, Call, Storage, Event, Config}, } ); diff --git a/src/storage/downloads.rs b/src/storage/downloads.rs new file mode 100644 index 0000000000..cb18c65503 --- /dev/null +++ b/src/storage/downloads.rs @@ -0,0 +1,167 @@ +#![cfg_attr(not(feature = "std"), no_std)] + +use rstd::prelude::*; +use parity_codec::Codec; +use parity_codec_derive::{Encode, Decode}; +use srml_support::{StorageMap, StorageValue, decl_module, decl_storage, decl_event, ensure, Parameter, dispatch}; +use runtime_primitives::traits::{SimpleArithmetic, As, Member, MaybeSerializeDebug, MaybeDebug}; +use system::{self, ensure_signed}; +use crate::traits::{ContentIdExists, ContentHasStorage}; +use crate::storage::data_object_storage_registry::Trait as DOSRTrait; +use crate::storage::data_directory::Trait as DDTrait; + +pub trait Trait: timestamp::Trait + system::Trait + DOSRTrait + DDTrait { + type Event: From> + Into<::Event>; + + type DownloadSessionId: Parameter + Member + SimpleArithmetic + Codec + Default + Copy + + As + As + MaybeSerializeDebug + PartialEq; + + type ContentHasStorage: ContentHasStorage; +} + +static MSG_SESSION_NOT_FOUND: &str = "Download session with the given ID not found."; +static MSG_SESSION_HAS_ENDED: &str = "Download session with the given ID has already ended."; +static MSG_CONSUMER_REQUIRED: &str = "Download session can only be modified by the downloader"; +static MSG_INVALID_TRANSMITTED_VALUE: &str = "Invalid update to transmitted bytes value"; + +const DEFAULT_FIRST_DOWNLOAD_SESSION_ID: u64 = 1; + +#[derive(Clone, Encode, Decode, PartialEq)] +#[cfg_attr(feature = "std", derive(Debug))] +pub enum DownloadState +{ + Started, + Ended, +} + +impl Default for DownloadState { + fn default() -> Self { + DownloadState::Started + } +} + + +#[derive(Clone, Encode, Decode, PartialEq)] +#[cfg_attr(feature = "std", derive(Debug))] +pub struct DownloadSession { + pub cid: ::ContentId, + pub consumer: T::AccountId, + pub distributor: T::AccountId, + pub initiated_at_block: T::BlockNumber, + pub initiated_at_time: T::Moment, + pub state: DownloadState, + pub transmitted: u64, +} + +decl_storage! { + trait Store for Module as DownloadSessions { + // Start at this value + pub FirstDownloadSessionId get(first_download_session_id) config(first_download_session_id): T::DownloadSessionId = T::DownloadSessionId::sa(DEFAULT_FIRST_DOWNLOAD_SESSION_ID); + + // Increment + pub NextDownloadSessionId get(next_download_session_id) build(|config: &GenesisConfig| config.first_download_session_id): T::DownloadSessionId = T::DownloadSessionId::sa(DEFAULT_FIRST_DOWNLOAD_SESSION_ID); + + // Mapping of Data object types + pub DownloadSessionMap get(download_session): map T::DownloadSessionId => Option>; + } +} + +decl_event! { + pub enum Event where + ::ContentId + { + // We send the content ID *only* because while we already leak download + // session information by storing it on the public chain, there's no + // need to advertise each download even more. + DownloadStarted(ContentId), + + // Transmitted size is included in the ended event. + DownloadEnded(ContentId, u64), + } +} + +decl_module! { + pub struct Module for enum Call where origin: T::Origin { + fn deposit_event() = default; + + // Origin starts a download from distributor. It's the origin's responsibility to + // start this, and hand the session ID to the distributor as proof they did. + pub fn start_download(origin, cid: ::ContentId, from: T::AccountId) { + // Origin can be anyone, it doesn't have to be a member. + let who = ensure_signed(origin).clone().unwrap(); + + // There has to be a storage relationship for the content ID and storage provider. + if !T::ContentHasStorage::is_ready_at_storage_provider(&cid, &from) { + return Err("NOPETYNOPE"); + } + + // Let's create the entry then + let new_id = Self::next_download_session_id(); + let session: DownloadSession = DownloadSession { + cid: cid, + consumer: who, + distributor: from.clone(), + initiated_at_block: >::block_number(), + initiated_at_time: >::now(), + state: DownloadState::Started, + transmitted: 0u64, + }; + + >::insert(new_id, session); + >::mutate(|n| { *n += T::DownloadSessionId::sa(1); }); + + // Fire off event + Self::deposit_event(RawEvent::DownloadStarted(cid)); + } + + // The downloader can also update the transmitted size, as long as it's + // strictly larger. + pub fn update_transmitted(origin, session_id: T::DownloadSessionId, transmitted: u64) + { + // Origin can be anyone, it doesn't have to be a member. + let who = ensure_signed(origin).clone().unwrap(); + + // Get session + let found = Self::download_session(session_id).ok_or(MSG_SESSION_NOT_FOUND); + let mut session = found.unwrap(); + + // Ensure that the session hasn't ended yet. + if session.state != DownloadState::Started { + return Err(MSG_SESSION_HAS_ENDED); + } + + // Ensure that the origin is the consumer + if session.consumer != who { + return Err(MSG_CONSUMER_REQUIRED); + } + + // Ensure that the new transmitted size is larger than the old one + if transmitted <= session.transmitted { + return Err(MSG_INVALID_TRANSMITTED_VALUE); + } + + // By fetching the content information, we can ensure that the transmitted + // field also does not exceed the content size. Furthermore, we can + // automatically detect when the download ended. + let data_object = T::ContentIdExists::get_data_object(&session.cid)?; + if transmitted > data_object.size { + return Err(MSG_INVALID_TRANSMITTED_VALUE); + } + let finished = transmitted == data_object.size; + + // Ok we can update the data. + session.transmitted = transmitted; + session.state = match finished { + true => DownloadState::Ended, + false => DownloadState::Started, + }; + let cid = session.cid.clone(); + >::insert(session_id, session); + + // Also announce if the download finished + if finished { + Self::deposit_event(RawEvent::DownloadEnded(cid, transmitted)); + } + } + } +} diff --git a/src/storage/mod.rs b/src/storage/mod.rs index 4b95091dfb..6bde57da09 100644 --- a/src/storage/mod.rs +++ b/src/storage/mod.rs @@ -3,6 +3,7 @@ pub mod data_object_type_registry; pub mod data_directory; pub mod data_object_storage_registry; +pub mod downloads; mod mock; mod tests; From 65d949211be994425a1bfaf7a7cce343fc2e91b7 Mon Sep 17 00:00:00 2001 From: Jens Finkhaeuser Date: Sat, 30 Mar 2019 15:37:26 +0100 Subject: [PATCH 086/175] Silence warnings --- src/storage/downloads.rs | 4 ++-- src/traits.rs | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/storage/downloads.rs b/src/storage/downloads.rs index cb18c65503..6717db11e1 100644 --- a/src/storage/downloads.rs +++ b/src/storage/downloads.rs @@ -3,8 +3,8 @@ use rstd::prelude::*; use parity_codec::Codec; use parity_codec_derive::{Encode, Decode}; -use srml_support::{StorageMap, StorageValue, decl_module, decl_storage, decl_event, ensure, Parameter, dispatch}; -use runtime_primitives::traits::{SimpleArithmetic, As, Member, MaybeSerializeDebug, MaybeDebug}; +use srml_support::{StorageMap, StorageValue, decl_module, decl_storage, decl_event, Parameter}; +use runtime_primitives::traits::{SimpleArithmetic, As, Member, MaybeSerializeDebug}; use system::{self, ensure_signed}; use crate::traits::{ContentIdExists, ContentHasStorage}; use crate::storage::data_object_storage_registry::Trait as DOSRTrait; diff --git a/src/traits.rs b/src/traits.rs index 4cfb09ff91..b24eee6d1a 100644 --- a/src/traits.rs +++ b/src/traits.rs @@ -6,27 +6,27 @@ use system; // Storage pub trait IsActiveDataObjectType { - fn is_active_data_object_type(which: &T::DataObjectTypeId) -> bool { + fn is_active_data_object_type(_which: &T::DataObjectTypeId) -> bool { false } } pub trait ContentIdExists { - fn has_content(which: &T::ContentId) -> bool { + fn has_content(_which: &T::ContentId) -> bool { false } - fn get_data_object(which: &T::ContentId) -> Result, &'static str> { + fn get_data_object(_which: &T::ContentId) -> Result, &'static str> { Err("not implemented") } } pub trait ContentHasStorage { - fn has_storage_provider(which: &T::ContentId) -> bool { + fn has_storage_provider(_which: &T::ContentId) -> bool { false } - fn is_ready_at_storage_provider(which: &T::ContentId, provider: &T::AccountId) -> bool { + fn is_ready_at_storage_provider(_which: &T::ContentId, _provider: &T::AccountId) -> bool { false } } From 4770deb281bcc429209043eb22198222c4237538 Mon Sep 17 00:00:00 2001 From: Jens Finkhaeuser Date: Sat, 30 Mar 2019 15:52:05 +0100 Subject: [PATCH 087/175] Silence warnings during 'cargo build' and 'cargo test'. Running `build.sh` still has warnings, but they aren't as distracting during development. --- src/governance/council.rs | 9 +++------ src/governance/election.rs | 6 +++--- src/governance/mock.rs | 5 ++--- src/governance/proposals.rs | 12 +++++++----- src/membership/members.rs | 6 +++--- src/membership/mock.rs | 2 -- src/membership/tests.rs | 1 - src/memo.rs | 2 +- src/migration.rs | 2 +- src/storage/mock.rs | 1 - src/storage/tests.rs | 1 - src/traits.rs | 2 +- 12 files changed, 21 insertions(+), 28 deletions(-) diff --git a/src/governance/council.rs b/src/governance/council.rs index f30d7c9b37..c69ff64a46 100644 --- a/src/governance/council.rs +++ b/src/governance/council.rs @@ -1,8 +1,7 @@ #![cfg_attr(not(feature = "std"), no_std)] -use srml_support::{StorageValue, StorageMap, dispatch::Result, decl_module, decl_event, decl_storage, ensure}; -use srml_support::traits::{Currency}; -use system::{self, ensure_signed}; +use srml_support::{StorageValue, decl_module, decl_event, decl_storage, ensure}; +use system::{self}; use runtime_primitives::traits::{As, Zero}; use rstd::prelude::*; @@ -37,7 +36,7 @@ decl_storage! { } } -/// Event for this module. +// Event for this module. decl_event!( pub enum Event where ::BlockNumber { CouncilTermEnded(BlockNumber), @@ -123,9 +122,7 @@ decl_module! { #[cfg(test)] mod tests { - use super::*; use crate::governance::mock::*; - use parity_codec::Encode; use runtime_io::with_externalities; use srml_support::*; diff --git a/src/governance/election.rs b/src/governance/election.rs index e6d0f109e7..26f1ddecf0 100644 --- a/src/governance/election.rs +++ b/src/governance/election.rs @@ -65,7 +65,7 @@ pub trait CouncilElected { } impl CouncilElected for () { - fn council_elected(_new_council: Elected, term: Term) {} + fn council_elected(_new_council: Elected, _term: Term) {} } impl> CouncilElected for (X,) { @@ -116,7 +116,7 @@ decl_storage! { } } -/// Event for this module. +// Event for this module. decl_event!( pub enum Event where ::BlockNumber, @@ -1668,4 +1668,4 @@ mod tests { assert_ok!(Election::start_election(vec![])); }); } -} \ No newline at end of file +} diff --git a/src/governance/mock.rs b/src/governance/mock.rs index ce5bb9bd4a..ba27a59176 100644 --- a/src/governance/mock.rs +++ b/src/governance/mock.rs @@ -1,6 +1,5 @@ #![cfg(test)] -use rstd::prelude::*; pub use super::{election, council, proposals, GovernanceCurrency}; pub use system; use crate::traits; @@ -20,7 +19,7 @@ impl_outer_origin! { pub struct AnyAccountIsMember {} impl traits::IsActiveMember for AnyAccountIsMember { - fn is_active_member(who: &T::AccountId) -> bool { + fn is_active_member(_who: &T::AccountId) -> bool { true } } @@ -96,7 +95,7 @@ impl GovernanceCurrency for Test { // This function basically just builds a genesis storage key/value store according to // our desired mockup. pub fn initial_test_ext() -> runtime_io::TestExternalities { - let mut t = system::GenesisConfig::::default().build_storage().unwrap().0; + let t = system::GenesisConfig::::default().build_storage().unwrap().0; runtime_io::TestExternalities::new(t) } diff --git a/src/governance/proposals.rs b/src/governance/proposals.rs index 58878dc9e9..4cafb22396 100644 --- a/src/governance/proposals.rs +++ b/src/governance/proposals.rs @@ -1,11 +1,14 @@ use srml_support::{StorageValue, StorageMap, dispatch::Result, decl_module, decl_event, decl_storage, ensure}; use srml_support::traits::{Currency}; -use primitives::{storage::well_known_keys}; use runtime_primitives::traits::{As, Hash, Zero}; use runtime_io::print; -use {balances, system::{self, ensure_signed}}; +use system::{self, ensure_signed}; use rstd::prelude::*; +#[cfg(test)] +use primitives::{storage::well_known_keys}; + + use super::council; pub use super::{ GovernanceCurrency, BalanceOf }; use crate::traits::{IsActiveMember}; @@ -382,7 +385,7 @@ impl Module { Ok(()) } - fn end_block(now: T::BlockNumber) -> Result { + fn end_block(_now: T::BlockNumber) -> Result { // TODO refactor this method @@ -558,7 +561,6 @@ mod tests { traits::{BlakeTwo256, OnFinalise, IdentityLookup}, testing::{Digest, DigestItem, Header, UintAuthorityId} }; - use system::{EventRecord, Phase}; use srml_support::*; impl_outer_origin! { @@ -620,7 +622,7 @@ mod tests { pub struct AnyAccountIsMember {} impl IsActiveMember for AnyAccountIsMember { - fn is_active_member(who: &T::AccountId) -> bool { + fn is_active_member(_who: &T::AccountId) -> bool { true } } diff --git a/src/membership/members.rs b/src/membership/members.rs index 68faed9917..74a7b843a6 100644 --- a/src/membership/members.rs +++ b/src/membership/members.rs @@ -5,7 +5,7 @@ use parity_codec::Codec; use parity_codec_derive::{Encode, Decode}; use srml_support::{StorageMap, StorageValue, dispatch, decl_module, decl_storage, decl_event, ensure, Parameter}; use srml_support::traits::{Currency}; -use runtime_primitives::traits::{Zero, SimpleArithmetic, As, Member, MaybeSerializeDebug}; +use runtime_primitives::traits::{SimpleArithmetic, As, Member, MaybeSerializeDebug}; use system::{self, ensure_signed}; use crate::governance::{GovernanceCurrency, BalanceOf }; use {timestamp}; @@ -179,7 +179,7 @@ impl traits::IsActiveMember for Module { .and_then(|member_id| Self::ensure_profile(member_id)) { Ok(profile) => !profile.suspended, - Err(err) => false + Err(_err) => false } } } @@ -408,4 +408,4 @@ impl Module { >::insert(id, profile); Ok(()) } -} \ No newline at end of file +} diff --git a/src/membership/mock.rs b/src/membership/mock.rs index b4e42c1be2..060f47c7db 100644 --- a/src/membership/mock.rs +++ b/src/membership/mock.rs @@ -1,6 +1,5 @@ #![cfg(test)] -use rstd::prelude::*; pub use crate::governance::{GovernanceCurrency}; pub use super::{members}; pub use system; @@ -110,6 +109,5 @@ impl ExtBuilder { } } -pub type System = system::Module; pub type Balances = balances::Module; pub type Members = members::Module; diff --git a/src/membership/tests.rs b/src/membership/tests.rs index 5b159d433e..9e270519d1 100644 --- a/src/membership/tests.rs +++ b/src/membership/tests.rs @@ -3,7 +3,6 @@ use super::*; use super::mock::*; -use parity_codec::Encode; use runtime_io::with_externalities; use srml_support::*; diff --git a/src/memo.rs b/src/memo.rs index 43892a725e..dd84afab18 100644 --- a/src/memo.rs +++ b/src/memo.rs @@ -1,6 +1,6 @@ #![cfg_attr(not(feature = "std"), no_std)] -use srml_support::{StorageMap, dispatch::Result, decl_module, decl_storage, decl_event, ensure}; +use srml_support::{StorageMap, decl_module, decl_storage, decl_event, ensure}; use srml_support::traits::{Currency}; use runtime_primitives::traits::{Zero}; use system::{self, ensure_signed}; diff --git a/src/migration.rs b/src/migration.rs index d835e0a17d..ba4166fdd7 100644 --- a/src/migration.rs +++ b/src/migration.rs @@ -1,6 +1,6 @@ #![cfg_attr(not(feature = "std"), no_std)] -use srml_support::{StorageValue, dispatch::Result, decl_module, decl_storage, decl_event, ensure}; +use srml_support::{StorageValue, decl_module, decl_storage, decl_event}; use system; use rstd::prelude::*; use runtime_io::print; diff --git a/src/storage/mock.rs b/src/storage/mock.rs index a81d247c1f..30e7ad93f6 100644 --- a/src/storage/mock.rs +++ b/src/storage/mock.rs @@ -1,6 +1,5 @@ #![cfg(test)] -use rstd::prelude::*; pub use super::{data_object_type_registry}; pub use system; diff --git a/src/storage/tests.rs b/src/storage/tests.rs index 7f3dfd8d34..59236b41d1 100644 --- a/src/storage/tests.rs +++ b/src/storage/tests.rs @@ -4,7 +4,6 @@ use super::*; use super::mock::*; use runtime_io::with_externalities; -use srml_support::*; use system::{self, Phase, EventRecord}; #[test] diff --git a/src/traits.rs b/src/traits.rs index b24eee6d1a..8cacea2eb2 100644 --- a/src/traits.rs +++ b/src/traits.rs @@ -34,7 +34,7 @@ pub trait ContentHasStorage { // Membership pub trait IsActiveMember { - fn is_active_member(account_id: &T::AccountId) -> bool { + fn is_active_member(_account_id: &T::AccountId) -> bool { false } } From 0ccc36af08a7929531906fdfe7bf22e8dbec1abf Mon Sep 17 00:00:00 2001 From: Jens Finkhaeuser Date: Sat, 30 Mar 2019 15:58:01 +0100 Subject: [PATCH 088/175] Move tests into main source file, so we can separate tests for individual source files more easily --- src/storage/data_object_type_registry.rs | 161 +++++++++++++++++++++++ src/storage/mod.rs | 1 - src/storage/tests.rs | 159 ---------------------- 3 files changed, 161 insertions(+), 160 deletions(-) delete mode 100644 src/storage/tests.rs diff --git a/src/storage/data_object_type_registry.rs b/src/storage/data_object_type_registry.rs index 646d4e85d5..17dc64d88c 100644 --- a/src/storage/data_object_type_registry.rs +++ b/src/storage/data_object_type_registry.rs @@ -137,3 +137,164 @@ impl Module { return Self::data_object_type(&id).ok_or(MSG_DO_TYPE_NOT_FOUND); } } + +#[cfg(test)] +mod tests { + use super::*; + use crate::storage::mock::*; + + use runtime_io::with_externalities; + use srml_support::*; + use system::{self, Phase, EventRecord}; + + #[test] + fn initial_state() { + const DEFAULT_FIRST_ID: u64 = 1000; + + with_externalities(&mut ExtBuilder::default() + .first_data_object_type_id(DEFAULT_FIRST_ID).build(), || { + assert_eq!(TestDataObjectTypeRegistry::first_data_object_type_id(), DEFAULT_FIRST_ID); + }); + } + + #[test] + fn fail_register_without_root() { + const DEFAULT_FIRST_ID: u64 = 1000; + + with_externalities(&mut ExtBuilder::default() + .first_data_object_type_id(DEFAULT_FIRST_ID).build(), || { + let data: TestDataObjectType = TestDataObjectType { + id: None, + description: "foo".as_bytes().to_vec(), + active: false, + }; + let res = TestDataObjectTypeRegistry::register_data_object_type(Origin::signed(1), data); + assert!(res.is_err()); + }); + } + + #[test] + fn succeed_register_as_root() { + const DEFAULT_FIRST_ID: u64 = 1000; + + with_externalities(&mut ExtBuilder::default() + .first_data_object_type_id(DEFAULT_FIRST_ID).build(), || { + let data: TestDataObjectType = TestDataObjectType { + id: None, + description: "foo".as_bytes().to_vec(), + active: false, + }; + let res = TestDataObjectTypeRegistry::register_data_object_type(Origin::ROOT, data); + assert!(res.is_ok()); + }); + } + + #[test] + fn update_existing() { + const DEFAULT_FIRST_ID: u64 = 1000; + + with_externalities(&mut ExtBuilder::default() + .first_data_object_type_id(DEFAULT_FIRST_ID).build(), || { + // First register a type + let data: TestDataObjectType = TestDataObjectType { + id: None, + description: "foo".as_bytes().to_vec(), + active: false, + }; + let id_res = TestDataObjectTypeRegistry::register_data_object_type(Origin::ROOT, data); + assert!(id_res.is_ok()); + assert_eq!(*System::events().last().unwrap(), + EventRecord { + phase: Phase::ApplyExtrinsic(0), + event: MetaEvent::data_object_type_registry(data_object_type_registry::RawEvent::DataObjectTypeRegistered(DEFAULT_FIRST_ID)), + } + ); + + + // Now update it with new data - we need the ID to be the same as in + // returned by the previous call. First, though, try and fail without + let updated1: TestDataObjectType = TestDataObjectType { + id: None, + description: "bar".as_bytes().to_vec(), + active: false, + }; + let res = TestDataObjectTypeRegistry::update_data_object_type(Origin::ROOT, updated1); + assert!(res.is_err()); + + // Now try with a bad ID + let updated2: TestDataObjectType = TestDataObjectType { + id: Some(DEFAULT_FIRST_ID + 1), + description: "bar".as_bytes().to_vec(), + active: false, + }; + let res = TestDataObjectTypeRegistry::update_data_object_type(Origin::ROOT, updated2); + assert!(res.is_err()); + + // Finally with an existing ID, it should work. + let updated3: TestDataObjectType = TestDataObjectType { + id: Some(DEFAULT_FIRST_ID), + description: "bar".as_bytes().to_vec(), + active: false, + }; + let res = TestDataObjectTypeRegistry::update_data_object_type(Origin::ROOT, updated3); + assert!(res.is_ok()); + assert_eq!(*System::events().last().unwrap(), + EventRecord { + phase: Phase::ApplyExtrinsic(0), + event: MetaEvent::data_object_type_registry(data_object_type_registry::RawEvent::DataObjectTypeUpdated(DEFAULT_FIRST_ID)), + } + ); + }); + } + + + #[test] + fn activate_existing() { + const DEFAULT_FIRST_ID: u64 = 1000; + + with_externalities(&mut ExtBuilder::default() + .first_data_object_type_id(DEFAULT_FIRST_ID).build(), || { + // First register a type + let data: TestDataObjectType = TestDataObjectType { + id: None, + description: "foo".as_bytes().to_vec(), + active: false, + }; + let id_res = TestDataObjectTypeRegistry::register_data_object_type(Origin::ROOT, data); + assert!(id_res.is_ok()); + assert_eq!(*System::events().last().unwrap(), + EventRecord { + phase: Phase::ApplyExtrinsic(0), + event: MetaEvent::data_object_type_registry(data_object_type_registry::RawEvent::DataObjectTypeRegistered(DEFAULT_FIRST_ID)), + } + ); + + // Retrieve, and ensure it's not active. + let data = TestDataObjectTypeRegistry::data_object_type(DEFAULT_FIRST_ID); + assert!(data.is_some()); + assert!(!data.unwrap().active); + + // Now activate the data object type + let res = TestDataObjectTypeRegistry::activate_data_object_type(Origin::ROOT, DEFAULT_FIRST_ID); + assert!(res.is_ok()); + assert_eq!(*System::events().last().unwrap(), + EventRecord { + phase: Phase::ApplyExtrinsic(0), + event: MetaEvent::data_object_type_registry(data_object_type_registry::RawEvent::DataObjectTypeUpdated(DEFAULT_FIRST_ID)), + } + ); + + // Ensure that the item is actually activated. + let data = TestDataObjectTypeRegistry::data_object_type(DEFAULT_FIRST_ID); + assert!(data.is_some()); + assert!(data.unwrap().active); + + // Deactivate again. + let res = TestDataObjectTypeRegistry::deactivate_data_object_type(Origin::ROOT, DEFAULT_FIRST_ID); + assert!(res.is_ok()); + let data = TestDataObjectTypeRegistry::data_object_type(DEFAULT_FIRST_ID); + assert!(data.is_some()); + assert!(!data.unwrap().active); + }); + } +} diff --git a/src/storage/mod.rs b/src/storage/mod.rs index 6bde57da09..7b44e5c05a 100644 --- a/src/storage/mod.rs +++ b/src/storage/mod.rs @@ -6,4 +6,3 @@ pub mod data_object_storage_registry; pub mod downloads; mod mock; -mod tests; diff --git a/src/storage/tests.rs b/src/storage/tests.rs deleted file mode 100644 index 7f3dfd8d34..0000000000 --- a/src/storage/tests.rs +++ /dev/null @@ -1,159 +0,0 @@ -#![cfg(test)] - -use super::*; -use super::mock::*; - -use runtime_io::with_externalities; -use srml_support::*; -use system::{self, Phase, EventRecord}; - -#[test] -fn initial_state() { - const DEFAULT_FIRST_ID: u64 = 1000; - - with_externalities(&mut ExtBuilder::default() - .first_data_object_type_id(DEFAULT_FIRST_ID).build(), || { - assert_eq!(TestDataObjectTypeRegistry::first_data_object_type_id(), DEFAULT_FIRST_ID); - }); -} - -#[test] -fn fail_register_without_root() { - const DEFAULT_FIRST_ID: u64 = 1000; - - with_externalities(&mut ExtBuilder::default() - .first_data_object_type_id(DEFAULT_FIRST_ID).build(), || { - let data: TestDataObjectType = TestDataObjectType { - id: None, - description: "foo".as_bytes().to_vec(), - active: false, - }; - let res = TestDataObjectTypeRegistry::register_data_object_type(Origin::signed(1), data); - assert!(res.is_err()); - }); -} - -#[test] -fn succeed_register_as_root() { - const DEFAULT_FIRST_ID: u64 = 1000; - - with_externalities(&mut ExtBuilder::default() - .first_data_object_type_id(DEFAULT_FIRST_ID).build(), || { - let data: TestDataObjectType = TestDataObjectType { - id: None, - description: "foo".as_bytes().to_vec(), - active: false, - }; - let res = TestDataObjectTypeRegistry::register_data_object_type(Origin::ROOT, data); - assert!(res.is_ok()); - }); -} - -#[test] -fn update_existing() { - const DEFAULT_FIRST_ID: u64 = 1000; - - with_externalities(&mut ExtBuilder::default() - .first_data_object_type_id(DEFAULT_FIRST_ID).build(), || { - // First register a type - let data: TestDataObjectType = TestDataObjectType { - id: None, - description: "foo".as_bytes().to_vec(), - active: false, - }; - let id_res = TestDataObjectTypeRegistry::register_data_object_type(Origin::ROOT, data); - assert!(id_res.is_ok()); - assert_eq!(*System::events().last().unwrap(), - EventRecord { - phase: Phase::ApplyExtrinsic(0), - event: MetaEvent::data_object_type_registry(data_object_type_registry::RawEvent::DataObjectTypeRegistered(DEFAULT_FIRST_ID)), - } - ); - - - // Now update it with new data - we need the ID to be the same as in - // returned by the previous call. First, though, try and fail without - let updated1: TestDataObjectType = TestDataObjectType { - id: None, - description: "bar".as_bytes().to_vec(), - active: false, - }; - let res = TestDataObjectTypeRegistry::update_data_object_type(Origin::ROOT, updated1); - assert!(res.is_err()); - - // Now try with a bad ID - let updated2: TestDataObjectType = TestDataObjectType { - id: Some(DEFAULT_FIRST_ID + 1), - description: "bar".as_bytes().to_vec(), - active: false, - }; - let res = TestDataObjectTypeRegistry::update_data_object_type(Origin::ROOT, updated2); - assert!(res.is_err()); - - // Finally with an existing ID, it should work. - let updated3: TestDataObjectType = TestDataObjectType { - id: Some(DEFAULT_FIRST_ID), - description: "bar".as_bytes().to_vec(), - active: false, - }; - let res = TestDataObjectTypeRegistry::update_data_object_type(Origin::ROOT, updated3); - assert!(res.is_ok()); - assert_eq!(*System::events().last().unwrap(), - EventRecord { - phase: Phase::ApplyExtrinsic(0), - event: MetaEvent::data_object_type_registry(data_object_type_registry::RawEvent::DataObjectTypeUpdated(DEFAULT_FIRST_ID)), - } - ); - }); -} - - -#[test] -fn activate_existing() { - const DEFAULT_FIRST_ID: u64 = 1000; - - with_externalities(&mut ExtBuilder::default() - .first_data_object_type_id(DEFAULT_FIRST_ID).build(), || { - // First register a type - let data: TestDataObjectType = TestDataObjectType { - id: None, - description: "foo".as_bytes().to_vec(), - active: false, - }; - let id_res = TestDataObjectTypeRegistry::register_data_object_type(Origin::ROOT, data); - assert!(id_res.is_ok()); - assert_eq!(*System::events().last().unwrap(), - EventRecord { - phase: Phase::ApplyExtrinsic(0), - event: MetaEvent::data_object_type_registry(data_object_type_registry::RawEvent::DataObjectTypeRegistered(DEFAULT_FIRST_ID)), - } - ); - - // Retrieve, and ensure it's not active. - let data = TestDataObjectTypeRegistry::data_object_type(DEFAULT_FIRST_ID); - assert!(data.is_some()); - assert!(!data.unwrap().active); - - // Now activate the data object type - let res = TestDataObjectTypeRegistry::activate_data_object_type(Origin::ROOT, DEFAULT_FIRST_ID); - assert!(res.is_ok()); - assert_eq!(*System::events().last().unwrap(), - EventRecord { - phase: Phase::ApplyExtrinsic(0), - event: MetaEvent::data_object_type_registry(data_object_type_registry::RawEvent::DataObjectTypeUpdated(DEFAULT_FIRST_ID)), - } - ); - - // Ensure that the item is actually activated. - let data = TestDataObjectTypeRegistry::data_object_type(DEFAULT_FIRST_ID); - assert!(data.is_some()); - assert!(data.unwrap().active); - - // Deactivate again. - let res = TestDataObjectTypeRegistry::deactivate_data_object_type(Origin::ROOT, DEFAULT_FIRST_ID); - assert!(res.is_ok()); - let data = TestDataObjectTypeRegistry::data_object_type(DEFAULT_FIRST_ID); - assert!(data.is_some()); - assert!(!data.unwrap().active); - }); -} From 16eeb5e66cf81175afc22d8c32125a0450f50a95 Mon Sep 17 00:00:00 2001 From: Jens Finkhaeuser Date: Sat, 30 Mar 2019 16:56:42 +0100 Subject: [PATCH 089/175] - Change requirement for ContentId to implement Clone, so we can use strings (Vec) - Mock enough to make data directory testable --- src/storage/data_directory.rs | 23 ++++++++---- src/storage/data_object_storage_registry.rs | 2 +- src/storage/downloads.rs | 2 +- src/storage/mock.rs | 39 ++++++++++++++++++++- 4 files changed, 57 insertions(+), 9 deletions(-) diff --git a/src/storage/data_directory.rs b/src/storage/data_directory.rs index 64e35c2fa3..2606e4c9ae 100644 --- a/src/storage/data_directory.rs +++ b/src/storage/data_directory.rs @@ -12,7 +12,7 @@ use crate::storage::data_object_type_registry::Trait as DOTRTrait; pub trait Trait: timestamp::Trait + system::Trait + DOTRTrait + MaybeDebug { type Event: From> + Into<::Event>; - type ContentId: Parameter + Member + Codec + Default + Copy + type ContentId: Parameter + Member + Codec + Default + Clone + MaybeSerializeDebug + PartialEq; type IsActiveMember: IsActiveMember; @@ -72,11 +72,11 @@ decl_event! { impl ContentIdExists for Module { fn has_content(which: &T::ContentId) -> bool { - Self::content(*which).is_some() + Self::content(which.clone()).is_some() } fn get_data_object(which: &T::ContentId) -> Result, &'static str> { - match Self::content(*which) { + match Self::content(which.clone()) { None => Err(MSG_CID_NOT_FOUND), Some(data) => Ok(data), } @@ -123,20 +123,20 @@ decl_module! { }; // If we've constructed the data, we can store it and send an event. - >::insert(id, data); + >::insert(id.clone(), data); Self::deposit_event(RawEvent::ContentAdded(id, liaison)); } // The LiaisonJudgement can be updated, but only by the liaison. fn accept_content(origin, id: T::ContentId) { - Self::update_content_judgement(origin, id, LiaisonJudgement::Accepted)?; + Self::update_content_judgement(origin, id.clone(), LiaisonJudgement::Accepted)?; Self::deposit_event(RawEvent::ContentAccepted(id)); } fn reject_content(origin, id: T::ContentId) { - Self::update_content_judgement(origin, id, LiaisonJudgement::Rejected)?; + Self::update_content_judgement(origin, id.clone(), LiaisonJudgement::Rejected)?; Self::deposit_event(RawEvent::ContentAccepted(id)); } } @@ -165,3 +165,14 @@ impl Module { Ok(()) } } + +#[cfg(test)] +mod tests { + use super::*; + use crate::storage::mock::*; + + use runtime_io::with_externalities; + use srml_support::*; + use system::{self, Phase, EventRecord}; + +} diff --git a/src/storage/data_object_storage_registry.rs b/src/storage/data_object_storage_registry.rs index 1e35c75b1e..f638eb3f34 100644 --- a/src/storage/data_object_storage_registry.rs +++ b/src/storage/data_object_storage_registry.rs @@ -107,7 +107,7 @@ decl_module! { // Also add the DOSR to the list of DOSRs for the CID. Uniqueness is guaranteed // by the map, so we can just append the new_id to the list. - let mut dosr_list = Self::data_object_storage_relationships(cid); + let mut dosr_list = Self::data_object_storage_relationships(cid.clone()); dosr_list.push(new_id); // Emit event diff --git a/src/storage/downloads.rs b/src/storage/downloads.rs index 6717db11e1..d04cdc84c6 100644 --- a/src/storage/downloads.rs +++ b/src/storage/downloads.rs @@ -98,7 +98,7 @@ decl_module! { // Let's create the entry then let new_id = Self::next_download_session_id(); let session: DownloadSession = DownloadSession { - cid: cid, + cid: cid.clone(), consumer: who, distributor: from.clone(), initiated_at_block: >::block_number(), diff --git a/src/storage/mock.rs b/src/storage/mock.rs index a81d247c1f..c60c37fe67 100644 --- a/src/storage/mock.rs +++ b/src/storage/mock.rs @@ -1,8 +1,9 @@ #![cfg(test)] use rstd::prelude::*; -pub use super::{data_object_type_registry}; +pub use super::{data_object_type_registry, data_directory}; pub use system; +use crate::traits; pub use primitives::{H256, Blake2Hasher}; pub use runtime_primitives::{ @@ -20,9 +21,26 @@ impl_outer_origin! { impl_outer_event! { pub enum MetaEvent for Test { data_object_type_registry, + data_directory, } } + +pub struct AnyAccountIsMember {} +impl traits::IsActiveMember for AnyAccountIsMember { + fn is_active_member(_who: &T::AccountId) -> bool { + true + } +} + +pub struct AnyDataObjectTypeIsActive {} +impl traits::IsActiveDataObjectType for AnyDataObjectTypeIsActive { + fn is_active_data_object_type(_which: &T::DataObjectTypeId) -> bool { + true + } +} + + // For testing the module, we construct most of a mock runtime. This means // first constructing a configuration type (`Test`) which `impl`s each of the // configuration traits of modules we want to use. @@ -41,11 +59,30 @@ impl system::Trait for Test { type Log = DigestItem; type Lookup = IdentityLookup; } + impl data_object_type_registry::Trait for Test { type Event = MetaEvent; type DataObjectTypeId = u64; } +impl data_directory::Trait for Test { + type Event = MetaEvent; + type ContentId = Vec; + type IsActiveMember = AnyAccountIsMember; + type IsActiveDataObjectType = AnyDataObjectTypeIsActive; +} + +impl timestamp::Trait for Test { + type Moment = u64; + type OnTimestampSet = (); +} + +impl consensus::Trait for Test { + type SessionKey = UintAuthorityId; + type InherentOfflineReport = (); + type Log = DigestItem; +} + pub struct ExtBuilder { first_data_object_type_id: u64, } From 7bb551bfe9459d4bc225aa32b89cae6ca510b2fa Mon Sep 17 00:00:00 2001 From: Jens Finkhaeuser Date: Sat, 30 Mar 2019 17:26:24 +0100 Subject: [PATCH 090/175] Simplify building of externalities for tests --- src/storage/data_object_type_registry.rs | 49 ++++++++---------------- src/storage/mock.rs | 10 +++++ 2 files changed, 27 insertions(+), 32 deletions(-) diff --git a/src/storage/data_object_type_registry.rs b/src/storage/data_object_type_registry.rs index 17dc64d88c..108e6a9934 100644 --- a/src/storage/data_object_type_registry.rs +++ b/src/storage/data_object_type_registry.rs @@ -149,20 +149,14 @@ mod tests { #[test] fn initial_state() { - const DEFAULT_FIRST_ID: u64 = 1000; - - with_externalities(&mut ExtBuilder::default() - .first_data_object_type_id(DEFAULT_FIRST_ID).build(), || { - assert_eq!(TestDataObjectTypeRegistry::first_data_object_type_id(), DEFAULT_FIRST_ID); + with_default_mock_builder(|| { + assert_eq!(TestDataObjectTypeRegistry::first_data_object_type_id(), TEST_FIRST_DATA_OBJECT_TYPE_ID); }); } #[test] fn fail_register_without_root() { - const DEFAULT_FIRST_ID: u64 = 1000; - - with_externalities(&mut ExtBuilder::default() - .first_data_object_type_id(DEFAULT_FIRST_ID).build(), || { + with_default_mock_builder(|| { let data: TestDataObjectType = TestDataObjectType { id: None, description: "foo".as_bytes().to_vec(), @@ -175,10 +169,7 @@ mod tests { #[test] fn succeed_register_as_root() { - const DEFAULT_FIRST_ID: u64 = 1000; - - with_externalities(&mut ExtBuilder::default() - .first_data_object_type_id(DEFAULT_FIRST_ID).build(), || { + with_default_mock_builder(|| { let data: TestDataObjectType = TestDataObjectType { id: None, description: "foo".as_bytes().to_vec(), @@ -191,10 +182,7 @@ mod tests { #[test] fn update_existing() { - const DEFAULT_FIRST_ID: u64 = 1000; - - with_externalities(&mut ExtBuilder::default() - .first_data_object_type_id(DEFAULT_FIRST_ID).build(), || { + with_default_mock_builder(|| { // First register a type let data: TestDataObjectType = TestDataObjectType { id: None, @@ -206,7 +194,7 @@ mod tests { assert_eq!(*System::events().last().unwrap(), EventRecord { phase: Phase::ApplyExtrinsic(0), - event: MetaEvent::data_object_type_registry(data_object_type_registry::RawEvent::DataObjectTypeRegistered(DEFAULT_FIRST_ID)), + event: MetaEvent::data_object_type_registry(data_object_type_registry::RawEvent::DataObjectTypeRegistered(TEST_FIRST_DATA_OBJECT_TYPE_ID)), } ); @@ -223,7 +211,7 @@ mod tests { // Now try with a bad ID let updated2: TestDataObjectType = TestDataObjectType { - id: Some(DEFAULT_FIRST_ID + 1), + id: Some(TEST_FIRST_DATA_OBJECT_TYPE_ID + 1), description: "bar".as_bytes().to_vec(), active: false, }; @@ -232,7 +220,7 @@ mod tests { // Finally with an existing ID, it should work. let updated3: TestDataObjectType = TestDataObjectType { - id: Some(DEFAULT_FIRST_ID), + id: Some(TEST_FIRST_DATA_OBJECT_TYPE_ID), description: "bar".as_bytes().to_vec(), active: false, }; @@ -241,7 +229,7 @@ mod tests { assert_eq!(*System::events().last().unwrap(), EventRecord { phase: Phase::ApplyExtrinsic(0), - event: MetaEvent::data_object_type_registry(data_object_type_registry::RawEvent::DataObjectTypeUpdated(DEFAULT_FIRST_ID)), + event: MetaEvent::data_object_type_registry(data_object_type_registry::RawEvent::DataObjectTypeUpdated(TEST_FIRST_DATA_OBJECT_TYPE_ID)), } ); }); @@ -250,10 +238,7 @@ mod tests { #[test] fn activate_existing() { - const DEFAULT_FIRST_ID: u64 = 1000; - - with_externalities(&mut ExtBuilder::default() - .first_data_object_type_id(DEFAULT_FIRST_ID).build(), || { + with_default_mock_builder(|| { // First register a type let data: TestDataObjectType = TestDataObjectType { id: None, @@ -265,34 +250,34 @@ mod tests { assert_eq!(*System::events().last().unwrap(), EventRecord { phase: Phase::ApplyExtrinsic(0), - event: MetaEvent::data_object_type_registry(data_object_type_registry::RawEvent::DataObjectTypeRegistered(DEFAULT_FIRST_ID)), + event: MetaEvent::data_object_type_registry(data_object_type_registry::RawEvent::DataObjectTypeRegistered(TEST_FIRST_DATA_OBJECT_TYPE_ID)), } ); // Retrieve, and ensure it's not active. - let data = TestDataObjectTypeRegistry::data_object_type(DEFAULT_FIRST_ID); + let data = TestDataObjectTypeRegistry::data_object_type(TEST_FIRST_DATA_OBJECT_TYPE_ID); assert!(data.is_some()); assert!(!data.unwrap().active); // Now activate the data object type - let res = TestDataObjectTypeRegistry::activate_data_object_type(Origin::ROOT, DEFAULT_FIRST_ID); + let res = TestDataObjectTypeRegistry::activate_data_object_type(Origin::ROOT, TEST_FIRST_DATA_OBJECT_TYPE_ID); assert!(res.is_ok()); assert_eq!(*System::events().last().unwrap(), EventRecord { phase: Phase::ApplyExtrinsic(0), - event: MetaEvent::data_object_type_registry(data_object_type_registry::RawEvent::DataObjectTypeUpdated(DEFAULT_FIRST_ID)), + event: MetaEvent::data_object_type_registry(data_object_type_registry::RawEvent::DataObjectTypeUpdated(TEST_FIRST_DATA_OBJECT_TYPE_ID)), } ); // Ensure that the item is actually activated. - let data = TestDataObjectTypeRegistry::data_object_type(DEFAULT_FIRST_ID); + let data = TestDataObjectTypeRegistry::data_object_type(TEST_FIRST_DATA_OBJECT_TYPE_ID); assert!(data.is_some()); assert!(data.unwrap().active); // Deactivate again. - let res = TestDataObjectTypeRegistry::deactivate_data_object_type(Origin::ROOT, DEFAULT_FIRST_ID); + let res = TestDataObjectTypeRegistry::deactivate_data_object_type(Origin::ROOT, TEST_FIRST_DATA_OBJECT_TYPE_ID); assert!(res.is_ok()); - let data = TestDataObjectTypeRegistry::data_object_type(DEFAULT_FIRST_ID); + let data = TestDataObjectTypeRegistry::data_object_type(TEST_FIRST_DATA_OBJECT_TYPE_ID); assert!(data.is_some()); assert!(!data.unwrap().active); }); diff --git a/src/storage/mock.rs b/src/storage/mock.rs index c60c37fe67..7bc3c00f7c 100644 --- a/src/storage/mock.rs +++ b/src/storage/mock.rs @@ -4,6 +4,7 @@ use rstd::prelude::*; pub use super::{data_object_type_registry, data_directory}; pub use system; use crate::traits; +use runtime_io::with_externalities; pub use primitives::{H256, Blake2Hasher}; pub use runtime_primitives::{ @@ -115,3 +116,12 @@ impl ExtBuilder { pub type System = system::Module; pub type TestDataObjectTypeRegistry = data_object_type_registry::Module; pub type TestDataObjectType = data_object_type_registry::DataObjectType; +pub type TestDataDirectory = data_directory::Module; +pub type TestDataObject = data_directory::DataObject; + + +pub const TEST_FIRST_DATA_OBJECT_TYPE_ID: u64 = 1000; +pub fn with_default_mock_builder R>(f: F) -> R { + with_externalities(&mut ExtBuilder::default() + .first_data_object_type_id(TEST_FIRST_DATA_OBJECT_TYPE_ID).build(), || f()) +} From aa1f3aa9a2d1c78e8e8715b3f266e5789fafef64 Mon Sep 17 00:00:00 2001 From: Jens Finkhaeuser Date: Sat, 30 Mar 2019 17:51:52 +0100 Subject: [PATCH 091/175] Add tests to data directory functions --- src/storage/data_directory.rs | 105 ++++++++++++++++++++++++++++++++++ 1 file changed, 105 insertions(+) diff --git a/src/storage/data_directory.rs b/src/storage/data_directory.rs index 2606e4c9ae..809adfa5cb 100644 --- a/src/storage/data_directory.rs +++ b/src/storage/data_directory.rs @@ -64,6 +64,7 @@ decl_event! { ::ContentId, ::AccountId { + // The account is the Liaison that was selected ContentAdded(ContentId, AccountId), ContentAccepted(ContentId), ContentRejected(ContentId), @@ -175,4 +176,108 @@ mod tests { use srml_support::*; use system::{self, Phase, EventRecord}; + #[test] + fn succeed_adding_content() { + with_default_mock_builder(|| { + // Register a content name "foo" with 1234 bytes of type 1, which should be recognized. + let res = TestDataDirectory::add_content(Origin::signed(1), + 1, + "foo".as_bytes().to_vec(), + 1234); + assert!(res.is_ok()); + + // Register the same under a different name + let res = TestDataDirectory::add_content(Origin::signed(1), + 1, + "bar".as_bytes().to_vec(), + 1234); + assert!(res.is_ok()); + }); + } + + #[test] + fn fail_adding_content_twice() { + with_default_mock_builder(|| { + // Register a content name "foo" with 1234 bytes of type 1, which should be recognized. + let res = TestDataDirectory::add_content(Origin::signed(1), + 1, + "foo".as_bytes().to_vec(), + 1234); + assert!(res.is_ok()); + + // The second time must fail + let res = TestDataDirectory::add_content(Origin::signed(1), + 1, + "foo".as_bytes().to_vec(), + 1234); + assert!(res.is_err()); + + // Also from a different origin must fail + let res = TestDataDirectory::add_content(Origin::signed(2), + 1, + "foo".as_bytes().to_vec(), + 1234); + assert!(res.is_err()); + + // Also with a different size must fail + let res = TestDataDirectory::add_content(Origin::signed(2), + 1, + "foo".as_bytes().to_vec(), + 4321); + assert!(res.is_err()); + }); + } + + #[test] + fn accept_content_as_liaison() { + with_default_mock_builder(|| { + let res = TestDataDirectory::add_content(Origin::signed(1), + 1, + "foo".as_bytes().to_vec(), + 1234); + assert!(res.is_ok()); + + // An appropriate event should have been fired. + let liaison = *match &System::events().last().unwrap().event { + MetaEvent::data_directory(data_directory::RawEvent::ContentAdded(content_id, liaison)) => liaison, + _ => &0xdeadbeefu64, // invalid value, unlikely to match + }; + assert_ne!(liaison, 0xdeadbeefu64); + + // Accepting content should not work with some random origin + let res = TestDataDirectory::accept_content(Origin::signed(42), "foo".as_bytes().to_vec()); + assert!(res.is_err()); + + // However, with the liaison as origin it should. + let res = TestDataDirectory::accept_content(Origin::signed(liaison), "foo".as_bytes().to_vec()); + assert!(res.is_ok()); + }); + } + + #[test] + fn reject_content_as_liaison() { + with_default_mock_builder(|| { + let res = TestDataDirectory::add_content(Origin::signed(1), + 1, + "foo".as_bytes().to_vec(), + 1234); + assert!(res.is_ok()); + + // An appropriate event should have been fired. + let liaison = *match &System::events().last().unwrap().event { + MetaEvent::data_directory(data_directory::RawEvent::ContentAdded(content_id, liaison)) => liaison, + _ => &0xdeadbeefu64, // invalid value, unlikely to match + }; + assert_ne!(liaison, 0xdeadbeefu64); + + // Rejecting content should not work with some random origin + let res = TestDataDirectory::reject_content(Origin::signed(42), "foo".as_bytes().to_vec()); + assert!(res.is_err()); + + // However, with the liaison as origin it should. + let res = TestDataDirectory::reject_content(Origin::signed(liaison), "foo".as_bytes().to_vec()); + assert!(res.is_ok()); + }); + } + } From 572b40f0699b2d9f7ad66b56a8732d2f87c3398a Mon Sep 17 00:00:00 2001 From: Jens Finkhaeuser Date: Mon, 1 Apr 2019 10:41:28 +0200 Subject: [PATCH 092/175] Basic content directory for #9 --- src/lib.rs | 10 ++- src/storage/content_directory.rs | 145 +++++++++++++++++++++++++++++++ src/storage/mod.rs | 1 + 3 files changed, 155 insertions(+), 1 deletion(-) create mode 100644 src/storage/content_directory.rs diff --git a/src/lib.rs b/src/lib.rs index 3b5480b8c7..c93a5f11c8 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -17,7 +17,7 @@ extern crate parity_codec_derive; pub mod governance; use governance::{election, council, proposals}; pub mod storage; -use storage::{data_object_type_registry, data_directory, data_object_storage_registry, downloads}; +use storage::{data_object_type_registry, data_directory, data_object_storage_registry, downloads, content_directory}; mod memo; mod traits; mod membership; @@ -261,6 +261,13 @@ impl storage::data_object_storage_registry::Trait for Runtime type ContentIdExists = DataDirectory; } +impl storage::content_directory::Trait for Runtime +{ + type Event = Event; + type MetadataId = u64; + type SchemaId = u64; + type IsActiveMember = Members; +} impl members::Trait for Runtime { type Event = Event; @@ -299,6 +306,7 @@ construct_runtime!( DataDirectory: data_directory::{Module, Call, Storage, Event}, DataObjectStorageRegistry: data_object_storage_registry::{Module, Call, Storage, Event, Config}, DownloadSessions: downloads::{Module, Call, Storage, Event, Config}, + ContentDirectory: content_directory::{Module, Call, Storage, Event, Config}, } ); diff --git a/src/storage/content_directory.rs b/src/storage/content_directory.rs new file mode 100644 index 0000000000..fec37d590a --- /dev/null +++ b/src/storage/content_directory.rs @@ -0,0 +1,145 @@ +#![cfg_attr(not(feature = "std"), no_std)] + +use rstd::prelude::*; +use parity_codec::Codec; +use parity_codec_derive::{Encode, Decode}; +use srml_support::{StorageMap, StorageValue, decl_module, decl_storage, decl_event, ensure, Parameter}; +use runtime_primitives::traits::{SimpleArithmetic, As, Member, MaybeSerializeDebug, MaybeDebug}; +use system::{self, ensure_signed}; +use crate::traits::{IsActiveMember}; +use crate::storage::data_object_type_registry::Trait as DOTRTrait; + +pub trait Trait: timestamp::Trait + system::Trait + DOTRTrait + MaybeDebug { + type Event: From> + Into<::Event>; + + type MetadataId: Parameter + Member + SimpleArithmetic + Codec + Default + Copy + + As + As + MaybeSerializeDebug + PartialEq; + + // Schema ID should be defined in a different Trait in future + type SchemaId: Parameter + Member + SimpleArithmetic + Codec + Default + Copy + + As + As + MaybeSerializeDebug + PartialEq; + + + type IsActiveMember: IsActiveMember; +} + +static MSG_CREATOR_MUST_BE_MEMBER: &str = "Only active members may create content!"; +static MSG_INVALID_SCHEMA_ID: &str = "The metadata schema is not known or invalid!"; +static MSG_METADATA_NOT_FOUND: &str = "Metadata with the given ID cannot be found!"; +static MSG_ONLY_OWNER_MAY_PUBLISH: &str = "Only metadata owners may publish their metadata!"; + +const DEFAULT_FIRST_METADATA_ID: u64 = 1; + +#[derive(Clone, Encode, Decode, PartialEq)] +#[cfg_attr(feature = "std", derive(Debug))] +pub enum MetadataState +{ + Draft, + Published, +} + +impl Default for MetadataState { + fn default() -> Self { + MetadataState::Draft + } +} + +// Content metadata contains two fields: one is the numeric ID of the metadata +// scheme to use, which is currently related to off-chain definitions ONLY. +// The other is the serialized metadata. +#[derive(Clone, Encode, Decode, PartialEq)] +#[cfg_attr(feature = "std", derive(Debug))] +pub struct Metadata { + pub schema: T::SchemaId, + pub metadata: Vec, + pub origin: T::AccountId, + pub state: MetadataState, +} + +decl_event! { + pub enum Event where + ::MetadataId + { + MetadataDraftCreated(MetadataId), + MetadataPublished(MetadataId), + } +} + +decl_storage! { + trait Store for Module as ContentDirectory { + // Start at this value + pub FirstMetadataId get(first_metadata_id) config(first_metadata_id): T::MetadataId = T::MetadataId::sa(DEFAULT_FIRST_METADATA_ID); + + // Increment + pub NextMetadataId get(next_metadata_id) build(|config: &GenesisConfig| config.first_metadata_id): T::MetadataId = T::MetadataId::sa(DEFAULT_FIRST_METADATA_ID); + + // Mapping of Data object types + pub MetadataMap get(metadata): map T::MetadataId => Option>; + } +} + +decl_module! { + pub struct Module for enum Call where origin: T::Origin { + fn deposit_event() = default; + + pub fn add_metadata(origin, schema: T::SchemaId, metadata: Vec) + { + // Origin has to be a member + let who = ensure_signed(origin).clone().unwrap(); + if !T::IsActiveMember::is_active_member(&who) { + return Err(MSG_CREATOR_MUST_BE_MEMBER); + } + + // TODO in future, we want the schema IDs to correspond to a schema + // registry, and validate the data. For now, we just allow the + // following schema IDs: + // 1 - Video (schema TBD, i.e. handled in UI only) + // 2 - Podcast (schema TBD, i.e. handled in UI only) + // Pseudocode + // if schema in (1, 2) { + // return Err(MSG_INVALID_SCHEMA_ID); + // } + + // New and data + let new_id = Self::next_metadata_id(); + let data: Metadata = Metadata { + origin: who.clone(), + schema: schema, + metadata: metadata.clone(), + state: MetadataState::Draft, + }; + + // Store + >::insert(new_id, data); + >::mutate(|n| { *n += T::MetadataId::sa(1); }); + + // Publish event + Self::deposit_event(RawEvent::MetadataDraftCreated(new_id)); + } + + pub fn publish_metadata(origin, id: T::MetadataId) + { + // Ensure signed account + let who = ensure_signed(origin).clone().unwrap(); + + // Try t find metadata + let found = Self::metadata(id); + ensure!(!found.is_some(), MSG_METADATA_NOT_FOUND); + + // Ensure it's the metadata creator who publishes + let mut data = found.unwrap(); + if data.origin != who { + return Err(MSG_ONLY_OWNER_MAY_PUBLISH); + } + + // Modify + data.state = MetadataState::Published; + + // Store + >::insert(id, data); + + // Publish event + Self::deposit_event(RawEvent::MetadataPublished(id)); + } + } +} diff --git a/src/storage/mod.rs b/src/storage/mod.rs index 6bde57da09..693e65e4f1 100644 --- a/src/storage/mod.rs +++ b/src/storage/mod.rs @@ -4,6 +4,7 @@ pub mod data_object_type_registry; pub mod data_directory; pub mod data_object_storage_registry; pub mod downloads; +pub mod content_directory; mod mock; mod tests; From 9b11ce5668e886c47c59eec4bd34290e209e9ffc Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Mon, 1 Apr 2019 22:47:27 +0300 Subject: [PATCH 093/175] adding tests for staked roles --- src/roles/actors.rs | 10 ++-- src/roles/mock.rs | 111 ++++++++++++++++++++++++++++++++++++++++++++ src/roles/mod.rs | 4 +- src/roles/tests.rs | 91 ++++++++++++++++++++++++++++++++++++ 4 files changed, 209 insertions(+), 7 deletions(-) create mode 100644 src/roles/mock.rs create mode 100644 src/roles/tests.rs diff --git a/src/roles/actors.rs b/src/roles/actors.rs index 121d9319d7..3d65d86d82 100644 --- a/src/roles/actors.rs +++ b/src/roles/actors.rs @@ -73,8 +73,8 @@ pub type MemberId = >::Id; pub type Request = (T::AccountId, MemberId, Role, T::BlockNumber); // actor account, memberid, role, expires pub type Requests = Vec>; -const REQUEST_LIFETIME: u64 = 300; -const DEFAULT_REQUEST_CLEARING_INTERVAL: u64 = 100; +pub const REQUEST_LIFETIME: u64 = 300; +pub const DEFAULT_REQUEST_CLEARING_INTERVAL: u64 = 100; decl_storage! { trait Store for Module as Actors { @@ -118,7 +118,7 @@ decl_event! { } impl Module { - fn role_is_available(role: Role) -> bool { + fn is_role_available(role: Role) -> bool { Self::available_roles().into_iter().any(|r| role == r) } @@ -243,7 +243,7 @@ decl_module! { ensure!(T::Members::lookup_member_id(&sender).is_err(), "account is a member"); ensure!(!Self::is_role_account(&sender), "account already used"); - ensure!(Self::role_is_available(role), "inactive role"); + ensure!(Self::is_role_available(role), "inactive role"); let role_parameters = Self::ensure_role_parameters(role)?; @@ -274,7 +274,7 @@ decl_module! { ensure!(!Self::is_role_account(&actor_account), "account already used"); // make sure role is still available - ensure!(Self::role_is_available(role), ""); + ensure!(Self::is_role_available(role), "inactive role"); let role_parameters = Self::ensure_role_parameters(role)?; let accounts_in_role = Self::account_ids_by_role(role); diff --git a/src/roles/mock.rs b/src/roles/mock.rs new file mode 100644 index 0000000000..292e00d6c2 --- /dev/null +++ b/src/roles/mock.rs @@ -0,0 +1,111 @@ +#![cfg(test)] + +use rstd::prelude::*; +pub use crate::governance::{GovernanceCurrency}; +pub use super::actors; +use crate::traits::{Members}; +//pub use crate::membership::members; +pub use system; + +pub use primitives::{H256, Blake2Hasher}; +pub use runtime_primitives::{ + BuildStorage, + traits::{BlakeTwo256, OnFinalise, IdentityLookup}, + testing::{Digest, DigestItem, Header, UintAuthorityId} +}; + +use srml_support::impl_outer_origin; + +impl_outer_origin! { + pub enum Origin for Test {} +} + +// For testing the module, we construct most of a mock runtime. This means +// first constructing a configuration type (`Test`) which `impl`s each of the +// configuration traits of modules we want to use. +#[derive(Clone, Eq, PartialEq, Debug)] +pub struct Test; +impl system::Trait for Test { + type Origin = Origin; + type Index = u64; + type BlockNumber = u64; + type Hash = H256; + type Hashing = BlakeTwo256; + type Digest = Digest; + type AccountId = u64; + type Header = Header; + type Event = (); + type Log = DigestItem; + type Lookup = IdentityLookup; +} +impl timestamp::Trait for Test { + type Moment = u64; + type OnTimestampSet = (); +} +impl consensus::Trait for Test { + type SessionKey = UintAuthorityId; + type InherentOfflineReport = (); + type Log = DigestItem; +} + +impl balances::Trait for Test { + type Event = (); + + /// The balance of an account. + type Balance = u32; + + /// A function which is invoked when the free-balance has fallen below the existential deposit and + /// has been reduced to zero. + /// + /// Gives a chance to clean up resources associated with the given account. + type OnFreeBalanceZero = (); + + /// Handler for when a new account is created. + type OnNewAccount = (); + + /// A function that returns true iff a given account can transfer its funds to another account. + type EnsureAccountLiquid = (); +} + +impl GovernanceCurrency for Test { + type Currency = balances::Module; +} + +pub struct MockMembers {} + +impl MockMembers { + pub fn alice_id() -> u32 {1} + pub fn alice_account() -> u64 {1} + pub fn bob_id() -> u32 {2} + pub fn bob_account() -> u64 {2} +} + +impl Members for MockMembers { + type Id = u32; + fn is_active_member(who: &u64) -> bool { + if *who == Self::alice_account() { return true; } + if *who == Self::bob_account() { return true; } + false + } + fn lookup_member_id(who: &u64) -> Result { + if *who == Self::alice_account() { return Ok(Self::alice_id()); } + if *who == Self::bob_account() { return Ok(Self::bob_id()); } + Err("member not found") + } +} + +impl actors::Trait for Test { + type Event = (); + type Members = MockMembers; +} + +pub fn initial_test_ext() -> runtime_io::TestExternalities { + let t = system::GenesisConfig::::default().build_storage().unwrap().0; + + runtime_io::TestExternalities::new(t) +} + +pub type System = system::Module; +pub type Balances = balances::Module; +pub type Actors = actors::Module; + diff --git a/src/roles/mod.rs b/src/roles/mod.rs index c878c3a215..227653d691 100644 --- a/src/roles/mod.rs +++ b/src/roles/mod.rs @@ -2,5 +2,5 @@ pub mod actors; -//mod mock; -//mod tests; \ No newline at end of file +mod mock; +mod tests; \ No newline at end of file diff --git a/src/roles/tests.rs b/src/roles/tests.rs new file mode 100644 index 0000000000..9e0f323227 --- /dev/null +++ b/src/roles/tests.rs @@ -0,0 +1,91 @@ +#![cfg(test)] + +use super::*; +use super::mock::*; + +use parity_codec::Encode; +use runtime_io::with_externalities; +use srml_support::*; + +// fn assert_ok_unwrap(value: Option, err: &'static str) -> T { +// match value { +// None => { assert!(false, err); value.unwrap() }, +// Some(v) => v +// } +// } + +fn init_storage_role() { + let roles: Vec = vec![actors::Role::Storage]; + assert!(Actors::set_available_roles(roles).is_ok(), ""); +} + +fn init_storage_parmeters() -> actors::RoleParameters { + let params = actors::RoleParameters { + // minium balance required to stake to enter a role + min_stake: 100 as u32, + min_actors: 1 as u32, + max_actors: 2 as u32, + reward: 100 as u32, + reward_period: 100 as u64, + bonding_period: 100 as u64, + unbonding_period: 100 as u64, + min_service_period: 100 as u64, + startup_grace_period: 100 as u64, + entry_request_fee: 10 as u32, + }; + assert!(Actors::set_role_parameters(actors::Role::Storage, params.clone()).is_ok(), ""); + params +} + +#[test] +fn adding_roles() { + with_externalities(&mut initial_test_ext(), || { + init_storage_role(); + assert_eq!(Actors::available_roles(), vec![actors::Role::Storage]); + }); +} + +#[test] +fn adding_role_parameters() { + with_externalities(&mut initial_test_ext(), || { + init_storage_role(); + let params = init_storage_parmeters(); + assert_eq!(Actors::parameters(actors::Role::Storage), Some(params)); + }); +} + +#[test] +fn make_entry_request() { + with_externalities(&mut initial_test_ext(), || { + init_storage_role(); + let storageParams = init_storage_parmeters(); + + let actor_account = 5 as u64; + + let starting_block = 1; + System::set_block_number(starting_block); + + let requests = Actors::role_entry_requests(); + assert_eq!(requests.len(), 0); + + assert!(Actors::role_entry_request( + Origin::signed(actor_account), actors::Role::Storage, MockMembers::alice_id()).is_err(), ""); + + let surplus_balance = 100; + Balances::set_free_balance(&actor_account, storageParams.entry_request_fee + surplus_balance); + + assert!(Actors::role_entry_request( + Origin::signed(actor_account), actors::Role::Storage, MockMembers::alice_id()).is_ok(), ""); + + assert_eq!(Balances::free_balance(&actor_account), surplus_balance); + + let requests = Actors::role_entry_requests(); + assert_eq!(requests.len(), 1); + let request = requests[0]; + assert_eq!(request.0, actor_account); + assert_eq!(request.1, MockMembers::alice_id()); + assert_eq!(request.2, actors::Role::Storage); + assert_eq!(request.3, starting_block + actors::REQUEST_LIFETIME); + }); +} + From 18fae5ec3d2760bdef0ae8b12602db2822d22f5a Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Mon, 1 Apr 2019 23:35:13 +0300 Subject: [PATCH 094/175] pay reward to member account --- src/governance/mock.rs | 3 +++ src/governance/proposals.rs | 3 +++ src/membership/members.rs | 11 +++++++++-- src/roles/actors.rs | 5 ++++- src/roles/mock.rs | 5 +++++ src/traits.rs | 5 +++++ 6 files changed, 29 insertions(+), 3 deletions(-) diff --git a/src/governance/mock.rs b/src/governance/mock.rs index 8cd1a604f2..183b5f3546 100644 --- a/src/governance/mock.rs +++ b/src/governance/mock.rs @@ -30,6 +30,9 @@ impl Members for MockMembership { fn lookup_member_id(account_id: &T::AccountId) -> Result { Err("not implemented!") } + fn lookup_account_by_member_id(id: Self::Id) -> Result { + Err("not implemented!") + } } // For testing the module, we construct most of a mock runtime. This means diff --git a/src/governance/proposals.rs b/src/governance/proposals.rs index de3a69b93f..18b80fa53b 100644 --- a/src/governance/proposals.rs +++ b/src/governance/proposals.rs @@ -630,6 +630,9 @@ mod tests { fn lookup_member_id(account_id: &T::AccountId) -> Result { Err("not implemented!") } + fn lookup_account_by_member_id(id: Self::Id) -> Result { + Err("not implemented!") + } } type System = system::Module; diff --git a/src/membership/members.rs b/src/membership/members.rs index a87b3a61cd..9ac1c9a4b0 100644 --- a/src/membership/members.rs +++ b/src/membership/members.rs @@ -188,8 +188,15 @@ impl Members for Module { } fn lookup_member_id(who: &T::AccountId) -> Result { - let id = Self::ensure_is_member(who)?; - Ok(id) + Self::ensure_is_member(who) + } + + fn lookup_account_by_member_id(id: Self::Id) -> Result { + if >::exists(&id) { + Ok(Self::account_id_by_member_id(&id)) + } else { + Err("member id doesn't exist") + } } } diff --git a/src/roles/actors.rs b/src/roles/actors.rs index 3d65d86d82..33cabfb1ab 100644 --- a/src/roles/actors.rs +++ b/src/roles/actors.rs @@ -199,7 +199,10 @@ decl_module! { for actor in accounts.into_iter().map(|account| Self::actor_by_account_id(account)) { if let Some(actor) = actor { if now > actor.joined_at + params.reward_period { - T::Currency::reward(&actor.account, params.reward); + // send reward to member account - not the actor account + if let Ok(member_account) = T::Members::lookup_account_by_member_id(actor.member_id) { + T::Currency::reward(&member_account, params.reward); + } } } } diff --git a/src/roles/mock.rs b/src/roles/mock.rs index 292e00d6c2..2b33f3eb3a 100644 --- a/src/roles/mock.rs +++ b/src/roles/mock.rs @@ -92,6 +92,11 @@ impl Members for MockMembers { if *who == Self::bob_account() { return Ok(Self::bob_id()); } Err("member not found") } + fn lookup_account_by_member_id(id: Self::Id) -> Result { + if id == Self::alice_id() { return Ok(Self::alice_account()); } + if id == Self::bob_id() { return Ok(Self::bob_account()); } + Err("account not found") + } } impl actors::Trait for Test { diff --git a/src/traits.rs b/src/traits.rs index b118c3b78d..7c55437424 100644 --- a/src/traits.rs +++ b/src/traits.rs @@ -14,6 +14,8 @@ pub trait Members { fn is_active_member(account_id: &T::AccountId) -> bool; fn lookup_member_id(account_id: &T::AccountId) -> Result; + + fn lookup_account_by_member_id(member_id: Self::Id) -> Result; } impl Members for () { @@ -24,6 +26,9 @@ impl Members for () { fn lookup_member_id(account_id: &T::AccountId) -> Result { Err("member not found") } + fn lookup_account_by_member_id(member_id: Self::Id) -> Result { + Err("account not found") + } } // Roles From c7940af80ae1b0b78c6908604eebfdd63bf437a0 Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Tue, 2 Apr 2019 00:56:14 +0300 Subject: [PATCH 095/175] tests: staked roles --- src/roles/actors.rs | 31 +++++++++------- src/roles/tests.rs | 86 +++++++++++++++++++++++++++++++++++++++------ 2 files changed, 94 insertions(+), 23 deletions(-) diff --git a/src/roles/actors.rs b/src/roles/actors.rs index 33cabfb1ab..8b5bce69c1 100644 --- a/src/roles/actors.rs +++ b/src/roles/actors.rs @@ -56,11 +56,10 @@ pub struct RoleParameters { #[derive(Encode, Decode, Clone)] pub struct Actor { - member_id: MemberId, - role: Role, - account: T::AccountId, - joined_at: T::BlockNumber, - // startup_grace_period_ends_at: T::BlockNumber, + pub member_id: MemberId, + pub role: Role, + pub account: T::AccountId, + pub joined_at: T::BlockNumber, } pub trait Trait: system::Trait + GovernanceCurrency + MaybeDebug { @@ -79,25 +78,25 @@ pub const DEFAULT_REQUEST_CLEARING_INTERVAL: u64 = 100; decl_storage! { trait Store for Module as Actors { /// requirements to enter and maintain status in roles - Parameters get(parameters) : map Role => Option>; + pub Parameters get(parameters) : map Role => Option>; /// the roles members can enter into - AvailableRoles get(available_roles) : Vec; + pub AvailableRoles get(available_roles) : Vec; /// Actors list - ActorAccountIds get(actor_account_ids) : Vec; + pub ActorAccountIds get(actor_account_ids) : Vec; /// actor accounts mapped to their actor - ActorByAccountId get(actor_by_account_id) : map T::AccountId => Option>; + pub ActorByAccountId get(actor_by_account_id) : map T::AccountId => Option>; /// actor accounts associated with a role - AccountIdsByRole get(account_ids_by_role) : map Role => Vec; + pub AccountIdsByRole get(account_ids_by_role) : map Role => Vec; /// actor accounts associated with a member id - AccountIdsByMemberId get(account_ids_by_member_id) : map MemberId => Vec; + pub AccountIdsByMemberId get(account_ids_by_member_id) : map MemberId => Vec; /// tokens locked until given block number - Bondage get(bondage) : map T::AccountId => T::BlockNumber; + pub Bondage get(bondage) : map T::AccountId => T::BlockNumber; /// First step before enter a role is registering intent with a new account/key. /// This is done by sending a role_entry_request() from the new account. @@ -106,7 +105,7 @@ decl_storage! { /// sufficient balance to cover the minimum stake for the role. /// Bonding only occurs after successful entry into a role. /// The request expires after REQUEST_LIFETIME blocks - RoleEntryRequests get(role_entry_requests) : Requests; + pub RoleEntryRequests get(role_entry_requests) : Requests; } } @@ -156,6 +155,12 @@ impl Module { .collect(); >::insert(&member_id, accounts); + let accounts: Vec = Self::actor_account_ids() + .into_iter() + .filter(|account| !(*account == actor_account)) + .collect(); + >::put(accounts); + >::remove(&actor_account); } diff --git a/src/roles/tests.rs b/src/roles/tests.rs index 9e0f323227..e043004f1f 100644 --- a/src/roles/tests.rs +++ b/src/roles/tests.rs @@ -3,17 +3,9 @@ use super::*; use super::mock::*; -use parity_codec::Encode; use runtime_io::with_externalities; use srml_support::*; -// fn assert_ok_unwrap(value: Option, err: &'static str) -> T { -// match value { -// None => { assert!(false, err); value.unwrap() }, -// Some(v) => v -// } -// } - fn init_storage_role() { let roles: Vec = vec![actors::Role::Storage]; assert!(Actors::set_available_roles(roles).is_ok(), ""); @@ -58,7 +50,7 @@ fn adding_role_parameters() { fn make_entry_request() { with_externalities(&mut initial_test_ext(), || { init_storage_role(); - let storageParams = init_storage_parmeters(); + let storage_params = init_storage_parmeters(); let actor_account = 5 as u64; @@ -72,7 +64,7 @@ fn make_entry_request() { Origin::signed(actor_account), actors::Role::Storage, MockMembers::alice_id()).is_err(), ""); let surplus_balance = 100; - Balances::set_free_balance(&actor_account, storageParams.entry_request_fee + surplus_balance); + Balances::set_free_balance(&actor_account, storage_params.entry_request_fee + surplus_balance); assert!(Actors::role_entry_request( Origin::signed(actor_account), actors::Role::Storage, MockMembers::alice_id()).is_ok(), ""); @@ -89,3 +81,77 @@ fn make_entry_request() { }); } +#[test] +fn staking() { + with_externalities(&mut initial_test_ext(), || { + init_storage_role(); + let storage_params = init_storage_parmeters(); + let actor_account = 5; + + let request: actors::Request = (actor_account, MockMembers::alice_id(), actors::Role::Storage, 1000); + + >::put(vec![request]); + + Balances::set_free_balance(&actor_account, storage_params.min_stake); + + assert!(Actors::stake( + Origin::signed(MockMembers::alice_account()), + actors::Role::Storage, + actor_account).is_ok()); + + let ids = Actors::actor_account_ids(); + assert_eq!(ids, vec![actor_account]); + + let actor = Actors::actor_by_account_id(actor_account); + assert!(actor.is_some()); + + let accounts_in_role = Actors::account_ids_by_role(actors::Role::Storage); + assert_eq!(accounts_in_role, vec![actor_account]); + + let account_ids_for_member = Actors::account_ids_by_member_id(MockMembers::alice_id()); + assert_eq!(account_ids_for_member, vec![actor_account]); + + assert!(>::exists(actor_account)); + }); +} + +#[test] +fn unstaking() { + with_externalities(&mut initial_test_ext(), || { + init_storage_role(); + let storage_params = init_storage_parmeters(); + let actor_account = 5; + + assert!(Actors::unstake(Origin::signed(MockMembers::alice_account()), actor_account).is_err()); + + let actor: actors::Actor = actors::Actor { + role: actors::Role::Storage, + member_id: MockMembers::alice_id(), + account: actor_account, + joined_at: 1, + }; + >::put(vec![actor_account]); + >::insert(&actor_account, actor); + >::insert(actors::Role::Storage, vec![actor_account]); + >::insert(MockMembers::alice_id(), vec![actor_account]); + >::insert(&actor_account, 10000); + let current_block = 500; + + System::set_block_number(current_block); + assert!(Actors::unstake(Origin::signed(MockMembers::alice_account()), actor_account).is_ok()); + + assert_eq!(Actors::actor_account_ids().len(), 0); + + let actor = Actors::actor_by_account_id(actor_account); + assert!(actor.is_none()); + + let accounts_in_role = Actors::account_ids_by_role(actors::Role::Storage); + assert_eq!(accounts_in_role.len(), 0); + + let account_ids_for_member = Actors::account_ids_by_member_id(MockMembers::alice_id()); + assert_eq!(account_ids_for_member.len(), 0); + + assert!(>::exists(actor_account)); + assert_eq!(Actors::bondage(actor_account), current_block + storage_params.unbonding_period); + }); +} \ No newline at end of file From 6c5deff11640007fbafdc661fa726dbb98eb9e83 Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Tue, 2 Apr 2019 01:10:03 +0300 Subject: [PATCH 096/175] add EntryRequested and Unstaked events --- src/roles/actors.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/roles/actors.rs b/src/roles/actors.rs index 8b5bce69c1..2e8f9e8305 100644 --- a/src/roles/actors.rs +++ b/src/roles/actors.rs @@ -112,7 +112,9 @@ decl_storage! { decl_event! { pub enum Event where ::AccountId { + EntryRequested(AccountId, Role), Staked(AccountId, Role), + Unstaked(AccountId, Role), } } @@ -262,8 +264,9 @@ decl_module! { >::mutate(|requests| { let expires = >::block_number()+ T::BlockNumber::sa(REQUEST_LIFETIME); - requests.push((sender, member_id, role, expires)); + requests.push((sender.clone(), member_id, role, expires)); }); + Self::deposit_event(RawEvent::EntryRequested(sender, role)); } /// Member activating entry request @@ -321,7 +324,9 @@ decl_module! { let role_parameters = Self::ensure_role_parameters(actor.role)?; - Self::apply_unstake(actor.account, actor.role, actor.member_id, role_parameters.unbonding_period); + Self::apply_unstake(actor.account.clone(), actor.role, actor.member_id, role_parameters.unbonding_period); + + Self::deposit_event(RawEvent::Unstaked(actor.account, actor.role)); } pub fn set_role_parameters(role: Role, params: RoleParameters) { From 710267fa379f2859cdc5d2dd7fb123b28ea40fbc Mon Sep 17 00:00:00 2001 From: Alex Siman Date: Tue, 2 Apr 2019 09:08:45 +0200 Subject: [PATCH 097/175] Update src/storage/data_directory.rs Co-Authored-By: jfinkhaeuser --- src/storage/data_directory.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/storage/data_directory.rs b/src/storage/data_directory.rs index 809adfa5cb..fe0e1b7911 100644 --- a/src/storage/data_directory.rs +++ b/src/storage/data_directory.rs @@ -47,7 +47,7 @@ pub struct DataObject { pub size: u64, pub added_at_block: T::BlockNumber, pub added_at_time: T::Moment, - pub origin: T::AccountId, + pub owner: T::AccountId, pub liaison: T::AccountId, pub liaison_judgement: LiaisonJudgement, } From 3f462b5f8bfe9b2429e3d8628bfab718f8055f9b Mon Sep 17 00:00:00 2001 From: Alex Siman Date: Tue, 2 Apr 2019 09:08:56 +0200 Subject: [PATCH 098/175] Update src/storage/data_directory.rs Co-Authored-By: jfinkhaeuser --- src/storage/data_directory.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/storage/data_directory.rs b/src/storage/data_directory.rs index fe0e1b7911..7697079ba9 100644 --- a/src/storage/data_directory.rs +++ b/src/storage/data_directory.rs @@ -55,7 +55,7 @@ pub struct DataObject { decl_storage! { trait Store for Module as DataDirectory { // Mapping of Content ID to Data Object - pub ContentMap get(content): map T::ContentId => Option>; + pub Contents get(contents): map T::ContentId => Option>; } } From 9dadcdcd4cc70c4f551effb5ad4c24cac2d7a644 Mon Sep 17 00:00:00 2001 From: Alex Siman Date: Tue, 2 Apr 2019 09:10:34 +0200 Subject: [PATCH 099/175] Update src/storage/downloads.rs Co-Authored-By: jfinkhaeuser --- src/storage/downloads.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/storage/downloads.rs b/src/storage/downloads.rs index d04cdc84c6..adf3f28b4d 100644 --- a/src/storage/downloads.rs +++ b/src/storage/downloads.rs @@ -126,7 +126,7 @@ decl_module! { let mut session = found.unwrap(); // Ensure that the session hasn't ended yet. - if session.state != DownloadState::Started { + ensure!(session.state == DownloadState::Started, MSG_SESSION_HAS_ENDED); return Err(MSG_SESSION_HAS_ENDED); } From 19ded2f9801de722e2269f64864f717d22a00c1e Mon Sep 17 00:00:00 2001 From: Alex Siman Date: Tue, 2 Apr 2019 09:10:47 +0200 Subject: [PATCH 100/175] Update src/storage/downloads.rs Co-Authored-By: jfinkhaeuser --- src/storage/downloads.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/storage/downloads.rs b/src/storage/downloads.rs index adf3f28b4d..ca2350274a 100644 --- a/src/storage/downloads.rs +++ b/src/storage/downloads.rs @@ -131,7 +131,7 @@ decl_module! { } // Ensure that the origin is the consumer - if session.consumer != who { + ensure!(session.consumer == who, MSG_CONSUMER_REQUIRED); return Err(MSG_CONSUMER_REQUIRED); } From a981199a3e672969d318975beec4f4daa6de5df2 Mon Sep 17 00:00:00 2001 From: Alex Siman Date: Tue, 2 Apr 2019 09:11:46 +0200 Subject: [PATCH 101/175] Update src/storage/downloads.rs Co-Authored-By: jfinkhaeuser --- src/storage/downloads.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/storage/downloads.rs b/src/storage/downloads.rs index ca2350274a..4b04649180 100644 --- a/src/storage/downloads.rs +++ b/src/storage/downloads.rs @@ -136,7 +136,7 @@ decl_module! { } // Ensure that the new transmitted size is larger than the old one - if transmitted <= session.transmitted { + ensure!(transmitted > session.transmitted, MSG_INVALID_TRANSMITTED_VALUE); return Err(MSG_INVALID_TRANSMITTED_VALUE); } From 588c8a36f86c03396e31b84dfaf6cc0d31662ee0 Mon Sep 17 00:00:00 2001 From: Alex Siman Date: Tue, 2 Apr 2019 09:17:57 +0200 Subject: [PATCH 102/175] Update src/storage/downloads.rs Co-Authored-By: jfinkhaeuser --- src/storage/downloads.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/storage/downloads.rs b/src/storage/downloads.rs index 4b04649180..c6443fd5e0 100644 --- a/src/storage/downloads.rs +++ b/src/storage/downloads.rs @@ -44,7 +44,7 @@ impl Default for DownloadState { #[derive(Clone, Encode, Decode, PartialEq)] #[cfg_attr(feature = "std", derive(Debug))] pub struct DownloadSession { - pub cid: ::ContentId, + pub content_id: ::ContentId, pub consumer: T::AccountId, pub distributor: T::AccountId, pub initiated_at_block: T::BlockNumber, From e126cb1b466394f81d48afc966516bcc78ebd11f Mon Sep 17 00:00:00 2001 From: Alex Siman Date: Tue, 2 Apr 2019 09:18:12 +0200 Subject: [PATCH 103/175] Update src/storage/downloads.rs Co-Authored-By: jfinkhaeuser --- src/storage/downloads.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/storage/downloads.rs b/src/storage/downloads.rs index c6443fd5e0..a55766e875 100644 --- a/src/storage/downloads.rs +++ b/src/storage/downloads.rs @@ -50,7 +50,7 @@ pub struct DownloadSession { pub initiated_at_block: T::BlockNumber, pub initiated_at_time: T::Moment, pub state: DownloadState, - pub transmitted: u64, + pub transmitted_bytes: u64, } decl_storage! { From efb3e9df8aede57c5af87cab5ba25a8a6ad5c843 Mon Sep 17 00:00:00 2001 From: Alex Siman Date: Tue, 2 Apr 2019 09:18:27 +0200 Subject: [PATCH 104/175] Update src/storage/downloads.rs Co-Authored-By: jfinkhaeuser --- src/storage/downloads.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/storage/downloads.rs b/src/storage/downloads.rs index a55766e875..232a5aadb5 100644 --- a/src/storage/downloads.rs +++ b/src/storage/downloads.rs @@ -62,7 +62,7 @@ decl_storage! { pub NextDownloadSessionId get(next_download_session_id) build(|config: &GenesisConfig| config.first_download_session_id): T::DownloadSessionId = T::DownloadSessionId::sa(DEFAULT_FIRST_DOWNLOAD_SESSION_ID); // Mapping of Data object types - pub DownloadSessionMap get(download_session): map T::DownloadSessionId => Option>; + pub DownloadSessions get(download_sessions): map T::DownloadSessionId => Option>; } } From 060c9f3ff99c9432db174ed790d81208932b73a0 Mon Sep 17 00:00:00 2001 From: Jens Finkhaeuser Date: Tue, 2 Apr 2019 09:34:20 +0200 Subject: [PATCH 105/175] Follow-on fixes from review suggestions --- src/storage/data_directory.rs | 14 ++++++------ src/storage/downloads.rs | 43 +++++++++++++++-------------------- 2 files changed, 25 insertions(+), 32 deletions(-) diff --git a/src/storage/data_directory.rs b/src/storage/data_directory.rs index 7697079ba9..59c8408331 100644 --- a/src/storage/data_directory.rs +++ b/src/storage/data_directory.rs @@ -73,11 +73,11 @@ decl_event! { impl ContentIdExists for Module { fn has_content(which: &T::ContentId) -> bool { - Self::content(which.clone()).is_some() + Self::contents(which.clone()).is_some() } fn get_data_object(which: &T::ContentId) -> Result, &'static str> { - match Self::content(which.clone()) { + match Self::contents(which.clone()) { None => Err(MSG_CID_NOT_FOUND), Some(data) => Ok(data), } @@ -103,7 +103,7 @@ decl_module! { // We essentially accept the content ID and size at face value. All we // need to know is that it doesn't yet exist. - let found = Self::content(&id); + let found = Self::contents(&id); ensure!(found.is_none(), MSG_DUPLICATE_CID); // The liaison is something we need to take from staked roles. The idea @@ -118,13 +118,13 @@ decl_module! { size: size, added_at_block: >::block_number(), added_at_time: >::now(), - origin: who, + owner: who, liaison: liaison.clone(), liaison_judgement: LiaisonJudgement::Pending, }; // If we've constructed the data, we can store it and send an event. - >::insert(id.clone(), data); + >::insert(id.clone(), data); Self::deposit_event(RawEvent::ContentAdded(id, liaison)); } @@ -149,7 +149,7 @@ impl Module { let who = ensure_signed(origin); // Find the data - let found = Self::content(&id).ok_or(MSG_CID_NOT_FOUND); + let found = Self::contents(&id).ok_or(MSG_CID_NOT_FOUND); // Make sure the liaison matches let mut data = found.unwrap(); @@ -161,7 +161,7 @@ impl Module { data.liaison_judgement = judgement; // Update and send event. - >::insert(id, data); + >::insert(id, data); Ok(()) } diff --git a/src/storage/downloads.rs b/src/storage/downloads.rs index 232a5aadb5..1bfbe3cc81 100644 --- a/src/storage/downloads.rs +++ b/src/storage/downloads.rs @@ -3,7 +3,7 @@ use rstd::prelude::*; use parity_codec::Codec; use parity_codec_derive::{Encode, Decode}; -use srml_support::{StorageMap, StorageValue, decl_module, decl_storage, decl_event, Parameter}; +use srml_support::{StorageMap, StorageValue, decl_module, decl_storage, decl_event, Parameter, ensure}; use runtime_primitives::traits::{SimpleArithmetic, As, Member, MaybeSerializeDebug}; use system::{self, ensure_signed}; use crate::traits::{ContentIdExists, ContentHasStorage}; @@ -86,81 +86,74 @@ decl_module! { // Origin starts a download from distributor. It's the origin's responsibility to // start this, and hand the session ID to the distributor as proof they did. - pub fn start_download(origin, cid: ::ContentId, from: T::AccountId) { + pub fn start_download(origin, content_id: ::ContentId, from: T::AccountId) { // Origin can be anyone, it doesn't have to be a member. let who = ensure_signed(origin).clone().unwrap(); // There has to be a storage relationship for the content ID and storage provider. - if !T::ContentHasStorage::is_ready_at_storage_provider(&cid, &from) { + if !T::ContentHasStorage::is_ready_at_storage_provider(&content_id, &from) { return Err("NOPETYNOPE"); } // Let's create the entry then let new_id = Self::next_download_session_id(); let session: DownloadSession = DownloadSession { - cid: cid.clone(), + content_id: content_id.clone(), consumer: who, distributor: from.clone(), initiated_at_block: >::block_number(), initiated_at_time: >::now(), state: DownloadState::Started, - transmitted: 0u64, + transmitted_bytes: 0u64, }; - >::insert(new_id, session); + >::insert(new_id, session); >::mutate(|n| { *n += T::DownloadSessionId::sa(1); }); // Fire off event - Self::deposit_event(RawEvent::DownloadStarted(cid)); + Self::deposit_event(RawEvent::DownloadStarted(content_id)); } // The downloader can also update the transmitted size, as long as it's // strictly larger. - pub fn update_transmitted(origin, session_id: T::DownloadSessionId, transmitted: u64) + pub fn update_transmitted(origin, session_id: T::DownloadSessionId, transmitted_bytes: u64) { // Origin can be anyone, it doesn't have to be a member. let who = ensure_signed(origin).clone().unwrap(); // Get session - let found = Self::download_session(session_id).ok_or(MSG_SESSION_NOT_FOUND); + let found = Self::download_sessions(session_id).ok_or(MSG_SESSION_NOT_FOUND); let mut session = found.unwrap(); // Ensure that the session hasn't ended yet. ensure!(session.state == DownloadState::Started, MSG_SESSION_HAS_ENDED); - return Err(MSG_SESSION_HAS_ENDED); - } // Ensure that the origin is the consumer ensure!(session.consumer == who, MSG_CONSUMER_REQUIRED); - return Err(MSG_CONSUMER_REQUIRED); - } // Ensure that the new transmitted size is larger than the old one - ensure!(transmitted > session.transmitted, MSG_INVALID_TRANSMITTED_VALUE); - return Err(MSG_INVALID_TRANSMITTED_VALUE); - } + ensure!(transmitted_bytes > session.transmitted_bytes, MSG_INVALID_TRANSMITTED_VALUE); // By fetching the content information, we can ensure that the transmitted // field also does not exceed the content size. Furthermore, we can // automatically detect when the download ended. - let data_object = T::ContentIdExists::get_data_object(&session.cid)?; - if transmitted > data_object.size { - return Err(MSG_INVALID_TRANSMITTED_VALUE); - } - let finished = transmitted == data_object.size; + let data_object = T::ContentIdExists::get_data_object(&session.content_id)?; + ensure!(transmitted_bytes <= data_object.size, MSG_INVALID_TRANSMITTED_VALUE); + + let finished = transmitted_bytes == data_object.size; // Ok we can update the data. - session.transmitted = transmitted; + session.transmitted_bytes = transmitted_bytes; session.state = match finished { true => DownloadState::Ended, false => DownloadState::Started, }; - let cid = session.cid.clone(); - >::insert(session_id, session); + let content_id = session.content_id.clone(); + >::insert(session_id, session); // Also announce if the download finished if finished { - Self::deposit_event(RawEvent::DownloadEnded(cid, transmitted)); + Self::deposit_event(RawEvent::DownloadEnded(content_id, transmitted_bytes)); } } } From d28e455d3d9732893fb19568ca99a6dc7242b2a8 Mon Sep 17 00:00:00 2001 From: Jens Finkhaeuser Date: Tue, 2 Apr 2019 09:35:42 +0200 Subject: [PATCH 106/175] Fix typo --- src/storage/data_directory.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/storage/data_directory.rs b/src/storage/data_directory.rs index 59c8408331..dcbe49176a 100644 --- a/src/storage/data_directory.rs +++ b/src/storage/data_directory.rs @@ -23,7 +23,7 @@ static MSG_DUPLICATE_CID: &str = "Content with this ID already exists!"; static MSG_CID_NOT_FOUND: &str = "Content with this ID not found!"; static MSG_LIAISON_REQUIRED: &str = "Only the liaison for the content may modify its status!"; static MSG_CREATOR_MUST_BE_MEMBER: &str = "Only active members may create content!"; -static MSG_DO_TYPE_MUST_BE_ACTIVE: &str = "Cannot create content for inactive of missing data object type!"; +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))] From 4fd1bf9755e65efc6848bae2aebb8d68c45ed654 Mon Sep 17 00:00:00 2001 From: Jens Finkhaeuser Date: Tue, 2 Apr 2019 09:46:26 +0200 Subject: [PATCH 107/175] Implement more review suggestions and fix some warnings --- src/storage/data_directory.rs | 20 ++++++-------------- src/storage/data_object_storage_registry.rs | 14 +++++--------- src/storage/data_object_type_registry.rs | 2 -- src/storage/downloads.rs | 9 ++++----- 4 files changed, 15 insertions(+), 30 deletions(-) diff --git a/src/storage/data_directory.rs b/src/storage/data_directory.rs index dcbe49176a..d9b447a6b0 100644 --- a/src/storage/data_directory.rs +++ b/src/storage/data_directory.rs @@ -91,15 +91,11 @@ decl_module! { pub fn add_content(origin, data_object_type_id: ::DataObjectTypeId, id: T::ContentId, size: u64) { // Origin has to be a member - let who = ensure_signed(origin).clone().unwrap(); - if !T::IsActiveMember::is_active_member(&who) { - return Err(MSG_CREATOR_MUST_BE_MEMBER); - } + let who = ensure_signed(origin)?; + ensure!(T::IsActiveMember::is_active_member(&who), MSG_CREATOR_MUST_BE_MEMBER); // Data object type has to be active - if !T::IsActiveDataObjectType::is_active_data_object_type(&data_object_type_id) { - return Err(MSG_DO_TYPE_MUST_BE_ACTIVE); - } + ensure!(T::IsActiveDataObjectType::is_active_data_object_type(&data_object_type_id), MSG_DO_TYPE_MUST_BE_ACTIVE); // We essentially accept the content ID and size at face value. All we // need to know is that it doesn't yet exist. @@ -153,9 +149,7 @@ impl Module { // Make sure the liaison matches let mut data = found.unwrap(); - if data.liaison != who.unwrap() { - return Err(MSG_LIAISON_REQUIRED); - } + ensure!(data.liaison == who.unwrap(), MSG_LIAISON_REQUIRED); // At this point we can update the data. data.liaison_judgement = judgement; @@ -172,8 +166,6 @@ mod tests { use super::*; use crate::storage::mock::*; - use runtime_io::with_externalities; - use srml_support::*; use system::{self, Phase, EventRecord}; #[test] @@ -239,7 +231,7 @@ mod tests { // An appropriate event should have been fired. let liaison = *match &System::events().last().unwrap().event { - MetaEvent::data_directory(data_directory::RawEvent::ContentAdded(content_id, liaison)) => liaison, + MetaEvent::data_directory(data_directory::RawEvent::ContentAdded(_content_id, liaison)) => liaison, _ => &0xdeadbeefu64, // invalid value, unlikely to match }; assert_ne!(liaison, 0xdeadbeefu64); @@ -265,7 +257,7 @@ mod tests { // An appropriate event should have been fired. let liaison = *match &System::events().last().unwrap().event { - MetaEvent::data_directory(data_directory::RawEvent::ContentAdded(content_id, liaison)) => liaison, + MetaEvent::data_directory(data_directory::RawEvent::ContentAdded(_content_id, liaison)) => liaison, _ => &0xdeadbeefu64, // invalid value, unlikely to match }; assert_ne!(liaison, 0xdeadbeefu64); diff --git a/src/storage/data_object_storage_registry.rs b/src/storage/data_object_storage_registry.rs index f638eb3f34..0a55ab18e8 100644 --- a/src/storage/data_object_storage_registry.rs +++ b/src/storage/data_object_storage_registry.rs @@ -3,7 +3,7 @@ use rstd::prelude::*; use parity_codec::Codec; use parity_codec_derive::{Encode, Decode}; -use srml_support::{StorageMap, StorageValue, decl_module, decl_storage, decl_event, Parameter, dispatch}; +use srml_support::{StorageMap, StorageValue, decl_module, decl_storage, decl_event, Parameter, dispatch, ensure}; use runtime_primitives::traits::{SimpleArithmetic, As, Member, MaybeSerializeDebug, MaybeDebug}; use system::{self, ensure_signed}; use crate::traits::{IsActiveMember, ContentIdExists, ContentHasStorage}; @@ -83,16 +83,14 @@ decl_module! { pub fn add_data_object_storage_relationship(origin, cid: T::ContentId) { // Origin has to be a storage provider - let who = ensure_signed(origin).clone().unwrap(); + let who = ensure_signed(origin)?; // TODO check for being staked as a storage provider // if !T::IsActiveMember::is_active_member(&who) { // return Err(MSG_CREATOR_MUST_BE_MEMBER); // } // Content ID must exist - if !T::ContentIdExists::has_content(&cid) { - return Err(MSG_CID_NOT_FOUND); - } + ensure!(T::ContentIdExists::has_content(&cid), MSG_CID_NOT_FOUND); // Create new ID, data. let new_id = Self::next_data_object_storage_relationship_id(); @@ -129,14 +127,12 @@ impl Module { fn toggle_dosr_ready(origin: T::Origin, id: T::DataObjectStorageRelationshipId, ready: bool) -> dispatch::Result { // Origin has to be the storage provider mentioned in the DOSR - let who = ensure_signed(origin).clone().unwrap(); + let who = ensure_signed(origin)?; // For that, we need to fetch the identified DOSR let found = Self::data_object_storage_relationship(id).ok_or(MSG_DOSR_NOT_FOUND); let mut dosr = found.unwrap(); - if dosr.storage_provider != who { - return Err(MSG_ONLY_STORAGE_PROVIDER_MAY_CLAIM_READY); - } + ensure!(dosr.storage_provider == who, MSG_ONLY_STORAGE_PROVIDER_MAY_CLAIM_READY); // Flip to ready dosr.ready = ready; diff --git a/src/storage/data_object_type_registry.rs b/src/storage/data_object_type_registry.rs index 108e6a9934..dbd1e1a6ca 100644 --- a/src/storage/data_object_type_registry.rs +++ b/src/storage/data_object_type_registry.rs @@ -143,8 +143,6 @@ mod tests { use super::*; use crate::storage::mock::*; - use runtime_io::with_externalities; - use srml_support::*; use system::{self, Phase, EventRecord}; #[test] diff --git a/src/storage/downloads.rs b/src/storage/downloads.rs index 1bfbe3cc81..33e32e6e97 100644 --- a/src/storage/downloads.rs +++ b/src/storage/downloads.rs @@ -23,6 +23,7 @@ static MSG_SESSION_NOT_FOUND: &str = "Download session with the given ID not fou static MSG_SESSION_HAS_ENDED: &str = "Download session with the given ID has already ended."; static MSG_CONSUMER_REQUIRED: &str = "Download session can only be modified by the downloader"; static MSG_INVALID_TRANSMITTED_VALUE: &str = "Invalid update to transmitted bytes value"; +static MSG_NEED_STORAGE_PROVIDER: &str = "Cannnot download without at least one active storage relationship!"; const DEFAULT_FIRST_DOWNLOAD_SESSION_ID: u64 = 1; @@ -88,12 +89,10 @@ decl_module! { // start this, and hand the session ID to the distributor as proof they did. pub fn start_download(origin, content_id: ::ContentId, from: T::AccountId) { // Origin can be anyone, it doesn't have to be a member. - let who = ensure_signed(origin).clone().unwrap(); + let who = ensure_signed(origin)?; // There has to be a storage relationship for the content ID and storage provider. - if !T::ContentHasStorage::is_ready_at_storage_provider(&content_id, &from) { - return Err("NOPETYNOPE"); - } + ensure!(T::ContentHasStorage::is_ready_at_storage_provider(&content_id, &from), MSG_NEED_STORAGE_PROVIDER); // Let's create the entry then let new_id = Self::next_download_session_id(); @@ -119,7 +118,7 @@ decl_module! { pub fn update_transmitted(origin, session_id: T::DownloadSessionId, transmitted_bytes: u64) { // Origin can be anyone, it doesn't have to be a member. - let who = ensure_signed(origin).clone().unwrap(); + let who = ensure_signed(origin)?; // Get session let found = Self::download_sessions(session_id).ok_or(MSG_SESSION_NOT_FOUND); From 7da887e31aae7999f852a8a62f5687e8a9a3137d Mon Sep 17 00:00:00 2001 From: Jens Finkhaeuser Date: Tue, 2 Apr 2019 10:10:30 +0200 Subject: [PATCH 108/175] Simplify names and other style suggestions --- src/storage/data_directory.rs | 16 ++++----- src/storage/data_object_storage_registry.rs | 39 ++++++++++----------- 2 files changed, 25 insertions(+), 30 deletions(-) diff --git a/src/storage/data_directory.rs b/src/storage/data_directory.rs index d9b447a6b0..c14e42fedc 100644 --- a/src/storage/data_directory.rs +++ b/src/storage/data_directory.rs @@ -125,31 +125,28 @@ decl_module! { } // The LiaisonJudgement can be updated, but only by the liaison. - fn accept_content(origin, id: T::ContentId) - { + fn accept_content(origin, id: T::ContentId) { Self::update_content_judgement(origin, id.clone(), LiaisonJudgement::Accepted)?; Self::deposit_event(RawEvent::ContentAccepted(id)); } - fn reject_content(origin, id: T::ContentId) - { + fn reject_content(origin, id: T::ContentId) { Self::update_content_judgement(origin, id.clone(), LiaisonJudgement::Rejected)?; - Self::deposit_event(RawEvent::ContentAccepted(id)); + Self::deposit_event(RawEvent::ContentRejected(id)); } } } impl Module { - fn update_content_judgement(origin: T::Origin, id: T::ContentId, judgement: LiaisonJudgement) -> dispatch::Result - { - let who = ensure_signed(origin); + fn update_content_judgement(origin: T::Origin, id: T::ContentId, judgement: LiaisonJudgement) -> dispatch::Result { + let who = ensure_signed(origin)?; // Find the data let found = Self::contents(&id).ok_or(MSG_CID_NOT_FOUND); // Make sure the liaison matches let mut data = found.unwrap(); - ensure!(data.liaison == who.unwrap(), MSG_LIAISON_REQUIRED); + ensure!(data.liaison == who, MSG_LIAISON_REQUIRED); // At this point we can update the data. data.liaison_judgement = judgement; @@ -271,5 +268,4 @@ mod tests { assert!(res.is_ok()); }); } - } diff --git a/src/storage/data_object_storage_registry.rs b/src/storage/data_object_storage_registry.rs index 0a55ab18e8..6a30d8629d 100644 --- a/src/storage/data_object_storage_registry.rs +++ b/src/storage/data_object_storage_registry.rs @@ -23,7 +23,7 @@ static MSG_CID_NOT_FOUND: &str = "Content with this ID not found!"; static MSG_DOSR_NOT_FOUND: &str = "No data object storage relationship found for this ID."; static MSG_ONLY_STORAGE_PROVIDER_MAY_CLAIM_READY: &str = "Only the storage provider in a DOSR can decide whether they're ready."; -const DEFAULT_FIRST_DATA_OBJECT_STORAGE_RELATIONSHIP_ID: u64 = 1; +const DEFAULT_FIRST_RELATIONSHIP_ID: u64 = 1; #[derive(Clone, Encode, Decode, PartialEq)] #[cfg_attr(feature = "std", derive(Debug))] @@ -36,16 +36,16 @@ pub struct DataObjectStorageRelationship { decl_storage! { trait Store for Module as DataObjectStorageRegistry { // Start at this value - pub FirstDataObjectStorageRelationshipId get(first_data_object_storage_relationship_id) config(first_data_object_storage_relationship_id): T::DataObjectStorageRelationshipId = T::DataObjectStorageRelationshipId::sa(DEFAULT_FIRST_DATA_OBJECT_STORAGE_RELATIONSHIP_ID); + pub FirstRelationshipId get(first_relationship_id) config(first_relationship_id): T::DataObjectStorageRelationshipId = T::DataObjectStorageRelationshipId::sa(DEFAULT_FIRST_RELATIONSHIP_ID); // Increment - pub NextDataObjectStorageRelationshipId get(next_data_object_storage_relationship_id) build(|config: &GenesisConfig| config.first_data_object_storage_relationship_id): T::DataObjectStorageRelationshipId = T::DataObjectStorageRelationshipId::sa(DEFAULT_FIRST_DATA_OBJECT_STORAGE_RELATIONSHIP_ID); + pub NextRelationshipId get(next_relationship_id) build(|config: &GenesisConfig| config.first_relationship_id): T::DataObjectStorageRelationshipId = T::DataObjectStorageRelationshipId::sa(DEFAULT_FIRST_RELATIONSHIP_ID); // Mapping of Data object types - pub DataObjectStorageRelationshipMap get(data_object_storage_relationship): map T::DataObjectStorageRelationshipId => Option>; + pub Relationships get(relationships): map T::DataObjectStorageRelationshipId => Option>; // Keep a list of storage relationships per CID - pub DataObjectStorageRelationships get(data_object_storage_relationships): map T::ContentId => Vec; + pub RelationshipsByContentId get(relationships_by_content_id): map T::ContentId => Vec; } } @@ -62,14 +62,14 @@ decl_event! { impl ContentHasStorage for Module { fn has_storage_provider(which: &T::ContentId) -> bool { - let dosr_list = Self::data_object_storage_relationships(which); - return dosr_list.iter().any(|&dosr_id| Self::data_object_storage_relationship(dosr_id).unwrap().ready); + let dosr_list = Self::relationships_by_content_id(which); + return dosr_list.iter().any(|&dosr_id| Self::relationships(dosr_id).unwrap().ready); } fn is_ready_at_storage_provider(which: &T::ContentId, provider: &T::AccountId) -> bool { - let dosr_list = Self::data_object_storage_relationships(which); + let dosr_list = Self::relationships_by_content_id(which); return dosr_list.iter().any(|&dosr_id| { - let dosr = Self::data_object_storage_relationship(dosr_id).unwrap(); + let dosr = Self::relationships(dosr_id).unwrap(); dosr.storage_provider == *provider && dosr.ready }); } @@ -81,7 +81,7 @@ decl_module! { pub struct Module for enum Call where origin: T::Origin { fn deposit_event() = default; - pub fn add_data_object_storage_relationship(origin, cid: T::ContentId) { + pub fn add_relationship(origin, cid: T::ContentId) { // Origin has to be a storage provider let who = ensure_signed(origin)?; // TODO check for being staked as a storage provider @@ -93,19 +93,19 @@ decl_module! { ensure!(T::ContentIdExists::has_content(&cid), MSG_CID_NOT_FOUND); // Create new ID, data. - let new_id = Self::next_data_object_storage_relationship_id(); + let new_id = Self::next_relationship_id(); let dosr: DataObjectStorageRelationship = DataObjectStorageRelationship { content_id: cid.clone(), storage_provider: who.clone(), ready: false, }; - >::insert(new_id, dosr); - >::mutate(|n| { *n += T::DataObjectStorageRelationshipId::sa(1); }); + >::insert(new_id, dosr); + >::mutate(|n| { *n += T::DataObjectStorageRelationshipId::sa(1); }); // Also add the DOSR to the list of DOSRs for the CID. Uniqueness is guaranteed // by the map, so we can just append the new_id to the list. - let mut dosr_list = Self::data_object_storage_relationships(cid.clone()); + let mut dosr_list = Self::relationships_by_content_id(cid.clone()); dosr_list.push(new_id); // Emit event @@ -113,24 +113,23 @@ decl_module! { } // A storage provider may flip their own ready state, but nobody else. - pub fn set_data_object_storage_relationship_ready(origin, id: T::DataObjectStorageRelationshipId) { + pub fn set_relationship_ready(origin, id: T::DataObjectStorageRelationshipId) { Self::toggle_dosr_ready(origin, id, true)?; } - pub fn unset_data_object_storage_relationship_ready(origin, id: T::DataObjectStorageRelationshipId) { + pub fn unset_relationship_ready(origin, id: T::DataObjectStorageRelationshipId) { Self::toggle_dosr_ready(origin, id, false)?; } } } impl Module { - fn toggle_dosr_ready(origin: T::Origin, id: T::DataObjectStorageRelationshipId, ready: bool) -> dispatch::Result - { + fn toggle_dosr_ready(origin: T::Origin, id: T::DataObjectStorageRelationshipId, ready: bool) -> dispatch::Result { // Origin has to be the storage provider mentioned in the DOSR let who = ensure_signed(origin)?; // For that, we need to fetch the identified DOSR - let found = Self::data_object_storage_relationship(id).ok_or(MSG_DOSR_NOT_FOUND); + let found = Self::relationships(id).ok_or(MSG_DOSR_NOT_FOUND); let mut dosr = found.unwrap(); ensure!(dosr.storage_provider == who, MSG_ONLY_STORAGE_PROVIDER_MAY_CLAIM_READY); @@ -138,7 +137,7 @@ impl Module { dosr.ready = ready; // Update DOSR and fire event. - >::insert(id, dosr); + >::insert(id, dosr); Self::deposit_event(RawEvent::DataObjectStorageRelationshipReadyUpdated(id, true)); Ok(()) From 10338696005f159d48ad6cf10b1fbea6dca86929 Mon Sep 17 00:00:00 2001 From: Jens Finkhaeuser Date: Tue, 2 Apr 2019 10:15:31 +0200 Subject: [PATCH 109/175] Also pass Liaison ID when they reject or accept content --- src/storage/data_directory.rs | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/storage/data_directory.rs b/src/storage/data_directory.rs index c14e42fedc..e8591eade8 100644 --- a/src/storage/data_directory.rs +++ b/src/storage/data_directory.rs @@ -66,8 +66,10 @@ decl_event! { { // The account is the Liaison that was selected ContentAdded(ContentId, AccountId), - ContentAccepted(ContentId), - ContentRejected(ContentId), + + // The account is the liaison again - only they can reject or accept + ContentAccepted(ContentId, AccountId), + ContentRejected(ContentId, AccountId), } } @@ -126,27 +128,27 @@ decl_module! { // The LiaisonJudgement can be updated, but only by the liaison. fn accept_content(origin, id: T::ContentId) { - Self::update_content_judgement(origin, id.clone(), LiaisonJudgement::Accepted)?; - Self::deposit_event(RawEvent::ContentAccepted(id)); + let who = ensure_signed(origin)?; + Self::update_content_judgement(&who, id.clone(), LiaisonJudgement::Accepted)?; + Self::deposit_event(RawEvent::ContentAccepted(id, who)); } fn reject_content(origin, id: T::ContentId) { - Self::update_content_judgement(origin, id.clone(), LiaisonJudgement::Rejected)?; - Self::deposit_event(RawEvent::ContentRejected(id)); + let who = ensure_signed(origin)?; + Self::update_content_judgement(&who, id.clone(), LiaisonJudgement::Rejected)?; + Self::deposit_event(RawEvent::ContentRejected(id, who)); } } } impl Module { - fn update_content_judgement(origin: T::Origin, id: T::ContentId, judgement: LiaisonJudgement) -> dispatch::Result { - let who = ensure_signed(origin)?; - + fn update_content_judgement(who: &T::AccountId, id: T::ContentId, judgement: LiaisonJudgement) -> dispatch::Result { // Find the data let found = Self::contents(&id).ok_or(MSG_CID_NOT_FOUND); // Make sure the liaison matches let mut data = found.unwrap(); - ensure!(data.liaison == who, MSG_LIAISON_REQUIRED); + ensure!(data.liaison == *who, MSG_LIAISON_REQUIRED); // At this point we can update the data. data.liaison_judgement = judgement; From ee2acfca889abaf0e48d2794e9986f55e634d437 Mon Sep 17 00:00:00 2001 From: Jens Finkhaeuser Date: Tue, 2 Apr 2019 10:18:43 +0200 Subject: [PATCH 110/175] Fix bug discovered during review by @mnaamani --- src/storage/data_object_storage_registry.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/storage/data_object_storage_registry.rs b/src/storage/data_object_storage_registry.rs index 6a30d8629d..36d07b6d0b 100644 --- a/src/storage/data_object_storage_registry.rs +++ b/src/storage/data_object_storage_registry.rs @@ -107,6 +107,7 @@ decl_module! { // by the map, so we can just append the new_id to the list. let mut dosr_list = Self::relationships_by_content_id(cid.clone()); dosr_list.push(new_id); + >::insert(cid.clone(), dosr_list); // Emit event Self::deposit_event(RawEvent::DataObjectStorageRelationshipAdded(new_id, cid, who)); From f985f5e6737f4d7c3d6060b6ad1ce133ea424a4a Mon Sep 17 00:00:00 2001 From: Jens Finkhaeuser Date: Tue, 2 Apr 2019 10:22:36 +0200 Subject: [PATCH 111/175] Change dispatch::Result -> Result for simplification --- src/storage/data_object_storage_registry.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/storage/data_object_storage_registry.rs b/src/storage/data_object_storage_registry.rs index 36d07b6d0b..9425e3a33a 100644 --- a/src/storage/data_object_storage_registry.rs +++ b/src/storage/data_object_storage_registry.rs @@ -125,13 +125,12 @@ decl_module! { } impl Module { - fn toggle_dosr_ready(origin: T::Origin, id: T::DataObjectStorageRelationshipId, ready: bool) -> dispatch::Result { + fn toggle_dosr_ready(origin: T::Origin, id: T::DataObjectStorageRelationshipId, ready: bool) -> Result<(), &'static str> { // Origin has to be the storage provider mentioned in the DOSR let who = ensure_signed(origin)?; // For that, we need to fetch the identified DOSR - let found = Self::relationships(id).ok_or(MSG_DOSR_NOT_FOUND); - let mut dosr = found.unwrap(); + let mut dosr = Self::relationships(id).ok_or(MSG_DOSR_NOT_FOUND)?; ensure!(dosr.storage_provider == who, MSG_ONLY_STORAGE_PROVIDER_MAY_CLAIM_READY); // Flip to ready From 75bcdb51ff4ccb5618c74e699b78f4533851b4dd Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Tue, 2 Apr 2019 11:30:32 +0300 Subject: [PATCH 112/175] rustfmt --- src/roles/actors.rs | 50 ++++++++++++++++----------- src/roles/mock.rs | 59 +++++++++++++++++++++----------- src/roles/mod.rs | 2 +- src/roles/tests.rs | 82 ++++++++++++++++++++++++++++++++------------- 4 files changed, 130 insertions(+), 63 deletions(-) diff --git a/src/roles/actors.rs b/src/roles/actors.rs index 2e8f9e8305..0c52b093dc 100644 --- a/src/roles/actors.rs +++ b/src/roles/actors.rs @@ -1,13 +1,17 @@ #![cfg_attr(not(feature = "std"), no_std)] -use rstd::prelude::*; +use crate::governance::{BalanceOf, GovernanceCurrency}; use parity_codec::Codec; -use parity_codec_derive::{Encode, Decode}; -use srml_support::{StorageMap, StorageValue, dispatch, decl_module, decl_storage, decl_event, ensure, Parameter}; +use parity_codec_derive::{Decode, Encode}; +use rstd::prelude::*; +use runtime_primitives::traits::{ + As, Bounded, MaybeDebug, MaybeSerializeDebug, Member, SimpleArithmetic, Zero, +}; use srml_support::traits::{Currency, EnsureAccountLiquid}; -use runtime_primitives::traits::{Zero, Bounded, SimpleArithmetic, As, Member, MaybeSerializeDebug, MaybeDebug}; +use srml_support::{ + decl_event, decl_module, decl_storage, dispatch, ensure, Parameter, StorageMap, StorageValue, +}; use system::{self, ensure_signed}; -use crate::governance::{GovernanceCurrency, BalanceOf }; use crate::traits::{Members, Roles}; @@ -16,7 +20,6 @@ pub enum Role { Storage, } - #[cfg_attr(feature = "std", derive(Debug))] #[derive(Encode, Decode, Copy, Clone, Eq, PartialEq)] pub struct RoleParameters { @@ -127,9 +130,10 @@ impl Module { Self::actor_by_account_id(role_key).ok_or("not role key") } - fn ensure_actor_is_member(role_key: &T::AccountId, member_id: MemberId) - -> Result, &'static str> - { + fn ensure_actor_is_member( + role_key: &T::AccountId, + member_id: MemberId, + ) -> Result, &'static str> { let actor = Self::ensure_actor(role_key)?; if actor.member_id == member_id { Ok(actor) @@ -166,9 +170,17 @@ impl Module { >::remove(&actor_account); } - fn apply_unstake(actor_account: T::AccountId, role: Role, member_id: MemberId, unbonding_period: T::BlockNumber) { + fn apply_unstake( + actor_account: T::AccountId, + role: Role, + member_id: MemberId, + unbonding_period: T::BlockNumber, + ) { // simple unstaking ...only applying unbonding period - >::insert(&actor_account, >::block_number() + unbonding_period); + >::insert( + &actor_account, + >::block_number() + unbonding_period, + ); Self::remove_actor_from_service(actor_account, role, member_id); } @@ -359,11 +371,11 @@ decl_module! { } impl EnsureAccountLiquid for Module { - fn ensure_account_liquid(who: &T::AccountId) -> dispatch::Result { - if Self::bondage(who) <= >::block_number() { - Ok(()) - } else { - Err("cannot transfer illiquid funds") - } - } -} \ No newline at end of file + fn ensure_account_liquid(who: &T::AccountId) -> dispatch::Result { + if Self::bondage(who) <= >::block_number() { + Ok(()) + } else { + Err("cannot transfer illiquid funds") + } + } +} diff --git a/src/roles/mock.rs b/src/roles/mock.rs index 2b33f3eb3a..94d75f0f08 100644 --- a/src/roles/mock.rs +++ b/src/roles/mock.rs @@ -1,17 +1,16 @@ #![cfg(test)] -use rstd::prelude::*; -pub use crate::governance::{GovernanceCurrency}; pub use super::actors; -use crate::traits::{Members}; -//pub use crate::membership::members; +pub use crate::governance::GovernanceCurrency; +use crate::traits::Members; +use rstd::prelude::*; pub use system; -pub use primitives::{H256, Blake2Hasher}; +pub use primitives::{Blake2Hasher, H256}; pub use runtime_primitives::{ + testing::{Digest, DigestItem, Header, UintAuthorityId}, + traits::{BlakeTwo256, IdentityLookup, OnFinalise}, BuildStorage, - traits::{BlakeTwo256, OnFinalise, IdentityLookup}, - testing::{Digest, DigestItem, Header, UintAuthorityId} }; use srml_support::impl_outer_origin; @@ -74,27 +73,47 @@ impl GovernanceCurrency for Test { pub struct MockMembers {} impl MockMembers { - pub fn alice_id() -> u32 {1} - pub fn alice_account() -> u64 {1} - pub fn bob_id() -> u32 {2} - pub fn bob_account() -> u64 {2} + pub fn alice_id() -> u32 { + 1 + } + pub fn alice_account() -> u64 { + 1 + } + pub fn bob_id() -> u32 { + 2 + } + pub fn bob_account() -> u64 { + 2 + } } impl Members for MockMembers { type Id = u32; fn is_active_member(who: &u64) -> bool { - if *who == Self::alice_account() { return true; } - if *who == Self::bob_account() { return true; } + if *who == Self::alice_account() { + return true; + } + if *who == Self::bob_account() { + return true; + } false } fn lookup_member_id(who: &u64) -> Result { - if *who == Self::alice_account() { return Ok(Self::alice_id()); } - if *who == Self::bob_account() { return Ok(Self::bob_id()); } + if *who == Self::alice_account() { + return Ok(Self::alice_id()); + } + if *who == Self::bob_account() { + return Ok(Self::bob_id()); + } Err("member not found") } fn lookup_account_by_member_id(id: Self::Id) -> Result { - if id == Self::alice_id() { return Ok(Self::alice_account()); } - if id == Self::bob_id() { return Ok(Self::bob_account()); } + if id == Self::alice_id() { + return Ok(Self::alice_account()); + } + if id == Self::bob_id() { + return Ok(Self::bob_account()); + } Err("account not found") } } @@ -105,7 +124,10 @@ impl actors::Trait for Test { } pub fn initial_test_ext() -> runtime_io::TestExternalities { - let t = system::GenesisConfig::::default().build_storage().unwrap().0; + let t = system::GenesisConfig::::default() + .build_storage() + .unwrap() + .0; runtime_io::TestExternalities::new(t) } @@ -113,4 +135,3 @@ pub fn initial_test_ext() -> runtime_io::TestExternalities { pub type System = system::Module; pub type Balances = balances::Module; pub type Actors = actors::Module; - diff --git a/src/roles/mod.rs b/src/roles/mod.rs index 227653d691..4ddb9c4f5d 100644 --- a/src/roles/mod.rs +++ b/src/roles/mod.rs @@ -3,4 +3,4 @@ pub mod actors; mod mock; -mod tests; \ No newline at end of file +mod tests; diff --git a/src/roles/tests.rs b/src/roles/tests.rs index e043004f1f..8aba121aec 100644 --- a/src/roles/tests.rs +++ b/src/roles/tests.rs @@ -1,7 +1,7 @@ #![cfg(test)] -use super::*; use super::mock::*; +use super::*; use runtime_io::with_externalities; use srml_support::*; @@ -14,18 +14,21 @@ fn init_storage_role() { fn init_storage_parmeters() -> actors::RoleParameters { let params = actors::RoleParameters { // minium balance required to stake to enter a role - min_stake: 100 as u32, - min_actors: 1 as u32, - max_actors: 2 as u32, - reward: 100 as u32, - reward_period: 100 as u64, - bonding_period: 100 as u64, - unbonding_period: 100 as u64, - min_service_period: 100 as u64, - startup_grace_period: 100 as u64, - entry_request_fee: 10 as u32, + min_stake: 100 as u32, + min_actors: 1 as u32, + max_actors: 2 as u32, + reward: 100 as u32, + reward_period: 100 as u64, + bonding_period: 100 as u64, + unbonding_period: 100 as u64, + min_service_period: 100 as u64, + startup_grace_period: 100 as u64, + entry_request_fee: 10 as u32, }; - assert!(Actors::set_role_parameters(actors::Role::Storage, params.clone()).is_ok(), ""); + assert!( + Actors::set_role_parameters(actors::Role::Storage, params.clone()).is_ok(), + "" + ); params } @@ -60,14 +63,31 @@ fn make_entry_request() { let requests = Actors::role_entry_requests(); assert_eq!(requests.len(), 0); - assert!(Actors::role_entry_request( - Origin::signed(actor_account), actors::Role::Storage, MockMembers::alice_id()).is_err(), ""); + assert!( + Actors::role_entry_request( + Origin::signed(actor_account), + actors::Role::Storage, + MockMembers::alice_id() + ) + .is_err(), + "" + ); let surplus_balance = 100; - Balances::set_free_balance(&actor_account, storage_params.entry_request_fee + surplus_balance); - - assert!(Actors::role_entry_request( - Origin::signed(actor_account), actors::Role::Storage, MockMembers::alice_id()).is_ok(), ""); + Balances::set_free_balance( + &actor_account, + storage_params.entry_request_fee + surplus_balance, + ); + + assert!( + Actors::role_entry_request( + Origin::signed(actor_account), + actors::Role::Storage, + MockMembers::alice_id() + ) + .is_ok(), + "" + ); assert_eq!(Balances::free_balance(&actor_account), surplus_balance); @@ -88,7 +108,12 @@ fn staking() { let storage_params = init_storage_parmeters(); let actor_account = 5; - let request: actors::Request = (actor_account, MockMembers::alice_id(), actors::Role::Storage, 1000); + let request: actors::Request = ( + actor_account, + MockMembers::alice_id(), + actors::Role::Storage, + 1000, + ); >::put(vec![request]); @@ -97,7 +122,9 @@ fn staking() { assert!(Actors::stake( Origin::signed(MockMembers::alice_account()), actors::Role::Storage, - actor_account).is_ok()); + actor_account + ) + .is_ok()); let ids = Actors::actor_account_ids(); assert_eq!(ids, vec![actor_account]); @@ -122,7 +149,9 @@ fn unstaking() { let storage_params = init_storage_parmeters(); let actor_account = 5; - assert!(Actors::unstake(Origin::signed(MockMembers::alice_account()), actor_account).is_err()); + assert!( + Actors::unstake(Origin::signed(MockMembers::alice_account()), actor_account).is_err() + ); let actor: actors::Actor = actors::Actor { role: actors::Role::Storage, @@ -138,7 +167,9 @@ fn unstaking() { let current_block = 500; System::set_block_number(current_block); - assert!(Actors::unstake(Origin::signed(MockMembers::alice_account()), actor_account).is_ok()); + assert!( + Actors::unstake(Origin::signed(MockMembers::alice_account()), actor_account).is_ok() + ); assert_eq!(Actors::actor_account_ids().len(), 0); @@ -152,6 +183,9 @@ fn unstaking() { assert_eq!(account_ids_for_member.len(), 0); assert!(>::exists(actor_account)); - assert_eq!(Actors::bondage(actor_account), current_block + storage_params.unbonding_period); + assert_eq!( + Actors::bondage(actor_account), + current_block + storage_params.unbonding_period + ); }); -} \ No newline at end of file +} From dcc87b38e4db1cee73fc585965d5d52637127e81 Mon Sep 17 00:00:00 2001 From: Jens Finkhaeuser Date: Tue, 2 Apr 2019 10:48:06 +0200 Subject: [PATCH 113/175] rustfmt for the storage directory --- src/storage/data_directory.rs | 139 ++++++++++++-------- src/storage/data_object_storage_registry.rs | 52 +++++--- src/storage/data_object_type_registry.rs | 97 +++++++++----- src/storage/downloads.rs | 35 +++-- src/storage/mock.rs | 48 ++++--- src/storage/mod.rs | 2 +- 6 files changed, 241 insertions(+), 132 deletions(-) diff --git a/src/storage/data_directory.rs b/src/storage/data_directory.rs index e8591eade8..6bf7ccf496 100644 --- a/src/storage/data_directory.rs +++ b/src/storage/data_directory.rs @@ -1,19 +1,20 @@ #![cfg_attr(not(feature = "std"), no_std)] -use rstd::prelude::*; +use crate::storage::data_object_type_registry::Trait as DOTRTrait; +use crate::traits::{ContentIdExists, IsActiveDataObjectType, IsActiveMember}; use parity_codec::Codec; -use parity_codec_derive::{Encode, Decode}; -use srml_support::{StorageMap, decl_module, decl_storage, decl_event, ensure, Parameter, dispatch}; -use runtime_primitives::traits::{Member, MaybeSerializeDebug, MaybeDebug}; +use parity_codec_derive::{Decode, Encode}; +use rstd::prelude::*; +use runtime_primitives::traits::{MaybeDebug, MaybeSerializeDebug, Member}; +use srml_support::{ + decl_event, decl_module, decl_storage, dispatch, ensure, Parameter, StorageMap, +}; use system::{self, ensure_signed}; -use crate::traits::{IsActiveMember, IsActiveDataObjectType, ContentIdExists}; -use crate::storage::data_object_type_registry::Trait as DOTRTrait; pub trait Trait: timestamp::Trait + system::Trait + DOTRTrait + MaybeDebug { type Event: From> + Into<::Event>; - type ContentId: Parameter + Member + Codec + Default + Clone - + MaybeSerializeDebug + PartialEq; + type ContentId: Parameter + Member + Codec + Default + Clone + MaybeSerializeDebug + PartialEq; type IsActiveMember: IsActiveMember; type IsActiveDataObjectType: IsActiveDataObjectType; @@ -23,12 +24,12 @@ static MSG_DUPLICATE_CID: &str = "Content with this ID already exists!"; static MSG_CID_NOT_FOUND: &str = "Content with this ID not found!"; static MSG_LIAISON_REQUIRED: &str = "Only the liaison for the content may modify its status!"; static MSG_CREATOR_MUST_BE_MEMBER: &str = "Only active members may create content!"; -static MSG_DO_TYPE_MUST_BE_ACTIVE: &str = "Cannot create content for inactive or missing data object type!"; +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))] -pub enum LiaisonJudgement -{ +pub enum LiaisonJudgement { Pending, Rejected, Accepted, @@ -141,8 +142,12 @@ decl_module! { } } -impl Module { - fn update_content_judgement(who: &T::AccountId, id: T::ContentId, judgement: LiaisonJudgement) -> dispatch::Result { +impl Module { + fn update_content_judgement( + who: &T::AccountId, + id: T::ContentId, + judgement: LiaisonJudgement, + ) -> dispatch::Result { // Find the data let found = Self::contents(&id).ok_or(MSG_CID_NOT_FOUND); @@ -165,23 +170,27 @@ mod tests { use super::*; use crate::storage::mock::*; - use system::{self, Phase, EventRecord}; + use system::{self, EventRecord, Phase}; #[test] fn succeed_adding_content() { with_default_mock_builder(|| { // Register a content name "foo" with 1234 bytes of type 1, which should be recognized. - let res = TestDataDirectory::add_content(Origin::signed(1), - 1, - "foo".as_bytes().to_vec(), - 1234); + let res = TestDataDirectory::add_content( + Origin::signed(1), + 1, + "foo".as_bytes().to_vec(), + 1234, + ); assert!(res.is_ok()); // Register the same under a different name - let res = TestDataDirectory::add_content(Origin::signed(1), - 1, - "bar".as_bytes().to_vec(), - 1234); + let res = TestDataDirectory::add_content( + Origin::signed(1), + 1, + "bar".as_bytes().to_vec(), + 1234, + ); assert!(res.is_ok()); }); } @@ -190,31 +199,39 @@ mod tests { fn fail_adding_content_twice() { with_default_mock_builder(|| { // Register a content name "foo" with 1234 bytes of type 1, which should be recognized. - let res = TestDataDirectory::add_content(Origin::signed(1), - 1, - "foo".as_bytes().to_vec(), - 1234); + let res = TestDataDirectory::add_content( + Origin::signed(1), + 1, + "foo".as_bytes().to_vec(), + 1234, + ); assert!(res.is_ok()); // The second time must fail - let res = TestDataDirectory::add_content(Origin::signed(1), - 1, - "foo".as_bytes().to_vec(), - 1234); + let res = TestDataDirectory::add_content( + Origin::signed(1), + 1, + "foo".as_bytes().to_vec(), + 1234, + ); assert!(res.is_err()); // Also from a different origin must fail - let res = TestDataDirectory::add_content(Origin::signed(2), - 1, - "foo".as_bytes().to_vec(), - 1234); + let res = TestDataDirectory::add_content( + Origin::signed(2), + 1, + "foo".as_bytes().to_vec(), + 1234, + ); assert!(res.is_err()); // Also with a different size must fail - let res = TestDataDirectory::add_content(Origin::signed(2), - 1, - "foo".as_bytes().to_vec(), - 4321); + let res = TestDataDirectory::add_content( + Origin::signed(2), + 1, + "foo".as_bytes().to_vec(), + 4321, + ); assert!(res.is_err()); }); } @@ -222,25 +239,34 @@ mod tests { #[test] fn accept_content_as_liaison() { with_default_mock_builder(|| { - let res = TestDataDirectory::add_content(Origin::signed(1), - 1, - "foo".as_bytes().to_vec(), - 1234); + let res = TestDataDirectory::add_content( + Origin::signed(1), + 1, + "foo".as_bytes().to_vec(), + 1234, + ); assert!(res.is_ok()); // An appropriate event should have been fired. let liaison = *match &System::events().last().unwrap().event { - MetaEvent::data_directory(data_directory::RawEvent::ContentAdded(_content_id, liaison)) => liaison, + MetaEvent::data_directory(data_directory::RawEvent::ContentAdded( + _content_id, + liaison, + )) => liaison, _ => &0xdeadbeefu64, // invalid value, unlikely to match }; assert_ne!(liaison, 0xdeadbeefu64); // Accepting content should not work with some random origin - let res = TestDataDirectory::accept_content(Origin::signed(42), "foo".as_bytes().to_vec()); + let res = + TestDataDirectory::accept_content(Origin::signed(42), "foo".as_bytes().to_vec()); assert!(res.is_err()); // However, with the liaison as origin it should. - let res = TestDataDirectory::accept_content(Origin::signed(liaison), "foo".as_bytes().to_vec()); + let res = TestDataDirectory::accept_content( + Origin::signed(liaison), + "foo".as_bytes().to_vec(), + ); assert!(res.is_ok()); }); } @@ -248,25 +274,34 @@ mod tests { #[test] fn reject_content_as_liaison() { with_default_mock_builder(|| { - let res = TestDataDirectory::add_content(Origin::signed(1), - 1, - "foo".as_bytes().to_vec(), - 1234); + let res = TestDataDirectory::add_content( + Origin::signed(1), + 1, + "foo".as_bytes().to_vec(), + 1234, + ); assert!(res.is_ok()); // An appropriate event should have been fired. let liaison = *match &System::events().last().unwrap().event { - MetaEvent::data_directory(data_directory::RawEvent::ContentAdded(_content_id, liaison)) => liaison, + MetaEvent::data_directory(data_directory::RawEvent::ContentAdded( + _content_id, + liaison, + )) => liaison, _ => &0xdeadbeefu64, // invalid value, unlikely to match }; assert_ne!(liaison, 0xdeadbeefu64); // Rejecting content should not work with some random origin - let res = TestDataDirectory::reject_content(Origin::signed(42), "foo".as_bytes().to_vec()); + let res = + TestDataDirectory::reject_content(Origin::signed(42), "foo".as_bytes().to_vec()); assert!(res.is_err()); // However, with the liaison as origin it should. - let res = TestDataDirectory::reject_content(Origin::signed(liaison), "foo".as_bytes().to_vec()); + let res = TestDataDirectory::reject_content( + Origin::signed(liaison), + "foo".as_bytes().to_vec(), + ); assert!(res.is_ok()); }); } diff --git a/src/storage/data_object_storage_registry.rs b/src/storage/data_object_storage_registry.rs index 9425e3a33a..a14d4041e9 100644 --- a/src/storage/data_object_storage_registry.rs +++ b/src/storage/data_object_storage_registry.rs @@ -1,19 +1,29 @@ #![cfg_attr(not(feature = "std"), no_std)] -use rstd::prelude::*; +use crate::storage::data_directory::Trait as DDTrait; +use crate::traits::{ContentHasStorage, ContentIdExists, IsActiveMember}; use parity_codec::Codec; -use parity_codec_derive::{Encode, Decode}; -use srml_support::{StorageMap, StorageValue, decl_module, decl_storage, decl_event, Parameter, dispatch, ensure}; -use runtime_primitives::traits::{SimpleArithmetic, As, Member, MaybeSerializeDebug, MaybeDebug}; +use parity_codec_derive::{Decode, Encode}; +use rstd::prelude::*; +use runtime_primitives::traits::{As, MaybeDebug, MaybeSerializeDebug, Member, SimpleArithmetic}; +use srml_support::{ + decl_event, decl_module, decl_storage, dispatch, ensure, Parameter, StorageMap, StorageValue, +}; use system::{self, ensure_signed}; -use crate::traits::{IsActiveMember, ContentIdExists, ContentHasStorage}; -use crate::storage::data_directory::Trait as DDTrait; pub trait Trait: timestamp::Trait + system::Trait + DDTrait + MaybeDebug { type Event: From> + Into<::Event>; - type DataObjectStorageRelationshipId: Parameter + Member + SimpleArithmetic + Codec + Default + Copy - + As + As + MaybeSerializeDebug + PartialEq; + type DataObjectStorageRelationshipId: Parameter + + Member + + SimpleArithmetic + + Codec + + Default + + Copy + + As + + As + + MaybeSerializeDebug + + PartialEq; type IsActiveMember: IsActiveMember; type ContentIdExists: ContentIdExists; @@ -21,7 +31,8 @@ pub trait Trait: timestamp::Trait + system::Trait + DDTrait + MaybeDebug { static MSG_CID_NOT_FOUND: &str = "Content with this ID not found!"; static MSG_DOSR_NOT_FOUND: &str = "No data object storage relationship found for this ID."; -static MSG_ONLY_STORAGE_PROVIDER_MAY_CLAIM_READY: &str = "Only the storage provider in a DOSR can decide whether they're ready."; +static MSG_ONLY_STORAGE_PROVIDER_MAY_CLAIM_READY: &str = + "Only the storage provider in a DOSR can decide whether they're ready."; const DEFAULT_FIRST_RELATIONSHIP_ID: u64 = 1; @@ -63,7 +74,9 @@ decl_event! { impl ContentHasStorage for Module { fn has_storage_provider(which: &T::ContentId) -> bool { let dosr_list = Self::relationships_by_content_id(which); - return dosr_list.iter().any(|&dosr_id| Self::relationships(dosr_id).unwrap().ready); + return dosr_list + .iter() + .any(|&dosr_id| Self::relationships(dosr_id).unwrap().ready); } fn is_ready_at_storage_provider(which: &T::ContentId, provider: &T::AccountId) -> bool { @@ -75,8 +88,6 @@ impl ContentHasStorage for Module { } } - - decl_module! { pub struct Module for enum Call where origin: T::Origin { fn deposit_event() = default; @@ -124,21 +135,30 @@ decl_module! { } } -impl Module { - fn toggle_dosr_ready(origin: T::Origin, id: T::DataObjectStorageRelationshipId, ready: bool) -> Result<(), &'static str> { +impl Module { + fn toggle_dosr_ready( + origin: T::Origin, + id: T::DataObjectStorageRelationshipId, + ready: bool, + ) -> Result<(), &'static str> { // Origin has to be the storage provider mentioned in the DOSR let who = ensure_signed(origin)?; // For that, we need to fetch the identified DOSR let mut dosr = Self::relationships(id).ok_or(MSG_DOSR_NOT_FOUND)?; - ensure!(dosr.storage_provider == who, MSG_ONLY_STORAGE_PROVIDER_MAY_CLAIM_READY); + ensure!( + dosr.storage_provider == who, + MSG_ONLY_STORAGE_PROVIDER_MAY_CLAIM_READY + ); // Flip to ready dosr.ready = ready; // Update DOSR and fire event. >::insert(id, dosr); - Self::deposit_event(RawEvent::DataObjectStorageRelationshipReadyUpdated(id, true)); + Self::deposit_event(RawEvent::DataObjectStorageRelationshipReadyUpdated( + id, true, + )); Ok(()) } diff --git a/src/storage/data_object_type_registry.rs b/src/storage/data_object_type_registry.rs index dbd1e1a6ca..23131363b8 100644 --- a/src/storage/data_object_type_registry.rs +++ b/src/storage/data_object_type_registry.rs @@ -1,24 +1,35 @@ #![cfg_attr(not(feature = "std"), no_std)] -use rstd::prelude::*; +use crate::traits; use parity_codec::Codec; -use parity_codec_derive::{Encode, Decode}; -use srml_support::{StorageMap, StorageValue, decl_module, decl_storage, decl_event, ensure, Parameter}; -use runtime_primitives::traits::{SimpleArithmetic, As, Member, MaybeSerializeDebug, MaybeDebug}; +use parity_codec_derive::{Decode, Encode}; +use rstd::prelude::*; +use runtime_primitives::traits::{As, MaybeDebug, MaybeSerializeDebug, Member, SimpleArithmetic}; +use srml_support::{ + decl_event, decl_module, decl_storage, ensure, Parameter, StorageMap, StorageValue, +}; use system::{self, ensure_root}; -use crate::traits; pub trait Trait: system::Trait + MaybeDebug { type Event: From> + Into<::Event>; - type DataObjectTypeId: Parameter + Member + SimpleArithmetic + Codec + Default + Copy - + As + As + MaybeSerializeDebug + PartialEq; + type DataObjectTypeId: Parameter + + Member + + SimpleArithmetic + + Codec + + Default + + Copy + + As + + As + + MaybeSerializeDebug + + PartialEq; } - -static MSG_REQUIRE_NEW_DO_TYPE: &str = "New Data Object Type required; the provided one seems to be in use already!"; +static MSG_REQUIRE_NEW_DO_TYPE: &str = + "New Data Object Type required; the provided one seems to be in use already!"; static MSG_DO_TYPE_NOT_FOUND: &str = "Data Object Type with the given ID not found!"; -static MSG_REQUIRE_DO_TYPE_ID: &str = "Can only update Data Object Types that are already registered (with an ID)!"; +static MSG_REQUIRE_DO_TYPE_ID: &str = + "Can only update Data Object Types that are already registered (with an ID)!"; const DEFAULT_FIRST_DATA_OBJECT_TYPE_ID: u64 = 1; @@ -28,7 +39,6 @@ pub struct DataObjectType { pub id: Option, pub description: Vec, pub active: bool, - // TODO in future releases // - maximum size // - replication factor @@ -56,18 +66,15 @@ decl_event! { } } - - impl traits::IsActiveDataObjectType for Module { fn is_active_data_object_type(which: &T::DataObjectTypeId) -> bool { match Self::ensure_data_object_type(*which) { Ok(do_type) => do_type.active, - Err(_err) => false + Err(_err) => false, } } } - decl_module! { pub struct Module for enum Call where origin: T::Origin { fn deposit_event() = default; @@ -132,7 +139,7 @@ decl_module! { } } -impl Module { +impl Module { fn ensure_data_object_type(id: T::DataObjectTypeId) -> Result, &'static str> { return Self::data_object_type(&id).ok_or(MSG_DO_TYPE_NOT_FOUND); } @@ -143,12 +150,15 @@ mod tests { use super::*; use crate::storage::mock::*; - use system::{self, Phase, EventRecord}; + use system::{self, EventRecord, Phase}; #[test] fn initial_state() { with_default_mock_builder(|| { - assert_eq!(TestDataObjectTypeRegistry::first_data_object_type_id(), TEST_FIRST_DATA_OBJECT_TYPE_ID); + assert_eq!( + TestDataObjectTypeRegistry::first_data_object_type_id(), + TEST_FIRST_DATA_OBJECT_TYPE_ID + ); }); } @@ -160,7 +170,8 @@ mod tests { description: "foo".as_bytes().to_vec(), active: false, }; - let res = TestDataObjectTypeRegistry::register_data_object_type(Origin::signed(1), data); + let res = + TestDataObjectTypeRegistry::register_data_object_type(Origin::signed(1), data); assert!(res.is_err()); }); } @@ -189,14 +200,18 @@ mod tests { }; let id_res = TestDataObjectTypeRegistry::register_data_object_type(Origin::ROOT, data); assert!(id_res.is_ok()); - assert_eq!(*System::events().last().unwrap(), + assert_eq!( + *System::events().last().unwrap(), EventRecord { phase: Phase::ApplyExtrinsic(0), - event: MetaEvent::data_object_type_registry(data_object_type_registry::RawEvent::DataObjectTypeRegistered(TEST_FIRST_DATA_OBJECT_TYPE_ID)), + event: MetaEvent::data_object_type_registry( + data_object_type_registry::RawEvent::DataObjectTypeRegistered( + TEST_FIRST_DATA_OBJECT_TYPE_ID + ) + ), } ); - // Now update it with new data - we need the ID to be the same as in // returned by the previous call. First, though, try and fail without let updated1: TestDataObjectType = TestDataObjectType { @@ -224,16 +239,20 @@ mod tests { }; let res = TestDataObjectTypeRegistry::update_data_object_type(Origin::ROOT, updated3); assert!(res.is_ok()); - assert_eq!(*System::events().last().unwrap(), + assert_eq!( + *System::events().last().unwrap(), EventRecord { phase: Phase::ApplyExtrinsic(0), - event: MetaEvent::data_object_type_registry(data_object_type_registry::RawEvent::DataObjectTypeUpdated(TEST_FIRST_DATA_OBJECT_TYPE_ID)), + event: MetaEvent::data_object_type_registry( + data_object_type_registry::RawEvent::DataObjectTypeUpdated( + TEST_FIRST_DATA_OBJECT_TYPE_ID + ) + ), } ); }); } - #[test] fn activate_existing() { with_default_mock_builder(|| { @@ -245,10 +264,15 @@ mod tests { }; let id_res = TestDataObjectTypeRegistry::register_data_object_type(Origin::ROOT, data); assert!(id_res.is_ok()); - assert_eq!(*System::events().last().unwrap(), + assert_eq!( + *System::events().last().unwrap(), EventRecord { phase: Phase::ApplyExtrinsic(0), - event: MetaEvent::data_object_type_registry(data_object_type_registry::RawEvent::DataObjectTypeRegistered(TEST_FIRST_DATA_OBJECT_TYPE_ID)), + event: MetaEvent::data_object_type_registry( + data_object_type_registry::RawEvent::DataObjectTypeRegistered( + TEST_FIRST_DATA_OBJECT_TYPE_ID + ) + ), } ); @@ -258,12 +282,20 @@ mod tests { assert!(!data.unwrap().active); // Now activate the data object type - let res = TestDataObjectTypeRegistry::activate_data_object_type(Origin::ROOT, TEST_FIRST_DATA_OBJECT_TYPE_ID); + let res = TestDataObjectTypeRegistry::activate_data_object_type( + Origin::ROOT, + TEST_FIRST_DATA_OBJECT_TYPE_ID, + ); assert!(res.is_ok()); - assert_eq!(*System::events().last().unwrap(), + assert_eq!( + *System::events().last().unwrap(), EventRecord { phase: Phase::ApplyExtrinsic(0), - event: MetaEvent::data_object_type_registry(data_object_type_registry::RawEvent::DataObjectTypeUpdated(TEST_FIRST_DATA_OBJECT_TYPE_ID)), + event: MetaEvent::data_object_type_registry( + data_object_type_registry::RawEvent::DataObjectTypeUpdated( + TEST_FIRST_DATA_OBJECT_TYPE_ID + ) + ), } ); @@ -273,7 +305,10 @@ mod tests { assert!(data.unwrap().active); // Deactivate again. - let res = TestDataObjectTypeRegistry::deactivate_data_object_type(Origin::ROOT, TEST_FIRST_DATA_OBJECT_TYPE_ID); + let res = TestDataObjectTypeRegistry::deactivate_data_object_type( + Origin::ROOT, + TEST_FIRST_DATA_OBJECT_TYPE_ID, + ); assert!(res.is_ok()); let data = TestDataObjectTypeRegistry::data_object_type(TEST_FIRST_DATA_OBJECT_TYPE_ID); assert!(data.is_some()); diff --git a/src/storage/downloads.rs b/src/storage/downloads.rs index 33e32e6e97..01de54e0aa 100644 --- a/src/storage/downloads.rs +++ b/src/storage/downloads.rs @@ -1,20 +1,30 @@ #![cfg_attr(not(feature = "std"), no_std)] -use rstd::prelude::*; +use crate::storage::data_directory::Trait as DDTrait; +use crate::storage::data_object_storage_registry::Trait as DOSRTrait; +use crate::traits::{ContentHasStorage, ContentIdExists}; use parity_codec::Codec; -use parity_codec_derive::{Encode, Decode}; -use srml_support::{StorageMap, StorageValue, decl_module, decl_storage, decl_event, Parameter, ensure}; -use runtime_primitives::traits::{SimpleArithmetic, As, Member, MaybeSerializeDebug}; +use parity_codec_derive::{Decode, Encode}; +use rstd::prelude::*; +use runtime_primitives::traits::{As, MaybeSerializeDebug, Member, SimpleArithmetic}; +use srml_support::{ + decl_event, decl_module, decl_storage, ensure, Parameter, StorageMap, StorageValue, +}; use system::{self, ensure_signed}; -use crate::traits::{ContentIdExists, ContentHasStorage}; -use crate::storage::data_object_storage_registry::Trait as DOSRTrait; -use crate::storage::data_directory::Trait as DDTrait; pub trait Trait: timestamp::Trait + system::Trait + DOSRTrait + DDTrait { type Event: From> + Into<::Event>; - type DownloadSessionId: Parameter + Member + SimpleArithmetic + Codec + Default + Copy - + As + As + MaybeSerializeDebug + PartialEq; + type DownloadSessionId: Parameter + + Member + + SimpleArithmetic + + Codec + + Default + + Copy + + As + + As + + MaybeSerializeDebug + + PartialEq; type ContentHasStorage: ContentHasStorage; } @@ -23,14 +33,14 @@ static MSG_SESSION_NOT_FOUND: &str = "Download session with the given ID not fou static MSG_SESSION_HAS_ENDED: &str = "Download session with the given ID has already ended."; static MSG_CONSUMER_REQUIRED: &str = "Download session can only be modified by the downloader"; static MSG_INVALID_TRANSMITTED_VALUE: &str = "Invalid update to transmitted bytes value"; -static MSG_NEED_STORAGE_PROVIDER: &str = "Cannnot download without at least one active storage relationship!"; +static MSG_NEED_STORAGE_PROVIDER: &str = + "Cannnot download without at least one active storage relationship!"; const DEFAULT_FIRST_DOWNLOAD_SESSION_ID: u64 = 1; #[derive(Clone, Encode, Decode, PartialEq)] #[cfg_attr(feature = "std", derive(Debug))] -pub enum DownloadState -{ +pub enum DownloadState { Started, Ended, } @@ -41,7 +51,6 @@ impl Default for DownloadState { } } - #[derive(Clone, Encode, Decode, PartialEq)] #[cfg_attr(feature = "std", derive(Debug))] pub struct DownloadSession { diff --git a/src/storage/mock.rs b/src/storage/mock.rs index 7bc3c00f7c..7b08b23829 100644 --- a/src/storage/mock.rs +++ b/src/storage/mock.rs @@ -1,19 +1,19 @@ #![cfg(test)] -use rstd::prelude::*; -pub use super::{data_object_type_registry, data_directory}; -pub use system; +pub use super::{data_directory, data_object_type_registry}; use crate::traits; +use rstd::prelude::*; use runtime_io::with_externalities; +pub use system; -pub use primitives::{H256, Blake2Hasher}; +pub use primitives::{Blake2Hasher, H256}; pub use runtime_primitives::{ + testing::{Digest, DigestItem, Header, UintAuthorityId}, + traits::{BlakeTwo256, IdentityLookup, OnFinalise}, BuildStorage, - traits::{BlakeTwo256, OnFinalise, IdentityLookup}, - testing::{Digest, DigestItem, Header, UintAuthorityId} }; -use srml_support::{impl_outer_origin, impl_outer_event}; +use srml_support::{impl_outer_event, impl_outer_origin}; impl_outer_origin! { pub enum Origin for Test {} @@ -26,7 +26,6 @@ impl_outer_event! { } } - pub struct AnyAccountIsMember {} impl traits::IsActiveMember for AnyAccountIsMember { fn is_active_member(_who: &T::AccountId) -> bool { @@ -35,13 +34,14 @@ impl traits::IsActiveMember for AnyAccountIsMember { } pub struct AnyDataObjectTypeIsActive {} -impl traits::IsActiveDataObjectType for AnyDataObjectTypeIsActive { +impl traits::IsActiveDataObjectType + for AnyDataObjectTypeIsActive +{ fn is_active_data_object_type(_which: &T::DataObjectTypeId) -> bool { true } } - // For testing the module, we construct most of a mock runtime. This means // first constructing a configuration type (`Test`) which `impl`s each of the // configuration traits of modules we want to use. @@ -102,26 +102,36 @@ impl ExtBuilder { self } pub fn build(self) -> runtime_io::TestExternalities { - let mut t = system::GenesisConfig::::default().build_storage().unwrap().0; - - t.extend(data_object_type_registry::GenesisConfig::{ - first_data_object_type_id: self.first_data_object_type_id, - }.build_storage().unwrap().0); + let mut t = system::GenesisConfig::::default() + .build_storage() + .unwrap() + .0; + + t.extend( + data_object_type_registry::GenesisConfig:: { + first_data_object_type_id: self.first_data_object_type_id, + } + .build_storage() + .unwrap() + .0, + ); t.into() } } - pub type System = system::Module; pub type TestDataObjectTypeRegistry = data_object_type_registry::Module; pub type TestDataObjectType = data_object_type_registry::DataObjectType; pub type TestDataDirectory = data_directory::Module; pub type TestDataObject = data_directory::DataObject; - pub const TEST_FIRST_DATA_OBJECT_TYPE_ID: u64 = 1000; pub fn with_default_mock_builder R>(f: F) -> R { - with_externalities(&mut ExtBuilder::default() - .first_data_object_type_id(TEST_FIRST_DATA_OBJECT_TYPE_ID).build(), || f()) + with_externalities( + &mut ExtBuilder::default() + .first_data_object_type_id(TEST_FIRST_DATA_OBJECT_TYPE_ID) + .build(), + || f(), + ) } diff --git a/src/storage/mod.rs b/src/storage/mod.rs index 7b44e5c05a..16def6f2a1 100644 --- a/src/storage/mod.rs +++ b/src/storage/mod.rs @@ -1,8 +1,8 @@ #![cfg_attr(not(feature = "std"), no_std)] -pub mod data_object_type_registry; pub mod data_directory; pub mod data_object_storage_registry; +pub mod data_object_type_registry; pub mod downloads; mod mock; From 40e1886eeec0a9b659890367ebb14aec0a14b08e Mon Sep 17 00:00:00 2001 From: Jens Finkhaeuser Date: Tue, 2 Apr 2019 10:49:50 +0200 Subject: [PATCH 114/175] Storage traits don't need a default implementation here --- src/traits.rs | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/src/traits.rs b/src/traits.rs index b24eee6d1a..78b5a08b2f 100644 --- a/src/traits.rs +++ b/src/traits.rs @@ -1,34 +1,26 @@ #![cfg_attr(not(feature = "std"), no_std)] -use crate::storage::{data_object_type_registry, data_directory, data_object_storage_registry}; +use crate::storage::{data_directory, data_object_storage_registry, data_object_type_registry}; use system; // Storage pub trait IsActiveDataObjectType { - fn is_active_data_object_type(_which: &T::DataObjectTypeId) -> bool { - false - } + fn is_active_data_object_type(_which: &T::DataObjectTypeId) -> bool; } pub trait ContentIdExists { - fn has_content(_which: &T::ContentId) -> bool { - false - } + fn has_content(_which: &T::ContentId) -> bool; - fn get_data_object(_which: &T::ContentId) -> Result, &'static str> { - Err("not implemented") - } + fn get_data_object( + _which: &T::ContentId, + ) -> Result, &'static str>; } pub trait ContentHasStorage { - fn has_storage_provider(_which: &T::ContentId) -> bool { - false - } + fn has_storage_provider(_which: &T::ContentId) -> bool; - fn is_ready_at_storage_provider(_which: &T::ContentId, _provider: &T::AccountId) -> bool { - false - } + fn is_ready_at_storage_provider(_which: &T::ContentId, _provider: &T::AccountId) -> bool; } // Membership From 22fffb7dde812dce268b4c4287b9ac08468820a1 Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Tue, 2 Apr 2019 11:50:10 +0300 Subject: [PATCH 115/175] fix warnings in roles module --- src/roles/actors.rs | 14 +++++++------- src/roles/mock.rs | 1 - src/roles/tests.rs | 2 +- src/traits.rs | 6 +++--- 4 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/roles/actors.rs b/src/roles/actors.rs index 0c52b093dc..9ad261d184 100644 --- a/src/roles/actors.rs +++ b/src/roles/actors.rs @@ -1,15 +1,14 @@ #![cfg_attr(not(feature = "std"), no_std)] use crate::governance::{BalanceOf, GovernanceCurrency}; -use parity_codec::Codec; use parity_codec_derive::{Decode, Encode}; use rstd::prelude::*; use runtime_primitives::traits::{ - As, Bounded, MaybeDebug, MaybeSerializeDebug, Member, SimpleArithmetic, Zero, + As, Bounded, MaybeDebug, Zero, }; use srml_support::traits::{Currency, EnsureAccountLiquid}; use srml_support::{ - decl_event, decl_module, decl_storage, dispatch, ensure, Parameter, StorageMap, StorageValue, + decl_event, decl_module, decl_storage, dispatch, ensure, StorageMap, StorageValue, }; use system::{self, ensure_signed}; @@ -71,9 +70,10 @@ pub trait Trait: system::Trait + GovernanceCurrency + MaybeDebug { type Members: Members; } -pub type MemberId = >::Id; -pub type Request = (T::AccountId, MemberId, Role, T::BlockNumber); // actor account, memberid, role, expires -pub type Requests = Vec>; +pub type MemberId = <::Members as Members>::Id; +// actor account, memberid, role, expires +pub type Request = (::AccountId, MemberId, Role, ::BlockNumber); +pub type Requests = Vec>; pub const REQUEST_LIFETIME: u64 = 300; pub const DEFAULT_REQUEST_CLEARING_INTERVAL: u64 = 100; @@ -220,7 +220,7 @@ decl_module! { if now > actor.joined_at + params.reward_period { // send reward to member account - not the actor account if let Ok(member_account) = T::Members::lookup_account_by_member_id(actor.member_id) { - T::Currency::reward(&member_account, params.reward); + let _ = T::Currency::reward(&member_account, params.reward); } } } diff --git a/src/roles/mock.rs b/src/roles/mock.rs index 94d75f0f08..4dba02bb9a 100644 --- a/src/roles/mock.rs +++ b/src/roles/mock.rs @@ -3,7 +3,6 @@ pub use super::actors; pub use crate::governance::GovernanceCurrency; use crate::traits::Members; -use rstd::prelude::*; pub use system; pub use primitives::{Blake2Hasher, H256}; diff --git a/src/roles/tests.rs b/src/roles/tests.rs index 8aba121aec..da9d630b82 100644 --- a/src/roles/tests.rs +++ b/src/roles/tests.rs @@ -1,7 +1,7 @@ #![cfg(test)] use super::mock::*; -use super::*; +//use super::*; use runtime_io::with_externalities; use srml_support::*; diff --git a/src/traits.rs b/src/traits.rs index 7c55437424..4bea919f79 100644 --- a/src/traits.rs +++ b/src/traits.rs @@ -20,13 +20,13 @@ pub trait Members { impl Members for () { type Id = u32; - fn is_active_member(account_id: &T::AccountId) -> bool { + fn is_active_member(_account_id: &T::AccountId) -> bool { false } - fn lookup_member_id(account_id: &T::AccountId) -> Result { + fn lookup_member_id(_account_id: &T::AccountId) -> Result { Err("member not found") } - fn lookup_account_by_member_id(member_id: Self::Id) -> Result { + fn lookup_account_by_member_id(_member_id: Self::Id) -> Result { Err("account not found") } } From 2ea69b322efdd73065c4d3b331c72fc2507a25a7 Mon Sep 17 00:00:00 2001 From: Jens Finkhaeuser Date: Tue, 2 Apr 2019 11:43:48 +0200 Subject: [PATCH 116/175] Silence more warnings (not all; some of them are going to be resolved in other PRs) --- src/governance/mock.rs | 6 +++--- src/governance/proposals.rs | 6 +++--- src/migration.rs | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/governance/mock.rs b/src/governance/mock.rs index 7524e17d0b..41f711ad71 100644 --- a/src/governance/mock.rs +++ b/src/governance/mock.rs @@ -20,16 +20,16 @@ impl_outer_origin! { pub struct MockMembership {} impl Members for MockMembership { type Id = u32; - fn is_active_member(who: &T::AccountId) -> bool { + fn is_active_member(_who: &T::AccountId) -> bool { // all accounts are considered members. // There is currently no test coverage for non-members. // Should add some coverage, and update this method to reflect which accounts are or are not members true } - fn lookup_member_id(account_id: &T::AccountId) -> Result { + fn lookup_member_id(_account_id: &T::AccountId) -> Result { Err("not implemented!") } - fn lookup_account_by_member_id(id: Self::Id) -> Result { + fn lookup_account_by_member_id(_id: Self::Id) -> Result { Err("not implemented!") } } diff --git a/src/governance/proposals.rs b/src/governance/proposals.rs index be03a9678b..501494fc08 100644 --- a/src/governance/proposals.rs +++ b/src/governance/proposals.rs @@ -623,16 +623,16 @@ mod tests { pub struct MockMembership {} impl Members for MockMembership { type Id = u32; - fn is_active_member(who: &T::AccountId) -> bool { + fn is_active_member(_who: &T::AccountId) -> bool { // all accounts are considered members. // There is currently no test coverage for non-members. // Should add some coverage, and update this method to reflect which accounts are or are not members true } - fn lookup_member_id(account_id: &T::AccountId) -> Result { + fn lookup_member_id(_account_id: &T::AccountId) -> Result { Err("not implemented!") } - fn lookup_account_by_member_id(id: Self::Id) -> Result { + fn lookup_account_by_member_id(_id: Self::Id) -> Result { Err("not implemented!") } } diff --git a/src/migration.rs b/src/migration.rs index 1807bc2a24..c1a85caecb 100644 --- a/src/migration.rs +++ b/src/migration.rs @@ -7,8 +7,8 @@ use runtime_io::print; use crate::{VERSION}; use crate::membership::members; use crate::roles::actors; -use crate::governance::{GovernanceCurrency, BalanceOf }; -use runtime_primitives::traits::{Zero, Bounded, SimpleArithmetic, As}; +use crate::governance::{BalanceOf}; +use runtime_primitives::traits::{As}; // When preparing a new major runtime release version bump this value to match it and update // the initialization code in runtime_initialization(). Because of the way substrate runs runtime code From 737fda9de6afef7f7f4c133eae1979ecab304585 Mon Sep 17 00:00:00 2001 From: Jens Finkhaeuser Date: Tue, 2 Apr 2019 12:10:49 +0200 Subject: [PATCH 117/175] Fix build after changes to membership traits --- src/lib.rs | 2 +- src/storage/content_directory.rs | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 0747208f54..8c85d169d6 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -268,7 +268,7 @@ impl storage::content_directory::Trait for Runtime type Event = Event; type MetadataId = u64; type SchemaId = u64; - type IsActiveMember = Members; + type Members = Members; } impl members::Trait for Runtime { diff --git a/src/storage/content_directory.rs b/src/storage/content_directory.rs index fec37d590a..453c7c095b 100644 --- a/src/storage/content_directory.rs +++ b/src/storage/content_directory.rs @@ -6,7 +6,7 @@ use parity_codec_derive::{Encode, Decode}; use srml_support::{StorageMap, StorageValue, decl_module, decl_storage, decl_event, ensure, Parameter}; use runtime_primitives::traits::{SimpleArithmetic, As, Member, MaybeSerializeDebug, MaybeDebug}; use system::{self, ensure_signed}; -use crate::traits::{IsActiveMember}; +use crate::traits::{Members}; use crate::storage::data_object_type_registry::Trait as DOTRTrait; pub trait Trait: timestamp::Trait + system::Trait + DOTRTrait + MaybeDebug { @@ -19,8 +19,7 @@ pub trait Trait: timestamp::Trait + system::Trait + DOTRTrait + MaybeDebug { type SchemaId: Parameter + Member + SimpleArithmetic + Codec + Default + Copy + As + As + MaybeSerializeDebug + PartialEq; - - type IsActiveMember: IsActiveMember; + type Members: Members; } static MSG_CREATOR_MUST_BE_MEMBER: &str = "Only active members may create content!"; @@ -86,7 +85,7 @@ decl_module! { { // Origin has to be a member let who = ensure_signed(origin).clone().unwrap(); - if !T::IsActiveMember::is_active_member(&who) { + if !T::Members::is_active_member(&who) { return Err(MSG_CREATOR_MUST_BE_MEMBER); } From 79e62de2bdcdcf70245f42e8ef818ac2b306c247 Mon Sep 17 00:00:00 2001 From: Jens Finkhaeuser Date: Tue, 2 Apr 2019 13:14:25 +0200 Subject: [PATCH 118/175] Implement suggestion to make the content ID an auto-incrementing integer, and have an optional signing key. --- src/lib.rs | 4 +- src/storage/data_directory.rs | 123 +++++++++++++--------------------- src/storage/mock.rs | 2 +- 3 files changed, 49 insertions(+), 80 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 5ca13a96bd..765ae32a77 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -54,7 +54,9 @@ pub use srml_support::{StorageValue, construct_runtime}; /// Alias to Ed25519 pubkey that identifies an account on the chain. pub type AccountId = primitives::H256; -pub type ContentId = primitives::H256; + +/// Alias for ContentId, used in various places +pub type ContentId = u64; /// A hash of some data used by the chain. pub type Hash = primitives::H256; diff --git a/src/storage/data_directory.rs b/src/storage/data_directory.rs index 2c2b9b0fa1..f51dd92305 100644 --- a/src/storage/data_directory.rs +++ b/src/storage/data_directory.rs @@ -5,28 +5,39 @@ use crate::traits::{ContentIdExists, IsActiveDataObjectType, Members}; use parity_codec::Codec; use parity_codec_derive::{Decode, Encode}; use rstd::prelude::*; -use runtime_primitives::traits::{MaybeDebug, MaybeSerializeDebug, Member}; +use runtime_primitives::traits::{As, MaybeSerializeDebug, Member, SimpleArithmetic, MaybeDebug}; use srml_support::{ - decl_event, decl_module, decl_storage, dispatch, ensure, Parameter, StorageMap, + decl_event, decl_module, decl_storage, dispatch, ensure, Parameter, StorageMap, StorageValue, }; use system::{self, ensure_signed}; +use primitives::{Ed25519AuthorityId}; pub trait Trait: timestamp::Trait + system::Trait + DOTRTrait + MaybeDebug { type Event: From> + Into<::Event>; - type ContentId: Parameter + Member + Codec + Default + Clone + MaybeSerializeDebug + PartialEq; + type ContentId: Parameter + + Member + + SimpleArithmetic + + Codec + + Default + + Copy + + As + + As + + MaybeSerializeDebug + + PartialEq; type Members: Members; type IsActiveDataObjectType: IsActiveDataObjectType; } -static MSG_DUPLICATE_CID: &str = "Content with this ID already exists!"; static MSG_CID_NOT_FOUND: &str = "Content with this ID not found!"; static MSG_LIAISON_REQUIRED: &str = "Only the liaison for the content may modify its status!"; static MSG_CREATOR_MUST_BE_MEMBER: &str = "Only active members may create content!"; static MSG_DO_TYPE_MUST_BE_ACTIVE: &str = "Cannot create content for inactive or missing data object type!"; +const DEFAULT_FIRST_CONTENT_ID: u64 = 1; + #[derive(Clone, Encode, Decode, PartialEq)] #[cfg_attr(feature = "std", derive(Debug))] pub enum LiaisonJudgement { @@ -45,6 +56,7 @@ impl Default for LiaisonJudgement { #[cfg_attr(feature = "std", derive(Debug))] pub struct DataObject { pub data_object_type: ::DataObjectTypeId, + pub signing_key: Option, pub size: u64, pub added_at_block: T::BlockNumber, pub added_at_time: T::Moment, @@ -55,6 +67,12 @@ pub struct DataObject { decl_storage! { trait Store for Module as DataDirectory { + // Start at this value + pub FirstContentId get(first_content_id) config(first_content_id): T::ContentId = T::ContentId::sa(DEFAULT_FIRST_CONTENT_ID); + + // Increment + pub NextContentId get(next_content_id) build(|config: &GenesisConfig| config.first_content_id): T::ContentId = T::ContentId::sa(DEFAULT_FIRST_CONTENT_ID); + // Mapping of Content ID to Data Object pub Contents get(contents): map T::ContentId => Option>; } @@ -92,7 +110,7 @@ decl_module! { fn deposit_event() = default; pub fn add_content(origin, data_object_type_id: ::DataObjectTypeId, - id: T::ContentId, size: u64) { + size: u64, signing_key: Option) { // Origin has to be a member let who = ensure_signed(origin)?; ensure!(T::Members::is_active_member(&who), MSG_CREATOR_MUST_BE_MEMBER); @@ -100,11 +118,6 @@ decl_module! { // Data object type has to be active ensure!(T::IsActiveDataObjectType::is_active_data_object_type(&data_object_type_id), MSG_DO_TYPE_MUST_BE_ACTIVE); - // We essentially accept the content ID and size at face value. All we - // need to know is that it doesn't yet exist. - let found = Self::contents(&id); - ensure!(found.is_none(), MSG_DUPLICATE_CID); - // The liaison is something we need to take from staked roles. The idea // is to select the liaison, for now randomly. // FIXME without that module, we're currently hardcoding it, to the @@ -112,8 +125,10 @@ decl_module! { let liaison = who.clone(); // Let's create the entry then + let new_id = Self::next_content_id(); let data: DataObject = DataObject { data_object_type: data_object_type_id, + signing_key: signing_key, size: size, added_at_block: >::block_number(), added_at_time: >::now(), @@ -123,8 +138,10 @@ decl_module! { }; // If we've constructed the data, we can store it and send an event. - >::insert(id.clone(), data); - Self::deposit_event(RawEvent::ContentAdded(id, liaison)); + >::insert(new_id, data); + >::mutate(|n| { *n += T::ContentId::sa(1); }); + + Self::deposit_event(RawEvent::ContentAdded(new_id, liaison)); } // The LiaisonJudgement can be updated, but only by the liaison. @@ -175,64 +192,14 @@ mod tests { #[test] fn succeed_adding_content() { with_default_mock_builder(|| { - // Register a content name "foo" with 1234 bytes of type 1, which should be recognized. + // Register a content with 1234 bytes of type 1, which should be recognized. let res = TestDataDirectory::add_content( Origin::signed(1), 1, - "foo".as_bytes().to_vec(), 1234, + None, ); assert!(res.is_ok()); - - // Register the same under a different name - let res = TestDataDirectory::add_content( - Origin::signed(1), - 1, - "bar".as_bytes().to_vec(), - 1234, - ); - assert!(res.is_ok()); - }); - } - - #[test] - fn fail_adding_content_twice() { - with_default_mock_builder(|| { - // Register a content name "foo" with 1234 bytes of type 1, which should be recognized. - let res = TestDataDirectory::add_content( - Origin::signed(1), - 1, - "foo".as_bytes().to_vec(), - 1234, - ); - assert!(res.is_ok()); - - // The second time must fail - let res = TestDataDirectory::add_content( - Origin::signed(1), - 1, - "foo".as_bytes().to_vec(), - 1234, - ); - assert!(res.is_err()); - - // Also from a different origin must fail - let res = TestDataDirectory::add_content( - Origin::signed(2), - 1, - "foo".as_bytes().to_vec(), - 1234, - ); - assert!(res.is_err()); - - // Also with a different size must fail - let res = TestDataDirectory::add_content( - Origin::signed(2), - 1, - "foo".as_bytes().to_vec(), - 4321, - ); - assert!(res.is_err()); }); } @@ -242,30 +209,30 @@ mod tests { let res = TestDataDirectory::add_content( Origin::signed(1), 1, - "foo".as_bytes().to_vec(), 1234, + None, ); assert!(res.is_ok()); // An appropriate event should have been fired. - let liaison = *match &System::events().last().unwrap().event { + let (content_id, liaison) = match System::events().last().unwrap().event { MetaEvent::data_directory(data_directory::RawEvent::ContentAdded( - _content_id, + content_id, liaison, - )) => liaison, - _ => &0xdeadbeefu64, // invalid value, unlikely to match + )) => (content_id, liaison), + _ => (0u64, 0xdeadbeefu64), // invalid value, unlikely to match }; assert_ne!(liaison, 0xdeadbeefu64); // Accepting content should not work with some random origin let res = - TestDataDirectory::accept_content(Origin::signed(42), "foo".as_bytes().to_vec()); + TestDataDirectory::accept_content(Origin::signed(42), content_id); assert!(res.is_err()); // However, with the liaison as origin it should. let res = TestDataDirectory::accept_content( Origin::signed(liaison), - "foo".as_bytes().to_vec(), + content_id, ); assert!(res.is_ok()); }); @@ -277,30 +244,30 @@ mod tests { let res = TestDataDirectory::add_content( Origin::signed(1), 1, - "foo".as_bytes().to_vec(), 1234, + None, ); assert!(res.is_ok()); // An appropriate event should have been fired. - let liaison = *match &System::events().last().unwrap().event { + let (content_id, liaison) = match System::events().last().unwrap().event { MetaEvent::data_directory(data_directory::RawEvent::ContentAdded( - _content_id, + content_id, liaison, - )) => liaison, - _ => &0xdeadbeefu64, // invalid value, unlikely to match + )) => (content_id, liaison), + _ => (0u64, 0xdeadbeefu64), // invalid value, unlikely to match }; assert_ne!(liaison, 0xdeadbeefu64); // Rejecting content should not work with some random origin let res = - TestDataDirectory::reject_content(Origin::signed(42), "foo".as_bytes().to_vec()); + TestDataDirectory::reject_content(Origin::signed(42), content_id); assert!(res.is_err()); // However, with the liaison as origin it should. let res = TestDataDirectory::reject_content( Origin::signed(liaison), - "foo".as_bytes().to_vec(), + content_id, ); assert!(res.is_ok()); }); diff --git a/src/storage/mock.rs b/src/storage/mock.rs index e082b38898..0397077222 100644 --- a/src/storage/mock.rs +++ b/src/storage/mock.rs @@ -78,7 +78,7 @@ impl data_object_type_registry::Trait for Test { impl data_directory::Trait for Test { type Event = MetaEvent; - type ContentId = Vec; + type ContentId = u64; type Members = AnyAccountIsMember; type IsActiveDataObjectType = AnyDataObjectTypeIsActive; } From bf39e42d80c3ab0f6d5bcd42837ec1a725df7e4c Mon Sep 17 00:00:00 2001 From: Jens Finkhaeuser Date: Tue, 2 Apr 2019 13:16:43 +0200 Subject: [PATCH 119/175] Rerun rustfmt --- src/storage/data_directory.rs | 41 ++++++++--------------------------- 1 file changed, 9 insertions(+), 32 deletions(-) diff --git a/src/storage/data_directory.rs b/src/storage/data_directory.rs index f51dd92305..d1ed013599 100644 --- a/src/storage/data_directory.rs +++ b/src/storage/data_directory.rs @@ -4,13 +4,13 @@ use crate::storage::data_object_type_registry::Trait as DOTRTrait; use crate::traits::{ContentIdExists, IsActiveDataObjectType, Members}; use parity_codec::Codec; use parity_codec_derive::{Decode, Encode}; +use primitives::Ed25519AuthorityId; use rstd::prelude::*; -use runtime_primitives::traits::{As, MaybeSerializeDebug, Member, SimpleArithmetic, MaybeDebug}; +use runtime_primitives::traits::{As, MaybeDebug, MaybeSerializeDebug, Member, SimpleArithmetic}; use srml_support::{ decl_event, decl_module, decl_storage, dispatch, ensure, Parameter, StorageMap, StorageValue, }; use system::{self, ensure_signed}; -use primitives::{Ed25519AuthorityId}; pub trait Trait: timestamp::Trait + system::Trait + DOTRTrait + MaybeDebug { type Event: From> + Into<::Event>; @@ -193,12 +193,7 @@ mod tests { fn succeed_adding_content() { with_default_mock_builder(|| { // Register a content with 1234 bytes of type 1, which should be recognized. - let res = TestDataDirectory::add_content( - Origin::signed(1), - 1, - 1234, - None, - ); + let res = TestDataDirectory::add_content(Origin::signed(1), 1, 1234, None); assert!(res.is_ok()); }); } @@ -206,12 +201,7 @@ mod tests { #[test] fn accept_content_as_liaison() { with_default_mock_builder(|| { - let res = TestDataDirectory::add_content( - Origin::signed(1), - 1, - 1234, - None, - ); + let res = TestDataDirectory::add_content(Origin::signed(1), 1, 1234, None); assert!(res.is_ok()); // An appropriate event should have been fired. @@ -225,15 +215,11 @@ mod tests { assert_ne!(liaison, 0xdeadbeefu64); // Accepting content should not work with some random origin - let res = - TestDataDirectory::accept_content(Origin::signed(42), content_id); + let res = TestDataDirectory::accept_content(Origin::signed(42), content_id); assert!(res.is_err()); // However, with the liaison as origin it should. - let res = TestDataDirectory::accept_content( - Origin::signed(liaison), - content_id, - ); + let res = TestDataDirectory::accept_content(Origin::signed(liaison), content_id); assert!(res.is_ok()); }); } @@ -241,12 +227,7 @@ mod tests { #[test] fn reject_content_as_liaison() { with_default_mock_builder(|| { - let res = TestDataDirectory::add_content( - Origin::signed(1), - 1, - 1234, - None, - ); + let res = TestDataDirectory::add_content(Origin::signed(1), 1, 1234, None); assert!(res.is_ok()); // An appropriate event should have been fired. @@ -260,15 +241,11 @@ mod tests { assert_ne!(liaison, 0xdeadbeefu64); // Rejecting content should not work with some random origin - let res = - TestDataDirectory::reject_content(Origin::signed(42), content_id); + let res = TestDataDirectory::reject_content(Origin::signed(42), content_id); assert!(res.is_err()); // However, with the liaison as origin it should. - let res = TestDataDirectory::reject_content( - Origin::signed(liaison), - content_id, - ); + let res = TestDataDirectory::reject_content(Origin::signed(liaison), content_id); assert!(res.is_ok()); }); } From a03a3927dc4b639b602e82d86d470245c81633c1 Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Tue, 2 Apr 2019 14:18:25 +0300 Subject: [PATCH 120/175] substrate update: initial update --- Cargo.toml | 43 +- wasm/Cargo.lock | 1833 +++++++++++++++++++++++++++++++++++++---------- 2 files changed, 1473 insertions(+), 403 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 75080094ef..0274a2766b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,7 +15,6 @@ std = [ 'runtime-io/std', 'srml-support/std', 'balances/std', - 'fees/std', 'executive/std', 'aura/std', 'indices/std', @@ -35,43 +34,37 @@ std = [ default_features = false git = 'https://github.com/joystream/substrate.git' package = 'srml-aura' -rev = 'df5e65927780b323482e2e8b5031822f423a032d' +rev = '2ba93e317c637ffee06153e15ca7c39f6812e88a' [dependencies.balances] default_features = false git = 'https://github.com/joystream/substrate.git' package = 'srml-balances' -rev = 'df5e65927780b323482e2e8b5031822f423a032d' +rev = '2ba93e317c637ffee06153e15ca7c39f6812e88a' [dependencies.consensus] default_features = false git = 'https://github.com/joystream/substrate.git' package = 'srml-consensus' -rev = 'df5e65927780b323482e2e8b5031822f423a032d' +rev = '2ba93e317c637ffee06153e15ca7c39f6812e88a' [dependencies.consensus-aura] default_features = false git = 'https://github.com/joystream/substrate.git' package = 'substrate-consensus-aura-primitives' -rev = 'df5e65927780b323482e2e8b5031822f423a032d' +rev = '2ba93e317c637ffee06153e15ca7c39f6812e88a' [dependencies.executive] default_features = false git = 'https://github.com/joystream/substrate.git' package = 'srml-executive' -rev = 'df5e65927780b323482e2e8b5031822f423a032d' - -[dependencies.fees] -default_features = false -git = 'https://github.com/joystream/substrate.git' -package = 'srml-fees' -rev = 'df5e65927780b323482e2e8b5031822f423a032d' +rev = '2ba93e317c637ffee06153e15ca7c39f6812e88a' [dependencies.indices] default_features = false git = 'https://github.com/joystream/substrate.git' package = 'srml-indices' -rev = 'df5e65927780b323482e2e8b5031822f423a032d' +rev = '2ba93e317c637ffee06153e15ca7c39f6812e88a' [dependencies.parity-codec] default-features = false @@ -85,25 +78,25 @@ version = '3.1' default_features = false git = 'https://github.com/joystream/substrate.git' package = 'substrate-primitives' -rev = 'df5e65927780b323482e2e8b5031822f423a032d' +rev = '2ba93e317c637ffee06153e15ca7c39f6812e88a' [dependencies.rstd] default_features = false git = 'https://github.com/joystream/substrate.git' package = 'sr-std' -rev = 'df5e65927780b323482e2e8b5031822f423a032d' +rev = '2ba93e317c637ffee06153e15ca7c39f6812e88a' [dependencies.runtime-io] default_features = false git = 'https://github.com/joystream/substrate.git' package = 'sr-io' -rev = 'df5e65927780b323482e2e8b5031822f423a032d' +rev = '2ba93e317c637ffee06153e15ca7c39f6812e88a' [dependencies.runtime-primitives] default_features = false git = 'https://github.com/joystream/substrate.git' package = 'sr-primitives' -rev = 'df5e65927780b323482e2e8b5031822f423a032d' +rev = '2ba93e317c637ffee06153e15ca7c39f6812e88a' [dependencies.safe-mix] default-features = false @@ -120,45 +113,45 @@ version = '1.0' [dependencies.srml-support] default_features = false git = 'https://github.com/joystream/substrate.git' -rev = 'df5e65927780b323482e2e8b5031822f423a032d' +rev = '2ba93e317c637ffee06153e15ca7c39f6812e88a' [dependencies.substrate-client] default_features = false git = 'https://github.com/joystream/substrate.git' -rev = 'df5e65927780b323482e2e8b5031822f423a032d' +rev = '2ba93e317c637ffee06153e15ca7c39f6812e88a' [dependencies.sudo] default_features = false git = 'https://github.com/joystream/substrate.git' package = 'srml-sudo' -rev = 'df5e65927780b323482e2e8b5031822f423a032d' +rev = '2ba93e317c637ffee06153e15ca7c39f6812e88a' [dependencies.system] default_features = false git = 'https://github.com/joystream/substrate.git' package = 'srml-system' -rev = 'df5e65927780b323482e2e8b5031822f423a032d' +rev = '2ba93e317c637ffee06153e15ca7c39f6812e88a' [dependencies.timestamp] default_features = false git = 'https://github.com/joystream/substrate.git' package = 'srml-timestamp' -rev = 'df5e65927780b323482e2e8b5031822f423a032d' +rev = '2ba93e317c637ffee06153e15ca7c39f6812e88a' [dependencies.version] default_features = false git = 'https://github.com/joystream/substrate.git' package = 'sr-version' -rev = 'df5e65927780b323482e2e8b5031822f423a032d' +rev = '2ba93e317c637ffee06153e15ca7c39f6812e88a' [dependencies.staking] default_features = false git = 'https://github.com/joystream/substrate.git' package = 'srml-staking' -rev = 'df5e65927780b323482e2e8b5031822f423a032d' +rev = '2ba93e317c637ffee06153e15ca7c39f6812e88a' [dependencies.session] default_features = false git = 'https://github.com/joystream/substrate.git' package = 'srml-session' -rev = 'df5e65927780b323482e2e8b5031822f423a032d' +rev = '2ba93e317c637ffee06153e15ca7c39f6812e88a' diff --git a/wasm/Cargo.lock b/wasm/Cargo.lock index 66fc93ec58..e9af8655fc 100644 --- a/wasm/Cargo.lock +++ b/wasm/Cargo.lock @@ -1,5 +1,57 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. +[[package]] +name = "aes-ctr" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "aes-soft 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "aesni 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "ctr 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "stream-cipher 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "aes-soft" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "block-cipher-trait 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "opaque-debug 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "aesni" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "block-cipher-trait 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "opaque-debug 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "stream-cipher 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "aho-corasick" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "memchr 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "aio-limited" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-executor 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-timer 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "arrayref" version = "0.3.5" @@ -13,6 +65,23 @@ dependencies = [ "nodrop 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "asn1_der" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "asn1_der_derive 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "asn1_der_derive" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.29 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "autocfg" version = "0.1.2" @@ -26,7 +95,7 @@ dependencies = [ "autocfg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "backtrace-sys 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", "cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-demangle 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -36,20 +105,50 @@ name = "backtrace-sys" version = "0.1.28" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cc 1.0.30 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.26 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "base-x" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "base58" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "bigint" +version = "4.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "crunchy 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "bitflags" version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "bitmask" +version = "0.5.0" +source = "git+https://github.com/paritytech/bitmask#a84e147be602631617badd18b6b9af83391db4a9" + +[[package]] +name = "blake2" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "byte-tools 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "crypto-mac 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "digest 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "opaque-debug 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "blake2-rfc" version = "0.2.18" @@ -79,6 +178,14 @@ dependencies = [ "generic-array 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "block-cipher-trait" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "generic-array 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "block-padding" version = "0.1.3" @@ -87,6 +194,11 @@ dependencies = [ "byte-tools 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "bs58" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "byte-tools" version = "0.2.0" @@ -97,6 +209,11 @@ name = "byte-tools" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "byteorder" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "byteorder" version = "1.3.1" @@ -113,7 +230,7 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.30" +version = "1.0.26" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -136,7 +253,7 @@ name = "clear_on_drop" version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cc 1.0.30 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.26 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -176,6 +293,15 @@ dependencies = [ "smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "crossbeam-deque" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "crossbeam-epoch 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "crossbeam-deque" version = "0.6.3" @@ -194,6 +320,20 @@ dependencies = [ "crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "crossbeam-epoch" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "arrayvec 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "memoffset 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "nodrop 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", + "scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "crossbeam-epoch" version = "0.7.1" @@ -215,6 +355,14 @@ dependencies = [ "crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "crossbeam-utils" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "crossbeam-utils" version = "0.6.5" @@ -243,6 +391,33 @@ dependencies = [ "generic-array 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "crypto-mac" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "generic-array 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "subtle 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "ctr" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "block-cipher-trait 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "stream-cipher 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "cuckoofilter" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "byteorder 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.3.23 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "curve25519-dalek" version = "1.1.3" @@ -255,6 +430,11 @@ dependencies = [ "subtle 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "data-encoding" +version = "2.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "digest" version = "0.6.2" @@ -271,6 +451,20 @@ dependencies = [ "generic-array 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "discard" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "dns-parser" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "ed25519-dalek" version = "1.0.0-pre.1" @@ -283,6 +477,11 @@ dependencies = [ "sha2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "either" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "elastic-array" version = "0.10.2" @@ -293,7 +492,7 @@ dependencies = [ [[package]] name = "environmental" -version = "1.0.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -308,6 +507,21 @@ dependencies = [ name = "failure" version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "backtrace 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", + "failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "failure_derive" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.29 (registry+https://github.com/rust-lang/crates.io-index)", + "synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", +] [[package]] name = "fake-simd" @@ -321,7 +535,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-hex 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "static_assertions 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", @@ -366,8 +580,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "futures" -version = "0.1.25" +version = "0.1.26" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "futures-cpupool" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", + "num_cpus 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)", +] [[package]] name = "generic-array" @@ -399,6 +622,15 @@ dependencies = [ "crunchy 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "hashbrown" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "heapsize" version = "0.4.2" @@ -407,18 +639,31 @@ dependencies = [ "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "heck" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "unicode-segmentation 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "hex" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "hex-literal" -version = "0.1.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "hex-literal-impl 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "hex-literal-impl 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro-hack 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "hex-literal-impl" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro-hack 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -434,6 +679,15 @@ dependencies = [ "generic-array 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "hmac" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "crypto-mac 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "digest 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "hmac-drbg" version = "0.1.2" @@ -464,7 +718,7 @@ name = "impl-codec" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "parity-codec 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 3.3.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -486,7 +740,7 @@ name = "iovec" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -499,30 +753,29 @@ source = "registry+https://github.com/rust-lang/crates.io-index" name = "joystream-node-runtime" version = "1.0.1" dependencies = [ - "parity-codec 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec-derive 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 3.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec-derive 3.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "safe-mix 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-io 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", - "sr-primitives 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", - "sr-std 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", - "sr-version 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", - "srml-aura 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", - "srml-balances 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", - "srml-consensus 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", - "srml-executive 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", - "srml-fees 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", - "srml-indices 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", - "srml-session 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", - "srml-staking 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", - "srml-sudo 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", - "srml-support 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", - "srml-system 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", - "srml-timestamp 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", - "substrate-client 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", - "substrate-consensus-aura-primitives 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", - "substrate-primitives 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", + "sr-io 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "sr-primitives 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "sr-std 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "sr-version 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "srml-aura 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "srml-balances 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "srml-consensus 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "srml-executive 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "srml-indices 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "srml-session 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "srml-staking 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "srml-sudo 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "srml-support 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "srml-system 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "srml-timestamp 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "substrate-client 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "substrate-consensus-aura-primitives 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "substrate-primitives 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", ] [[package]] @@ -567,9 +820,328 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "libc" -version = "0.2.50" +version = "0.2.51" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "libp2p" +version = "0.5.0" +source = "git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20#e8e6ccec7409aa19939230d6720035e3ed28dfd6" +dependencies = [ + "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-core 0.5.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)", + "libp2p-core-derive 0.5.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)", + "libp2p-dns 0.5.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)", + "libp2p-floodsub 0.5.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)", + "libp2p-identify 0.5.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)", + "libp2p-kad 0.5.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)", + "libp2p-mdns 0.5.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)", + "libp2p-mplex 0.5.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)", + "libp2p-noise 0.3.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)", + "libp2p-ping 0.5.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)", + "libp2p-plaintext 0.5.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)", + "libp2p-ratelimit 0.5.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)", + "libp2p-secio 0.5.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)", + "libp2p-tcp 0.5.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)", + "libp2p-uds 0.5.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)", + "libp2p-yamux 0.5.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)", + "parity-multiaddr 0.2.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)", + "parity-multihash 0.1.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)", + "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", + "stdweb 0.4.15 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-executor 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "libp2p-core" +version = "0.5.0" +source = "git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20#e8e6ccec7409aa19939230d6720035e3ed28dfd6" +dependencies = [ + "asn1_der 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", + "bs58 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", + "ed25519-dalek 1.0.0-pre.1 (registry+https://github.com/rust-lang/crates.io-index)", + "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "multistream-select 0.3.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)", + "parity-multiaddr 0.2.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)", + "parity-multihash 0.1.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)", + "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "protobuf 2.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", + "ring 0.14.6 (registry+https://github.com/rust-lang/crates.io-index)", + "rw-stream-sink 0.1.1 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)", + "secp256k1 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)", + "sha2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-executor 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-timer 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", + "unsigned-varint 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "untrusted 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "zeroize 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "libp2p-core-derive" +version = "0.5.0" +source = "git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20#e8e6ccec7409aa19939230d6720035e3ed28dfd6" +dependencies = [ + "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.29 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "libp2p-dns" +version = "0.5.0" +source = "git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20#e8e6ccec7409aa19939230d6720035e3ed28dfd6" +dependencies = [ + "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-core 0.5.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-multiaddr 0.2.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)", + "tokio-dns-unofficial 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "libp2p-floodsub" +version = "0.5.0" +source = "git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20#e8e6ccec7409aa19939230d6720035e3ed28dfd6" +dependencies = [ + "bs58 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", + "cuckoofilter 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-core 0.5.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)", + "protobuf 2.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", + "unsigned-varint 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "libp2p-identify" +version = "0.5.0" +source = "git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20#e8e6ccec7409aa19939230d6720035e3ed28dfd6" +dependencies = [ + "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", + "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-core 0.5.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-multiaddr 0.2.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)", + "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "protobuf 2.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-timer 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", + "unsigned-varint 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "libp2p-kad" +version = "0.5.0" +source = "git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20#e8e6ccec7409aa19939230d6720035e3ed28dfd6" +dependencies = [ + "arrayvec 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", + "bigint 4.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "bs58 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", + "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-core 0.5.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)", + "libp2p-identify 0.5.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)", + "libp2p-ping 0.5.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-multiaddr 0.2.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)", + "parity-multihash 0.1.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)", + "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "protobuf 2.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-timer 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", + "unsigned-varint 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "libp2p-mdns" +version = "0.5.0" +source = "git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20#e8e6ccec7409aa19939230d6720035e3ed28dfd6" +dependencies = [ + "data-encoding 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "dns-parser 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-core 0.5.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-multiaddr 0.2.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)", + "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-reactor 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-timer 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-udp 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "libp2p-mplex" +version = "0.5.0" +source = "git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20#e8e6ccec7409aa19939230d6720035e3ed28dfd6" +dependencies = [ + "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", + "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-core 0.5.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", + "unsigned-varint 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "libp2p-noise" +version = "0.3.0" +source = "git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20#e8e6ccec7409aa19939230d6720035e3ed28dfd6" +dependencies = [ + "curve25519-dalek 1.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-core 0.5.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", + "ring 0.14.6 (registry+https://github.com/rust-lang/crates.io-index)", + "snow 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", + "x25519-dalek 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", + "zeroize 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "libp2p-ping" +version = "0.5.0" +source = "git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20#e8e6ccec7409aa19939230d6720035e3ed28dfd6" +dependencies = [ + "arrayvec 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-core 0.5.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-multiaddr 0.2.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)", + "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-timer 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", + "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "libp2p-plaintext" +version = "0.5.0" +source = "git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20#e8e6ccec7409aa19939230d6720035e3ed28dfd6" +dependencies = [ + "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-core 0.5.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)", + "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "libp2p-ratelimit" +version = "0.5.0" +source = "git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20#e8e6ccec7409aa19939230d6720035e3ed28dfd6" +dependencies = [ + "aio-limited 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-core 0.5.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-executor 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "libp2p-secio" +version = "0.5.0" +source = "git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20#e8e6ccec7409aa19939230d6720035e3ed28dfd6" +dependencies = [ + "aes-ctr 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "asn1_der 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", + "ctr 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", + "hmac 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-core 0.5.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "protobuf 2.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", + "ring 0.14.6 (registry+https://github.com/rust-lang/crates.io-index)", + "rw-stream-sink 0.1.1 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)", + "sha2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "stdweb 0.4.15 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", + "twofish 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "untrusted 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "libp2p-tcp" +version = "0.5.0" +source = "git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20#e8e6ccec7409aa19939230d6720035e3ed28dfd6" +dependencies = [ + "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-core 0.5.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-multiaddr 0.2.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)", + "tk-listen 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-tcp 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "libp2p-uds" +version = "0.5.0" +source = "git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20#e8e6ccec7409aa19939230d6720035e3ed28dfd6" +dependencies = [ + "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-core 0.5.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-multiaddr 0.2.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)", + "tokio-uds 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "libp2p-yamux" +version = "0.5.0" +source = "git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20#e8e6ccec7409aa19939230d6720035e3ed28dfd6" +dependencies = [ + "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-core 0.5.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", + "yamux 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "libsecp256k1" version = "0.2.2" @@ -605,6 +1177,11 @@ name = "matches" version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "memchr" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "memoffset" version = "0.2.1" @@ -645,7 +1222,7 @@ dependencies = [ "iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "lazycell 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", @@ -670,7 +1247,7 @@ version = "0.6.7" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", "mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -685,13 +1262,27 @@ dependencies = [ "ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "multistream-select" +version = "0.3.0" +source = "git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20#e8e6ccec7409aa19939230d6720035e3ed28dfd6" +dependencies = [ + "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", + "unsigned-varint 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "net2" version = "0.2.33" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -700,6 +1291,11 @@ name = "nodrop" version = "0.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "nohash-hasher" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "num-integer" version = "0.1.39" @@ -718,13 +1314,16 @@ name = "num_cpus" version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "once_cell" version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", +] [[package]] name = "opaque-debug" @@ -733,29 +1332,37 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "openssl" -version = "0.10.19" +version = "0.10.20" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", "cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", "foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl-sys 0.9.42 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl-sys 0.9.43 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "openssl-sys" -version = "0.9.42" +version = "0.9.43" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cc 1.0.30 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.26 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "vcpkg 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "owning_ref" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "owning_ref" version = "0.4.0" @@ -771,22 +1378,50 @@ source = "git+https://github.com/paritytech/parity-common?rev=b0317f649ab2c665b7 [[package]] name = "parity-codec" -version = "3.1.0" +version = "3.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "arrayvec 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec-derive 3.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "parity-codec-derive" -version = "3.1.0" +version = "3.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro-crate 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.27 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.29 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "parity-multiaddr" +version = "0.2.0" +source = "git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20#e8e6ccec7409aa19939230d6720035e3ed28dfd6" +dependencies = [ + "arrayref 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", + "bs58 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "data-encoding 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-multihash 0.1.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)", + "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", + "unsigned-varint 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "parity-multihash" +version = "0.1.0" +source = "git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20#e8e6ccec7409aa19939230d6720035e3ed28dfd6" +dependencies = [ + "blake2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", + "sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sha2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "tiny-keccak 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "unsigned-varint 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -797,6 +1432,24 @@ dependencies = [ "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "parking_lot" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "owning_ref 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot_core 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "parking_lot" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "lock_api 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "parking_lot" version = "0.7.1" @@ -806,12 +1459,35 @@ dependencies = [ "parking_lot_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "parking_lot_core" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "parking_lot_core" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "parking_lot_core" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", @@ -820,22 +1496,32 @@ dependencies = [ [[package]] name = "paste" -version = "0.1.4" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "paste-impl 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "paste-impl 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro-hack 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "paste-impl" -version = "0.1.4" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro-hack 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.27 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.29 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "pbkdf2" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "crypto-mac 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rayon 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -882,7 +1568,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.27 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.29 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -898,6 +1584,21 @@ dependencies = [ "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "protobuf" +version = "2.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "quick-error" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "quick-error" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "quote" version = "0.6.11" @@ -906,13 +1607,22 @@ dependencies = [ "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "rand" +version = "0.3.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "rand" version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -925,7 +1635,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -936,7 +1646,7 @@ version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "autocfg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", "rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "rand_hc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -991,7 +1701,7 @@ name = "rand_jitter" version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1003,7 +1713,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1026,6 +1736,27 @@ dependencies = [ "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "rayon" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "crossbeam-deque 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "either 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rayon-core 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rayon-core" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "crossbeam-deque 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", + "num_cpus 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "rdrand" version = "0.4.0" @@ -1036,17 +1767,37 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.1.51" +version = "0.1.52" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "regex" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "aho-corasick 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "regex-syntax 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)", + "thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "utf8-ranges 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "regex-syntax" +version = "0.6.6" source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "ucd-util 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", +] [[package]] name = "ring" version = "0.14.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cc 1.0.30 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.26 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", "spin 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "untrusted 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1070,6 +1821,16 @@ dependencies = [ "semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "rw-stream-sink" +version = "0.1.1" +source = "git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20#e8e6ccec7409aa19939230d6720035e3ed28dfd6" +dependencies = [ + "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "ryu" version = "0.2.7" @@ -1085,7 +1846,7 @@ dependencies = [ [[package]] name = "schnorrkel" -version = "0.0.0" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "clear_on_drop 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1095,6 +1856,7 @@ dependencies = [ "merlin 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", "rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "sha2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "sha3 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "subtle 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1104,6 +1866,15 @@ name = "scopeguard" version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "secp256k1" +version = "0.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cc 1.0.26 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "semver" version = "0.9.0" @@ -1129,7 +1900,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.27 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.29 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1228,6 +1999,23 @@ name = "smallvec" version = "0.6.9" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "snow" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "arrayref 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "ring 0.14.6 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", + "static_slice 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "subtle 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "spin" version = "0.5.0" @@ -1236,53 +2024,52 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "sr-api-macros" version = "0.1.0" -source = "git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d#df5e65927780b323482e2e8b5031822f423a032d" +source = "git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a#2ba93e317c637ffee06153e15ca7c39f6812e88a" dependencies = [ "blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro-crate 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.27 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.29 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "sr-io" version = "0.1.0" -source = "git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d#df5e65927780b323482e2e8b5031822f423a032d" +source = "git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a#2ba93e317c637ffee06153e15ca7c39f6812e88a" dependencies = [ - "environmental 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "environmental 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "hash-db 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "libsecp256k1 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 3.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-std 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", - "substrate-primitives 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", - "substrate-state-machine 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", - "substrate-trie 0.4.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", + "sr-std 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "substrate-primitives 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "substrate-state-machine 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "substrate-trie 0.4.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", "tiny-keccak 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "sr-primitives" version = "0.1.0" -source = "git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d#df5e65927780b323482e2e8b5031822f423a032d" +source = "git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a#2ba93e317c637ffee06153e15ca7c39f6812e88a" dependencies = [ "integer-sqrt 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec-derive 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 3.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-io 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", - "sr-std 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", - "substrate-primitives 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", + "sr-io 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "sr-std 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "substrate-primitives 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", ] [[package]] name = "sr-std" version = "0.1.0" -source = "git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d#df5e65927780b323482e2e8b5031822f423a032d" +source = "git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a#2ba93e317c637ffee06153e15ca7c39f6812e88a" dependencies = [ "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1290,273 +2077,250 @@ dependencies = [ [[package]] name = "sr-version" version = "0.1.0" -source = "git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d#df5e65927780b323482e2e8b5031822f423a032d" +source = "git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a#2ba93e317c637ffee06153e15ca7c39f6812e88a" dependencies = [ "impl-serde 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec-derive 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 3.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-primitives 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", - "sr-std 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", + "sr-primitives 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "sr-std 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", ] [[package]] name = "srml-aura" version = "0.1.0" -source = "git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d#df5e65927780b323482e2e8b5031822f423a032d" +source = "git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a#2ba93e317c637ffee06153e15ca7c39f6812e88a" dependencies = [ - "hex-literal 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec-derive 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "hex-literal 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 3.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec-derive 3.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-primitives 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", - "sr-std 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", - "srml-staking 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", - "srml-support 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", - "srml-system 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", - "srml-timestamp 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", - "substrate-inherents 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", + "sr-primitives 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "sr-std 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "srml-session 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "srml-staking 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "srml-support 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "srml-system 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "srml-timestamp 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "substrate-inherents 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", ] [[package]] name = "srml-balances" version = "0.1.0" -source = "git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d#df5e65927780b323482e2e8b5031822f423a032d" +source = "git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a#2ba93e317c637ffee06153e15ca7c39f6812e88a" dependencies = [ - "hex-literal 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec-derive 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "hex-literal 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 3.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "safe-mix 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-primitives 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", - "sr-std 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", - "srml-support 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", - "srml-system 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", - "substrate-keyring 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", + "sr-primitives 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "sr-std 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "srml-support 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "srml-system 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "substrate-keyring 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", ] [[package]] name = "srml-consensus" version = "0.1.0" -source = "git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d#df5e65927780b323482e2e8b5031822f423a032d" +source = "git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a#2ba93e317c637ffee06153e15ca7c39f6812e88a" dependencies = [ - "hex-literal 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec-derive 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "hex-literal 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 3.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-primitives 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", - "sr-std 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", - "srml-support 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", - "srml-system 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", - "substrate-inherents 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", - "substrate-primitives 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", + "sr-primitives 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "sr-std 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "srml-support 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "srml-system 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "substrate-inherents 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "substrate-primitives 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", ] [[package]] name = "srml-executive" version = "0.1.0" -source = "git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d#df5e65927780b323482e2e8b5031822f423a032d" +source = "git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a#2ba93e317c637ffee06153e15ca7c39f6812e88a" dependencies = [ - "parity-codec 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 3.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-io 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", - "sr-primitives 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", - "sr-std 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", - "srml-support 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", - "srml-system 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", -] - -[[package]] -name = "srml-fees" -version = "0.1.0" -source = "git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d#df5e65927780b323482e2e8b5031822f423a032d" -dependencies = [ - "hex-literal 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec-derive 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-io 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", - "sr-primitives 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", - "sr-std 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", - "srml-support 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", - "srml-system 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", - "substrate-primitives 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", + "sr-io 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "sr-primitives 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "sr-std 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "srml-support 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "srml-system 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", ] [[package]] name = "srml-indices" version = "0.1.0" -source = "git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d#df5e65927780b323482e2e8b5031822f423a032d" +source = "git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a#2ba93e317c637ffee06153e15ca7c39f6812e88a" dependencies = [ - "hex-literal 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec-derive 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "hex-literal 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 3.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec-derive 3.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "safe-mix 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-io 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", - "sr-primitives 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", - "sr-std 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", - "srml-support 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", - "srml-system 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", - "substrate-keyring 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", - "substrate-primitives 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", + "sr-io 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "sr-primitives 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "sr-std 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "srml-support 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "srml-system 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "substrate-keyring 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "substrate-primitives 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", ] [[package]] name = "srml-metadata" version = "0.1.0" -source = "git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d#df5e65927780b323482e2e8b5031822f423a032d" +source = "git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a#2ba93e317c637ffee06153e15ca7c39f6812e88a" dependencies = [ - "parity-codec 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec-derive 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 3.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-std 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", - "substrate-primitives 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", + "sr-std 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "substrate-primitives 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", ] [[package]] name = "srml-session" version = "0.1.0" -source = "git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d#df5e65927780b323482e2e8b5031822f423a032d" +source = "git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a#2ba93e317c637ffee06153e15ca7c39f6812e88a" dependencies = [ - "hex-literal 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec-derive 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "hex-literal 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 3.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec-derive 3.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "safe-mix 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-primitives 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", - "sr-std 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", - "srml-consensus 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", - "srml-support 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", - "srml-system 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", - "srml-timestamp 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", + "sr-primitives 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "sr-std 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "srml-consensus 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "srml-support 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "srml-system 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "srml-timestamp 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", ] [[package]] name = "srml-staking" version = "0.1.0" -source = "git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d#df5e65927780b323482e2e8b5031822f423a032d" +source = "git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a#2ba93e317c637ffee06153e15ca7c39f6812e88a" dependencies = [ - "hex-literal 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec-derive 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "hex-literal 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 3.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "safe-mix 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-primitives 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", - "sr-std 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", - "srml-consensus 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", - "srml-session 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", - "srml-support 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", - "srml-system 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", - "substrate-keyring 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", + "sr-io 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "sr-primitives 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "sr-std 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "srml-consensus 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "srml-session 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "srml-support 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "srml-system 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "substrate-keyring 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", ] [[package]] name = "srml-sudo" version = "0.1.0" -source = "git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d#df5e65927780b323482e2e8b5031822f423a032d" +source = "git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a#2ba93e317c637ffee06153e15ca7c39f6812e88a" dependencies = [ - "hex-literal 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec-derive 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "hex-literal 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 3.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec-derive 3.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-primitives 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", - "sr-std 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", - "srml-support 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", - "srml-support-procedural 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", - "srml-system 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", + "sr-primitives 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "sr-std 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "srml-support 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "srml-support-procedural 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "srml-system 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", ] [[package]] name = "srml-support" version = "0.1.0" -source = "git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d#df5e65927780b323482e2e8b5031822f423a032d" +source = "git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a#2ba93e317c637ffee06153e15ca7c39f6812e88a" dependencies = [ - "hex-literal 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "bitmask 0.5.0 (git+https://github.com/paritytech/bitmask)", + "hex-literal 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "once_cell 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec-derive 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "paste 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 3.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "paste 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-io 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", - "sr-primitives 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", - "sr-std 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", - "srml-metadata 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", - "srml-support-procedural 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", - "substrate-inherents 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", + "sr-io 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "sr-primitives 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "sr-std 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "srml-metadata 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "srml-support-procedural 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "substrate-inherents 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", ] [[package]] name = "srml-support-procedural" version = "0.1.0" -source = "git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d#df5e65927780b323482e2e8b5031822f423a032d" +source = "git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a#2ba93e317c637ffee06153e15ca7c39f6812e88a" dependencies = [ "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-api-macros 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", - "srml-support-procedural-tools 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", - "syn 0.15.27 (registry+https://github.com/rust-lang/crates.io-index)", + "sr-api-macros 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "srml-support-procedural-tools 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "syn 0.15.29 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "srml-support-procedural-tools" version = "0.1.0" -source = "git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d#df5e65927780b323482e2e8b5031822f423a032d" +source = "git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a#2ba93e317c637ffee06153e15ca7c39f6812e88a" dependencies = [ "proc-macro-crate 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", - "srml-support-procedural-tools-derive 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", - "syn 0.15.27 (registry+https://github.com/rust-lang/crates.io-index)", + "srml-support-procedural-tools-derive 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "syn 0.15.29 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "srml-support-procedural-tools-derive" version = "0.1.0" -source = "git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d#df5e65927780b323482e2e8b5031822f423a032d" +source = "git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a#2ba93e317c637ffee06153e15ca7c39f6812e88a" dependencies = [ "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.27 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.29 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "srml-system" version = "0.1.0" -source = "git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d#df5e65927780b323482e2e8b5031822f423a032d" +source = "git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a#2ba93e317c637ffee06153e15ca7c39f6812e88a" dependencies = [ - "hex-literal 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec-derive 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "hex-literal 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 3.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "safe-mix 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-io 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", - "sr-primitives 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", - "sr-std 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", - "srml-support 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", - "substrate-primitives 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", + "sr-io 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "sr-primitives 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "sr-std 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "srml-support 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "substrate-primitives 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", ] [[package]] name = "srml-timestamp" version = "0.1.0" -source = "git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d#df5e65927780b323482e2e8b5031822f423a032d" +source = "git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a#2ba93e317c637ffee06153e15ca7c39f6812e88a" dependencies = [ - "hex-literal 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec-derive 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "hex-literal 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 3.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-primitives 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", - "sr-std 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", - "srml-consensus 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", - "srml-support 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", - "srml-system 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", - "substrate-inherents 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", + "sr-primitives 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "sr-std 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "srml-support 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "srml-system 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "substrate-inherents 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", ] [[package]] @@ -1569,113 +2333,198 @@ name = "static_assertions" version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "static_slice" +version = "0.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "stdweb" +version = "0.4.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "discard 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "stdweb-derive 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "stdweb-internal-macros 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", + "stdweb-internal-runtime 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "stdweb-derive" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.29 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "stdweb-internal-macros" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "base-x 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", + "sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.29 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "stdweb-internal-runtime" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "stream-cipher" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "generic-array 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "strum" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "strum_macros" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.29 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "substrate-bip39" +version = "0.2.1" +source = "git+https://github.com/paritytech/substrate-bip39#44307fda4ea17fe97aeb93af317fbc8f6ed34193" +dependencies = [ + "hmac 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "pbkdf2 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "schnorrkel 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "sha2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "substrate-client" version = "0.1.0" -source = "git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d#df5e65927780b323482e2e8b5031822f423a032d" +source = "git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a#2ba93e317c637ffee06153e15ca7c39f6812e88a" dependencies = [ "error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", "hash-db 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", - "hex-literal 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "hex-literal 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "kvdb 0.1.0 (git+https://github.com/paritytech/parity-common?rev=b0317f649ab2c665b7987b8475878fc4d2e1f81d)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec-derive 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 3.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-api-macros 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", - "sr-primitives 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", - "sr-std 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", - "sr-version 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", - "substrate-consensus-common 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", - "substrate-executor 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", - "substrate-inherents 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", - "substrate-keyring 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", - "substrate-primitives 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", - "substrate-state-machine 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", - "substrate-telemetry 0.3.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", - "substrate-trie 0.4.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", + "sr-api-macros 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "sr-primitives 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "sr-std 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "sr-version 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "substrate-consensus-common 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "substrate-executor 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "substrate-inherents 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "substrate-keyring 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "substrate-primitives 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "substrate-state-machine 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "substrate-telemetry 0.3.1 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "substrate-trie 0.4.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", ] [[package]] name = "substrate-consensus-aura-primitives" version = "0.1.0" -source = "git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d#df5e65927780b323482e2e8b5031822f423a032d" +source = "git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a#2ba93e317c637ffee06153e15ca7c39f6812e88a" dependencies = [ - "substrate-client 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", + "substrate-client 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", ] [[package]] name = "substrate-consensus-common" version = "0.1.0" -source = "git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d#df5e65927780b323482e2e8b5031822f423a032d" +source = "git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a#2ba93e317c637ffee06153e15ca7c39f6812e88a" dependencies = [ "crossbeam-channel 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p 0.5.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec-derive 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-primitives 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", - "sr-version 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", - "substrate-inherents 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", - "substrate-primitives 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", - "tokio 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 3.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec-derive 3.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sr-primitives 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "sr-version 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "substrate-inherents 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "substrate-primitives 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "tokio 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "substrate-executor" version = "0.1.0" -source = "git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d#df5e65927780b323482e2e8b5031822f423a032d" +source = "git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a#2ba93e317c637ffee06153e15ca7c39f6812e88a" dependencies = [ "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "libsecp256k1 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 3.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-io 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", - "sr-version 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", - "substrate-panic-handler 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", - "substrate-primitives 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", - "substrate-serializer 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", - "substrate-state-machine 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", - "substrate-trie 0.4.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", + "sr-io 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "sr-version 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "substrate-panic-handler 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "substrate-primitives 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "substrate-serializer 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "substrate-state-machine 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "substrate-trie 0.4.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", "tiny-keccak 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)", - "wasmi 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", + "wasmi 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "substrate-inherents" version = "0.1.0" -source = "git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d#df5e65927780b323482e2e8b5031822f423a032d" +source = "git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a#2ba93e317c637ffee06153e15ca7c39f6812e88a" dependencies = [ - "parity-codec 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec-derive 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 3.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-primitives 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", - "sr-std 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", + "sr-primitives 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "sr-std 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", ] [[package]] name = "substrate-keyring" version = "0.1.0" -source = "git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d#df5e65927780b323482e2e8b5031822f423a032d" +source = "git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a#2ba93e317c637ffee06153e15ca7c39f6812e88a" dependencies = [ - "hex-literal 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "hex-literal 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "substrate-primitives 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", + "strum 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", + "strum_macros 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", + "substrate-primitives 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", ] [[package]] name = "substrate-panic-handler" version = "0.1.0" -source = "git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d#df5e65927780b323482e2e8b5031822f423a032d" +source = "git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a#2ba93e317c637ffee06153e15ca7c39f6812e88a" dependencies = [ "backtrace 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1684,35 +2533,38 @@ dependencies = [ [[package]] name = "substrate-primitives" version = "0.1.0" -source = "git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d#df5e65927780b323482e2e8b5031822f423a032d" +source = "git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a#2ba93e317c637ffee06153e15ca7c39f6812e88a" dependencies = [ "base58 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "hash-db 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "hash256-std-hasher 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", - "hex-literal 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "hex-literal 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "impl-serde 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec-derive 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 3.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "primitive-types 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "ring 0.14.6 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-hex 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "schnorrkel 0.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "schnorrkel 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", "sha2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-std 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", + "sr-std 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "substrate-bip39 0.2.1 (git+https://github.com/paritytech/substrate-bip39)", + "tiny-bip39 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "twox-hash 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "untrusted 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", - "wasmi 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", + "wasmi 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "substrate-serializer" version = "0.1.0" -source = "git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d#df5e65927780b323482e2e8b5031822f423a032d" +source = "git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a#2ba93e317c637ffee06153e15ca7c39f6812e88a" dependencies = [ "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1721,29 +2573,32 @@ dependencies = [ [[package]] name = "substrate-state-machine" version = "0.1.0" -source = "git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d#df5e65927780b323482e2e8b5031822f423a032d" +source = "git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a#2ba93e317c637ffee06153e15ca7c39f6812e88a" dependencies = [ "hash-db 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", - "hex-literal 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "hex-literal 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 3.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", - "substrate-panic-handler 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", - "substrate-primitives 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", - "substrate-trie 0.4.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)", + "substrate-panic-handler 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "substrate-primitives 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "substrate-trie 0.4.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", "trie-db 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "trie-root 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "substrate-telemetry" -version = "0.3.0" -source = "git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d#df5e65927780b323482e2e8b5031822f423a032d" +version = "0.3.1" +source = "git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a#2ba93e317c637ffee06153e15ca7c39f6812e88a" dependencies = [ "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", "slog 2.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "slog-async 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "slog-json 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1754,15 +2609,20 @@ dependencies = [ [[package]] name = "substrate-trie" version = "0.4.0" -source = "git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d#df5e65927780b323482e2e8b5031822f423a032d" +source = "git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a#2ba93e317c637ffee06153e15ca7c39f6812e88a" dependencies = [ "hash-db 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "memory-db 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-codec 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 3.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "trie-db 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "trie-root 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "subtle" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "subtle" version = "2.0.0" @@ -1770,11 +2630,22 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "syn" -version = "0.15.27" +version = "0.15.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "synstructure" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.29 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1796,11 +2667,25 @@ name = "time" version = "0.1.42" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.51 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.52 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "tiny-bip39" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "hashbrown 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "hmac 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "once_cell 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "pbkdf2 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", + "sha2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "tiny-keccak" version = "1.4.2" @@ -1809,25 +2694,37 @@ dependencies = [ "crunchy 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "tk-listen" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "tokio" -version = "0.1.16" +version = "0.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", "mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)", "num_cpus 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-current-thread 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-executor 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-current-thread 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-executor 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-fs 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-reactor 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-sync 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-sync 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-tcp 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-threadpool 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-threadpool 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-timer 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-trace-core 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-udp 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-uds 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1838,26 +2735,37 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "tokio-current-thread" -version = "0.1.5" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-executor 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tokio-dns-unofficial" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-executor 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-cpupool 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "tokio-executor" -version = "0.1.6" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1865,9 +2773,9 @@ name = "tokio-fs" version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-threadpool 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-threadpool 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1876,7 +2784,7 @@ version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1886,25 +2794,25 @@ version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)", "num_cpus 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-executor 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-executor 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-sync 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-sync 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "tokio-sync" -version = "0.1.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1913,7 +2821,7 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", "iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1922,18 +2830,18 @@ dependencies = [ [[package]] name = "tokio-threadpool" -version = "0.1.12" +version = "0.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "crossbeam-deque 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "crossbeam-queue 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "num_cpus 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", "slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-executor 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-executor 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1942,9 +2850,17 @@ version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", "slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-executor 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-executor 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tokio-trace-core" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1953,7 +2869,7 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1967,9 +2883,9 @@ version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", "iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)", "mio-uds 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2005,6 +2921,16 @@ dependencies = [ "hash-db 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "twofish" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "block-cipher-trait 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "opaque-debug 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "twox-hash" version = "1.1.2" @@ -2018,6 +2944,11 @@ name = "typenum" version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "ucd-util" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "uint" version = "0.6.1" @@ -2045,11 +2976,25 @@ dependencies = [ "smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "unicode-segmentation" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "unicode-xid" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "unsigned-varint" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "untrusted" version = "0.6.2" @@ -2065,17 +3010,26 @@ dependencies = [ "percent-encoding 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "utf8-ranges" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "vcpkg" version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "void" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "wasmi" -version = "0.4.3" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "memory_units 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "parity-wasm 0.31.3 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2120,7 +3074,7 @@ dependencies = [ "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)", "mio-extras 2.0.5 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl 0.10.19 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl 0.10.20 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2136,23 +3090,68 @@ dependencies = [ "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "x25519-dalek" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "clear_on_drop 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "curve25519-dalek 1.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "yamux" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "nohash-hasher 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", + "quick-error 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "zeroize" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + [metadata] +"checksum aes-ctr 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d2e5b0458ea3beae0d1d8c0f3946564f8e10f90646cf78c06b4351052058d1ee" +"checksum aes-soft 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "cfd7e7ae3f9a1fb5c03b389fc6bb9a51400d0c13053f0dca698c832bfd893a0d" +"checksum aesni 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2f70a6b5f971e473091ab7cfb5ffac6cde81666c4556751d8d5620ead8abf100" +"checksum aho-corasick 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e6f484ae0c99fec2e858eb6134949117399f222608d84cadb3f58c1f97c2364c" +"checksum aio-limited 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7f10b352bc3fc08ae24dc5d2d3ddcac153678533986122dc283d747b12071000" "checksum arrayref 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "0d382e583f07208808f6b1249e60848879ba3543f57c32277bf52d69c2f0f0ee" "checksum arrayvec 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)" = "92c7fb76bc8826a8b33b4ee5bb07a247a81e76764ab4d55e8f73e3a4d8808c71" +"checksum asn1_der 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9893d63fc3b1c44231e667da6836a33f27d8b6b3bdc82f83da5dfd579d1b6528" +"checksum asn1_der_derive 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9e7f92edafad155aff997fa5b727c6429b91e996b5a5d62a2b0adbae1306b5fe" "checksum autocfg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a6d640bee2da49f60a4068a7fae53acde8982514ab7bae8b8cea9e88cbcfd799" "checksum backtrace 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)" = "cd5a90e2b463010cd0e0ce9a11d4a9d5d58d9f41d4a6ba3dcaf9e68b466e88b4" "checksum backtrace-sys 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)" = "797c830ac25ccc92a7f8a7b9862bde440715531514594a6154e3d4a54dd769b6" +"checksum base-x 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "d55aa264e822dbafa12db4d54767aff17c6ba55ea2d8559b3e17392c7d000e5d" "checksum base58 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5024ee8015f02155eee35c711107ddd9a9bf3cb689cf2a9089c97e79b6e1ae83" +"checksum bigint 4.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ebecac13b3c745150d7b6c3ea7572d372f09d627c2077e893bf26c5c7f70d282" "checksum bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "228047a76f468627ca71776ecdebd732a3423081fcf5125585bcd7c49886ce12" +"checksum bitmask 0.5.0 (git+https://github.com/paritytech/bitmask)" = "" +"checksum blake2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "91721a6330935673395a0607df4d49a9cb90ae12d259f1b3e0a3f6e1d486872e" "checksum blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)" = "5d6d530bdd2d52966a6d03b7a964add7ae1a288d25214066fd4b600f0f796400" "checksum block-buffer 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1339a1042f5d9f295737ad4d9a6ab6bf81c84a933dba110b9200cd6d1448b814" "checksum block-buffer 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "49665c62e0e700857531fa5d3763e91b539ff1abeebd56808d378b495870d60d" +"checksum block-cipher-trait 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1c924d49bd09e7c06003acda26cd9742e796e34282ec6c1189404dee0c1f4774" "checksum block-padding 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "d75255892aeb580d3c566f213a2b6fdc1c66667839f45719ee1d30ebf2aea591" +"checksum bs58 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "0de79cfb98e7aa9988188784d8664b4b5dad6eaaa0863b91d9a4ed871d4f7a42" "checksum byte-tools 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "560c32574a12a89ecd91f5e742165893f86e3ab98d21f8ea548658eb9eef5f40" "checksum byte-tools 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7" +"checksum byteorder 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "0fc10e8cc6b2580fda3f36eb6dc5316657f812a3df879a44a66fc9f0fdbc4855" "checksum byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a019b10a2a7cdeb292db131fc8113e57ea2a908f6e7894b0c3c671893b65dbeb" "checksum bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)" = "206fdffcfa2df7cbe15601ef46c813fce0965eb3286db6b56c583b814b51c81c" -"checksum cc 1.0.30 (registry+https://github.com/rust-lang/crates.io-index)" = "d01c69d08ff207f231f07196e30f84c70f1c815b04f980f8b7b01ff01f05eb92" +"checksum cc 1.0.26 (registry+https://github.com/rust-lang/crates.io-index)" = "389803e36973d242e7fecb092b2de44a3d35ac62524b3b9339e51d577d668e02" "checksum cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "11d43355396e872eefb45ce6342e4374ed7bc2b3a502d1b28e36d6e23c05d1f4" "checksum chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "45912881121cb26fad7c38c17ba7daa18764771836b34fab7d3fbd93ed633878" "checksum clear_on_drop 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "97276801e127ffb46b66ce23f35cc96bd454fa311294bced4bbace7baa8b1d17" @@ -2160,22 +3159,33 @@ dependencies = [ "checksum constant_time_eq 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8ff012e225ce166d4422e0e78419d901719760f62ae2b7969ca6b564d1b54a9e" "checksum crossbeam 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ad4c7ea749d9fb09e23c5cb17e3b70650860553a0e2744e38446b1803bf7db94" "checksum crossbeam-channel 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "0f0ed1a4de2235cabda8558ff5840bffb97fcb64c97827f354a451307df5f72b" +"checksum crossbeam-deque 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f739f8c5363aca78cfb059edf753d8f0d36908c348f3d8d1503f03d8b75d9cf3" "checksum crossbeam-deque 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "05e44b8cf3e1a625844d1750e1f7820da46044ff6d28f4d43e455ba3e5bb2c13" "checksum crossbeam-deque 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b18cd2e169ad86297e6bc0ad9aa679aee9daa4f19e8163860faf7c164e4f5a71" +"checksum crossbeam-epoch 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "927121f5407de9956180ff5e936fe3cf4324279280001cd56b669d28ee7e9150" "checksum crossbeam-epoch 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "04c9e3102cc2d69cd681412141b390abd55a362afc1540965dad0ad4d34280b4" "checksum crossbeam-queue 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7c979cd6cfe72335896575c6b5688da489e420d36a27a0b9eb0c73db574b4a4b" +"checksum crossbeam-utils 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "2760899e32a1d58d5abb31129f8fae5de75220bc2176e77ff7c627ae45c918d9" "checksum crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "f8306fcef4a7b563b76b7dd949ca48f52bc1141aa067d2ea09565f3e2652aa5c" "checksum crunchy 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "a2f4a431c5c9f662e1200b7c7f02c34e91361150e382089a8f2dec3ba680cbda" "checksum crunchy 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c240f247c278fa08a6d4820a6a222bfc6e0d999e51ba67be94f44c905b2161f2" "checksum crypto-mac 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "779015233ac67d65098614aec748ac1c756ab6677fa2e14cf8b37c08dfed1198" +"checksum crypto-mac 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4434400df11d95d556bac068ddfedd482915eb18fe8bea89bc80b6e4b1c179e5" +"checksum ctr 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "022cd691704491df67d25d006fe8eca083098253c4d43516c2206479c58c6736" +"checksum cuckoofilter 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "8dd43f7cfaffe0a386636a10baea2ee05cc50df3b77bea4a456c9572a939bf1f" "checksum curve25519-dalek 1.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e1f8a6fc0376eb52dc18af94915cc04dfdf8353746c0e8c550ae683a0815e5c1" +"checksum data-encoding 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f4f47ca1860a761136924ddd2422ba77b2ea54fe8cc75b9040804a0d9d32ad97" "checksum digest 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e5b29bf156f3f4b3c4f610a25ff69370616ae6e0657d416de22645483e72af0a" "checksum digest 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "05f47366984d3ad862010e22c7ce81a7dbcaebbdfb37241a620f8b6596ee135c" +"checksum discard 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "212d0f5754cb6769937f4501cc0e67f4f4483c8d2c3e1e922ee9edbe4ab4c7c0" +"checksum dns-parser 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c4d33be9473d06f75f58220f71f7a9317aca647dc061dbd3c361b0bef505fbea" "checksum ed25519-dalek 1.0.0-pre.1 (registry+https://github.com/rust-lang/crates.io-index)" = "81956bcf7ef761fb4e1d88de3fa181358a0d26cbcb9755b587a08f9119824b86" +"checksum either 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c67353c641dc847124ea1902d69bd753dee9bb3beff9aa3662ecf86c971d1fac" "checksum elastic-array 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)" = "073be79b6538296faf81c631872676600616073817dd9a440c477ad09b408983" -"checksum environmental 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "db746025e3ea695bfa0ae744dbacd5fcfc8db51b9760cf8bd0ab69708bb93c49" +"checksum environmental 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "5c7464757b80de8930c91c9afe77ddce501826bf9d134a87db2c67d9dc177e2c" "checksum error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "07e791d3be96241c77c43846b665ef1384606da2cd2a48730abe606a12906e02" "checksum failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "795bd83d3abeb9220f257e597aa0080a508b27533824adf336529648f6abf7e2" +"checksum failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "ea1063915fd7ef4309e222a5a07cf9c319fb9c7836b1f89b85458672dbb127e1" "checksum fake-simd 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" "checksum fixed-hash 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a557e80084b05c32b455963ff565a9de6f2866da023d6671705c6aff6f65e01c" "checksum fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "2fad85553e09a6f881f739c29f0b00b0f01357c743266d478b68951ce23285f3" @@ -2184,15 +3194,20 @@ dependencies = [ "checksum fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" "checksum fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" "checksum fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" -"checksum futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)" = "49e7653e374fe0d0c12de4250f0bdb60680b8c80eed558c5c7538eec9c89e21b" +"checksum futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)" = "62941eff9507c8177d448bd83a44d9b9760856e184081d8cd79ba9f03dd24981" +"checksum futures-cpupool 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "ab90cde24b3319636588d0c35fe03b1333857621051837ed769faefb4c2162e4" "checksum generic-array 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3c0f28c2f5bfb5960175af447a2da7c18900693738343dc896ffbcabd9839592" "checksum generic-array 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)" = "fceb69994e330afed50c93524be68c42fa898c2d9fd4ee8da03bd7363acd26f2" "checksum hash-db 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1b03501f6e1a2a97f1618879aba3156f14ca2847faa530c4e28859638bd11483" "checksum hash256-std-hasher 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f5c13dbac3cc50684760f54af18545c9e80fb75e93a3e586d71ebdc13138f6a4" +"checksum hashbrown 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "3bae29b6653b3412c2e71e9d486db9f9df5d701941d86683005efb9f2d28e3da" "checksum heapsize 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1679e6ea370dee694f91f1dc469bf94cf8f52051d147aec3e1f9497c6fc22461" -"checksum hex-literal 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "27455ce8b4a6666c87220e4b59c9a83995476bdadc10197905e61dbe906e36fa" -"checksum hex-literal-impl 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1d340b6514f232f6db1bd16db65302a5278a04fef9ce867cb932e7e5fa21130a" +"checksum heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "20564e78d53d2bb135c343b3f47714a56af2061f1c928fdb541dc7b9fdd94205" +"checksum hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "805026a5d0141ffc30abb3be3173848ad46a1b1664fe632428479619a3644d77" +"checksum hex-literal 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "ddc2928beef125e519d69ae1baa8c37ea2e0d3848545217f6db0179c5eb1d639" +"checksum hex-literal-impl 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "520870c3213943eb8d7803e80180d12a6c7ceb4ae74602544529d1643dc4ddda" "checksum hmac 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7a13f4163aa0c5ca1be584aace0e2212b2e41be5478218d4f657f5f778b2ae2a" +"checksum hmac 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f127a908633569f208325f86f71255d3363c79721d7f9fe31cd5569908819771" "checksum hmac-drbg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4fe727d41d2eec0a6574d887914347e5ff96a3b87177817e2a9820c5c87fecc2" "checksum httparse 1.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e8734b0cfd3bc3e101ec59100e101c2eecd19282202e87808b3037b442777a83" "checksum idna 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "38f09e0f0b1fb55fdee1f17470ad800da77af5186a1a76c026b679358b7e844e" @@ -2206,11 +3221,29 @@ dependencies = [ "checksum kvdb 0.1.0 (git+https://github.com/paritytech/parity-common?rev=b0317f649ab2c665b7987b8475878fc4d2e1f81d)" = "" "checksum lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bc5729f27f159ddd61f4df6228e827e86643d4d3e7c32183cb30a1c08f604a14" "checksum lazycell 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b294d6fa9ee409a054354afc4352b0b9ef7ca222c69b8812cbea9e7d2bf3783f" -"checksum libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)" = "aab692d7759f5cd8c859e169db98ae5b52c924add2af5fbbca11d12fefb567c1" +"checksum libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)" = "bedcc7a809076656486ffe045abeeac163da1b558e963a31e29fbfbeba916917" +"checksum libp2p 0.5.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)" = "" +"checksum libp2p-core 0.5.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)" = "" +"checksum libp2p-core-derive 0.5.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)" = "" +"checksum libp2p-dns 0.5.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)" = "" +"checksum libp2p-floodsub 0.5.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)" = "" +"checksum libp2p-identify 0.5.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)" = "" +"checksum libp2p-kad 0.5.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)" = "" +"checksum libp2p-mdns 0.5.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)" = "" +"checksum libp2p-mplex 0.5.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)" = "" +"checksum libp2p-noise 0.3.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)" = "" +"checksum libp2p-ping 0.5.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)" = "" +"checksum libp2p-plaintext 0.5.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)" = "" +"checksum libp2p-ratelimit 0.5.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)" = "" +"checksum libp2p-secio 0.5.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)" = "" +"checksum libp2p-tcp 0.5.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)" = "" +"checksum libp2p-uds 0.5.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)" = "" +"checksum libp2p-yamux 0.5.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)" = "" "checksum libsecp256k1 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "688e8d65e495567c2c35ea0001b26b9debf0b4ea11f8cccc954233b75fc3428a" "checksum lock_api 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "62ebf1391f6acad60e5c8b43706dde4582df75c06698ab44511d15016bc2442c" "checksum log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c84ec4b527950aa83a329754b01dbe3f58361d1c5efacd1f6d68c494d08a17c6" "checksum matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08" +"checksum memchr 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2efc7bc57c883d4a4d6e3246905283d8dae951bb3bd32f49d6ef297f546e1c39" "checksum memoffset 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0f9dc261e2b62d7a622bf416ea3c5245cdd5d9a7fcc428c0d06804dfce1775b3" "checksum memory-db 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "94da53143d45f6bad3753f532e56ad57a6a26c0ca6881794583310c7cb4c885f" "checksum memory_units 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "71d96e3f3c0b6325d8ccd83c33b28acb183edcb6c67938ba104ec546854b0882" @@ -2219,24 +3252,34 @@ dependencies = [ "checksum mio-extras 2.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "46e73a04c2fa6250b8d802134d56d554a9ec2922bf977777c805ea5def61ce40" "checksum mio-uds 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)" = "966257a94e196b11bb43aca423754d87429960a768de9414f3691d6957abf125" "checksum miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f2f3b1cf331de6896aabf6e9d55dca90356cc9960cca7eaaf408a355ae919" +"checksum multistream-select 0.3.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)" = "" "checksum net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)" = "42550d9fb7b6684a6d404d9fa7250c2eb2646df731d1c06afc06dcee9e1bcf88" "checksum nodrop 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "2f9667ddcc6cc8a43afc9b7917599d7216aa09c463919ea32c59ed6cac8bc945" +"checksum nohash-hasher 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0d138afcce92d219ccb6eb53d9b1e8a96ac0d633cfd3c53cd9856d96d1741bb8" "checksum num-integer 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)" = "e83d528d2677f0518c570baf2b7abdcf0cd2d248860b68507bdcb3e91d4c0cea" "checksum num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0b3a5d7cc97d6d30d8b9bc8fa19bf45349ffe46241e8816f50f62f6d6aaabee1" "checksum num_cpus 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1a23f0ed30a54abaa0c7e83b1d2d87ada7c3c23078d1d87815af3e3b6385fbba" "checksum once_cell 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "532c29a261168a45ce28948f9537ddd7a5dd272cc513b3017b1e82a88f962c37" "checksum opaque-debug 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "93f5bb2e8e8dec81642920ccff6b61f1eb94fa3020c5a325c9851ff604152409" -"checksum openssl 0.10.19 (registry+https://github.com/rust-lang/crates.io-index)" = "84321fb9004c3bce5611188a644d6171f895fa2889d155927d528782edb21c5d" -"checksum openssl-sys 0.9.42 (registry+https://github.com/rust-lang/crates.io-index)" = "cb534d752bf98cf363b473950659ac2546517f9c6be9723771614ab3f03bbc9e" +"checksum openssl 0.10.20 (registry+https://github.com/rust-lang/crates.io-index)" = "5a0d6b781aac4ac1bd6cafe2a2f0ad8c16ae8e1dd5184822a16c50139f8838d9" +"checksum openssl-sys 0.9.43 (registry+https://github.com/rust-lang/crates.io-index)" = "33c86834957dd5b915623e94f2f4ab2c70dd8f6b70679824155d5ae21dbd495d" +"checksum owning_ref 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "cdf84f41639e037b484f93433aa3897863b561ed65c6e59c7073d7c561710f37" "checksum owning_ref 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "49a4b8ea2179e6a2e27411d3bca09ca6dd630821cf6894c6c7c8467a8ee7ef13" "checksum parity-bytes 0.1.0 (git+https://github.com/paritytech/parity-common?rev=b0317f649ab2c665b7987b8475878fc4d2e1f81d)" = "" -"checksum parity-codec 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "67a4d27831e31e27f1454d6e3d3bb34bcac6bf7ad7032eed0ad0070dc8cf55c1" -"checksum parity-codec-derive 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "864e9f66b58c0b38f0d6b511b6576afa2b678ae801b64220553bced57ac12df9" +"checksum parity-codec 3.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0333b2a2973e75c3b4a9bc2a7b28dceacb56e3949907b4ce113ff3a53bcc6713" +"checksum parity-codec-derive 3.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "be90eb3f1b4c02a478ccee3e0e64e5152692e7871c7258d2aa8e356359325aa7" +"checksum parity-multiaddr 0.2.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)" = "" +"checksum parity-multihash 0.1.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)" = "" "checksum parity-wasm 0.31.3 (registry+https://github.com/rust-lang/crates.io-index)" = "511379a8194230c2395d2f5fa627a5a7e108a9f976656ce723ae68fca4097bfc" +"checksum parking_lot 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)" = "d4d05f1349491390b1730afba60bb20d55761bef489a954546b58b4b34e1e2ac" +"checksum parking_lot 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "f0802bff09003b291ba756dc7e79313e51cc31667e94afbe847def490424cde5" "checksum parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ab41b4aed082705d1056416ae4468b6ea99d52599ecf3169b00088d43113e337" +"checksum parking_lot_core 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "4db1a8ccf734a7bce794cc19b3df06ed87ab2f3907036b693c68f56b4d4537fa" +"checksum parking_lot_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ad7f7e6ebdc79edff6fdcb87a55b620174f7a989e3eb31b65231f4af57f00b8c" "checksum parking_lot_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "94c8c7923936b28d546dfd14d4472eaf34c99b14e1c973a32b3e6d4eb04298c9" -"checksum paste 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "f50392d1265092fbee9273414cc40eb6d47d307bd66222c477bb8450c8504f9d" -"checksum paste-impl 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "a3cd512fe3a55e8933b2dcad913e365639db86d512e4004c3084b86864d9467a" +"checksum paste 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "1f4a4a1c555c6505821f9d58b8779d0f630a6b7e4e1be24ba718610acf01fa79" +"checksum paste-impl 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "26e796e623b8b257215f27e6c80a5478856cae305f5b59810ff9acdaa34570e6" +"checksum pbkdf2 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "006c038a43a45995a9670da19e67600114740e8511d4333bf97a56e66a7542d9" "checksum percent-encoding 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "31010dd2e1ac33d5b46a5b413495239882813e0369f8ed8a5e266f173602f831" "checksum pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)" = "676e8eb2b1b4c9043511a9b7bea0915320d7e502b0a079fb03f9635a5252b18c" "checksum primitive-types 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "edb92f1ebfc177432c03287b15d48c202e6e2c95993a7af3ba039abb43b1492e" @@ -2245,7 +3288,11 @@ dependencies = [ "checksum proc-macro-hack 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)" = "3e90aa19cd73dedc2d0e1e8407473f073d735fef0ab521438de6da8ee449ab66" "checksum proc-macro-hack-impl 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2b753ad9ed99dd8efeaa7d2fb8453c8f6bc3e54b97966d35f1bc77ca6865254a" "checksum proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)" = "4d317f9caece796be1980837fd5cb3dfec5613ebdb04ad0956deea83ce168915" +"checksum protobuf 2.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "524d165d95627ddebba768db728216c4429bbb62882f7e6ab1a6c3c54a7ed830" +"checksum quick-error 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "5fb6ccf8db7bbcb9c2eae558db5ab4f3da1c2a87e4e597ed394726bc8ea6ca1d" +"checksum quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9274b940887ce9addde99c4eee6b5c44cc494b182b97e73dc8ffdcb3397fd3f0" "checksum quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)" = "cdd8e04bd9c52e0342b406469d494fcb033be4bdbe5c606016defbb1681411e1" +"checksum rand 0.3.23 (registry+https://github.com/rust-lang/crates.io-index)" = "64ac302d8f83c0c1974bf758f6b041c6c8ada916fbb44a609158ca8b064cc76c" "checksum rand 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "552840b97013b1a26992c11eac34bdd778e464601a4c2054b5f0bff7c6761293" "checksum rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c618c47cd3ebd209790115ab837de41425723956ad3ce2e6a7f09890947cacb9" "checksum rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "6d71dacdc3c88c1fde3885a3be3fbab9f35724e6ce99467f7d9c5026132184ca" @@ -2258,16 +3305,22 @@ dependencies = [ "checksum rand_os 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "7b75f676a1e053fc562eafbb47838d67c84801e38fc1ba459e8f180deabd5071" "checksum rand_pcg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "abf9b09b01790cfe0364f52bf32995ea3c39f4d2dd011eac241d2914146d0b44" "checksum rand_xorshift 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cbf7e9e623549b0e21f6e97cf8ecf247c1a8fd2e8a992ae265314300b2455d5c" +"checksum rayon 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "373814f27745b2686b350dd261bfd24576a6fb0e2c5919b3a2b6005f820b0473" +"checksum rayon-core 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b055d1e92aba6877574d8fe604a63c8b5df60f60e5982bf7ccbb1338ea527356" "checksum rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2" -"checksum redox_syscall 0.1.51 (registry+https://github.com/rust-lang/crates.io-index)" = "423e376fffca3dfa06c9e9790a9ccd282fafb3cc6e6397d01dbf64f9bacc6b85" +"checksum redox_syscall 0.1.52 (registry+https://github.com/rust-lang/crates.io-index)" = "d32b3053e5ced86e4bc0411fec997389532bf56b000e66cb4884eeeb41413d69" +"checksum regex 1.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "559008764a17de49a3146b234641644ed37d118d1ef641a0bb573d146edc6ce0" +"checksum regex-syntax 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)" = "dcfd8681eebe297b81d98498869d4aae052137651ad7b96822f09ceb690d0a96" "checksum ring 0.14.6 (registry+https://github.com/rust-lang/crates.io-index)" = "426bc186e3e95cac1e4a4be125a4aca7e84c2d616ffc02244eef36e2a60a093c" "checksum rustc-demangle 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "adacaae16d02b6ec37fdc7acfcddf365978de76d1983d3ee22afc260e1ca9619" "checksum rustc-hex 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "403bb3a286107a04825a5f82e1270acc1e14028d3d554d7a1e08914549575ab8" "checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" +"checksum rw-stream-sink 0.1.1 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)" = "" "checksum ryu 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "eb9e9b8cde282a9fe6a42dd4681319bfb63f121b8a8ee9439c6f4107e58a46f7" "checksum safe-mix 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7f7bf422d23a88c16d5090d455f182bc99c60af4df6a345c63428acf5129e347" -"checksum schnorrkel 0.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fe554f318830b48e5da8ab1ccb1ffd02b79228364dac7766b7cd1ec461ca5116" +"checksum schnorrkel 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b5eff518f9bed3d803a0d002af0ab96339b0ebbedde3bec98a684986134b7a39" "checksum scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "94258f53601af11e6a49f722422f6e3425c52b06245a5cf9bc09908b174f5e27" +"checksum secp256k1 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)" = "bfaccd3a23619349e0878d9a241f34b1982343cdf67367058cd7d078d326b63e" "checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" "checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" "checksum serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)" = "92514fb95f900c9b5126e32d020f5c6d40564c27a5ea6d1d7d9f157a96623560" @@ -2283,74 +3336,95 @@ dependencies = [ "checksum slog-json 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ddc0d2aff1f8f325ef660d9a0eb6e6dcd20b30b3f581a5897f58bf42d061c37a" "checksum slog-scope 4.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "60c04b4726fa04595ccf2c2dad7bcd15474242c4c5e109a8a376e8a2c9b1539a" "checksum smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)" = "c4488ae950c49d403731982257768f48fada354a5203fe81f9bb6f43ca9002be" +"checksum snow 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "5a64f02fd208ef15bd2d1a65861df4707e416151e1272d02c8faafad1c138100" "checksum spin 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "44363f6f51401c34e7be73db0db371c04705d35efbe9f7d6082e03a921a32c55" -"checksum sr-api-macros 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)" = "" -"checksum sr-io 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)" = "" -"checksum sr-primitives 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)" = "" -"checksum sr-std 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)" = "" -"checksum sr-version 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)" = "" -"checksum srml-aura 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)" = "" -"checksum srml-balances 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)" = "" -"checksum srml-consensus 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)" = "" -"checksum srml-executive 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)" = "" -"checksum srml-fees 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)" = "" -"checksum srml-indices 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)" = "" -"checksum srml-metadata 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)" = "" -"checksum srml-session 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)" = "" -"checksum srml-staking 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)" = "" -"checksum srml-sudo 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)" = "" -"checksum srml-support 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)" = "" -"checksum srml-support-procedural 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)" = "" -"checksum srml-support-procedural-tools 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)" = "" -"checksum srml-support-procedural-tools-derive 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)" = "" -"checksum srml-system 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)" = "" -"checksum srml-timestamp 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)" = "" +"checksum sr-api-macros 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)" = "" +"checksum sr-io 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)" = "" +"checksum sr-primitives 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)" = "" +"checksum sr-std 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)" = "" +"checksum sr-version 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)" = "" +"checksum srml-aura 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)" = "" +"checksum srml-balances 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)" = "" +"checksum srml-consensus 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)" = "" +"checksum srml-executive 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)" = "" +"checksum srml-indices 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)" = "" +"checksum srml-metadata 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)" = "" +"checksum srml-session 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)" = "" +"checksum srml-staking 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)" = "" +"checksum srml-sudo 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)" = "" +"checksum srml-support 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)" = "" +"checksum srml-support-procedural 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)" = "" +"checksum srml-support-procedural-tools 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)" = "" +"checksum srml-support-procedural-tools-derive 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)" = "" +"checksum srml-system 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)" = "" +"checksum srml-timestamp 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)" = "" "checksum stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dba1a27d3efae4351c8051072d619e3ade2820635c3958d826bfea39d59b54c8" "checksum static_assertions 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "c19be23126415861cb3a23e501d34a708f7f9b2183c5252d690941c2e69199d5" -"checksum substrate-client 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)" = "" -"checksum substrate-consensus-aura-primitives 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)" = "" -"checksum substrate-consensus-common 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)" = "" -"checksum substrate-executor 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)" = "" -"checksum substrate-inherents 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)" = "" -"checksum substrate-keyring 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)" = "" -"checksum substrate-panic-handler 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)" = "" -"checksum substrate-primitives 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)" = "" -"checksum substrate-serializer 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)" = "" -"checksum substrate-state-machine 0.1.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)" = "" -"checksum substrate-telemetry 0.3.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)" = "" -"checksum substrate-trie 0.4.0 (git+https://github.com/joystream/substrate.git?rev=df5e65927780b323482e2e8b5031822f423a032d)" = "" +"checksum static_slice 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "92a7e0c5e3dfb52e8fbe0e63a1b947bbb17b4036408b151353c4491374931362" +"checksum stdweb 0.4.15 (registry+https://github.com/rust-lang/crates.io-index)" = "a3edad410e603184d656e2abded5fd4d3d6e93d5763d21130dbaf99795db74eb" +"checksum stdweb-derive 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0e21ebd9179de08f2300a65454268a17ea3de204627458588c84319c4def3930" +"checksum stdweb-internal-macros 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "1635afd059cbfac7d5b1274f0c44cec110c1e013c48e8bbc22e07e52696cf887" +"checksum stdweb-internal-runtime 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a2a2f4a2eb556337b2d1a302630bbddf989ae383c70393e89b48152b9896cbda" +"checksum stream-cipher 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8861bc80f649f5b4c9bd38b696ae9af74499d479dbfb327f0607de6b326a36bc" +"checksum strum 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1810e25f576e7ffce1ff5243b37066da5ded0310b3274c20baaeccb1145b2806" +"checksum strum_macros 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)" = "572a2f4e53dd4c3483fd79e5cc10ddd773a3acb1169bbfe8762365e107110579" +"checksum substrate-bip39 0.2.1 (git+https://github.com/paritytech/substrate-bip39)" = "" +"checksum substrate-client 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)" = "" +"checksum substrate-consensus-aura-primitives 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)" = "" +"checksum substrate-consensus-common 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)" = "" +"checksum substrate-executor 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)" = "" +"checksum substrate-inherents 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)" = "" +"checksum substrate-keyring 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)" = "" +"checksum substrate-panic-handler 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)" = "" +"checksum substrate-primitives 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)" = "" +"checksum substrate-serializer 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)" = "" +"checksum substrate-state-machine 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)" = "" +"checksum substrate-telemetry 0.3.1 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)" = "" +"checksum substrate-trie 0.4.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)" = "" +"checksum subtle 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2d67a5a62ba6e01cb2192ff309324cb4875d0c451d55fe2319433abe7a05a8ee" "checksum subtle 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "702662512f3ddeb74a64ce2fbbf3707ee1b6bb663d28bb054e0779bbc720d926" -"checksum syn 0.15.27 (registry+https://github.com/rust-lang/crates.io-index)" = "525bd55255f03c816e5d7f615587bd13030c7103354fadb104993dcee6a788ec" +"checksum syn 0.15.29 (registry+https://github.com/rust-lang/crates.io-index)" = "1825685f977249735d510a242a6727b46efe914bb67e38d30c071b1b72b1d5c2" +"checksum synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "73687139bf99285483c96ac0add482c3776528beac1d97d444f6e91f203a2015" "checksum take_mut 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f764005d11ee5f36500a149ace24e00e3da98b0158b3e2d53a7495660d3f4d60" "checksum thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b" "checksum time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f" +"checksum tiny-bip39 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f5388a470627f97a01a6e13389ced797a42b1611f9de7e0f6ca705675ac55297" "checksum tiny-keccak 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e9175261fbdb60781fcd388a4d6cc7e14764a2b629a7ad94abb439aed223a44f" -"checksum tokio 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "fcaabb3cec70485d0df6e9454fe514393ad1c4070dee8915f11041e95630b230" +"checksum tk-listen 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "5462b0f968c0457efe38fcd2df7e487096b992419e4f5337b06775a614bbda4b" +"checksum tokio 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)" = "65641e515a437b308ab131a82ce3042ff9795bef5d6c5a9be4eb24195c417fd9" "checksum tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "5c501eceaf96f0e1793cf26beb63da3d11c738c4a943fdf3746d81d64684c39f" -"checksum tokio-current-thread 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "c756b04680eea21902a46fca4e9f410a2332c04995af590e07ff262e2193a9a3" -"checksum tokio-executor 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "30c6dbf2d1ad1de300b393910e8a3aa272b724a400b6531da03eed99e329fbf0" +"checksum tokio-current-thread 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "d16217cad7f1b840c5a97dfb3c43b0c871fef423a6e8d2118c604e843662a443" +"checksum tokio-dns-unofficial 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "82c65483db54eb91b4ef3a9389a3364558590faf30ce473141707c0e16fda975" +"checksum tokio-executor 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "83ea44c6c0773cc034771693711c35c677b4b5a4b21b9e7071704c54de7d555e" "checksum tokio-fs 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "3fe6dc22b08d6993916647d108a1a7d15b9cd29c4f4496c62b92c45b5041b7af" "checksum tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)" = "5090db468dad16e1a7a54c8c67280c5e4b544f3d3e018f0b913b400261f85926" "checksum tokio-reactor 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "6af16bfac7e112bea8b0442542161bfc41cbfa4466b580bdda7d18cb88b911ce" -"checksum tokio-sync 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "1bf2b9dac2a0509b5cfd1df5aa25eafacb616a42a491a13604d6bbeab4486363" +"checksum tokio-sync 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "fda385df506bf7546e70872767f71e81640f1f251bdf2fd8eb81a0eaec5fe022" "checksum tokio-tcp 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "1d14b10654be682ac43efee27401d792507e30fd8d26389e1da3b185de2e4119" -"checksum tokio-threadpool 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)" = "742e511f6ce2298aeb86fc9ea0d8df81c2388c6ebae3dc8a7316e8c9df0df801" +"checksum tokio-threadpool 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "ec5759cf26cf9659555f36c431b515e3d05f66831741c85b4b5d5dfb9cf1323c" "checksum tokio-timer 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)" = "2910970404ba6fa78c5539126a9ae2045d62e3713041e447f695f41405a120c6" +"checksum tokio-trace-core 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "350c9edade9830dc185ae48ba45667a445ab59f6167ef6d0254ec9d2430d9dd3" "checksum tokio-udp 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "66268575b80f4a4a710ef83d087fdfeeabdce9b74c797535fbac18a2cb906e92" "checksum tokio-uds 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "037ffc3ba0e12a0ab4aca92e5234e0dedeb48fddf6ccd260f1f150a36a9f2445" "checksum toml 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)" = "758664fc71a3a69038656bee8b6be6477d2a6c315a6b81f7081f591bffa4111f" "checksum trie-db 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3c7319e28ca295f27359d944a682f7f65b419158bf1590c92cadc0000258d788" "checksum trie-root 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e3c6fef2705af3258ec46a7e22286090394a44216201a1cf7d04b78db825e543" +"checksum twofish 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712d261e83e727c8e2dbb75dacac67c36e35db36a958ee504f2164fc052434e1" "checksum twox-hash 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "555cd4909480122bbbf21e34faac4cb08a171f324775670447ed116726c474af" "checksum typenum 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "612d636f949607bdf9b123b4a6f6d966dedf3ff669f7f045890d3a4a73948169" +"checksum ucd-util 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "535c204ee4d8434478593480b8f86ab45ec9aae0e83c568ca81abf0fd0e88f86" "checksum uint 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e7780bb27fd8a22295e0d9d53ae3be253f715a0dccb1808527f478f1c2603708" "checksum unicode-bidi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "49f2bd0c6468a8230e1db229cff8029217cf623c767ea5d60bfbd42729ea54d5" "checksum unicode-normalization 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "141339a08b982d942be2ca06ff8b076563cbe223d1befd5450716790d44e2426" +"checksum unicode-segmentation 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "aa6024fc12ddfd1c6dbc14a80fa2324d4568849869b779f6bd37e5e4c03344d1" "checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" +"checksum unsigned-varint 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "2c64cdf40b4a9645534a943668681bcb219faf51874d4b65d2e0abda1b10a2ab" "checksum untrusted 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "55cd1f4b4e96b46aeb8d4855db4a7a9bd96eeeb5c6a1ab54593328761642ce2f" "checksum url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dd4e7c0d531266369519a4aa4f399d748bd37043b00bde1e4ff1f60a120b355a" +"checksum utf8-ranges 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "796f7e48bef87609f7ade7e06495a87d5cd06c7866e6a5cbfceffc558a243737" "checksum vcpkg 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "def296d3eb3b12371b2c7d0e83bfe1403e4db2d7a0bba324a12b21c4ee13143d" -"checksum wasmi 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "21ef487a11df1ed468cf613c78798c26282da5c30e9d49f824872d4c77b47d1d" +"checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" +"checksum wasmi 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "f6a891b45c79e9f96fb66cc84a057211ef9cd2e5e8d093f3dbbd480e146a8758" "checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" "checksum winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "92c1eb33641e276cfa214a0522acad57be5c56b10cb348b3c5117db75f3ac4b0" "checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" @@ -2358,3 +3432,6 @@ dependencies = [ "checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" "checksum ws 0.7.9 (registry+https://github.com/rust-lang/crates.io-index)" = "329d3e6dd450a9c5c73024e1047f0be7e24121a68484eb0b5368977bee3cf8c3" "checksum ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e" +"checksum x25519-dalek 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7ee1585dc1484373cbc1cee7aafda26634665cf449436fd6e24bfd1fad230538" +"checksum yamux 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "302defd1bed8a9a6d43b82f0e5a50510dfdfbbd02c270c93ff9d6f3f5e2dea89" +"checksum zeroize 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "8ddfeb6eee2fb3b262ef6e0898a52b7563bb8e0d5955a313b3cf2f808246ea14" From fc6149b84a8e435fb41de4291d98b0b8f8cb5690 Mon Sep 17 00:00:00 2001 From: Jens Finkhaeuser Date: Tue, 2 Apr 2019 14:19:37 +0200 Subject: [PATCH 121/175] Mock other storage in storage/ subdirectory --- src/storage/mock.rs | 57 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 56 insertions(+), 1 deletion(-) diff --git a/src/storage/mock.rs b/src/storage/mock.rs index 0397077222..a47c3e6640 100644 --- a/src/storage/mock.rs +++ b/src/storage/mock.rs @@ -1,6 +1,6 @@ #![cfg(test)] -pub use super::{data_directory, data_object_type_registry}; +pub use super::{data_directory, data_object_storage_registry, data_object_type_registry}; use crate::traits; use rstd::prelude::*; use runtime_io::with_externalities; @@ -23,6 +23,7 @@ impl_outer_event! { pub enum MetaEvent for Test { data_object_type_registry, data_directory, + data_object_storage_registry, } } @@ -52,6 +53,19 @@ impl traits::IsActiveDataObjectType } } +pub struct AnyContentIdExists {} +impl traits::ContentIdExists for AnyContentIdExists { + fn has_content(which: &T::ContentId) -> bool { + true + } + + fn get_data_object( + which: &T::ContentId, + ) -> Result, &'static str> { + Err("not implemented!") + } +} + // For testing the module, we construct most of a mock runtime. This means // first constructing a configuration type (`Test`) which `impl`s each of the // configuration traits of modules we want to use. @@ -83,6 +97,13 @@ impl data_directory::Trait for Test { type IsActiveDataObjectType = AnyDataObjectTypeIsActive; } +impl data_object_storage_registry::Trait for Test { + type Event = MetaEvent; + type DataObjectStorageRelationshipId = u64; + type Members = AnyAccountIsMember; + type ContentIdExists = AnyContentIdExists; +} + impl timestamp::Trait for Test { type Moment = u64; type OnTimestampSet = (); @@ -96,12 +117,16 @@ impl consensus::Trait for Test { pub struct ExtBuilder { first_data_object_type_id: u64, + first_content_id: u64, + first_relationship_id: u64, } impl Default for ExtBuilder { fn default() -> Self { Self { first_data_object_type_id: 1, + first_content_id: 2, + first_relationship_id: 3, } } } @@ -111,6 +136,14 @@ impl ExtBuilder { self.first_data_object_type_id = first_data_object_type_id; self } + pub fn first_content_id(mut self, first_content_id: u64) -> Self { + self.first_content_id = first_content_id; + self + } + pub fn first_relationship_id(mut self, first_relationship_id: u64) -> Self { + self.first_relationship_id = first_relationship_id; + self + } pub fn build(self) -> runtime_io::TestExternalities { let mut t = system::GenesisConfig::::default() .build_storage() @@ -126,6 +159,24 @@ impl ExtBuilder { .0, ); + t.extend( + data_directory::GenesisConfig:: { + first_content_id: self.first_content_id, + } + .build_storage() + .unwrap() + .0, + ); + + t.extend( + data_object_storage_registry::GenesisConfig:: { + first_relationship_id: self.first_relationship_id, + } + .build_storage() + .unwrap() + .0, + ); + t.into() } } @@ -137,10 +188,14 @@ pub type TestDataDirectory = data_directory::Module; pub type TestDataObject = data_directory::DataObject; pub const TEST_FIRST_DATA_OBJECT_TYPE_ID: u64 = 1000; +pub const TEST_FIRST_CONTENT_ID: u64 = 2000; +pub const TEST_FIRST_RELATIONSHIP_ID: u64 = 3000; pub fn with_default_mock_builder R>(f: F) -> R { with_externalities( &mut ExtBuilder::default() .first_data_object_type_id(TEST_FIRST_DATA_OBJECT_TYPE_ID) + .first_content_id(TEST_FIRST_CONTENT_ID) + .first_relationship_id(TEST_FIRST_RELATIONSHIP_ID) .build(), || f(), ) From a6e3e29a34dcb6b6db6e2b0e0e57cbfa67bb34cc Mon Sep 17 00:00:00 2001 From: Jens Finkhaeuser Date: Tue, 2 Apr 2019 14:37:23 +0200 Subject: [PATCH 122/175] Thanks to @mnaamani, found a way to mock the data directory. That means better tests, yay! --- src/storage/mock.rs | 36 ++++++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/src/storage/mock.rs b/src/storage/mock.rs index a47c3e6640..133e14abbf 100644 --- a/src/storage/mock.rs +++ b/src/storage/mock.rs @@ -27,8 +27,8 @@ impl_outer_event! { } } -pub struct AnyAccountIsMember {} -impl traits::Members for AnyAccountIsMember { +pub struct MockMembers {} +impl traits::Members for MockMembers { type Id = u64; fn is_active_member(_who: &T::AccountId) -> bool { @@ -53,16 +53,28 @@ impl traits::IsActiveDataObjectType } } -pub struct AnyContentIdExists {} -impl traits::ContentIdExists for AnyContentIdExists { - fn has_content(which: &T::ContentId) -> bool { - true +pub struct MockContent {} +impl traits::ContentIdExists for MockContent { + fn has_content(which: &::ContentId) -> bool { + return *which == 42 } fn get_data_object( - which: &T::ContentId, - ) -> Result, &'static str> { - Err("not implemented!") + which: &::ContentId, + ) -> Result, &'static str> { + match *which { + 42 => Ok(data_directory::DataObject { + data_object_type: 1, + signing_key: None, + size: 1234, + added_at_block: 10, + added_at_time: 1024, + owner: 1, + liaison: 1, // TODO change to another later + liaison_judgement: data_directory::LiaisonJudgement::Pending, + }), + _ => Err("nope, missing"), + } } } @@ -93,15 +105,15 @@ impl data_object_type_registry::Trait for Test { impl data_directory::Trait for Test { type Event = MetaEvent; type ContentId = u64; - type Members = AnyAccountIsMember; + type Members = MockMembers; type IsActiveDataObjectType = AnyDataObjectTypeIsActive; } impl data_object_storage_registry::Trait for Test { type Event = MetaEvent; type DataObjectStorageRelationshipId = u64; - type Members = AnyAccountIsMember; - type ContentIdExists = AnyContentIdExists; + type Members = MockMembers; + type ContentIdExists = MockContent; } impl timestamp::Trait for Test { From b300c29d3ad127e2022871f1dae22019081af0f3 Mon Sep 17 00:00:00 2001 From: Jens Finkhaeuser Date: Tue, 2 Apr 2019 14:45:44 +0200 Subject: [PATCH 123/175] Simplify return (also test pre-commit hook) --- src/storage/mock.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/storage/mock.rs b/src/storage/mock.rs index 133e14abbf..8ba14e4557 100644 --- a/src/storage/mock.rs +++ b/src/storage/mock.rs @@ -56,7 +56,7 @@ impl traits::IsActiveDataObjectType pub struct MockContent {} impl traits::ContentIdExists for MockContent { fn has_content(which: &::ContentId) -> bool { - return *which == 42 + *which == 42 } fn get_data_object( From 787aaed1892467d5a4af5f0b97ba195b22f77af6 Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Tue, 2 Apr 2019 16:30:36 +0300 Subject: [PATCH 124/175] substrate upgrade: fix runtime configuration --- src/governance/mock.rs | 5 ++-- src/governance/mod.rs | 7 +++-- src/governance/proposals.rs | 4 ++- src/lib.rs | 58 ++++++++++++++++++------------------- src/membership/mock.rs | 5 ++-- src/roles/actors.rs | 21 +++++++------- src/roles/mock.rs | 5 ++-- 7 files changed, 56 insertions(+), 49 deletions(-) diff --git a/src/governance/mock.rs b/src/governance/mock.rs index 183b5f3546..3351e009ad 100644 --- a/src/governance/mock.rs +++ b/src/governance/mock.rs @@ -90,8 +90,9 @@ impl balances::Trait for Test { /// Handler for when a new account is created. type OnNewAccount = (); - /// A function that returns true iff a given account can transfer its funds to another account. - type EnsureAccountLiquid = (); + type TransactionPayment = (); + type DustRemoval = (); + type TransferPayment = (); } impl GovernanceCurrency for Test { diff --git a/src/governance/mod.rs b/src/governance/mod.rs index 544fa97a15..8686cf1a3a 100644 --- a/src/governance/mod.rs +++ b/src/governance/mod.rs @@ -1,6 +1,6 @@ #![cfg_attr(not(feature = "std"), no_std)] -use srml_support::traits::{Currency, ArithmeticType}; +use srml_support::traits::{Currency, LockableCurrency}; use system; pub mod election; @@ -11,9 +11,10 @@ mod stake; mod sealed_vote; pub trait GovernanceCurrency: system::Trait + Sized { - type Currency: ArithmeticType + Currency<::AccountId, Balance=BalanceOf>; + type Currency: Currency + + LockableCurrency; } -pub type BalanceOf = <::Currency as ArithmeticType>::Type; +pub type BalanceOf = <::Currency as Currency<::AccountId>>::Balance; mod mock; \ No newline at end of file diff --git a/src/governance/proposals.rs b/src/governance/proposals.rs index 18b80fa53b..c11a21d502 100644 --- a/src/governance/proposals.rs +++ b/src/governance/proposals.rs @@ -595,8 +595,10 @@ mod tests { type Balance = u64; type OnFreeBalanceZero = (); type OnNewAccount = (); - type EnsureAccountLiquid = (); type Event = (); + type TransactionPayment = (); + type DustRemoval = (); + type TransferPayment = (); } impl timestamp::Trait for Test { diff --git a/src/lib.rs b/src/lib.rs index 8344253e74..3aae8a1883 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -29,10 +29,10 @@ use roles::actors; use rstd::prelude::*; #[cfg(feature = "std")] use primitives::bytes; -use primitives::{Ed25519AuthorityId, OpaqueMetadata}; +use primitives::{ed25519, OpaqueMetadata}; use runtime_primitives::{ - ApplyResult, transaction_validity::TransactionValidity, Ed25519Signature, generic, - traits::{self as runtime_traits, Convert, BlakeTwo256, Block as BlockT, StaticLookup}, create_runtime_str + ApplyResult, transaction_validity::TransactionValidity, generic, create_runtime_str, + traits::{self as runtime_traits, Convert, BlakeTwo256, Block as BlockT, StaticLookup, Verify}, }; use client::{ block_builder::api::{CheckInherentsResult, InherentData, self as block_builder_api}, @@ -52,8 +52,17 @@ pub use runtime_primitives::{Permill, Perbill}; pub use timestamp::BlockPeriod; pub use srml_support::{StorageValue, construct_runtime}; -/// Alias to Ed25519 pubkey that identifies an account on the chain. -pub type AccountId = primitives::H256; +/// The type that is used for identifying authorities. +pub type AuthorityId = ::Signer; + +/// The type used by authorities to prove their ID. +pub type AuthoritySignature = ed25519::Signature; + +/// Alias to pubkey that identifies an account on the chain. +pub type AccountId = ::Signer; + +/// The type used by accounts to prove their ID. +pub type AccountSignature = ed25519::Signature; /// A hash of some data used by the chain. pub type Hash = primitives::H256; @@ -81,13 +90,13 @@ pub mod opaque { } } /// Opaque block header type. - pub type Header = generic::Header>; + pub type Header = generic::Header>; /// Opaque block type. pub type Block = generic::Block; /// Opaque block identifier type. pub type BlockId = generic::BlockId; /// Opaque session key type. - pub type SessionKey = Ed25519AuthorityId; + pub type SessionKey = AuthorityId; } /// This runtime version. @@ -140,7 +149,7 @@ impl aura::Trait for Runtime { impl consensus::Trait for Runtime { /// The identifier we use to refer to authorities. - type SessionKey = Ed25519AuthorityId; + type SessionKey = AuthorityId; // The aura module handles offline-reports internally // rather than using an explicit report system. type InherentOfflineReport = (); @@ -148,16 +157,8 @@ impl consensus::Trait for Runtime { type Log = Log; } -/// Session key conversion. -pub struct SessionKeyConversion; -impl Convert for SessionKeyConversion { - fn convert(a: AccountId) -> Ed25519AuthorityId { - a.to_fixed_bytes().into() - } -} - impl session::Trait for Runtime { - type ConvertAccountIdToSessionKey = SessionKeyConversion; + type ConvertAccountIdToSessionKey = (); type OnSessionChange = (Staking, ); type Event = Event; } @@ -184,18 +185,15 @@ impl balances::Trait for Runtime { /// The type for recording an account's balance. type Balance = u128; /// What to do if an account's free balance gets zeroed. - type OnFreeBalanceZero = Staking; + type OnFreeBalanceZero = (Staking, Session); /// What to do if a new account is created. type OnNewAccount = Indices; - /// Restrict whether an account can transfer funds. We don't place any further restrictions. - type EnsureAccountLiquid = (Staking, Actors); /// The uniquitous event type. type Event = Event; -} -impl fees::Trait for Runtime { - type TransferAsset = Balances; - type Event = Event; + type TransactionPayment = (); + type DustRemoval = (); + type TransferPayment = (); } impl sudo::Trait for Runtime { @@ -206,8 +204,11 @@ impl sudo::Trait for Runtime { impl staking::Trait for Runtime { type Currency = balances::Module; + //type CurrencyToVote = CurrencyToVoteHandler; type OnRewardMinted = (); type Event = Event; + type Slash = (); + type Reward = (); } impl governance::GovernanceCurrency for Runtime { @@ -257,7 +258,7 @@ impl actors::Trait for Runtime { } construct_runtime!( - pub enum Runtime with Log(InternalLog: DigestItem) where + pub enum Runtime with Log(InternalLog: DigestItem) where Block = Block, NodeBlock = opaque::Block, UncheckedExtrinsic = UncheckedExtrinsic @@ -270,7 +271,6 @@ construct_runtime!( Balances: balances, Session: session, Staking: staking::{default, OfflineWorker}, - Fees: fees::{Module, Storage, Config, Event}, Sudo: sudo, Proposals: proposals::{Module, Call, Storage, Event, Config}, CouncilElection: election::{Module, Call, Storage, Event, Config}, @@ -294,11 +294,11 @@ pub type Block = generic::Block; /// BlockId type as expected by this runtime. pub type BlockId = generic::BlockId; /// Unchecked extrinsic type as expected by this runtime. -pub type UncheckedExtrinsic = generic::UncheckedMortalCompactExtrinsic; +pub type UncheckedExtrinsic = generic::UncheckedMortalCompactExtrinsic; /// Extrinsic type that has already been checked. pub type CheckedExtrinsic = generic::CheckedExtrinsic; /// Executive: handles dispatch to the various modules. -pub type Executive = executive::Executive; +pub type Executive = executive::Executive; // Implement our runtime API endpoints. This is just a bunch of proxying. impl_runtime_apis! { @@ -307,7 +307,7 @@ impl_runtime_apis! { VERSION } - fn authorities() -> Vec { + fn authorities() -> Vec { Consensus::authorities() } diff --git a/src/membership/mock.rs b/src/membership/mock.rs index 2460c11a81..c63d810fd4 100644 --- a/src/membership/mock.rs +++ b/src/membership/mock.rs @@ -61,8 +61,9 @@ impl balances::Trait for Test { /// Handler for when a new account is created. type OnNewAccount = (); - /// A function that returns true iff a given account can transfer its funds to another account. - type EnsureAccountLiquid = (); + type TransactionPayment = (); + type DustRemoval = (); + type TransferPayment = (); } impl GovernanceCurrency for Test { diff --git a/src/roles/actors.rs b/src/roles/actors.rs index 9ad261d184..08ed7a197b 100644 --- a/src/roles/actors.rs +++ b/src/roles/actors.rs @@ -6,7 +6,7 @@ use rstd::prelude::*; use runtime_primitives::traits::{ As, Bounded, MaybeDebug, Zero, }; -use srml_support::traits::{Currency, EnsureAccountLiquid}; +use srml_support::traits::{Currency}; use srml_support::{ decl_event, decl_module, decl_storage, dispatch, ensure, StorageMap, StorageValue, }; @@ -370,12 +370,13 @@ decl_module! { } } -impl EnsureAccountLiquid for Module { - fn ensure_account_liquid(who: &T::AccountId) -> dispatch::Result { - if Self::bondage(who) <= >::block_number() { - Ok(()) - } else { - Err("cannot transfer illiquid funds") - } - } -} +// TODO: Find how balances module checks account liquidity state +// impl EnsureAccountLiquid for Module { +// fn ensure_account_liquid(who: &T::AccountId) -> dispatch::Result { +// if Self::bondage(who) <= >::block_number() { +// Ok(()) +// } else { +// Err("cannot transfer illiquid funds") +// } +// } +// } diff --git a/src/roles/mock.rs b/src/roles/mock.rs index 4dba02bb9a..044189d0ce 100644 --- a/src/roles/mock.rs +++ b/src/roles/mock.rs @@ -61,8 +61,9 @@ impl balances::Trait for Test { /// Handler for when a new account is created. type OnNewAccount = (); - /// A function that returns true iff a given account can transfer its funds to another account. - type EnsureAccountLiquid = (); + type TransactionPayment = (); + type DustRemoval = (); + type TransferPayment = (); } impl GovernanceCurrency for Test { From 02276fc83695c4427b4518a00ee79106c60bf3df Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Tue, 2 Apr 2019 16:34:47 +0300 Subject: [PATCH 125/175] substrate upgrade: fix migration, build method doesn't need to return Some(v) --- src/migration.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/migration.rs b/src/migration.rs index 10eb7413f4..06c33800c9 100644 --- a/src/migration.rs +++ b/src/migration.rs @@ -58,7 +58,7 @@ decl_storage! { trait Store for Module as Migration { /// Records at what runtime spec version the store was initialized. This allows the runtime /// to know when to run initialize code if it was installed as an update. - pub SpecVersion get(spec_version) build(|_| Some(VERSION.spec_version)) : Option; + pub SpecVersion get(spec_version) build(|_| VERSION.spec_version) : Option; } } From 29e52a2a412deeb7fefb0a6dd4e5851e24d9e195 Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Tue, 2 Apr 2019 17:09:16 +0300 Subject: [PATCH 126/175] substrate upgrade: fixes for changed balances module --- src/governance/election.rs | 36 +++++++++---------- src/governance/proposals.rs | 70 ++++++++++++++----------------------- src/membership/mock.rs | 3 +- src/membership/tests.rs | 4 +-- src/roles/mock.rs | 1 + src/roles/tests.rs | 4 +-- 6 files changed, 52 insertions(+), 66 deletions(-) diff --git a/src/governance/election.rs b/src/governance/election.rs index 0cc47a5c49..718e7a76df 100644 --- a/src/governance/election.rs +++ b/src/governance/election.rs @@ -992,7 +992,7 @@ mod tests { let applicant = 20 as u64; let starting_balance = 1000 as u32; - Balances::set_free_balance(&applicant, starting_balance); + Balances::deposit_creating(&applicant, starting_balance); let stake = 100 as u32; @@ -1019,7 +1019,7 @@ mod tests { }); let additional_stake = 100 as u32; - Balances::set_free_balance(&applicant, additional_stake); + Balances::deposit_creating(&applicant, additional_stake); assert!(Election::try_add_applicant(applicant, additional_stake).is_ok()); assert_eq!(Election::applicant_stakes(applicant).new, starting_stake + additional_stake); @@ -1032,7 +1032,7 @@ mod tests { with_externalities(&mut initial_test_ext(), || { let applicant = 20 as u64; - Balances::set_free_balance(&applicant, 5000); + Balances::deposit_creating(&applicant, 5000); >::put(vec![applicant]); save_transferable_stake(applicant, TransferableStake {seat: 1000, backing: 0}); @@ -1137,9 +1137,9 @@ mod tests { #[test] fn refunding_applicant_stakes_should_work () { with_externalities(&mut initial_test_ext(), || { - Balances::set_free_balance(&1, 1000); - Balances::set_free_balance(&2, 2000); Balances::set_reserved_balance(&2, 5000); - Balances::set_free_balance(&3, 3000); Balances::set_reserved_balance(&3, 5000); + Balances::deposit_creating(&1, 1000); + Balances::deposit_creating(&2, 7000); Balances::reserve(&2, 5000); + Balances::deposit_creating(&3, 8000); Balances::reserve(&3, 5000); >::put(vec![1,2,3]); @@ -1186,7 +1186,7 @@ mod tests { #[test] fn voting_should_work () { with_externalities(&mut initial_test_ext(), || { - Balances::set_free_balance(&20, 1000); + Balances::deposit_creating(&20, 1000); let payload = vec![10u8]; let commitment = ::Hashing::hash(&payload[..]); @@ -1210,7 +1210,7 @@ mod tests { #[test] fn votes_can_be_covered_by_transferable_stake () { with_externalities(&mut initial_test_ext(), || { - Balances::set_free_balance(&20, 1000); + Balances::deposit_creating(&20, 1000); save_transferable_stake(20, TransferableStake {seat: 0, backing: 500}); @@ -1233,7 +1233,7 @@ mod tests { #[test] fn voting_without_enough_balance_should_not_work () { with_externalities(&mut initial_test_ext(), || { - Balances::set_free_balance(&20, 100); + Balances::deposit_creating(&20, 100); save_transferable_stake(20, TransferableStake { seat: 0, backing: 500 }); @@ -1250,7 +1250,7 @@ mod tests { #[test] fn voting_with_existing_commitment_should_not_work () { with_externalities(&mut initial_test_ext(), || { - Balances::set_free_balance(&20, 1000); + Balances::deposit_creating(&20, 1000); save_transferable_stake(20, TransferableStake { seat: 0, backing: 500}); @@ -1490,7 +1490,7 @@ mod tests { with_externalities(&mut initial_test_ext(), || { >::put(vec![100, 200, 300]); - Balances::set_free_balance(&100, 1000); Balances::set_reserved_balance(&100, 1000); + Balances::deposit_creating(&100, 2000); Balances::reserve(&100, 1000); >::insert(100, Stake { new: 20 as u32, @@ -1521,9 +1521,9 @@ mod tests { fn refunding_voting_stakes_should_work () { with_externalities(&mut initial_test_ext(), || { // voters' balances - Balances::set_free_balance(&10, 1000); Balances::set_reserved_balance(&10, 5000); - Balances::set_free_balance(&20, 2000); Balances::set_reserved_balance(&20, 5000); - Balances::set_free_balance(&30, 3000); Balances::set_reserved_balance(&30, 5000); + Balances::deposit_creating(&10, 6000); Balances::reserve(&10, 5000); + Balances::deposit_creating(&20, 7000); Balances::reserve(&20, 5000); + Balances::deposit_creating(&30, 8000); Balances::reserve(&30, 5000); save_transferable_stake(10, TransferableStake {seat: 0, backing: 100}); save_transferable_stake(20, TransferableStake {seat: 0, backing: 200}); @@ -1565,13 +1565,13 @@ mod tests { with_externalities(&mut initial_test_ext(), || { >::put(vec![10,20,30]); - Balances::set_free_balance(&10, 1000); Balances::set_reserved_balance(&10, 5000); + Balances::deposit_creating(&10, 6000); Balances::reserve(&10, 5000); save_transferable_stake(10, TransferableStake {seat: 50, backing: 100}); - Balances::set_free_balance(&20, 2000); Balances::set_reserved_balance(&20, 5000); + Balances::deposit_creating(&20, 7000); Balances::reserve(&20, 5000); save_transferable_stake(20, TransferableStake {seat: 60, backing: 200}); - Balances::set_free_balance(&30, 3000); Balances::set_reserved_balance(&30, 5000); + Balances::deposit_creating(&30, 8000); Balances::reserve(&30, 5000); save_transferable_stake(30, TransferableStake {seat: 70, backing: 300}); Election::unlock_transferable_stakes(); @@ -1615,7 +1615,7 @@ mod tests { >::put(10); for i in 1..30 { - Balances::set_free_balance(&(i as u64), 50000); + Balances::deposit_creating(&(i as u64), 50000); } System::set_block_number(1); diff --git a/src/governance/proposals.rs b/src/governance/proposals.rs index c11a21d502..60ebbc5ffc 100644 --- a/src/governance/proposals.rs +++ b/src/governance/proposals.rs @@ -778,8 +778,7 @@ mod tests { #[test] fn member_create_proposal() { with_externalities(&mut new_test_ext(), || { - Balances::set_free_balance(&PROPOSER1, initial_balance()); - Balances::increase_total_stake_by(initial_balance()); + Balances::deposit_creating(&PROPOSER1, initial_balance()); assert_ok!(_create_default_proposal()); assert_eq!(Proposals::active_proposal_ids().len(), 1); @@ -819,8 +818,7 @@ mod tests { #[test] fn cannot_create_proposal_with_small_stake() { with_externalities(&mut new_test_ext(), || { - Balances::set_free_balance(&PROPOSER1, initial_balance()); - Balances::increase_total_stake_by(initial_balance()); + Balances::deposit_creating(&PROPOSER1, initial_balance()); assert_eq!(_create_proposal( None, Some(min_stake() - 1), None, None, None), @@ -835,8 +833,7 @@ mod tests { #[test] fn cannot_create_proposal_when_stake_is_greater_than_balance() { with_externalities(&mut new_test_ext(), || { - Balances::set_free_balance(&PROPOSER1, initial_balance()); - Balances::increase_total_stake_by(initial_balance()); + Balances::deposit_creating(&PROPOSER1, initial_balance()); assert_eq!(_create_proposal( None, Some(initial_balance() + 1), None, None, None), @@ -851,8 +848,7 @@ mod tests { #[test] fn cannot_create_proposal_with_empty_values() { with_externalities(&mut new_test_ext(), || { - Balances::set_free_balance(&PROPOSER1, initial_balance()); - Balances::increase_total_stake_by(initial_balance()); + Balances::deposit_creating(&PROPOSER1, initial_balance()); // Empty name: assert_eq!(_create_proposal( @@ -874,8 +870,7 @@ mod tests { #[test] fn cannot_create_proposal_with_too_long_values() { with_externalities(&mut new_test_ext(), || { - Balances::set_free_balance(&PROPOSER1, initial_balance()); - Balances::increase_total_stake_by(initial_balance()); + Balances::deposit_creating(&PROPOSER1, initial_balance()); // Too long name: assert_eq!(_create_proposal( @@ -912,8 +907,7 @@ mod tests { #[test] fn owner_cancel_proposal() { with_externalities(&mut new_test_ext(), || { - Balances::set_free_balance(&PROPOSER1, initial_balance()); - Balances::increase_total_stake_by(initial_balance()); + Balances::deposit_creating(&PROPOSER1, initial_balance()); assert_ok!(_create_default_proposal()); assert_ok!(Proposals::cancel_proposal(Origin::signed(PROPOSER1), 1)); @@ -931,8 +925,7 @@ mod tests { #[test] fn owner_cannot_cancel_proposal_if_its_finalized() { with_externalities(&mut new_test_ext(), || { - Balances::set_free_balance(&PROPOSER1, initial_balance()); - Balances::increase_total_stake_by(initial_balance()); + Balances::deposit_creating(&PROPOSER1, initial_balance()); assert_ok!(_create_default_proposal()); assert_ok!(Proposals::cancel_proposal(Origin::signed(PROPOSER1), 1)); @@ -954,9 +947,8 @@ mod tests { #[test] fn not_owner_cannot_cancel_proposal() { with_externalities(&mut new_test_ext(), || { - Balances::set_free_balance(&PROPOSER1, initial_balance()); - Balances::set_free_balance(&PROPOSER2, initial_balance()); - Balances::increase_total_stake_by(initial_balance() * 2); + Balances::deposit_creating(&PROPOSER1, initial_balance()); + Balances::deposit_creating(&PROPOSER2, initial_balance()); assert_ok!(_create_default_proposal()); assert_eq!(Proposals::cancel_proposal(Origin::signed(PROPOSER2), 1), Err(MSG_YOU_DONT_OWN_THIS_PROPOSAL)); @@ -969,8 +961,8 @@ mod tests { #[test] fn councilor_vote_on_proposal() { with_externalities(&mut new_test_ext(), || { - Balances::set_free_balance(&PROPOSER1, initial_balance()); - Balances::increase_total_stake_by(initial_balance()); + Balances::deposit_creating(&PROPOSER1, initial_balance()); + assert_ok!(_create_default_proposal()); assert_ok!(Proposals::vote_on_proposal( @@ -987,8 +979,8 @@ mod tests { #[test] fn councilor_cannot_vote_on_proposal_twice() { with_externalities(&mut new_test_ext(), || { - Balances::set_free_balance(&PROPOSER1, initial_balance()); - Balances::increase_total_stake_by(initial_balance()); + Balances::deposit_creating(&PROPOSER1, initial_balance()); + assert_ok!(_create_default_proposal()); assert_ok!(Proposals::vote_on_proposal( @@ -1002,8 +994,8 @@ mod tests { #[test] fn autovote_with_approve_when_councilor_creates_proposal() { with_externalities(&mut new_test_ext(), || { - Balances::set_free_balance(&COUNCILOR1, initial_balance()); - Balances::increase_total_stake_by(initial_balance()); + Balances::deposit_creating(&COUNCILOR1, initial_balance()); + assert_ok!(_create_proposal( Some(COUNCILOR1), None, None, None, None )); @@ -1018,8 +1010,8 @@ mod tests { #[test] fn not_councilor_cannot_vote_on_proposal() { with_externalities(&mut new_test_ext(), || { - Balances::set_free_balance(&PROPOSER1, initial_balance()); - Balances::increase_total_stake_by(initial_balance()); + Balances::deposit_creating(&PROPOSER1, initial_balance()); + assert_ok!(_create_default_proposal()); assert_eq!(Proposals::vote_on_proposal( Origin::signed(NOT_COUNCILOR), 1, Approve), @@ -1030,8 +1022,8 @@ mod tests { #[test] fn councilor_cannot_vote_on_proposal_if_it_has_been_cancelled() { with_externalities(&mut new_test_ext(), || { - Balances::set_free_balance(&PROPOSER1, initial_balance()); - Balances::increase_total_stake_by(initial_balance()); + Balances::deposit_creating(&PROPOSER1, initial_balance()); + assert_ok!(_create_default_proposal()); assert_ok!(Proposals::cancel_proposal(Origin::signed(PROPOSER1), 1)); assert_eq!(Proposals::vote_on_proposal( @@ -1043,8 +1035,7 @@ mod tests { #[test] fn councilor_cannot_vote_on_proposal_if_tally_has_been_finalized() { with_externalities(&mut new_test_ext(), || { - Balances::set_free_balance(&PROPOSER1, initial_balance()); - Balances::increase_total_stake_by(initial_balance()); + Balances::deposit_creating(&PROPOSER1, initial_balance()); assert_ok!(_create_default_proposal()); @@ -1076,8 +1067,7 @@ mod tests { #[test] fn approve_proposal_when_all_councilors_approved_it() { with_externalities(&mut new_test_ext(), || { - Balances::set_free_balance(&PROPOSER1, initial_balance()); - Balances::increase_total_stake_by(initial_balance()); + Balances::deposit_creating(&PROPOSER1, initial_balance()); assert_ok!(_create_default_proposal()); @@ -1121,8 +1111,7 @@ mod tests { #[test] fn approve_proposal_when_all_councilors_voted_and_only_quorum_approved() { with_externalities(&mut new_test_ext(), || { - Balances::set_free_balance(&PROPOSER1, initial_balance()); - Balances::increase_total_stake_by(initial_balance()); + Balances::deposit_creating(&PROPOSER1, initial_balance()); assert_ok!(_create_default_proposal()); @@ -1168,8 +1157,7 @@ mod tests { #[test] fn approve_proposal_when_voting_period_expired_if_only_quorum_voted() { with_externalities(&mut new_test_ext(), || { - Balances::set_free_balance(&PROPOSER1, initial_balance()); - Balances::increase_total_stake_by(initial_balance()); + Balances::deposit_creating(&PROPOSER1, initial_balance()); assert_ok!(_create_default_proposal()); @@ -1221,8 +1209,7 @@ mod tests { #[test] fn reject_proposal_when_all_councilors_voted_and_quorum_not_reached() { with_externalities(&mut new_test_ext(), || { - Balances::set_free_balance(&PROPOSER1, initial_balance()); - Balances::increase_total_stake_by(initial_balance()); + Balances::deposit_creating(&PROPOSER1, initial_balance()); assert_ok!(_create_default_proposal()); @@ -1268,8 +1255,7 @@ mod tests { #[test] fn reject_proposal_when_all_councilors_rejected_it() { with_externalities(&mut new_test_ext(), || { - Balances::set_free_balance(&PROPOSER1, initial_balance()); - Balances::increase_total_stake_by(initial_balance()); + Balances::deposit_creating(&PROPOSER1, initial_balance()); assert_ok!(_create_default_proposal()); @@ -1313,8 +1299,7 @@ mod tests { #[test] fn slash_proposal_when_all_councilors_slashed_it() { with_externalities(&mut new_test_ext(), || { - Balances::set_free_balance(&PROPOSER1, initial_balance()); - Balances::increase_total_stake_by(initial_balance()); + Balances::deposit_creating(&PROPOSER1, initial_balance()); assert_ok!(_create_default_proposal()); @@ -1367,8 +1352,7 @@ mod tests { #[test] fn expire_proposal_when_not_all_councilors_voted_and_quorum_not_reached() { with_externalities(&mut new_test_ext(), || { - Balances::set_free_balance(&PROPOSER1, initial_balance()); - Balances::increase_total_stake_by(initial_balance()); + Balances::deposit_creating(&PROPOSER1, initial_balance()); assert_ok!(_create_default_proposal()); diff --git a/src/membership/mock.rs b/src/membership/mock.rs index c63d810fd4..9935dfd29a 100644 --- a/src/membership/mock.rs +++ b/src/membership/mock.rs @@ -1,6 +1,7 @@ #![cfg(test)] -use rstd::prelude::*; +//use rstd::prelude::*; +use srml_support::traits::{Currency}; pub use crate::governance::{GovernanceCurrency}; pub use super::{members}; pub use system; diff --git a/src/membership/tests.rs b/src/membership/tests.rs index 5b159d433e..7cac9490f1 100644 --- a/src/membership/tests.rs +++ b/src/membership/tests.rs @@ -3,7 +3,7 @@ use super::*; use super::mock::*; -use parity_codec::Encode; +//use parity_codec::Encode; use runtime_io::with_externalities; use srml_support::*; @@ -38,7 +38,7 @@ fn buy_default_membership_as_alice() -> dispatch::Result { } fn set_alice_free_balance(balance: u32) { - Balances::set_free_balance(&ALICE_ACCOUNT_ID, balance); + Balances::deposit_creating(&ALICE_ACCOUNT_ID, balance); } #[test] diff --git a/src/roles/mock.rs b/src/roles/mock.rs index 044189d0ce..25801a73b1 100644 --- a/src/roles/mock.rs +++ b/src/roles/mock.rs @@ -1,6 +1,7 @@ #![cfg(test)] pub use super::actors; +pub use srml_support::traits::{Currency}; pub use crate::governance::GovernanceCurrency; use crate::traits::Members; pub use system; diff --git a/src/roles/tests.rs b/src/roles/tests.rs index da9d630b82..5715bb81f5 100644 --- a/src/roles/tests.rs +++ b/src/roles/tests.rs @@ -74,7 +74,7 @@ fn make_entry_request() { ); let surplus_balance = 100; - Balances::set_free_balance( + Balances::deposit_creating( &actor_account, storage_params.entry_request_fee + surplus_balance, ); @@ -117,7 +117,7 @@ fn staking() { >::put(vec![request]); - Balances::set_free_balance(&actor_account, storage_params.min_stake); + Balances::deposit_creating(&actor_account, storage_params.min_stake); assert!(Actors::stake( Origin::signed(MockMembers::alice_account()), From 60a3a0be7146060240bd672b031305b8fae1a45b Mon Sep 17 00:00:00 2001 From: Jens Finkhaeuser Date: Tue, 2 Apr 2019 16:12:44 +0200 Subject: [PATCH 127/175] Add tests to DOSR --- src/storage/data_object_storage_registry.rs | 79 +++++++++++++++++++++ src/storage/mock.rs | 1 + 2 files changed, 80 insertions(+) diff --git a/src/storage/data_object_storage_registry.rs b/src/storage/data_object_storage_registry.rs index 5b0939559b..b0ce7ea89b 100644 --- a/src/storage/data_object_storage_registry.rs +++ b/src/storage/data_object_storage_registry.rs @@ -163,3 +163,82 @@ impl Module { Ok(()) } } + +#[cfg(test)] +mod tests { + use super::*; + use crate::storage::mock::*; + + use system::{self, EventRecord, Phase}; + + #[test] + fn initial_state() { + with_default_mock_builder(|| { + assert_eq!( + TestDataObjectStorageRegistry::first_relationship_id(), + TEST_FIRST_RELATIONSHIP_ID + ); + }); + } + + #[test] + fn test_add_relationship() { + with_default_mock_builder(|| { + // The content needs to exist - in our mock, that's with the content ID 42 + let res = TestDataObjectStorageRegistry::add_relationship(Origin::signed(1), 42); + assert!(res.is_ok()); + }); + } + + #[test] + fn test_fail_adding_relationship_with_bad_content() { + with_default_mock_builder(|| { + let res = TestDataObjectStorageRegistry::add_relationship(Origin::signed(1), 24); + assert!(res.is_err()); + }); + } + + #[test] + fn test_toggle_ready() { + with_default_mock_builder(|| { + // Create a DOSR + let res = TestDataObjectStorageRegistry::add_relationship(Origin::signed(1), 42); + assert!(res.is_ok()); + + // Grab DOSR ID from event + let dosr_id = match System::events().last().unwrap().event { + MetaEvent::data_object_storage_registry( + data_object_storage_registry::RawEvent::DataObjectStorageRelationshipAdded( + dosr_id, + content_id, + account_id, + ), + ) => dosr_id, + _ => 0xdeadbeefu64, // invalid value, unlikely to match + }; + assert_ne!(dosr_id, 0xdeadbeefu64); + + // Toggling from a different account should fail + let res = + TestDataObjectStorageRegistry::set_relationship_ready(Origin::signed(2), dosr_id); + assert!(res.is_err()); + + // Toggling with the wrong ID should fail. + let res = TestDataObjectStorageRegistry::set_relationship_ready( + Origin::signed(1), + dosr_id + 1, + ); + assert!(res.is_err()); + + // Toggling with the correct ID and origin should succeed + let res = + TestDataObjectStorageRegistry::set_relationship_ready(Origin::signed(1), dosr_id); + assert!(res.is_ok()); + assert_eq!(System::events().last().unwrap().event, + MetaEvent::data_object_storage_registry(data_object_storage_registry::RawEvent::DataObjectStorageRelationshipReadyUpdated( + dosr_id, + true, + ))); + }); + } +} diff --git a/src/storage/mock.rs b/src/storage/mock.rs index 97c18a20a5..94508e876a 100644 --- a/src/storage/mock.rs +++ b/src/storage/mock.rs @@ -198,6 +198,7 @@ pub type TestDataObjectTypeRegistry = data_object_type_registry::Module; pub type TestDataObjectType = data_object_type_registry::DataObjectType; pub type TestDataDirectory = data_directory::Module; pub type TestDataObject = data_directory::DataObject; +pub type TestDataObjectStorageRegistry = data_object_storage_registry::Module; pub const TEST_FIRST_DATA_OBJECT_TYPE_ID: u64 = 1000; pub const TEST_FIRST_CONTENT_ID: u64 = 2000; From 198485c610d3372fb56fa66264ae03f6c1be7025 Mon Sep 17 00:00:00 2001 From: Jens Finkhaeuser Date: Tue, 2 Apr 2019 16:13:59 +0200 Subject: [PATCH 128/175] Add note to downloads module --- src/storage/downloads.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/storage/downloads.rs b/src/storage/downloads.rs index 01de54e0aa..70ff271a12 100644 --- a/src/storage/downloads.rs +++ b/src/storage/downloads.rs @@ -1,5 +1,12 @@ #![cfg_attr(not(feature = "std"), no_std)] +/* + * XXX This module is not really supposed to be used this way, and therefore also lacks tests. + * + * This is a straightforward implementation of the whitepaper's specs, and is intended to + * be iterated over. Please don't use it as-is. + */ + use crate::storage::data_directory::Trait as DDTrait; use crate::storage::data_object_storage_registry::Trait as DOSRTrait; use crate::traits::{ContentHasStorage, ContentIdExists}; From a7ed299f4b9de932dc5b2cb1a861a9308f5ab6ab Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Tue, 2 Apr 2019 17:19:06 +0300 Subject: [PATCH 129/175] substrate upgrade: fix currency::reward -> currency::deposit_into_existing --- src/membership/mock.rs | 3 +-- src/membership/tests.rs | 1 - src/roles/actors.rs | 2 +- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/membership/mock.rs b/src/membership/mock.rs index 9935dfd29a..97379244cc 100644 --- a/src/membership/mock.rs +++ b/src/membership/mock.rs @@ -1,7 +1,6 @@ #![cfg(test)] -//use rstd::prelude::*; -use srml_support::traits::{Currency}; +pub use srml_support::traits::{Currency}; pub use crate::governance::{GovernanceCurrency}; pub use super::{members}; pub use system; diff --git a/src/membership/tests.rs b/src/membership/tests.rs index 7cac9490f1..827df2fcda 100644 --- a/src/membership/tests.rs +++ b/src/membership/tests.rs @@ -3,7 +3,6 @@ use super::*; use super::mock::*; -//use parity_codec::Encode; use runtime_io::with_externalities; use srml_support::*; diff --git a/src/roles/actors.rs b/src/roles/actors.rs index 08ed7a197b..b2c815f309 100644 --- a/src/roles/actors.rs +++ b/src/roles/actors.rs @@ -220,7 +220,7 @@ decl_module! { if now > actor.joined_at + params.reward_period { // send reward to member account - not the actor account if let Ok(member_account) = T::Members::lookup_account_by_member_id(actor.member_id) { - let _ = T::Currency::reward(&member_account, params.reward); + let _ = T::Currency::deposit_into_existing(&member_account, params.reward); } } } From 3365015f1ae8c6a598210156520e9b40d022e597 Mon Sep 17 00:00:00 2001 From: Jens Finkhaeuser Date: Tue, 2 Apr 2019 16:22:24 +0200 Subject: [PATCH 130/175] - Rename Metadata -> ContentMetadata to avoid naming conflict - rustfmt --- src/storage/content_directory.rs | 47 ++++++++++++++++++++++---------- 1 file changed, 32 insertions(+), 15 deletions(-) diff --git a/src/storage/content_directory.rs b/src/storage/content_directory.rs index 453c7c095b..d320f5f943 100644 --- a/src/storage/content_directory.rs +++ b/src/storage/content_directory.rs @@ -1,23 +1,41 @@ #![cfg_attr(not(feature = "std"), no_std)] -use rstd::prelude::*; +use crate::storage::data_object_type_registry::Trait as DOTRTrait; +use crate::traits::Members; use parity_codec::Codec; -use parity_codec_derive::{Encode, Decode}; -use srml_support::{StorageMap, StorageValue, decl_module, decl_storage, decl_event, ensure, Parameter}; -use runtime_primitives::traits::{SimpleArithmetic, As, Member, MaybeSerializeDebug, MaybeDebug}; +use parity_codec_derive::{Decode, Encode}; +use rstd::prelude::*; +use runtime_primitives::traits::{As, MaybeDebug, MaybeSerializeDebug, Member, SimpleArithmetic}; +use srml_support::{ + decl_event, decl_module, decl_storage, ensure, Parameter, StorageMap, StorageValue, +}; use system::{self, ensure_signed}; -use crate::traits::{Members}; -use crate::storage::data_object_type_registry::Trait as DOTRTrait; pub trait Trait: timestamp::Trait + system::Trait + DOTRTrait + MaybeDebug { type Event: From> + Into<::Event>; - type MetadataId: Parameter + Member + SimpleArithmetic + Codec + Default + Copy - + As + As + MaybeSerializeDebug + PartialEq; + type MetadataId: Parameter + + Member + + SimpleArithmetic + + Codec + + Default + + Copy + + As + + As + + MaybeSerializeDebug + + PartialEq; // Schema ID should be defined in a different Trait in future - type SchemaId: Parameter + Member + SimpleArithmetic + Codec + Default + Copy - + As + As + MaybeSerializeDebug + PartialEq; + type SchemaId: Parameter + + Member + + SimpleArithmetic + + Codec + + Default + + Copy + + As + + As + + MaybeSerializeDebug + + PartialEq; type Members: Members; } @@ -31,8 +49,7 @@ const DEFAULT_FIRST_METADATA_ID: u64 = 1; #[derive(Clone, Encode, Decode, PartialEq)] #[cfg_attr(feature = "std", derive(Debug))] -pub enum MetadataState -{ +pub enum MetadataState { Draft, Published, } @@ -48,7 +65,7 @@ impl Default for MetadataState { // The other is the serialized metadata. #[derive(Clone, Encode, Decode, PartialEq)] #[cfg_attr(feature = "std", derive(Debug))] -pub struct Metadata { +pub struct ContentMetadata { pub schema: T::SchemaId, pub metadata: Vec, pub origin: T::AccountId, @@ -73,7 +90,7 @@ decl_storage! { pub NextMetadataId get(next_metadata_id) build(|config: &GenesisConfig| config.first_metadata_id): T::MetadataId = T::MetadataId::sa(DEFAULT_FIRST_METADATA_ID); // Mapping of Data object types - pub MetadataMap get(metadata): map T::MetadataId => Option>; + pub MetadataMap get(metadata): map T::MetadataId => Option>; } } @@ -101,7 +118,7 @@ decl_module! { // New and data let new_id = Self::next_metadata_id(); - let data: Metadata = Metadata { + let data: ContentMetadata = ContentMetadata { origin: who.clone(), schema: schema, metadata: metadata.clone(), From 070ee5b43febc0638994e30f358c1b2c8de64b33 Mon Sep 17 00:00:00 2001 From: Jens Finkhaeuser Date: Tue, 2 Apr 2019 16:24:33 +0200 Subject: [PATCH 131/175] @siman prefers quieter messages :) --- src/storage/data_directory.rs | 8 ++++---- src/storage/data_object_storage_registry.rs | 2 +- src/storage/data_object_type_registry.rs | 2 +- src/storage/downloads.rs | 6 +++--- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/storage/data_directory.rs b/src/storage/data_directory.rs index d1ed013599..36b62d845e 100644 --- a/src/storage/data_directory.rs +++ b/src/storage/data_directory.rs @@ -30,11 +30,11 @@ pub trait Trait: timestamp::Trait + system::Trait + DOTRTrait + MaybeDebug { type IsActiveDataObjectType: IsActiveDataObjectType; } -static MSG_CID_NOT_FOUND: &str = "Content with this ID not found!"; -static MSG_LIAISON_REQUIRED: &str = "Only the liaison for the content may modify its status!"; -static MSG_CREATOR_MUST_BE_MEMBER: &str = "Only active members may create content!"; +static MSG_CID_NOT_FOUND: &str = "Content with this ID not found."; +static MSG_LIAISON_REQUIRED: &str = "Only the liaison for the content may modify its status."; +static MSG_CREATOR_MUST_BE_MEMBER: &str = "Only active members may create content."; static MSG_DO_TYPE_MUST_BE_ACTIVE: &str = - "Cannot create content for inactive or missing data object type!"; + "Cannot create content for inactive or missing data object type."; const DEFAULT_FIRST_CONTENT_ID: u64 = 1; diff --git a/src/storage/data_object_storage_registry.rs b/src/storage/data_object_storage_registry.rs index b0ce7ea89b..fa56417f26 100644 --- a/src/storage/data_object_storage_registry.rs +++ b/src/storage/data_object_storage_registry.rs @@ -29,7 +29,7 @@ pub trait Trait: timestamp::Trait + system::Trait + DDTrait + MaybeDebug { type ContentIdExists: ContentIdExists; } -static MSG_CID_NOT_FOUND: &str = "Content with this ID not found!"; +static MSG_CID_NOT_FOUND: &str = "Content with this ID not found."; static MSG_DOSR_NOT_FOUND: &str = "No data object storage relationship found for this ID."; static MSG_ONLY_STORAGE_PROVIDER_MAY_CLAIM_READY: &str = "Only the storage provider in a DOSR can decide whether they're ready."; diff --git a/src/storage/data_object_type_registry.rs b/src/storage/data_object_type_registry.rs index f6a162c752..b8f15b3ede 100644 --- a/src/storage/data_object_type_registry.rs +++ b/src/storage/data_object_type_registry.rs @@ -25,7 +25,7 @@ pub trait Trait: system::Trait + MaybeDebug { + PartialEq; } -static MSG_DO_TYPE_NOT_FOUND: &str = "Data Object Type with the given ID not found!"; +static MSG_DO_TYPE_NOT_FOUND: &str = "Data Object Type with the given ID not found."; const DEFAULT_FIRST_DATA_OBJECT_TYPE_ID: u64 = 1; diff --git a/src/storage/downloads.rs b/src/storage/downloads.rs index 70ff271a12..abd05cef22 100644 --- a/src/storage/downloads.rs +++ b/src/storage/downloads.rs @@ -38,10 +38,10 @@ pub trait Trait: timestamp::Trait + system::Trait + DOSRTrait + DDTrait { static MSG_SESSION_NOT_FOUND: &str = "Download session with the given ID not found."; static MSG_SESSION_HAS_ENDED: &str = "Download session with the given ID has already ended."; -static MSG_CONSUMER_REQUIRED: &str = "Download session can only be modified by the downloader"; -static MSG_INVALID_TRANSMITTED_VALUE: &str = "Invalid update to transmitted bytes value"; +static MSG_CONSUMER_REQUIRED: &str = "Download session can only be modified by the downloader."; +static MSG_INVALID_TRANSMITTED_VALUE: &str = "Invalid update to transmitted bytes value."; static MSG_NEED_STORAGE_PROVIDER: &str = - "Cannnot download without at least one active storage relationship!"; + "Cannnot download without at least one active storage relationship."; const DEFAULT_FIRST_DOWNLOAD_SESSION_ID: u64 = 1; From 1f50bf18cf5e806d5723fc7083e226a74746f663 Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Tue, 2 Apr 2019 17:34:08 +0300 Subject: [PATCH 132/175] substrate upgrade: add missing trait bound for proposals module --- src/governance/proposals.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/governance/proposals.rs b/src/governance/proposals.rs index 60ebbc5ffc..9caea6ac83 100644 --- a/src/governance/proposals.rs +++ b/src/governance/proposals.rs @@ -3,7 +3,7 @@ use srml_support::traits::{Currency}; use primitives::{storage::well_known_keys}; use runtime_primitives::traits::{As, Hash, Zero}; use runtime_io::print; -use {balances, system::{self, ensure_signed}}; +use {balances, consensus, system::{self, ensure_signed}}; use rstd::prelude::*; use super::council; @@ -113,7 +113,7 @@ pub struct TallyResult { finalized_at: BlockNumber, } -pub trait Trait: timestamp::Trait + council::Trait + GovernanceCurrency { +pub trait Trait: timestamp::Trait + council::Trait + consensus::Trait + GovernanceCurrency { /// The overarching event type. type Event: From> + Into<::Event>; From 2448c5d9162688705d846c3a5a726c417ec8a060 Mon Sep 17 00:00:00 2001 From: Jens Finkhaeuser Date: Tue, 2 Apr 2019 16:44:32 +0200 Subject: [PATCH 133/175] - Fix unwrap() issues @mnaamani raised - Fix warnings --- src/storage/data_directory.rs | 6 +----- src/storage/data_object_storage_registry.rs | 24 +++++++++++++-------- src/storage/data_object_type_registry.rs | 4 +--- src/storage/downloads.rs | 3 +-- src/storage/mock.rs | 3 +-- 5 files changed, 19 insertions(+), 21 deletions(-) diff --git a/src/storage/data_directory.rs b/src/storage/data_directory.rs index 36b62d845e..ee1037ddae 100644 --- a/src/storage/data_directory.rs +++ b/src/storage/data_directory.rs @@ -166,10 +166,9 @@ impl Module { judgement: LiaisonJudgement, ) -> dispatch::Result { // Find the data - let found = Self::contents(&id).ok_or(MSG_CID_NOT_FOUND); + let mut data = Self::contents(&id).ok_or(MSG_CID_NOT_FOUND)?; // Make sure the liaison matches - let mut data = found.unwrap(); ensure!(data.liaison == *who, MSG_LIAISON_REQUIRED); // At this point we can update the data. @@ -184,11 +183,8 @@ impl Module { #[cfg(test)] mod tests { - use super::*; use crate::storage::mock::*; - use system::{self, EventRecord, Phase}; - #[test] fn succeed_adding_content() { with_default_mock_builder(|| { diff --git a/src/storage/data_object_storage_registry.rs b/src/storage/data_object_storage_registry.rs index fa56417f26..61b81defbd 100644 --- a/src/storage/data_object_storage_registry.rs +++ b/src/storage/data_object_storage_registry.rs @@ -74,15 +74,24 @@ decl_event! { impl ContentHasStorage for Module { fn has_storage_provider(which: &T::ContentId) -> bool { let dosr_list = Self::relationships_by_content_id(which); - return dosr_list - .iter() - .any(|&dosr_id| Self::relationships(dosr_id).unwrap().ready); + return dosr_list.iter().any(|&dosr_id| { + let res = Self::relationships(dosr_id); + if res.is_none() { + return false; + } + let dosr = res.unwrap(); + dosr.ready + }); } fn is_ready_at_storage_provider(which: &T::ContentId, provider: &T::AccountId) -> bool { let dosr_list = Self::relationships_by_content_id(which); return dosr_list.iter().any(|&dosr_id| { - let dosr = Self::relationships(dosr_id).unwrap(); + let res = Self::relationships(dosr_id); + if res.is_none() { + return false; + } + let dosr = res.unwrap(); dosr.storage_provider == *provider && dosr.ready }); } @@ -166,11 +175,8 @@ impl Module { #[cfg(test)] mod tests { - use super::*; use crate::storage::mock::*; - use system::{self, EventRecord, Phase}; - #[test] fn initial_state() { with_default_mock_builder(|| { @@ -210,8 +216,8 @@ mod tests { MetaEvent::data_object_storage_registry( data_object_storage_registry::RawEvent::DataObjectStorageRelationshipAdded( dosr_id, - content_id, - account_id, + _content_id, + _account_id, ), ) => dosr_id, _ => 0xdeadbeefu64, // invalid value, unlikely to match diff --git a/src/storage/data_object_type_registry.rs b/src/storage/data_object_type_registry.rs index b8f15b3ede..9a290cfd2e 100644 --- a/src/storage/data_object_type_registry.rs +++ b/src/storage/data_object_type_registry.rs @@ -5,9 +5,7 @@ use parity_codec::Codec; use parity_codec_derive::{Decode, Encode}; use rstd::prelude::*; use runtime_primitives::traits::{As, MaybeDebug, MaybeSerializeDebug, Member, SimpleArithmetic}; -use srml_support::{ - decl_event, decl_module, decl_storage, ensure, Parameter, StorageMap, StorageValue, -}; +use srml_support::{decl_event, decl_module, decl_storage, Parameter, StorageMap, StorageValue}; use system::{self, ensure_root}; pub trait Trait: system::Trait + MaybeDebug { diff --git a/src/storage/downloads.rs b/src/storage/downloads.rs index abd05cef22..2c3770a97d 100644 --- a/src/storage/downloads.rs +++ b/src/storage/downloads.rs @@ -137,8 +137,7 @@ decl_module! { let who = ensure_signed(origin)?; // Get session - let found = Self::download_sessions(session_id).ok_or(MSG_SESSION_NOT_FOUND); - let mut session = found.unwrap(); + let mut session = Self::download_sessions(session_id).ok_or(MSG_SESSION_NOT_FOUND)?; // Ensure that the session hasn't ended yet. ensure!(session.state == DownloadState::Started, MSG_SESSION_HAS_ENDED); diff --git a/src/storage/mock.rs b/src/storage/mock.rs index 94508e876a..c461ab15c2 100644 --- a/src/storage/mock.rs +++ b/src/storage/mock.rs @@ -2,7 +2,6 @@ pub use super::{data_directory, data_object_storage_registry, data_object_type_registry}; use crate::traits; -use rstd::prelude::*; use runtime_io::with_externalities; pub use system; @@ -197,7 +196,7 @@ pub type System = system::Module; pub type TestDataObjectTypeRegistry = data_object_type_registry::Module; pub type TestDataObjectType = data_object_type_registry::DataObjectType; pub type TestDataDirectory = data_directory::Module; -pub type TestDataObject = data_directory::DataObject; +// pub type TestDataObject = data_directory::DataObject; pub type TestDataObjectStorageRegistry = data_object_storage_registry::Module; pub const TEST_FIRST_DATA_OBJECT_TYPE_ID: u64 = 1000; From 40be6a99f7a5ac69f356fb6267f28ada6aa4710a Mon Sep 17 00:00:00 2001 From: Jens Finkhaeuser Date: Tue, 2 Apr 2019 17:33:54 +0200 Subject: [PATCH 134/175] Content directory test & some changes from review --- src/storage/content_directory.rs | 62 +++++++++++++++++++++++++------- src/storage/mock.rs | 30 +++++++++++++++- 2 files changed, 79 insertions(+), 13 deletions(-) diff --git a/src/storage/content_directory.rs b/src/storage/content_directory.rs index d320f5f943..57fba3c535 100644 --- a/src/storage/content_directory.rs +++ b/src/storage/content_directory.rs @@ -41,7 +41,7 @@ pub trait Trait: timestamp::Trait + system::Trait + DOTRTrait + MaybeDebug { } static MSG_CREATOR_MUST_BE_MEMBER: &str = "Only active members may create content!"; -static MSG_INVALID_SCHEMA_ID: &str = "The metadata schema is not known or invalid!"; +// TODO for future: static MSG_INVALID_SCHEMA_ID: &str = "The metadata schema is not known or invalid!"; static MSG_METADATA_NOT_FOUND: &str = "Metadata with the given ID cannot be found!"; static MSG_ONLY_OWNER_MAY_PUBLISH: &str = "Only metadata owners may publish their metadata!"; @@ -101,10 +101,8 @@ decl_module! { pub fn add_metadata(origin, schema: T::SchemaId, metadata: Vec) { // Origin has to be a member - let who = ensure_signed(origin).clone().unwrap(); - if !T::Members::is_active_member(&who) { - return Err(MSG_CREATOR_MUST_BE_MEMBER); - } + let who = ensure_signed(origin)?; + ensure!(T::Members::is_active_member(&who), MSG_CREATOR_MUST_BE_MEMBER); // TODO in future, we want the schema IDs to correspond to a schema // registry, and validate the data. For now, we just allow the @@ -136,17 +134,13 @@ decl_module! { pub fn publish_metadata(origin, id: T::MetadataId) { // Ensure signed account - let who = ensure_signed(origin).clone().unwrap(); + let who = ensure_signed(origin)?; // Try t find metadata - let found = Self::metadata(id); - ensure!(!found.is_some(), MSG_METADATA_NOT_FOUND); + let mut data = Self::metadata(id).ok_or(MSG_METADATA_NOT_FOUND)?; // Ensure it's the metadata creator who publishes - let mut data = found.unwrap(); - if data.origin != who { - return Err(MSG_ONLY_OWNER_MAY_PUBLISH); - } + ensure!(data.origin == who, MSG_ONLY_OWNER_MAY_PUBLISH); // Modify data.state = MetadataState::Published; @@ -159,3 +153,47 @@ decl_module! { } } } + +#[cfg(test)] +mod tests { + use crate::storage::mock::*; + + #[test] + fn add_metadata() { + with_default_mock_builder(|| { + let res = + TestContentDirectory::add_metadata(Origin::signed(1), 1, "foo".as_bytes().to_vec()); + assert!(res.is_ok()); + }); + } + + #[test] + fn publish_metadata() { + with_default_mock_builder(|| { + let res = + TestContentDirectory::add_metadata(Origin::signed(1), 1, "foo".as_bytes().to_vec()); + assert!(res.is_ok()); + + // Grab ID from event + let metadata_id = match System::events().last().unwrap().event { + MetaEvent::content_directory( + content_directory::RawEvent::MetadataDraftCreated(metadata_id), + ) => metadata_id, + _ => 0xdeadbeefu64, // invalid value, unlikely to match + }; + assert_ne!(metadata_id, 0xdeadbeefu64); + + // Publishing a bad ID should fail + let res = TestContentDirectory::publish_metadata(Origin::signed(1), metadata_id + 1); + assert!(res.is_err()); + + // Publishing should not work for non-owners + let res = TestContentDirectory::publish_metadata(Origin::signed(2), metadata_id); + assert!(res.is_err()); + + // For the owner, it should work however + let res = TestContentDirectory::publish_metadata(Origin::signed(1), metadata_id); + assert!(res.is_ok()); + }); + } +} diff --git a/src/storage/mock.rs b/src/storage/mock.rs index c461ab15c2..ffb95ab550 100644 --- a/src/storage/mock.rs +++ b/src/storage/mock.rs @@ -1,6 +1,8 @@ #![cfg(test)] -pub use super::{data_directory, data_object_storage_registry, data_object_type_registry}; +pub use super::{ + content_directory, data_directory, data_object_storage_registry, data_object_type_registry, +}; use crate::traits; use runtime_io::with_externalities; pub use system; @@ -23,6 +25,7 @@ impl_outer_event! { data_object_type_registry, data_directory, data_object_storage_registry, + content_directory, } } @@ -115,6 +118,13 @@ impl data_object_storage_registry::Trait for Test { type ContentIdExists = MockContent; } +impl content_directory::Trait for Test { + type Event = MetaEvent; + type MetadataId = u64; + type SchemaId = u64; + type Members = MockMembers; +} + impl timestamp::Trait for Test { type Moment = u64; type OnTimestampSet = (); @@ -130,6 +140,7 @@ pub struct ExtBuilder { first_data_object_type_id: u64, first_content_id: u64, first_relationship_id: u64, + first_metadata_id: u64, } impl Default for ExtBuilder { @@ -138,6 +149,7 @@ impl Default for ExtBuilder { first_data_object_type_id: 1, first_content_id: 2, first_relationship_id: 3, + first_metadata_id: 4, } } } @@ -155,6 +167,10 @@ impl ExtBuilder { self.first_relationship_id = first_relationship_id; self } + pub fn first_metadata_id(mut self, first_metadata_id: u64) -> Self { + self.first_metadata_id = first_metadata_id; + self + } pub fn build(self) -> runtime_io::TestExternalities { let mut t = system::GenesisConfig::::default() .build_storage() @@ -188,6 +204,15 @@ impl ExtBuilder { .0, ); + t.extend( + content_directory::GenesisConfig:: { + first_metadata_id: self.first_metadata_id, + } + .build_storage() + .unwrap() + .0, + ); + t.into() } } @@ -198,16 +223,19 @@ pub type TestDataObjectType = data_object_type_registry::DataObjectType; pub type TestDataDirectory = data_directory::Module; // pub type TestDataObject = data_directory::DataObject; pub type TestDataObjectStorageRegistry = data_object_storage_registry::Module; +pub type TestContentDirectory = content_directory::Module; pub const TEST_FIRST_DATA_OBJECT_TYPE_ID: u64 = 1000; pub const TEST_FIRST_CONTENT_ID: u64 = 2000; pub const TEST_FIRST_RELATIONSHIP_ID: u64 = 3000; +pub const TEST_FIRST_METADATA_ID: u64 = 4000; pub fn with_default_mock_builder R>(f: F) -> R { with_externalities( &mut ExtBuilder::default() .first_data_object_type_id(TEST_FIRST_DATA_OBJECT_TYPE_ID) .first_content_id(TEST_FIRST_CONTENT_ID) .first_relationship_id(TEST_FIRST_RELATIONSHIP_ID) + .first_metadata_id(TEST_FIRST_METADATA_ID) .build(), || f(), ) From 471e96a12c66cc3d4f9c7b2bb244aa0e0e455194 Mon Sep 17 00:00:00 2001 From: Jens Finkhaeuser Date: Tue, 2 Apr 2019 17:35:15 +0200 Subject: [PATCH 135/175] Fix typo --- src/storage/content_directory.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/storage/content_directory.rs b/src/storage/content_directory.rs index 57fba3c535..d6a610150e 100644 --- a/src/storage/content_directory.rs +++ b/src/storage/content_directory.rs @@ -110,7 +110,7 @@ decl_module! { // 1 - Video (schema TBD, i.e. handled in UI only) // 2 - Podcast (schema TBD, i.e. handled in UI only) // Pseudocode - // if schema in (1, 2) { + // if schema not in (1, 2) { // return Err(MSG_INVALID_SCHEMA_ID); // } From e774594a1b75dde18e58e1f842a0d112009cd6de Mon Sep 17 00:00:00 2001 From: Jens Finkhaeuser Date: Tue, 2 Apr 2019 17:36:08 +0200 Subject: [PATCH 136/175] Add issue comment --- src/storage/content_directory.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/storage/content_directory.rs b/src/storage/content_directory.rs index d6a610150e..a66b13ee4d 100644 --- a/src/storage/content_directory.rs +++ b/src/storage/content_directory.rs @@ -113,6 +113,8 @@ decl_module! { // if schema not in (1, 2) { // return Err(MSG_INVALID_SCHEMA_ID); // } + // + // See https://github.com/Joystream/substrate-runtime-joystream/issues/20 // New and data let new_id = Self::next_metadata_id(); From e69a6dae741525c948f7a4e8675ea11f519d6810 Mon Sep 17 00:00:00 2001 From: Jens Finkhaeuser Date: Wed, 3 Apr 2019 08:52:53 +0200 Subject: [PATCH 137/175] Run rustfmt over everything. --- src/governance/council.rs | 13 +- src/governance/election.rs | 940 +++++++++++++++++++++++----------- src/governance/mock.rs | 15 +- src/governance/mod.rs | 11 +- src/governance/proposals.rs | 529 ++++++++++++------- src/governance/sealed_vote.rs | 42 +- src/governance/stake.rs | 27 +- src/lib.rs | 427 +++++++-------- src/membership/members.rs | 126 +++-- src/membership/mock.rs | 62 ++- src/membership/mod.rs | 2 +- src/membership/tests.rs | 272 ++++++---- src/memo.rs | 10 +- src/migration.rs | 52 +- src/roles/actors.rs | 11 +- src/storage/mod.rs | 2 +- src/storage/tests.rs | 294 ++++++----- src/traits.rs | 22 +- 18 files changed, 1791 insertions(+), 1066 deletions(-) diff --git a/src/governance/council.rs b/src/governance/council.rs index c69ff64a46..2d02895a21 100644 --- a/src/governance/council.rs +++ b/src/governance/council.rs @@ -1,12 +1,12 @@ #![cfg_attr(not(feature = "std"), no_std)] -use srml_support::{StorageValue, decl_module, decl_event, decl_storage, ensure}; -use system::{self}; -use runtime_primitives::traits::{As, Zero}; use rstd::prelude::*; +use runtime_primitives::traits::{As, Zero}; +use srml_support::{decl_event, decl_module, decl_storage, ensure, StorageValue}; +use system; -pub use super::election::{self, Seats, Seat, CouncilElected}; -pub use super::{ GovernanceCurrency, BalanceOf }; +pub use super::election::{self, CouncilElected, Seat, Seats}; +pub use super::{BalanceOf, GovernanceCurrency}; // Hook For announcing that council term has ended pub trait CouncilTermEnded { @@ -55,7 +55,6 @@ impl CouncilElected>, T::BlockNumber> } impl Module { - pub fn is_term_ended() -> bool { >::block_number() >= Self::term_ends_at() } @@ -158,7 +157,7 @@ mod tests { #[test] fn set_council_test() { with_externalities(&mut initial_test_ext(), || { - assert_ok!(Council::set_council(vec![4,5,6])); + assert_ok!(Council::set_council(vec![4, 5, 6])); assert!(Council::is_councilor(&4)); assert!(Council::is_councilor(&5)); assert!(Council::is_councilor(&6)); diff --git a/src/governance/election.rs b/src/governance/election.rs index 5a9ef71043..59d3976ffb 100644 --- a/src/governance/election.rs +++ b/src/governance/election.rs @@ -1,23 +1,25 @@ #![cfg_attr(not(feature = "std"), no_std)] use rstd::prelude::*; -use srml_support::{StorageValue, StorageMap, dispatch::Result, decl_module, decl_event, decl_storage, ensure}; -use srml_support::traits::{Currency}; +use srml_support::traits::Currency; +use srml_support::{ + decl_event, decl_module, decl_storage, dispatch::Result, ensure, StorageMap, StorageValue, +}; use system::{self, ensure_signed}; -use runtime_primitives::traits::{Hash, As, Zero, /*SimpleArithmetic*/}; +use runtime_primitives::traits::{As, Hash, Zero /*SimpleArithmetic*/}; //use {balances}; use rstd::collections::btree_map::BTreeMap; use rstd::ops::Add; -use super::stake::Stake; use super::sealed_vote::SealedVote; +use super::stake::Stake; -pub use super::{ GovernanceCurrency, BalanceOf }; use super::council; +pub use super::{BalanceOf, GovernanceCurrency}; -use crate::traits::{Members}; +use crate::traits::Members; pub trait Trait: system::Trait + council::Trait + GovernanceCurrency { type Event: From> + Into<::Event>; @@ -43,10 +45,13 @@ pub struct Seat { } impl Seat - where Balance: Add + Copy, +where + Balance: Add + Copy, { pub fn calc_total_stake(&self) -> Balance { - self.backers.iter().fold(self.stake, |acc, backer| acc + backer.stake) + self.backers + .iter() + .fold(self.stake, |acc, backer| acc + backer.stake) } } @@ -152,7 +157,6 @@ impl Module { >::block_number() + length } - fn can_participate(sender: &T::AccountId) -> bool { !T::Currency::free_balance(sender).is_zero() && T::Members::is_active_member(sender) } @@ -183,7 +187,10 @@ impl Module { /// Initializes transferable stakes. Assumes election parameters have already been set. fn start_election(current_council: Seats>) -> Result { ensure!(!Self::is_election_running(), "election already in progress"); - ensure!(Self::existing_stake_holders().len() == 0, "stake holders must be empty"); + ensure!( + Self::existing_stake_holders().len() == 0, + "stake holders must be empty" + ); ensure!(Self::applicants().len() == 0, "applicants must be empty"); ensure!(Self::commitments().len() == 0, "commitments must be empty"); @@ -202,7 +209,10 @@ impl Module { /// for entering the stage has been performed. /// Bumps the election round. fn move_to_announcing_stage() { - let next_round = >::mutate(|n| { *n += 1; *n }); + let next_round = >::mutate(|n| { + *n += 1; + *n + }); let new_stage_ends_at = Self::current_block_number_plus(Self::announcing_period()); @@ -233,15 +243,15 @@ impl Module { /// Sorts applicants by stake, and returns slice of applicants with least stake. Applicants not /// returned in the slice are the top `len` highest staked. - fn find_least_staked_applicants ( + fn find_least_staked_applicants( applicants: &mut Vec, - len: usize) -> &[T::AccountId] - { + len: usize, + ) -> &[T::AccountId] { if len >= applicants.len() { &[] } else { applicants.sort_by_key(|applicant| Self::applicant_stakes(applicant)); - &applicants[0 .. applicants.len() - len] + &applicants[0..applicants.len() - len] } } @@ -283,11 +293,14 @@ impl Module { for applicant in Self::applicants().iter() { if !new_council.contains_key(applicant) { - new_council.insert(applicant.clone(), Seat { - member: applicant.clone(), - stake: Self::applicant_stakes(applicant).total(), - backers: Vec::new(), - }); + new_council.insert( + applicant.clone(), + Seat { + member: applicant.clone(), + stake: Self::applicant_stakes(applicant).total(), + backers: Vec::new(), + }, + ); } } @@ -307,10 +320,10 @@ impl Module { // unless we want to add more filtering criteria to what is considered a successful election // other than just the minimum stake for candidacy, we have a new council! - Self::teardown_election ( + Self::teardown_election( &votes, &new_council, - true /* unlock transferable stakes */ + true, /* unlock transferable stakes */ ); let new_council = new_council.into_iter().map(|(_, seat)| seat).collect(); @@ -319,11 +332,11 @@ impl Module { Self::deposit_event(RawEvent::CouncilElected(>::block_number())); } - fn teardown_election ( - votes: &Vec>, - T::Hash, T::AccountId>>, new_council: &BTreeMap>>, - unlock_ts: bool) - { + fn teardown_election( + votes: &Vec>, T::Hash, T::AccountId>>, + new_council: &BTreeMap>>, + unlock_ts: bool, + ) { Self::refund_voting_stakes(&votes, &new_council); Self::clear_votes(); @@ -374,12 +387,15 @@ impl Module { // return unused transferable stake if !stake.transferred.is_zero() { - >::mutate(applicant, |transferable| (*transferable).seat += stake.transferred); + >::mutate(applicant, |transferable| { + (*transferable).seat += stake.transferred + }); } } fn drop_applicants(drop: &[T::AccountId]) { - let not_dropped: Vec = Self::applicants().into_iter() + let not_dropped: Vec = Self::applicants() + .into_iter() .filter(|id| !drop.iter().any(|x| *x == *id)) .collect(); @@ -391,8 +407,11 @@ impl Module { >::put(not_dropped); } - fn drop_unelected_applicants(new_council: &BTreeMap>>) { - let applicants_to_drop: Vec = Self::applicants().into_iter() + fn drop_unelected_applicants( + new_council: &BTreeMap>>, + ) { + let applicants_to_drop: Vec = Self::applicants() + .into_iter() .filter(|applicant| !new_council.contains_key(&applicant)) .collect(); @@ -401,8 +420,8 @@ impl Module { fn refund_voting_stakes( sealed_votes: &Vec>, T::Hash, T::AccountId>>, - new_council: &BTreeMap>>) - { + new_council: &BTreeMap>>, + ) { for sealed_vote in sealed_votes.iter() { // Do a refund if commitment was not revealed, or the vote was for applicant that did // not get elected to the council @@ -410,7 +429,7 @@ impl Module { // See https://github.com/Joystream/substrate-node-joystream/issues/4 let do_refund = match sealed_vote.get_vote() { Some(applicant) => !new_council.contains_key(&applicant), - None => true + None => true, }; if do_refund { @@ -422,7 +441,9 @@ impl Module { // return unused transferable stake if !stake.transferred.is_zero() { - >::mutate(voter, |transferable| (*transferable).backing += stake.transferred); + >::mutate(voter, |transferable| { + (*transferable).backing += stake.transferred + }); } } } @@ -435,24 +456,29 @@ impl Module { >::kill(); } - fn tally_votes(sealed_votes: &Vec>, T::Hash, T::AccountId>>) -> BTreeMap>> { + fn tally_votes( + sealed_votes: &Vec>, T::Hash, T::AccountId>>, + ) -> BTreeMap>> { let mut tally: BTreeMap>> = BTreeMap::new(); for sealed_vote in sealed_votes.iter() { if let Some(applicant) = sealed_vote.get_vote() { if !tally.contains_key(&applicant) { // Add new seat - tally.insert(applicant.clone(), Seat { - member: applicant.clone(), - stake: Self::applicant_stakes(applicant).total(), - backers: vec![], - }); + tally.insert( + applicant.clone(), + Seat { + member: applicant.clone(), + stake: Self::applicant_stakes(applicant).total(), + backers: vec![], + }, + ); } if let Some(seat) = tally.get_mut(&applicant) { // Add backer to existing seat seat.backers.push(Backer { member: sealed_vote.voter.clone(), - stake: sealed_vote.stake.total() + stake: sealed_vote.stake.total(), }); } } @@ -461,15 +487,19 @@ impl Module { tally } - fn filter_top_staked(tally: &mut BTreeMap>>, limit: usize) { - + fn filter_top_staked( + tally: &mut BTreeMap>>, + limit: usize, + ) { if limit >= tally.len() { return; } // use ordering in the applicants vector (not ordering resulting from btreemap iteration) - let mut seats: Vec = Self::applicants().into_iter() - .filter(|id| tally.contains_key(id)).collect(); + let mut seats: Vec = Self::applicants() + .into_iter() + .filter(|id| tally.contains_key(id)) + .collect(); // ensure_eq!(seats.len(), tally.len()); @@ -481,11 +511,13 @@ impl Module { // TODO: order by number of votes, then number of backers seats.sort_by_key(|applicant| { - tally.get(&applicant).map_or(Zero::zero(), |seat| seat.calc_total_stake()) + tally + .get(&applicant) + .map_or(Zero::zero(), |seat| seat.calc_total_stake()) }); // seats at bottom of list - let filtered_out_seats = &seats[0 .. seats.len() - limit]; + let filtered_out_seats = &seats[0..seats.len() - limit]; for id in filtered_out_seats { tally.remove(id); @@ -496,18 +528,24 @@ impl Module { fn check_if_stage_is_ending(now: T::BlockNumber) { if let Some(stage) = Self::stage() { match stage { - ElectionStage::Announcing(ends) => if ends == now { - Self::deposit_event(RawEvent::AnnouncingEnded()); - Self::on_announcing_ended(); - }, - ElectionStage::Voting(ends) => if ends == now { - Self::deposit_event(RawEvent::VotingEnded()); - Self::on_voting_ended(); - }, - ElectionStage::Revealing(ends) => if ends == now { - Self::deposit_event(RawEvent::RevealingEnded()); - Self::on_revealing_ended(); - }, + ElectionStage::Announcing(ends) => { + if ends == now { + Self::deposit_event(RawEvent::AnnouncingEnded()); + Self::on_announcing_ended(); + } + } + ElectionStage::Voting(ends) => { + if ends == now { + Self::deposit_event(RawEvent::VotingEnded()); + Self::on_voting_ended(); + } + } + ElectionStage::Revealing(ends) => { + if ends == now { + Self::deposit_event(RawEvent::RevealingEnded()); + Self::on_revealing_ended(); + } + } } } } @@ -520,32 +558,42 @@ impl Module { let Seat { member, stake, .. } = seat; if >::exists(&member) { - >::mutate(&member, |transferbale_stake| *transferbale_stake = TransferableStake { - seat: transferbale_stake.seat + stake, - backing: transferbale_stake.backing, + >::mutate(&member, |transferbale_stake| { + *transferbale_stake = TransferableStake { + seat: transferbale_stake.seat + stake, + backing: transferbale_stake.backing, + } }); } else { - >::insert(&member, TransferableStake { - seat: stake, - backing: BalanceOf::::zero(), - }); + >::insert( + &member, + TransferableStake { + seat: stake, + backing: BalanceOf::::zero(), + }, + ); stakeholder_accounts.push(member); } for backer in seat.backers.into_iter() { - let Backer { member, stake, ..} = backer; + let Backer { member, stake, .. } = backer; if >::exists(&member) { - >::mutate(&member, |transferbale_stake| *transferbale_stake = TransferableStake { - seat: transferbale_stake.seat, - backing: transferbale_stake.backing + stake, + >::mutate(&member, |transferbale_stake| { + *transferbale_stake = TransferableStake { + seat: transferbale_stake.seat, + backing: transferbale_stake.backing + stake, + } }); } else { - >::insert(&member, TransferableStake { - seat: BalanceOf::::zero(), - backing: stake, - }); + >::insert( + &member, + TransferableStake { + seat: BalanceOf::::zero(), + backing: stake, + }, + ); stakeholder_accounts.push(member); } @@ -555,13 +603,15 @@ impl Module { >::put(stakeholder_accounts); } - fn new_stake_reusing_transferable(transferable: &mut BalanceOf, new_stake: BalanceOf) -> Stake> { - let transferred = - if *transferable >= new_stake { - new_stake - } else { - *transferable - }; + fn new_stake_reusing_transferable( + transferable: &mut BalanceOf, + new_stake: BalanceOf, + ) -> Stake> { + let transferred = if *transferable >= new_stake { + new_stake + } else { + *transferable + }; *transferable = *transferable - transferred; @@ -576,9 +626,15 @@ impl Module { let new_stake = Self::new_stake_reusing_transferable(&mut transferable_stake.seat, stake); - ensure!(T::Currency::can_reserve(&applicant, new_stake.new), "not enough free balance to reserve"); + ensure!( + T::Currency::can_reserve(&applicant, new_stake.new), + "not enough free balance to reserve" + ); - ensure!(T::Currency::reserve(&applicant, new_stake.new).is_ok(), "failed to reserve applicant stake!"); + ensure!( + T::Currency::reserve(&applicant, new_stake.new).is_ok(), + "failed to reserve applicant stake!" + ); let applicant_stake = >::get(&applicant); let total_stake = applicant_stake.add(&new_stake); @@ -603,15 +659,25 @@ impl Module { let mut transferable_stake = >::get(&voter); - let vote_stake = Self::new_stake_reusing_transferable(&mut transferable_stake.backing, stake); + let vote_stake = + Self::new_stake_reusing_transferable(&mut transferable_stake.backing, stake); - ensure!(T::Currency::can_reserve(&voter, vote_stake.new), "not enough free balance to reserve"); + ensure!( + T::Currency::can_reserve(&voter, vote_stake.new), + "not enough free balance to reserve" + ); - ensure!(T::Currency::reserve(&voter, vote_stake.new).is_ok(), "failed to reserve voting stake!"); + ensure!( + T::Currency::reserve(&voter, vote_stake.new).is_ok(), + "failed to reserve voting stake!" + ); >::mutate(|commitments| commitments.push(commitment)); - >::insert(commitment, SealedVote::new(voter.clone(), vote_stake, commitment)); + >::insert( + commitment, + SealedVote::new(voter.clone(), vote_stake, commitment), + ); if >::exists(&voter) { >::insert(&voter, transferable_stake); @@ -620,7 +686,12 @@ impl Module { Ok(()) } - fn try_reveal_vote(voter: T::AccountId, commitment: T::Hash, vote_for: T::AccountId, salt: Vec) -> Result { + fn try_reveal_vote( + voter: T::AccountId, + commitment: T::Hash, + vote_for: T::AccountId, + salt: Vec, + ) -> Result { ensure!(>::exists(&commitment), "commitment not found"); let mut sealed_vote = >::get(&commitment); @@ -628,7 +699,10 @@ impl Module { ensure!(sealed_vote.is_not_revealed(), "vote already revealed"); // only voter can reveal their own votes ensure!(sealed_vote.is_owned_by(voter), "only voter can reveal vote"); - ensure!(>::exists(&vote_for), "vote for non-applicant not allowed"); + ensure!( + >::exists(&vote_for), + "vote for non-applicant not allowed" + ); let mut salt = salt.clone(); @@ -868,12 +942,18 @@ mod tests { fn should_not_start_new_election_if_already_started() { with_externalities(&mut initial_test_ext(), || { assert_ok!(Election::start_election(vec![])); - assert_err!(Election::start_election(vec![]), "election already in progress"); + assert_err!( + Election::start_election(vec![]), + "election already in progress" + ); }); } fn assert_announcing_period(expected_period: ::BlockNumber) { - assert!(Election::is_election_running(), "Election Stage was not set"); + assert!( + Election::is_election_running(), + "Election Stage was not set" + ); let election_stage = Election::stage().unwrap(); @@ -881,9 +961,7 @@ mod tests { election::ElectionStage::Announcing(period) => { assert_eq!(period, expected_period, "Election period not set correctly") } - _ => { - assert!(false, "Election Stage was not correctly set to Announcing") - } + _ => assert!(false, "Election Stage was not correctly set to Announcing"), } } @@ -905,9 +983,8 @@ mod tests { } #[test] - fn init_transferable_stake_should_work () { + fn init_transferable_stake_should_work() { with_externalities(&mut initial_test_ext(), || { - let existing_council = vec![ Seat { member: 1, @@ -924,9 +1001,9 @@ mod tests { Backer { member: 10, stake: 10, - }] + }, + ], }, - Seat { member: 2, stake: 200, @@ -942,9 +1019,9 @@ mod tests { Backer { member: 20, stake: 20, - }] + }, + ], }, - Seat { member: 3, stake: 300, @@ -956,14 +1033,15 @@ mod tests { Backer { member: 2, stake: 40, - }] - } + }, + ], + }, ]; Election::initialize_transferable_stakes(existing_council); let mut existing_stake_holders = Election::existing_stake_holders(); existing_stake_holders.sort(); - assert_eq!(existing_stake_holders, vec![1,2,3,10,20]); + assert_eq!(existing_stake_holders, vec![1, 2, 3, 10, 20]); assert_eq!(Election::transferable_stakes(&1).seat, 100); assert_eq!(Election::transferable_stakes(&1).backing, 30); @@ -979,14 +1057,12 @@ mod tests { assert_eq!(Election::transferable_stakes(&20).seat, 0); assert_eq!(Election::transferable_stakes(&20).backing, 20); - }); } #[test] fn try_add_applicant_should_work() { with_externalities(&mut initial_test_ext(), || { - assert!(Election::applicants().len() == 0); let applicant = 20 as u64; @@ -1007,22 +1083,28 @@ mod tests { } #[test] - fn increasing_applicant_stake_should_work () { + fn increasing_applicant_stake_should_work() { with_externalities(&mut initial_test_ext(), || { let applicant = 20 as u64; let starting_stake = 100 as u32; >::put(vec![applicant]); - >::insert(applicant, Stake { - new: starting_stake, - transferred: 0, - }); + >::insert( + applicant, + Stake { + new: starting_stake, + transferred: 0, + }, + ); let additional_stake = 100 as u32; Balances::set_free_balance(&applicant, additional_stake); assert!(Election::try_add_applicant(applicant, additional_stake).is_ok()); - assert_eq!(Election::applicant_stakes(applicant).new, starting_stake + additional_stake); + assert_eq!( + Election::applicant_stakes(applicant).new, + starting_stake + additional_stake + ); assert_eq!(Election::applicant_stakes(applicant).transferred, 0) }); } @@ -1030,12 +1112,17 @@ mod tests { #[test] fn using_transferable_seat_stake_should_work() { with_externalities(&mut initial_test_ext(), || { - let applicant = 20 as u64; Balances::set_free_balance(&applicant, 5000); >::put(vec![applicant]); - save_transferable_stake(applicant, TransferableStake {seat: 1000, backing: 0}); + save_transferable_stake( + applicant, + TransferableStake { + seat: 1000, + backing: 0, + }, + ); >::put(vec![applicant]); let starting_stake = Stake { @@ -1046,18 +1133,23 @@ mod tests { // transferable stake covers new stake assert!(Election::try_add_applicant(applicant, 600).is_ok()); - assert_eq!(Election::applicant_stakes(applicant).new, starting_stake.new); + assert_eq!( + Election::applicant_stakes(applicant).new, + starting_stake.new + ); assert_eq!(Election::applicant_stakes(applicant).transferred, 600); assert_eq!(Election::transferable_stakes(applicant).seat, 400); assert_eq!(Balances::free_balance(applicant), 5000); // all remaining transferable stake is consumed and free balance covers remaining stake assert!(Election::try_add_applicant(applicant, 1000).is_ok()); - assert_eq!(Election::applicant_stakes(applicant).new, starting_stake.new + 600); + assert_eq!( + Election::applicant_stakes(applicant).new, + starting_stake.new + 600 + ); assert_eq!(Election::applicant_stakes(applicant).transferred, 1000); assert_eq!(Election::transferable_stakes(applicant).seat, 0); assert_eq!(Balances::free_balance(applicant), 4400); - }); } @@ -1071,7 +1163,7 @@ mod tests { let round = Election::round(); // add applicants - >::put(vec![10,20,30]); + >::put(vec![10, 20, 30]); let stake = Stake { new: 10, transferred: 0, @@ -1109,10 +1201,13 @@ mod tests { let mut applicants = Election::applicants(); for (i, applicant) in applicants.iter().enumerate() { - >::insert(applicant, Stake { - new: (i * 10) as u32, - transferred: 0, - }); + >::insert( + applicant, + Stake { + new: (i * 10) as u32, + transferred: 0, + }, + ); } let rejected = Election::find_least_staked_applicants(&mut applicants, 3); @@ -1122,10 +1217,13 @@ mod tests { let mut applicants = Election::applicants(); for applicant in applicants.iter() { - >::insert(applicant, Stake { - new: 20 as u32, - transferred: 0, - }); + >::insert( + applicant, + Stake { + new: 20 as u32, + transferred: 0, + }, + ); } // stable sort is preserving order when two elements are equivalent @@ -1135,34 +1233,63 @@ mod tests { } #[test] - fn refunding_applicant_stakes_should_work () { + fn refunding_applicant_stakes_should_work() { with_externalities(&mut initial_test_ext(), || { Balances::set_free_balance(&1, 1000); - Balances::set_free_balance(&2, 2000); Balances::set_reserved_balance(&2, 5000); - Balances::set_free_balance(&3, 3000); Balances::set_reserved_balance(&3, 5000); - - >::put(vec![1,2,3]); - - save_transferable_stake(1, TransferableStake {seat: 50, backing: 0}); - save_transferable_stake(2, TransferableStake {seat: 0, backing: 0}); - save_transferable_stake(3, TransferableStake {seat: 0, backing: 0}); + Balances::set_free_balance(&2, 2000); + Balances::set_reserved_balance(&2, 5000); + Balances::set_free_balance(&3, 3000); + Balances::set_reserved_balance(&3, 5000); + + >::put(vec![1, 2, 3]); + + save_transferable_stake( + 1, + TransferableStake { + seat: 50, + backing: 0, + }, + ); + save_transferable_stake( + 2, + TransferableStake { + seat: 0, + backing: 0, + }, + ); + save_transferable_stake( + 3, + TransferableStake { + seat: 0, + backing: 0, + }, + ); - >::insert(1, Stake { - new: 100, - transferred: 200, - }); + >::insert( + 1, + Stake { + new: 100, + transferred: 200, + }, + ); - >::insert(2, Stake { - new: 300, - transferred: 400, - }); + >::insert( + 2, + Stake { + new: 300, + transferred: 400, + }, + ); - >::insert(3, Stake { - new: 500, - transferred: 600, - }); + >::insert( + 3, + Stake { + new: 500, + transferred: 600, + }, + ); - Election::drop_applicants(&vec![2,3][..]); + Election::drop_applicants(&vec![2, 3][..]); assert_eq!(Election::applicants(), vec![1]); @@ -1184,7 +1311,7 @@ mod tests { } #[test] - fn voting_should_work () { + fn voting_should_work() { with_externalities(&mut initial_test_ext(), || { Balances::set_free_balance(&20, 1000); let payload = vec![10u8]; @@ -1195,10 +1322,13 @@ mod tests { assert_eq!(Election::commitments(), vec![commitment]); assert_eq!(Election::votes(commitment).voter, 20); assert_eq!(Election::votes(commitment).commitment, commitment); - assert_eq!(Election::votes(commitment).stake, Stake { - new: 100, - transferred: 0, - }); + assert_eq!( + Election::votes(commitment).stake, + Stake { + new: 100, + transferred: 0, + } + ); assert_eq!(Balances::free_balance(&20), 900); }); } @@ -1208,11 +1338,17 @@ mod tests { } #[test] - fn votes_can_be_covered_by_transferable_stake () { + fn votes_can_be_covered_by_transferable_stake() { with_externalities(&mut initial_test_ext(), || { Balances::set_free_balance(&20, 1000); - save_transferable_stake(20, TransferableStake {seat: 0, backing: 500}); + save_transferable_stake( + 20, + TransferableStake { + seat: 0, + backing: 500, + }, + ); let payload = vec![10u8]; let commitment = ::Hashing::hash(&payload[..]); @@ -1222,20 +1358,29 @@ mod tests { assert_eq!(Election::commitments(), vec![commitment]); assert_eq!(Election::votes(commitment).voter, 20); assert_eq!(Election::votes(commitment).commitment, commitment); - assert_eq!(Election::votes(commitment).stake, Stake { - new: 0, - transferred: 100, - }); + assert_eq!( + Election::votes(commitment).stake, + Stake { + new: 0, + transferred: 100, + } + ); assert_eq!(Balances::free_balance(&20), 1000); }); } #[test] - fn voting_without_enough_balance_should_not_work () { + fn voting_without_enough_balance_should_not_work() { with_externalities(&mut initial_test_ext(), || { Balances::set_free_balance(&20, 100); - save_transferable_stake(20, TransferableStake { seat: 0, backing: 500 }); + save_transferable_stake( + 20, + TransferableStake { + seat: 0, + backing: 500, + }, + ); let payload = vec![10u8]; let commitment = ::Hashing::hash(&payload[..]); @@ -1248,11 +1393,17 @@ mod tests { } #[test] - fn voting_with_existing_commitment_should_not_work () { + fn voting_with_existing_commitment_should_not_work() { with_externalities(&mut initial_test_ext(), || { Balances::set_free_balance(&20, 1000); - save_transferable_stake(20, TransferableStake { seat: 0, backing: 500}); + save_transferable_stake( + 20, + TransferableStake { + seat: 0, + backing: 500, + }, + ); let payload = vec![10u8]; let commitment = ::Hashing::hash(&payload[..]); @@ -1262,55 +1413,92 @@ mod tests { assert_eq!(Election::commitments(), vec![commitment]); assert_eq!(Election::votes(commitment).voter, 20); assert_eq!(Election::votes(commitment).commitment, commitment); - assert_eq!(Election::votes(commitment).stake, Stake { - new: 0, - transferred: 100, - }); + assert_eq!( + Election::votes(commitment).stake, + Stake { + new: 0, + transferred: 100, + } + ); assert_eq!(Balances::free_balance(&20), 1000); assert!(Election::try_add_vote(30, 100, commitment).is_err()); }); } - fn make_commitment_for_applicant(applicant: ::AccountId, salt: &mut Vec) -> ::Hash { + fn make_commitment_for_applicant( + applicant: ::AccountId, + salt: &mut Vec, + ) -> ::Hash { let mut payload = applicant.encode(); payload.append(salt); ::Hashing::hash(&payload[..]) } #[test] - fn revealing_vote_works () { + fn revealing_vote_works() { with_externalities(&mut initial_test_ext(), || { let applicant = 20 as u64; let salt = vec![128u8]; let commitment = make_commitment_for_applicant(applicant, &mut salt.clone()); let voter = 10 as u64; - >::insert(&applicant, Stake {new: 0, transferred: 0}); + >::insert( + &applicant, + Stake { + new: 0, + transferred: 0, + }, + ); - >::insert(&commitment, SealedVote::new(voter, Stake { - new: 100, transferred: 0 - }, commitment)); + >::insert( + &commitment, + SealedVote::new( + voter, + Stake { + new: 100, + transferred: 0, + }, + commitment, + ), + ); assert!(>::get(commitment).is_not_revealed()); assert!(Election::try_reveal_vote(voter, commitment, applicant, salt).is_ok()); - assert_eq!(>::get(commitment).get_vote().unwrap(), applicant); + assert_eq!( + >::get(commitment).get_vote().unwrap(), + applicant + ); }); } #[test] - fn revealing_with_bad_salt_should_not_work () { + fn revealing_with_bad_salt_should_not_work() { with_externalities(&mut initial_test_ext(), || { let applicant = 20 as u64; let salt = vec![128u8]; let commitment = make_commitment_for_applicant(applicant, &mut salt.clone()); let voter = 10 as u64; - >::insert(&applicant, Stake {new: 0, transferred: 0}); + >::insert( + &applicant, + Stake { + new: 0, + transferred: 0, + }, + ); - >::insert(&commitment, SealedVote::new(voter, Stake { - new: 100, transferred: 0 - }, commitment)); + >::insert( + &commitment, + SealedVote::new( + voter, + Stake { + new: 100, + transferred: 0, + }, + commitment, + ), + ); assert!(>::get(commitment).is_not_revealed()); assert!(Election::try_reveal_vote(voter, commitment, applicant, vec![]).is_err()); @@ -1319,30 +1507,44 @@ mod tests { } #[test] - fn revealing_non_matching_commitment_should_not_work () { + fn revealing_non_matching_commitment_should_not_work() { with_externalities(&mut initial_test_ext(), || { let applicant = 20 as u64; let salt = vec![128u8]; let commitment = make_commitment_for_applicant(100, &mut salt.clone()); let voter = 10 as u64; - >::insert(&applicant, Stake {new: 0, transferred: 0}); + >::insert( + &applicant, + Stake { + new: 0, + transferred: 0, + }, + ); assert!(Election::try_reveal_vote(voter, commitment, applicant, vec![]).is_err()); }); } #[test] - fn revealing_for_non_applicant_should_not_work () { + fn revealing_for_non_applicant_should_not_work() { with_externalities(&mut initial_test_ext(), || { let applicant = 20 as u64; let salt = vec![128u8]; let commitment = make_commitment_for_applicant(applicant, &mut salt.clone()); let voter = 10 as u64; - >::insert(&commitment, SealedVote::new(voter, Stake { - new: 100, transferred: 0 - }, commitment)); + >::insert( + &commitment, + SealedVote::new( + voter, + Stake { + new: 100, + transferred: 0, + }, + commitment, + ), + ); assert!(>::get(commitment).is_not_revealed()); assert!(Election::try_reveal_vote(voter, commitment, applicant, vec![]).is_err()); @@ -1351,7 +1553,7 @@ mod tests { } #[test] - fn revealing_by_non_committer_should_not_work () { + fn revealing_by_non_committer_should_not_work() { with_externalities(&mut initial_test_ext(), || { let applicant = 20 as u64; let salt = vec![128u8]; @@ -1359,11 +1561,25 @@ mod tests { let voter = 10 as u64; let not_voter = 100 as u64; - >::insert(&applicant, Stake {new: 0, transferred: 0}); + >::insert( + &applicant, + Stake { + new: 0, + transferred: 0, + }, + ); - >::insert(&commitment, SealedVote::new(voter, Stake { - new: 100, transferred: 0 - }, commitment)); + >::insert( + &commitment, + SealedVote::new( + voter, + Stake { + new: 100, + transferred: 0, + }, + commitment, + ), + ); assert!(>::get(commitment).is_not_revealed()); assert!(Election::try_reveal_vote(not_voter, commitment, applicant, salt).is_err()); @@ -1371,26 +1587,35 @@ mod tests { }); } - pub fn mock_votes (mock: Vec<(u64, u32, u32, u64)>) -> Vec, primitives::H256, u64>> { + pub fn mock_votes( + mock: Vec<(u64, u32, u32, u64)>, + ) -> Vec, primitives::H256, u64>> { let commitment = make_commitment_for_applicant(1, &mut vec![0u8]); - mock.into_iter().map(|(voter, stake_ref, stake_tran, applicant)| SealedVote::new_unsealed(voter as u64, Stake { - new: stake_ref as u32, transferred: stake_tran as u32 - }, commitment, applicant as u64)).collect() + mock.into_iter() + .map(|(voter, stake_ref, stake_tran, applicant)| { + SealedVote::new_unsealed( + voter as u64, + Stake { + new: stake_ref as u32, + transferred: stake_tran as u32, + }, + commitment, + applicant as u64, + ) + }) + .collect() } - #[test] - fn vote_tallying_should_work () { + fn vote_tallying_should_work() { with_externalities(&mut initial_test_ext(), || { let votes = mock_votes(vec![ - // (voter, stake[new], stake[transferred], applicant) + // (voter, stake[new], stake[transferred], applicant) (10, 100, 0, 100), (10, 150, 0, 100), - (10, 500, 0, 200), (20, 200, 0, 200), - (30, 300, 0, 300), (30, 400, 0, 300), ]); @@ -1400,58 +1625,65 @@ mod tests { assert_eq!(tally.len(), 3); assert_eq!(tally.get(&100).unwrap().member, 100); - assert_eq!(tally.get(&100).unwrap().backers, vec![ - Backer { - member: 10 as u64, - stake: 100 as u32, - }, - Backer { - member: 10 as u64, - stake: 150 as u32, - }, - ]); + assert_eq!( + tally.get(&100).unwrap().backers, + vec![ + Backer { + member: 10 as u64, + stake: 100 as u32, + }, + Backer { + member: 10 as u64, + stake: 150 as u32, + }, + ] + ); assert_eq!(tally.get(&200).unwrap().member, 200); - assert_eq!(tally.get(&200).unwrap().backers, vec![ - Backer { - member: 10 as u64, - stake: 500 as u32, - }, - Backer { - member: 20 as u64, - stake: 200 as u32, - } - ]); + assert_eq!( + tally.get(&200).unwrap().backers, + vec![ + Backer { + member: 10 as u64, + stake: 500 as u32, + }, + Backer { + member: 20 as u64, + stake: 200 as u32, + } + ] + ); assert_eq!(tally.get(&300).unwrap().member, 300); - assert_eq!(tally.get(&300).unwrap().backers, vec![ - Backer { - member: 30 as u64, - stake: 300 as u32, - }, - Backer { - member: 30 as u64, - stake: 400 as u32, - } - ]); + assert_eq!( + tally.get(&300).unwrap().backers, + vec![ + Backer { + member: 30 as u64, + stake: 300 as u32, + }, + Backer { + member: 30 as u64, + stake: 400 as u32, + } + ] + ); }); } - #[test] - fn filter_top_staked_applicants_should_work () { + #[test] + fn filter_top_staked_applicants_should_work() { with_externalities(&mut initial_test_ext(), || { // filter_top_staked depends on order of applicants >::put(vec![100, 200, 300]); { let votes = mock_votes(vec![ - // (voter, stake[new], stake[transferred], applicant) + // (voter, stake[new], stake[transferred], applicant) (10, 100, 0, 100), (10, 150, 0, 100), - (10, 500, 0, 200), (20, 200, 0, 200), - (30, 300, 0, 300), (30, 400, 0, 300), ]); @@ -1464,13 +1696,11 @@ mod tests { { let votes = mock_votes(vec![ - // (voter, stake[new], stake[transferred], applicant) + // (voter, stake[new], stake[transferred], applicant) (10, 100, 0, 100), (10, 150, 0, 100), - (10, 500, 0, 200), (20, 200, 0, 200), - (30, 300, 0, 300), (30, 400, 0, 300), ]); @@ -1486,22 +1716,46 @@ mod tests { } #[test] - fn drop_unelected_applicants_should_work () { + fn drop_unelected_applicants_should_work() { with_externalities(&mut initial_test_ext(), || { >::put(vec![100, 200, 300]); - Balances::set_free_balance(&100, 1000); Balances::set_reserved_balance(&100, 1000); + Balances::set_free_balance(&100, 1000); + Balances::set_reserved_balance(&100, 1000); - >::insert(100, Stake { - new: 20 as u32, - transferred: 50 as u32, - }); + >::insert( + 100, + Stake { + new: 20 as u32, + transferred: 50 as u32, + }, + ); - save_transferable_stake(100, TransferableStake {seat:100, backing: 0}); + save_transferable_stake( + 100, + TransferableStake { + seat: 100, + backing: 0, + }, + ); let mut new_council: BTreeMap> = BTreeMap::new(); - new_council.insert(200 as u64, Seat{ member: 200 as u64, stake: 0 as u32, backers: vec![]}); - new_council.insert(300 as u64, Seat{ member: 300 as u64, stake: 0 as u32, backers: vec![]}); + new_council.insert( + 200 as u64, + Seat { + member: 200 as u64, + stake: 0 as u32, + backers: vec![], + }, + ); + new_council.insert( + 300 as u64, + Seat { + member: 300 as u64, + stake: 0 as u32, + backers: vec![], + }, + ); Election::drop_unelected_applicants(&new_council); @@ -1516,43 +1770,78 @@ mod tests { }); } - #[test] - fn refunding_voting_stakes_should_work () { + fn refunding_voting_stakes_should_work() { with_externalities(&mut initial_test_ext(), || { // voters' balances - Balances::set_free_balance(&10, 1000); Balances::set_reserved_balance(&10, 5000); - Balances::set_free_balance(&20, 2000); Balances::set_reserved_balance(&20, 5000); - Balances::set_free_balance(&30, 3000); Balances::set_reserved_balance(&30, 5000); - - save_transferable_stake(10, TransferableStake {seat: 0, backing: 100}); - save_transferable_stake(20, TransferableStake {seat: 0, backing: 200}); - save_transferable_stake(30, TransferableStake {seat: 0, backing: 300}); + Balances::set_free_balance(&10, 1000); + Balances::set_reserved_balance(&10, 5000); + Balances::set_free_balance(&20, 2000); + Balances::set_reserved_balance(&20, 5000); + Balances::set_free_balance(&30, 3000); + Balances::set_reserved_balance(&30, 5000); + + save_transferable_stake( + 10, + TransferableStake { + seat: 0, + backing: 100, + }, + ); + save_transferable_stake( + 20, + TransferableStake { + seat: 0, + backing: 200, + }, + ); + save_transferable_stake( + 30, + TransferableStake { + seat: 0, + backing: 300, + }, + ); let votes = mock_votes(vec![ - // (voter, stake[new], stake[transferred], applicant) + // (voter, stake[new], stake[transferred], applicant) (10, 100, 20, 100), (20, 200, 40, 100), (30, 300, 60, 100), - (10, 500, 70, 200), (20, 600, 80, 200), (30, 700, 90, 200), - - (10, 800, 100, 300), - (20, 900, 120, 300), + (10, 800, 100, 300), + (20, 900, 120, 300), (30, 1000, 140, 300), ]); let mut new_council: BTreeMap> = BTreeMap::new(); - new_council.insert(200 as u64, Seat{ member: 200 as u64, stake: 0 as u32, backers: vec![]}); - new_council.insert(300 as u64, Seat{ member: 300 as u64, stake: 0 as u32, backers: vec![]}); + new_council.insert( + 200 as u64, + Seat { + member: 200 as u64, + stake: 0 as u32, + backers: vec![], + }, + ); + new_council.insert( + 300 as u64, + Seat { + member: 300 as u64, + stake: 0 as u32, + backers: vec![], + }, + ); Election::refund_voting_stakes(&votes, &new_council); - assert_eq!(Balances::free_balance(&10), 1100); assert_eq!(Balances::reserved_balance(&10), 4900); - assert_eq!(Balances::free_balance(&20), 2200); assert_eq!(Balances::reserved_balance(&20), 4800); - assert_eq!(Balances::free_balance(&30), 3300); assert_eq!(Balances::reserved_balance(&30), 4700); + assert_eq!(Balances::free_balance(&10), 1100); + assert_eq!(Balances::reserved_balance(&10), 4900); + assert_eq!(Balances::free_balance(&20), 2200); + assert_eq!(Balances::reserved_balance(&20), 4800); + assert_eq!(Balances::free_balance(&30), 3300); + assert_eq!(Balances::reserved_balance(&30), 4700); assert_eq!(Election::transferable_stakes(10).backing, 120); assert_eq!(Election::transferable_stakes(20).backing, 240); @@ -1561,38 +1850,75 @@ mod tests { } #[test] - fn unlock_transferable_stakes_should_work () { - with_externalities(&mut initial_test_ext(), || { - >::put(vec![10,20,30]); - - Balances::set_free_balance(&10, 1000); Balances::set_reserved_balance(&10, 5000); - save_transferable_stake(10, TransferableStake {seat: 50, backing: 100}); + fn unlock_transferable_stakes_should_work() { + with_externalities(&mut initial_test_ext(), || { + >::put(vec![10, 20, 30]); + + Balances::set_free_balance(&10, 1000); + Balances::set_reserved_balance(&10, 5000); + save_transferable_stake( + 10, + TransferableStake { + seat: 50, + backing: 100, + }, + ); - Balances::set_free_balance(&20, 2000); Balances::set_reserved_balance(&20, 5000); - save_transferable_stake(20, TransferableStake {seat: 60, backing: 200}); + Balances::set_free_balance(&20, 2000); + Balances::set_reserved_balance(&20, 5000); + save_transferable_stake( + 20, + TransferableStake { + seat: 60, + backing: 200, + }, + ); - Balances::set_free_balance(&30, 3000); Balances::set_reserved_balance(&30, 5000); - save_transferable_stake(30, TransferableStake {seat: 70, backing: 300}); + Balances::set_free_balance(&30, 3000); + Balances::set_reserved_balance(&30, 5000); + save_transferable_stake( + 30, + TransferableStake { + seat: 70, + backing: 300, + }, + ); Election::unlock_transferable_stakes(); assert_eq!(Balances::free_balance(&10), 1150); assert_eq!(Balances::free_balance(&20), 2260); assert_eq!(Balances::free_balance(&30), 3370); - }); + }); } #[test] fn council_elected_hook_should_work() { with_externalities(&mut initial_test_ext(), || { - let mut new_council: BTreeMap> = BTreeMap::new(); - new_council.insert(200 as u64, Seat{ member: 200 as u64, stake: 10 as u32, backers: vec![]}); - new_council.insert(300 as u64, Seat{ member: 300 as u64, stake: 20 as u32, backers: vec![]}); + new_council.insert( + 200 as u64, + Seat { + member: 200 as u64, + stake: 10 as u32, + backers: vec![], + }, + ); + new_council.insert( + 300 as u64, + Seat { + member: 300 as u64, + stake: 20 as u32, + backers: vec![], + }, + ); assert_eq!(Council::active_council().len(), 0); - let new_council = new_council.into_iter().map(|(_, seat)| seat.clone()).collect(); + let new_council = new_council + .into_iter() + .map(|(_, seat)| seat.clone()) + .collect(); ::CouncilElected::council_elected(new_council, 10); assert_eq!(Council::active_council().len(), 2); @@ -1635,11 +1961,26 @@ mod tests { Election::on_finalise(n); for i in 1..20 { - assert!(Election::vote(Origin::signed(i), make_commitment_for_applicant(i, &mut vec![40u8]), 100).is_ok()); - - assert!(Election::vote(Origin::signed(i), make_commitment_for_applicant(i, &mut vec![41u8]), 100).is_ok()); - - assert!(Election::vote(Origin::signed(i), make_commitment_for_applicant(i + 1000, &mut vec![42u8]), 100).is_ok()); + assert!(Election::vote( + Origin::signed(i), + make_commitment_for_applicant(i, &mut vec![40u8]), + 100 + ) + .is_ok()); + + assert!(Election::vote( + Origin::signed(i), + make_commitment_for_applicant(i, &mut vec![41u8]), + 100 + ) + .is_ok()); + + assert!(Election::vote( + Origin::signed(i), + make_commitment_for_applicant(i + 1000, &mut vec![42u8]), + 100 + ) + .is_ok()); } let n = n + Election::voting_period(); @@ -1647,18 +1988,39 @@ mod tests { Election::on_finalise(n); for i in 1..20 { - assert!(Election::reveal(Origin::signed(i), make_commitment_for_applicant(i, &mut vec![40u8]), i, vec![40u8]).is_ok()); + assert!(Election::reveal( + Origin::signed(i), + make_commitment_for_applicant(i, &mut vec![40u8]), + i, + vec![40u8] + ) + .is_ok()); //wrong salt - assert!(Election::reveal(Origin::signed(i), make_commitment_for_applicant(i, &mut vec![41u8]), i, vec![]).is_err()); + assert!(Election::reveal( + Origin::signed(i), + make_commitment_for_applicant(i, &mut vec![41u8]), + i, + vec![] + ) + .is_err()); //vote not for valid applicant - assert!(Election::reveal(Origin::signed(i), make_commitment_for_applicant(i + 1000, &mut vec![42u8]), i + 1000, vec![42u8]).is_err()); + assert!(Election::reveal( + Origin::signed(i), + make_commitment_for_applicant(i + 1000, &mut vec![42u8]), + i + 1000, + vec![42u8] + ) + .is_err()); } let n = n + Election::revealing_period(); System::set_block_number(n); Election::on_finalise(n); - assert_eq!(Council::active_council().len(), Election::council_size_usize()); + assert_eq!( + Council::active_council().len(), + Election::council_size_usize() + ); for (i, seat) in Council::active_council().iter().enumerate() { assert_eq!(seat.member, (i + 1) as u64); } diff --git a/src/governance/mock.rs b/src/governance/mock.rs index 41f711ad71..9d7f1d6423 100644 --- a/src/governance/mock.rs +++ b/src/governance/mock.rs @@ -1,14 +1,14 @@ #![cfg(test)] -pub use super::{election, council, proposals, GovernanceCurrency}; +pub use super::{council, election, proposals, GovernanceCurrency}; +use crate::traits::Members; pub use system; -use crate::traits::{Members}; -pub use primitives::{H256, Blake2Hasher}; +pub use primitives::{Blake2Hasher, H256}; pub use runtime_primitives::{ + testing::{Digest, DigestItem, Header, UintAuthorityId}, + traits::{BlakeTwo256, IdentityLookup, OnFinalise}, BuildStorage, - traits::{BlakeTwo256, OnFinalise, IdentityLookup}, - testing::{Digest, DigestItem, Header, UintAuthorityId} }; use srml_support::impl_outer_origin; @@ -102,7 +102,10 @@ impl GovernanceCurrency for Test { // This function basically just builds a genesis storage key/value store according to // our desired mockup. pub fn initial_test_ext() -> runtime_io::TestExternalities { - let t = system::GenesisConfig::::default().build_storage().unwrap().0; + let t = system::GenesisConfig::::default() + .build_storage() + .unwrap() + .0; runtime_io::TestExternalities::new(t) } diff --git a/src/governance/mod.rs b/src/governance/mod.rs index 544fa97a15..3eb484b453 100644 --- a/src/governance/mod.rs +++ b/src/governance/mod.rs @@ -1,19 +1,20 @@ #![cfg_attr(not(feature = "std"), no_std)] -use srml_support::traits::{Currency, ArithmeticType}; +use srml_support::traits::{ArithmeticType, Currency}; use system; -pub mod election; pub mod council; +pub mod election; pub mod proposals; -mod stake; mod sealed_vote; +mod stake; pub trait GovernanceCurrency: system::Trait + Sized { - type Currency: ArithmeticType + Currency<::AccountId, Balance=BalanceOf>; + type Currency: ArithmeticType + + Currency<::AccountId, Balance = BalanceOf>; } pub type BalanceOf = <::Currency as ArithmeticType>::Type; -mod mock; \ No newline at end of file +mod mock; diff --git a/src/governance/proposals.rs b/src/governance/proposals.rs index 501494fc08..d09fd0edca 100644 --- a/src/governance/proposals.rs +++ b/src/governance/proposals.rs @@ -1,17 +1,18 @@ -use srml_support::{StorageValue, StorageMap, dispatch, decl_module, decl_event, decl_storage, ensure}; -use srml_support::traits::{Currency}; -use runtime_primitives::traits::{As, Hash, Zero}; +use rstd::prelude::*; use runtime_io::print; +use runtime_primitives::traits::{As, Hash, Zero}; +use srml_support::traits::Currency; +use srml_support::{ + decl_event, decl_module, decl_storage, dispatch, ensure, StorageMap, StorageValue, +}; use system::{self, ensure_signed}; -use rstd::prelude::*; #[cfg(test)] -use primitives::{storage::well_known_keys}; - +use primitives::storage::well_known_keys; use super::council; -pub use super::{ GovernanceCurrency, BalanceOf }; -use crate::traits::{Members}; +pub use super::{BalanceOf, GovernanceCurrency}; +use crate::traits::Members; const DEFAULT_APPROVAL_QUORUM: u32 = 60; const DEFAULT_MIN_STAKE: u64 = 100; @@ -346,7 +347,6 @@ decl_module! { } impl Module { - fn current_block() -> T::BlockNumber { >::block_number() } @@ -386,20 +386,18 @@ impl Module { } fn end_block(_now: T::BlockNumber) -> dispatch::Result { - // TODO refactor this method // TODO iterate over not expired proposals and tally - Self::tally()?; - // TODO approve or reject a proposal + Self::tally()?; + // TODO approve or reject a proposal Ok(()) } /// Get the voters for the current proposal. - pub fn tally(/* proposal_id: u32 */) -> dispatch::Result { - + pub fn tally() -> dispatch::Result { let councilors: u32 = Self::councilors_count(); let quorum: u32 = Self::approval_quorum_seats(); @@ -436,26 +434,25 @@ impl Module { // Instead let other councilors cast their vote // up until the proposal's expired. - let new_status: Option = - if all_councilors_slashed { - Some(Slashed) - } else if all_councilors_voted { - if quorum_reached { - Some(Approved) - } else { - Some(Rejected) - } - } else if is_expired { - if quorum_reached { - Some(Approved) - } else { - // Proposal has been expired and quorum not reached. - Some(Expired) - } + let new_status: Option = if all_councilors_slashed { + Some(Slashed) + } else if all_councilors_voted { + if quorum_reached { + Some(Approved) } else { - // Councilors still have time to vote on this proposal. - None - }; + Some(Rejected) + } + } else if is_expired { + if quorum_reached { + Some(Approved) + } else { + // Proposal has been expired and quorum not reached. + Some(Expired) + } + } else { + // Councilors still have time to vote on this proposal. + None + }; // TODO move next block outside of tally to 'end_block' if let Some(status) = new_status { @@ -496,7 +493,7 @@ impl Module { Slashed => Self::_slash_proposal(pid)?, Rejected | Expired => Self::_reject_proposal(pid)?, Approved => Self::_approve_proposal(pid)?, - Active | Cancelled => { /* nothing */ }, + Active | Cancelled => { /* nothing */ } } >::put(other_active_ids); >::mutate(proposal_id, |p| p.status = new_status.clone()); @@ -552,14 +549,14 @@ impl Module { mod tests { use super::*; + use primitives::{Blake2Hasher, H256}; use runtime_io::with_externalities; - use primitives::{H256, Blake2Hasher}; // The testing primitives are very useful for avoiding having to work with signatures // or public keys. `u64` is used as the `AccountId` and no `Signature`s are requried. use runtime_primitives::{ + testing::{Digest, DigestItem, Header, UintAuthorityId}, + traits::{BlakeTwo256, IdentityLookup, OnFinalise}, BuildStorage, - traits::{BlakeTwo256, OnFinalise, IdentityLookup}, - testing::{Digest, DigestItem, Header, UintAuthorityId} }; use srml_support::*; @@ -652,13 +649,7 @@ mod tests { const NOT_COUNCILOR: u64 = 22; - const ALL_COUNCILORS: [u64; 5] = [ - COUNCILOR1, - COUNCILOR2, - COUNCILOR3, - COUNCILOR4, - COUNCILOR5 - ]; + const ALL_COUNCILORS: [u64; 5] = [COUNCILOR1, COUNCILOR2, COUNCILOR3, COUNCILOR4, COUNCILOR5]; // TODO Figure out how to test Events in test... (low priority) // mod proposals { @@ -673,21 +664,36 @@ mod tests { // This function basically just builds a genesis storage key/value store according to // our desired mockup. fn new_test_ext() -> runtime_io::TestExternalities { - let mut t = system::GenesisConfig::::default().build_storage().unwrap().0; + let mut t = system::GenesisConfig::::default() + .build_storage() + .unwrap() + .0; // We use default for brevity, but you can configure as desired if needed. - t.extend(balances::GenesisConfig::::default().build_storage().unwrap().0); - - let council_mock: council::Seats = - ALL_COUNCILORS.iter().map(|&c| council::Seat { + t.extend( + balances::GenesisConfig::::default() + .build_storage() + .unwrap() + .0, + ); + + let council_mock: council::Seats = ALL_COUNCILORS + .iter() + .map(|&c| council::Seat { member: c, stake: 0u64, backers: vec![], - }).collect(); + }) + .collect(); - t.extend(council::GenesisConfig::{ - active_council: council_mock, - term_ends_at: 0, - }.build_storage().unwrap().0); + t.extend( + council::GenesisConfig:: { + active_council: council_mock, + term_ends_at: 0, + } + .build_storage() + .unwrap() + .0, + ); // t.extend(GenesisConfig::{ // // Here we can override defaults. @@ -737,14 +743,14 @@ mod tests { stake: Option, name: Option>, description: Option>, - wasm_code: Option> + wasm_code: Option>, ) -> dispatch::Result { Proposals::create_proposal( Origin::signed(origin.unwrap_or(PROPOSER1)), stake.unwrap_or(min_stake()), name.unwrap_or(self::name()), description.unwrap_or(self::description()), - wasm_code.unwrap_or(self::wasm_code()) + wasm_code.unwrap_or(self::wasm_code()), ) } @@ -753,11 +759,15 @@ mod tests { } macro_rules! assert_runtime_code_empty { - () => { assert_eq!(get_runtime_code(), None) } + () => { + assert_eq!(get_runtime_code(), None) + }; } macro_rules! assert_runtime_code { - ($code:expr) => { assert_eq!(get_runtime_code(), Some($code)) } + ($code:expr) => { + assert_eq!(get_runtime_code(), Some($code)) + }; } #[test] @@ -768,7 +778,10 @@ mod tests { assert_eq!(Proposals::cancellation_fee(), DEFAULT_CANCELLATION_FEE); assert_eq!(Proposals::rejection_fee(), DEFAULT_REJECTION_FEE); assert_eq!(Proposals::name_max_len(), DEFAULT_NAME_MAX_LEN); - assert_eq!(Proposals::description_max_len(), DEFAULT_DESCRIPTION_MAX_LEN); + assert_eq!( + Proposals::description_max_len(), + DEFAULT_DESCRIPTION_MAX_LEN + ); assert_eq!(Proposals::wasm_code_max_len(), DEFAULT_WASM_CODE_MAX_LEN); assert_eq!(Proposals::proposal_count(), 0); assert!(Proposals::active_proposal_ids().is_empty()); @@ -794,12 +807,15 @@ mod tests { description: description(), wasm_hash, proposed_at: 1, - status: Active + status: Active, }; assert_eq!(Proposals::proposals(1), expected_proposal); // Check that stake amount has been locked on proposer's balance: - assert_eq!(Balances::free_balance(PROPOSER1), initial_balance() - min_stake()); + assert_eq!( + Balances::free_balance(PROPOSER1), + initial_balance() - min_stake() + ); assert_eq!(Balances::reserved_balance(PROPOSER1), min_stake()); // TODO expect event ProposalCreated(AccountId, u32) @@ -811,8 +827,10 @@ mod tests { with_externalities(&mut new_test_ext(), || { // In this test a proposer has an empty balance // thus he is not considered as a member. - assert_eq!(_create_default_proposal(), - Err(MSG_ONLY_MEMBERS_CAN_PROPOSE)); + assert_eq!( + _create_default_proposal(), + Err(MSG_ONLY_MEMBERS_CAN_PROPOSE) + ); }); } @@ -822,9 +840,10 @@ mod tests { Balances::set_free_balance(&PROPOSER1, initial_balance()); Balances::increase_total_stake_by(initial_balance()); - assert_eq!(_create_proposal( - None, Some(min_stake() - 1), None, None, None), - Err(MSG_STAKE_IS_TOO_LOW)); + assert_eq!( + _create_proposal(None, Some(min_stake() - 1), None, None, None), + Err(MSG_STAKE_IS_TOO_LOW) + ); // Check that balances remain unchanged afer a failed attempt to create a proposal: assert_eq!(Balances::free_balance(PROPOSER1), initial_balance()); @@ -838,9 +857,10 @@ mod tests { Balances::set_free_balance(&PROPOSER1, initial_balance()); Balances::increase_total_stake_by(initial_balance()); - assert_eq!(_create_proposal( - None, Some(initial_balance() + 1), None, None, None), - Err(MSG_STAKE_IS_GREATER_THAN_BALANCE)); + assert_eq!( + _create_proposal(None, Some(initial_balance() + 1), None, None, None), + Err(MSG_STAKE_IS_GREATER_THAN_BALANCE) + ); // Check that balances remain unchanged afer a failed attempt to create a proposal: assert_eq!(Balances::free_balance(PROPOSER1), initial_balance()); @@ -855,19 +875,22 @@ mod tests { Balances::increase_total_stake_by(initial_balance()); // Empty name: - assert_eq!(_create_proposal( - None, None, Some(vec![]), None, None), - Err(MSG_EMPTY_NAME_PROVIDED)); + assert_eq!( + _create_proposal(None, None, Some(vec![]), None, None), + Err(MSG_EMPTY_NAME_PROVIDED) + ); // Empty description: - assert_eq!(_create_proposal( - None, None, None, Some(vec![]), None), - Err(MSG_EMPTY_DESCRIPTION_PROVIDED)); + assert_eq!( + _create_proposal(None, None, None, Some(vec![]), None), + Err(MSG_EMPTY_DESCRIPTION_PROVIDED) + ); // Empty WASM code: - assert_eq!(_create_proposal( - None, None, None, None, Some(vec![])), - Err(MSG_EMPTY_WASM_CODE_PROVIDED)); + assert_eq!( + _create_proposal(None, None, None, None, Some(vec![])), + Err(MSG_EMPTY_WASM_CODE_PROVIDED) + ); }); } @@ -878,19 +901,22 @@ mod tests { Balances::increase_total_stake_by(initial_balance()); // Too long name: - assert_eq!(_create_proposal( - None, None, Some(too_long_name()), None, None), - Err(MSG_TOO_LONG_NAME)); + assert_eq!( + _create_proposal(None, None, Some(too_long_name()), None, None), + Err(MSG_TOO_LONG_NAME) + ); // Too long description: - assert_eq!(_create_proposal( - None, None, None, Some(too_long_description()), None), - Err(MSG_TOO_LONG_DESCRIPTION)); + assert_eq!( + _create_proposal(None, None, None, Some(too_long_description()), None), + Err(MSG_TOO_LONG_DESCRIPTION) + ); // Too long WASM code: - assert_eq!(_create_proposal( - None, None, None, None, Some(too_long_wasm_code())), - Err(MSG_TOO_LONG_WASM_CODE)); + assert_eq!( + _create_proposal(None, None, None, None, Some(too_long_wasm_code())), + Err(MSG_TOO_LONG_WASM_CODE) + ); }); } @@ -921,7 +947,10 @@ mod tests { assert!(Proposals::active_proposal_ids().is_empty()); // Check that proposer's balance reduced by cancellation fee and other part of his stake returned to his balance: - assert_eq!(Balances::free_balance(PROPOSER1), initial_balance() - cancellation_fee()); + assert_eq!( + Balances::free_balance(PROPOSER1), + initial_balance() - cancellation_fee() + ); assert_eq!(Balances::reserved_balance(PROPOSER1), 0); // TODO expect event ProposalCancelled(AccountId, u32) @@ -942,12 +971,17 @@ mod tests { let updated_free_balance = Balances::free_balance(PROPOSER1); let updated_reserved_balance = Balances::reserved_balance(PROPOSER1); - assert_eq!(Proposals::cancel_proposal(Origin::signed(PROPOSER1), 1), - Err(MSG_PROPOSAL_FINALIZED)); + assert_eq!( + Proposals::cancel_proposal(Origin::signed(PROPOSER1), 1), + Err(MSG_PROPOSAL_FINALIZED) + ); // Check that proposer's balance and locked stake haven't been changed: assert_eq!(Balances::free_balance(PROPOSER1), updated_free_balance); - assert_eq!(Balances::reserved_balance(PROPOSER1), updated_reserved_balance); + assert_eq!( + Balances::reserved_balance(PROPOSER1), + updated_reserved_balance + ); }); } @@ -958,8 +992,10 @@ mod tests { Balances::set_free_balance(&PROPOSER2, initial_balance()); Balances::increase_total_stake_by(initial_balance() * 2); assert_ok!(_create_default_proposal()); - assert_eq!(Proposals::cancel_proposal(Origin::signed(PROPOSER2), 1), - Err(MSG_YOU_DONT_OWN_THIS_PROPOSAL)); + assert_eq!( + Proposals::cancel_proposal(Origin::signed(PROPOSER2), 1), + Err(MSG_YOU_DONT_OWN_THIS_PROPOSAL) + ); }); } @@ -974,11 +1010,17 @@ mod tests { assert_ok!(_create_default_proposal()); assert_ok!(Proposals::vote_on_proposal( - Origin::signed(COUNCILOR1), 1, Approve)); + Origin::signed(COUNCILOR1), + 1, + Approve + )); // Check that a vote has been saved: assert_eq!(Proposals::votes_by_proposal(1), vec![(COUNCILOR1, Approve)]); - assert_eq!(Proposals::vote_by_account_and_proposal((COUNCILOR1, 1)), Approve); + assert_eq!( + Proposals::vote_by_account_and_proposal((COUNCILOR1, 1)), + Approve + ); // TODO expect event Voted(PROPOSER1, 1, Approve) }); @@ -992,10 +1034,14 @@ mod tests { assert_ok!(_create_default_proposal()); assert_ok!(Proposals::vote_on_proposal( - Origin::signed(COUNCILOR1), 1, Approve)); - assert_eq!(Proposals::vote_on_proposal( - Origin::signed(COUNCILOR1), 1, Approve), - Err(MSG_YOU_ALREADY_VOTED)); + Origin::signed(COUNCILOR1), + 1, + Approve + )); + assert_eq!( + Proposals::vote_on_proposal(Origin::signed(COUNCILOR1), 1, Approve), + Err(MSG_YOU_ALREADY_VOTED) + ); }); } @@ -1004,14 +1050,15 @@ mod tests { with_externalities(&mut new_test_ext(), || { Balances::set_free_balance(&COUNCILOR1, initial_balance()); Balances::increase_total_stake_by(initial_balance()); - assert_ok!(_create_proposal( - Some(COUNCILOR1), None, None, None, None - )); + assert_ok!(_create_proposal(Some(COUNCILOR1), None, None, None, None)); // Check that a vote has been sent automatically, // such as the proposer is a councilor: assert_eq!(Proposals::votes_by_proposal(1), vec![(COUNCILOR1, Approve)]); - assert_eq!(Proposals::vote_by_account_and_proposal((COUNCILOR1, 1)), Approve); + assert_eq!( + Proposals::vote_by_account_and_proposal((COUNCILOR1, 1)), + Approve + ); }); } @@ -1021,9 +1068,10 @@ mod tests { Balances::set_free_balance(&PROPOSER1, initial_balance()); Balances::increase_total_stake_by(initial_balance()); assert_ok!(_create_default_proposal()); - assert_eq!(Proposals::vote_on_proposal( - Origin::signed(NOT_COUNCILOR), 1, Approve), - Err(MSG_ONLY_COUNCILORS_CAN_VOTE)); + assert_eq!( + Proposals::vote_on_proposal(Origin::signed(NOT_COUNCILOR), 1, Approve), + Err(MSG_ONLY_COUNCILORS_CAN_VOTE) + ); }); } @@ -1034,9 +1082,10 @@ mod tests { Balances::increase_total_stake_by(initial_balance()); assert_ok!(_create_default_proposal()); assert_ok!(Proposals::cancel_proposal(Origin::signed(PROPOSER1), 1)); - assert_eq!(Proposals::vote_on_proposal( - Origin::signed(COUNCILOR1), 1, Approve), - Err(MSG_PROPOSAL_FINALIZED)); + assert_eq!( + Proposals::vote_on_proposal(Origin::signed(COUNCILOR1), 1, Approve), + Err(MSG_PROPOSAL_FINALIZED) + ); }); } @@ -1052,8 +1101,15 @@ mod tests { let mut expected_votes: Vec<(u64, VoteKind)> = vec![]; for &councilor in ALL_COUNCILORS.iter() { expected_votes.push((councilor, Approve)); - assert_ok!(Proposals::vote_on_proposal(Origin::signed(councilor), 1, Approve)); - assert_eq!(Proposals::vote_by_account_and_proposal((councilor, 1)), Approve); + assert_ok!(Proposals::vote_on_proposal( + Origin::signed(councilor), + 1, + Approve + )); + assert_eq!( + Proposals::vote_by_account_and_proposal((councilor, 1)), + Approve + ); } assert_eq!(Proposals::votes_by_proposal(1), expected_votes); @@ -1064,9 +1120,10 @@ mod tests { assert_eq!(Proposals::proposals(1).status, Approved); // Try to vote on finalized proposal: - assert_eq!(Proposals::vote_on_proposal( - Origin::signed(COUNCILOR1), 1, Reject), - Err(MSG_PROPOSAL_FINALIZED)); + assert_eq!( + Proposals::vote_on_proposal(Origin::signed(COUNCILOR1), 1, Reject), + Err(MSG_PROPOSAL_FINALIZED) + ); }); } @@ -1085,8 +1142,15 @@ mod tests { let mut expected_votes: Vec<(u64, VoteKind)> = vec![]; for &councilor in ALL_COUNCILORS.iter() { expected_votes.push((councilor, Approve)); - assert_ok!(Proposals::vote_on_proposal(Origin::signed(councilor), 1, Approve)); - assert_eq!(Proposals::vote_by_account_and_proposal((councilor, 1)), Approve); + assert_ok!(Proposals::vote_on_proposal( + Origin::signed(councilor), + 1, + Approve + )); + assert_eq!( + Proposals::vote_by_account_and_proposal((councilor, 1)), + Approve + ); } assert_eq!(Proposals::votes_by_proposal(1), expected_votes); @@ -1100,15 +1164,18 @@ mod tests { assert!(Proposals::active_proposal_ids().is_empty()); assert_eq!(Proposals::proposals(1).status, Approved); - assert_eq!(Proposals::tally_results(1), TallyResult { - proposal_id: 1, - abstentions: 0, - approvals: ALL_COUNCILORS.len() as u32, - rejections: 0, - slashes: 0, - status: Approved, - finalized_at: 2 - }); + assert_eq!( + Proposals::tally_results(1), + TallyResult { + proposal_id: 1, + abstentions: 0, + approvals: ALL_COUNCILORS.len() as u32, + rejections: 0, + slashes: 0, + status: Approved, + finalized_at: 2 + } + ); // Check that proposer's stake has been added back to his balance: assert_eq!(Balances::free_balance(PROPOSER1), initial_balance()); @@ -1131,9 +1198,16 @@ mod tests { let approvals = Proposals::approval_quorum_seats(); let rejections = councilors - approvals; for i in 0..councilors as usize { - let vote = if (i as u32) < approvals { Approve } else { Reject }; + let vote = if (i as u32) < approvals { + Approve + } else { + Reject + }; assert_ok!(Proposals::vote_on_proposal( - Origin::signed(ALL_COUNCILORS[i]), 1, vote)); + Origin::signed(ALL_COUNCILORS[i]), + 1, + vote + )); } assert_eq!(Proposals::votes_by_proposal(1).len() as u32, councilors); @@ -1147,15 +1221,18 @@ mod tests { assert!(Proposals::active_proposal_ids().is_empty()); assert_eq!(Proposals::proposals(1).status, Approved); - assert_eq!(Proposals::tally_results(1), TallyResult { - proposal_id: 1, - abstentions: 0, - approvals: approvals, - rejections: rejections, - slashes: 0, - status: Approved, - finalized_at: 2 - }); + assert_eq!( + Proposals::tally_results(1), + TallyResult { + proposal_id: 1, + abstentions: 0, + approvals: approvals, + rejections: rejections, + slashes: 0, + status: Approved, + finalized_at: 2 + } + ); // Check that proposer's stake has been added back to his balance: assert_eq!(Balances::free_balance(PROPOSER1), initial_balance()); @@ -1176,9 +1253,16 @@ mod tests { // Only quorum of councilors approved, other councilors didn't vote: let approvals = Proposals::approval_quorum_seats(); for i in 0..approvals as usize { - let vote = if (i as u32) < approvals { Approve } else { Slash }; + let vote = if (i as u32) < approvals { + Approve + } else { + Slash + }; assert_ok!(Proposals::vote_on_proposal( - Origin::signed(ALL_COUNCILORS[i]), 1, vote)); + Origin::signed(ALL_COUNCILORS[i]), + 1, + vote + )); } assert_eq!(Proposals::votes_by_proposal(1).len() as u32, approvals); @@ -1200,15 +1284,18 @@ mod tests { assert!(Proposals::active_proposal_ids().is_empty()); assert_eq!(Proposals::proposals(1).status, Approved); - assert_eq!(Proposals::tally_results(1), TallyResult { - proposal_id: 1, - abstentions: 0, - approvals: approvals, - rejections: 0, - slashes: 0, - status: Approved, - finalized_at: expiration_block - }); + assert_eq!( + Proposals::tally_results(1), + TallyResult { + proposal_id: 1, + abstentions: 0, + approvals: approvals, + rejections: 0, + slashes: 0, + status: Approved, + finalized_at: expiration_block + } + ); // Check that proposer's stake has been added back to his balance: assert_eq!(Balances::free_balance(PROPOSER1), initial_balance()); @@ -1231,9 +1318,16 @@ mod tests { let approvals = Proposals::approval_quorum_seats() - 1; let abstentions = councilors - approvals; for i in 0..councilors as usize { - let vote = if (i as u32) < approvals { Approve } else { Abstain }; + let vote = if (i as u32) < approvals { + Approve + } else { + Abstain + }; assert_ok!(Proposals::vote_on_proposal( - Origin::signed(ALL_COUNCILORS[i]), 1, vote)); + Origin::signed(ALL_COUNCILORS[i]), + 1, + vote + )); } assert_eq!(Proposals::votes_by_proposal(1).len() as u32, councilors); @@ -1247,18 +1341,24 @@ mod tests { assert!(Proposals::active_proposal_ids().is_empty()); assert_eq!(Proposals::proposals(1).status, Rejected); - assert_eq!(Proposals::tally_results(1), TallyResult { - proposal_id: 1, - abstentions: abstentions, - approvals: approvals, - rejections: 0, - slashes: 0, - status: Rejected, - finalized_at: 2 - }); + assert_eq!( + Proposals::tally_results(1), + TallyResult { + proposal_id: 1, + abstentions: abstentions, + approvals: approvals, + rejections: 0, + slashes: 0, + status: Rejected, + finalized_at: 2 + } + ); // Check that proposer's balance reduced by burnt stake: - assert_eq!(Balances::free_balance(PROPOSER1), initial_balance() - rejection_fee()); + assert_eq!( + Balances::free_balance(PROPOSER1), + initial_balance() - rejection_fee() + ); assert_eq!(Balances::reserved_balance(PROPOSER1), 0); // TODO expect event ProposalStatusUpdated(1, Rejected) @@ -1277,8 +1377,15 @@ mod tests { let mut expected_votes: Vec<(u64, VoteKind)> = vec![]; for &councilor in ALL_COUNCILORS.iter() { expected_votes.push((councilor, Reject)); - assert_ok!(Proposals::vote_on_proposal(Origin::signed(councilor), 1, Reject)); - assert_eq!(Proposals::vote_by_account_and_proposal((councilor, 1)), Reject); + assert_ok!(Proposals::vote_on_proposal( + Origin::signed(councilor), + 1, + Reject + )); + assert_eq!( + Proposals::vote_by_account_and_proposal((councilor, 1)), + Reject + ); } assert_eq!(Proposals::votes_by_proposal(1), expected_votes); @@ -1292,18 +1399,24 @@ mod tests { assert!(Proposals::active_proposal_ids().is_empty()); assert_eq!(Proposals::proposals(1).status, Rejected); - assert_eq!(Proposals::tally_results(1), TallyResult { - proposal_id: 1, - abstentions: 0, - approvals: 0, - rejections: ALL_COUNCILORS.len() as u32, - slashes: 0, - status: Rejected, - finalized_at: 2 - }); + assert_eq!( + Proposals::tally_results(1), + TallyResult { + proposal_id: 1, + abstentions: 0, + approvals: 0, + rejections: ALL_COUNCILORS.len() as u32, + slashes: 0, + status: Rejected, + finalized_at: 2 + } + ); // Check that proposer's balance reduced by burnt stake: - assert_eq!(Balances::free_balance(PROPOSER1), initial_balance() - rejection_fee()); + assert_eq!( + Balances::free_balance(PROPOSER1), + initial_balance() - rejection_fee() + ); assert_eq!(Balances::reserved_balance(PROPOSER1), 0); // TODO expect event ProposalStatusUpdated(1, Rejected) @@ -1322,8 +1435,15 @@ mod tests { let mut expected_votes: Vec<(u64, VoteKind)> = vec![]; for &councilor in ALL_COUNCILORS.iter() { expected_votes.push((councilor, Slash)); - assert_ok!(Proposals::vote_on_proposal(Origin::signed(councilor), 1, Slash)); - assert_eq!(Proposals::vote_by_account_and_proposal((councilor, 1)), Slash); + assert_ok!(Proposals::vote_on_proposal( + Origin::signed(councilor), + 1, + Slash + )); + assert_eq!( + Proposals::vote_by_account_and_proposal((councilor, 1)), + Slash + ); } assert_eq!(Proposals::votes_by_proposal(1), expected_votes); @@ -1337,18 +1457,24 @@ mod tests { assert!(Proposals::active_proposal_ids().is_empty()); assert_eq!(Proposals::proposals(1).status, Slashed); - assert_eq!(Proposals::tally_results(1), TallyResult { - proposal_id: 1, - abstentions: 0, - approvals: 0, - rejections: 0, - slashes: ALL_COUNCILORS.len() as u32, - status: Slashed, - finalized_at: 2 - }); + assert_eq!( + Proposals::tally_results(1), + TallyResult { + proposal_id: 1, + abstentions: 0, + approvals: 0, + rejections: 0, + slashes: ALL_COUNCILORS.len() as u32, + status: Slashed, + finalized_at: 2 + } + ); // Check that proposer's balance reduced by burnt stake: - assert_eq!(Balances::free_balance(PROPOSER1), initial_balance() - min_stake()); + assert_eq!( + Balances::free_balance(PROPOSER1), + initial_balance() - min_stake() + ); assert_eq!(Balances::reserved_balance(PROPOSER1), 0); // TODO expect event ProposalStatusUpdated(1, Slashed) @@ -1375,9 +1501,16 @@ mod tests { // Less than a quorum of councilors approved: let approvals = Proposals::approval_quorum_seats() - 1; for i in 0..approvals as usize { - let vote = if (i as u32) < approvals { Approve } else { Slash }; + let vote = if (i as u32) < approvals { + Approve + } else { + Slash + }; assert_ok!(Proposals::vote_on_proposal( - Origin::signed(ALL_COUNCILORS[i]), 1, vote)); + Origin::signed(ALL_COUNCILORS[i]), + 1, + vote + )); } assert_eq!(Proposals::votes_by_proposal(1).len() as u32, approvals); @@ -1392,18 +1525,24 @@ mod tests { assert!(Proposals::active_proposal_ids().is_empty()); assert_eq!(Proposals::proposals(1).status, Expired); - assert_eq!(Proposals::tally_results(1), TallyResult { - proposal_id: 1, - abstentions: 0, - approvals: approvals, - rejections: 0, - slashes: 0, - status: Expired, - finalized_at: expiration_block - }); + assert_eq!( + Proposals::tally_results(1), + TallyResult { + proposal_id: 1, + abstentions: 0, + approvals: approvals, + rejections: 0, + slashes: 0, + status: Expired, + finalized_at: expiration_block + } + ); // Check that proposer's balance reduced by burnt stake: - assert_eq!(Balances::free_balance(PROPOSER1), initial_balance() - rejection_fee()); + assert_eq!( + Balances::free_balance(PROPOSER1), + initial_balance() - rejection_fee() + ); assert_eq!(Balances::reserved_balance(PROPOSER1), 0); // TODO expect event ProposalStatusUpdated(1, Rejected) diff --git a/src/governance/sealed_vote.rs b/src/governance/sealed_vote.rs index 324e0a50ba..ac08ff9e4e 100644 --- a/src/governance/sealed_vote.rs +++ b/src/governance/sealed_vote.rs @@ -1,23 +1,33 @@ #![cfg_attr(not(feature = "std"), no_std)] -use srml_support::{ensure}; use parity_codec::Encode; use rstd::vec::Vec; +use srml_support::ensure; #[derive(Clone, Copy, Encode, Decode, Default)] pub struct SealedVote - where Vote: Encode, Hash: PartialEq, AccountId: PartialEq +where + Vote: Encode, + Hash: PartialEq, + AccountId: PartialEq, { - pub voter: AccountId, - pub commitment: Hash, // 32 bytes - salted hash of serialized Vote - pub stake: Stake, - vote: Option, // will be set when unsealing + pub voter: AccountId, + pub commitment: Hash, // 32 bytes - salted hash of serialized Vote + pub stake: Stake, + vote: Option, // will be set when unsealing } impl SealedVote - where Vote: Encode, Hash: PartialEq, AccountId: PartialEq +where + Vote: Encode, + Hash: PartialEq, + AccountId: PartialEq, { - pub fn new(voter: AccountId, stake: Stake, commitment: Hash) -> SealedVote { + pub fn new( + voter: AccountId, + stake: Stake, + commitment: Hash, + ) -> SealedVote { SealedVote { voter, commitment, @@ -26,7 +36,12 @@ impl SealedVote } } - pub fn new_unsealed(voter: AccountId, stake: Stake, commitment: Hash, vote: Vote) -> SealedVote { + pub fn new_unsealed( + voter: AccountId, + stake: Stake, + commitment: Hash, + vote: Vote, + ) -> SealedVote { SealedVote { voter, commitment, @@ -35,7 +50,12 @@ impl SealedVote } } - pub fn unseal(&mut self, vote: Vote, salt: &mut Vec, hasher: fn(&[u8]) -> Hash) -> Result<(), &'static str> { + pub fn unseal( + &mut self, + vote: Vote, + salt: &mut Vec, + hasher: fn(&[u8]) -> Hash, + ) -> Result<(), &'static str> { // only unseal once ensure!(self.is_not_revealed(), "vote already unsealed"); @@ -67,4 +87,4 @@ impl SealedVote pub fn is_not_revealed(&self) -> bool { self.vote.is_none() } -} \ No newline at end of file +} diff --git a/src/governance/stake.rs b/src/governance/stake.rs index 299f3e4f84..7a9c6c417d 100644 --- a/src/governance/stake.rs +++ b/src/governance/stake.rs @@ -1,18 +1,20 @@ #![cfg_attr(not(feature = "std"), no_std)] use rstd::cmp::Ordering; -use runtime_primitives::traits::{SimpleArithmetic}; +use runtime_primitives::traits::SimpleArithmetic; #[derive(Encode, Decode, Clone, Copy, Default, Debug)] pub struct Stake - where Balance: Copy + SimpleArithmetic, +where + Balance: Copy + SimpleArithmetic, { pub new: Balance, pub transferred: Balance, } impl Stake - where Balance: Copy + SimpleArithmetic, +where + Balance: Copy + SimpleArithmetic, { pub fn total(&self) -> Balance { self.new + self.transferred @@ -21,7 +23,7 @@ impl Stake pub fn add(&self, v: &Self) -> Self { Self { new: self.new + v.new, - transferred: self.transferred + v.transferred + transferred: self.transferred + v.transferred, } } } @@ -63,8 +65,10 @@ mod tests { #[test] fn adding() { - let a1: u128 = 3; let b1: u128 = 2; - let a2: u128 = 5; let b2: u128 = 7; + let a1: u128 = 3; + let b1: u128 = 2; + let a2: u128 = 5; + let b2: u128 = 7; let s1 = Stake { new: a1, @@ -84,9 +88,12 @@ mod tests { #[test] fn equality() { - let a1: u128 = 3; let b1: u128 = 2; - let a2: u128 = 2; let b2: u128 = 3; - let a3: u128 = 10; let b3: u128 = 10; + let a1: u128 = 3; + let b1: u128 = 2; + let a2: u128 = 2; + let b2: u128 = 3; + let a3: u128 = 10; + let b3: u128 = 10; let s1 = Stake { new: a1, @@ -111,4 +118,4 @@ mod tests { assert_ne!(s1, s4); } -} \ No newline at end of file +} diff --git a/src/lib.rs b/src/lib.rs index 85ba5fc40a..4600041b62 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -3,7 +3,7 @@ #![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"] +#![recursion_limit = "256"] #[cfg(feature = "std")] #[macro_use] @@ -15,42 +15,47 @@ use substrate_client as client; extern crate parity_codec_derive; pub mod governance; -use governance::{election, council, proposals}; +use governance::{council, election, proposals}; pub mod storage; -use storage::{data_object_type_registry, data_directory, data_object_storage_registry, downloads, content_directory}; +use storage::{ + content_directory, data_directory, data_object_storage_registry, data_object_type_registry, + downloads, +}; +mod membership; mod memo; mod traits; -mod membership; use membership::members; mod migration; mod roles; use roles::actors; -use rstd::prelude::*; +use client::{ + block_builder::api::{self as block_builder_api, CheckInherentsResult, InherentData}, + impl_runtime_apis, runtime_api, +}; #[cfg(feature = "std")] use primitives::bytes; use primitives::{Ed25519AuthorityId, OpaqueMetadata}; +use rstd::prelude::*; use runtime_primitives::{ - ApplyResult, transaction_validity::TransactionValidity, Ed25519Signature, generic, - traits::{self as runtime_traits, Convert, BlakeTwo256, Block as BlockT, StaticLookup}, create_runtime_str -}; -use client::{ - block_builder::api::{CheckInherentsResult, InherentData, self as block_builder_api}, - runtime_api, impl_runtime_apis + create_runtime_str, generic, + traits::{self as runtime_traits, BlakeTwo256, Block as BlockT, Convert, StaticLookup}, + transaction_validity::TransactionValidity, + ApplyResult, Ed25519Signature, }; -use version::RuntimeVersion; #[cfg(feature = "std")] use version::NativeVersion; +use version::RuntimeVersion; // A few exports that help ease life for downstream crates. +pub use balances::Call as BalancesCall; +pub use consensus::Call as ConsensusCall; #[cfg(any(feature = "std", test))] pub use runtime_primitives::BuildStorage; -pub use consensus::Call as ConsensusCall; -pub use timestamp::Call as TimestampCall; -pub use balances::Call as BalancesCall; -pub use runtime_primitives::{Permill, Perbill}; +pub use runtime_primitives::{Perbill, Permill}; +pub use srml_support::{construct_runtime, StorageValue}; pub use timestamp::BlockPeriod; -pub use srml_support::{StorageValue, construct_runtime}; +pub use timestamp::Call as TimestampCall; /// Alias to Ed25519 pubkey that identifies an account on the chain. pub type AccountId = primitives::H256; @@ -72,222 +77,219 @@ pub type Nonce = u64; /// of data like extrinsics, allowing for them to continue syncing the network through upgrades /// to even the core datastructures. pub mod opaque { - use super::*; - - /// Opaque, encoded, unchecked extrinsic. - #[derive(PartialEq, Eq, Clone, Default, Encode, Decode)] - #[cfg_attr(feature = "std", derive(Serialize, Deserialize, Debug))] - pub struct UncheckedExtrinsic(#[cfg_attr(feature = "std", serde(with="bytes"))] pub Vec); - impl runtime_traits::Extrinsic for UncheckedExtrinsic { - fn is_signed(&self) -> Option { - None - } - } - /// Opaque block header type. - pub type Header = generic::Header>; - /// Opaque block type. - pub type Block = generic::Block; - /// Opaque block identifier type. - pub type BlockId = generic::BlockId; - /// Opaque session key type. - pub type SessionKey = Ed25519AuthorityId; + use super::*; + + /// Opaque, encoded, unchecked extrinsic. + #[derive(PartialEq, Eq, Clone, Default, Encode, Decode)] + #[cfg_attr(feature = "std", derive(Serialize, Deserialize, Debug))] + pub struct UncheckedExtrinsic(#[cfg_attr(feature = "std", serde(with = "bytes"))] pub Vec); + impl runtime_traits::Extrinsic for UncheckedExtrinsic { + fn is_signed(&self) -> Option { + None + } + } + /// Opaque block header type. + pub type Header = + generic::Header>; + /// Opaque block type. + pub type Block = generic::Block; + /// Opaque block identifier type. + pub type BlockId = generic::BlockId; + /// Opaque session key type. + pub type SessionKey = Ed25519AuthorityId; } /// This runtime version. pub const VERSION: RuntimeVersion = RuntimeVersion { - spec_name: create_runtime_str!("joystream-node"), - impl_name: create_runtime_str!("joystream-node"), - authoring_version: 3, - spec_version: 5, - impl_version: 0, - apis: RUNTIME_API_VERSIONS, + spec_name: create_runtime_str!("joystream-node"), + impl_name: create_runtime_str!("joystream-node"), + authoring_version: 3, + spec_version: 5, + impl_version: 0, + apis: RUNTIME_API_VERSIONS, }; /// The version infromation used to identify this runtime when compiled natively. #[cfg(feature = "std")] pub fn native_version() -> NativeVersion { - NativeVersion { - runtime_version: VERSION, - can_author_with: Default::default(), - } + NativeVersion { + runtime_version: VERSION, + can_author_with: Default::default(), + } } impl system::Trait for Runtime { - /// The identifier used to distinguish between accounts. - type AccountId = AccountId; - /// The lookup mechanism to get account ID from whatever is passed in dispatchers. - type Lookup = Indices; - /// The index type for storing how many extrinsics an account has signed. - type Index = Nonce; - /// The index type for blocks. - type BlockNumber = BlockNumber; - /// The type for hashing blocks and tries. - type Hash = Hash; - /// The hashing algorithm used. - type Hashing = BlakeTwo256; - /// The header digest type. - type Digest = generic::Digest; - /// The header type. - type Header = generic::Header; - /// The ubiquitous event type. - type Event = Event; - /// The ubiquitous log type. - type Log = Log; - /// The ubiquitous origin type. - type Origin = Origin; + /// The identifier used to distinguish between accounts. + type AccountId = AccountId; + /// The lookup mechanism to get account ID from whatever is passed in dispatchers. + type Lookup = Indices; + /// The index type for storing how many extrinsics an account has signed. + type Index = Nonce; + /// The index type for blocks. + type BlockNumber = BlockNumber; + /// The type for hashing blocks and tries. + type Hash = Hash; + /// The hashing algorithm used. + type Hashing = BlakeTwo256; + /// The header digest type. + type Digest = generic::Digest; + /// The header type. + type Header = generic::Header; + /// The ubiquitous event type. + type Event = Event; + /// The ubiquitous log type. + type Log = Log; + /// The ubiquitous origin type. + type Origin = Origin; } impl aura::Trait for Runtime { - type HandleReport = aura::StakingSlasher; + type HandleReport = aura::StakingSlasher; } impl consensus::Trait for Runtime { - /// The identifier we use to refer to authorities. - type SessionKey = Ed25519AuthorityId; - // The aura module handles offline-reports internally - // rather than using an explicit report system. - type InherentOfflineReport = (); - /// The ubiquitous log type. - type Log = Log; + /// The identifier we use to refer to authorities. + type SessionKey = Ed25519AuthorityId; + // The aura module handles offline-reports internally + // rather than using an explicit report system. + type InherentOfflineReport = (); + /// The ubiquitous log type. + type Log = Log; } /// Session key conversion. pub struct SessionKeyConversion; impl Convert for SessionKeyConversion { - fn convert(a: AccountId) -> Ed25519AuthorityId { - a.to_fixed_bytes().into() - } + fn convert(a: AccountId) -> Ed25519AuthorityId { + a.to_fixed_bytes().into() + } } impl session::Trait for Runtime { - type ConvertAccountIdToSessionKey = SessionKeyConversion; - type OnSessionChange = (Staking, ); - type Event = Event; + type ConvertAccountIdToSessionKey = SessionKeyConversion; + type OnSessionChange = (Staking,); + type Event = Event; } impl indices::Trait for Runtime { - /// The type for recording indexing into the account enumeration. If this ever overflows, there - /// will be problems! - type AccountIndex = u32; - /// Use the standard means of resolving an index hint from an id. - type ResolveHint = indices::SimpleResolveHint; - /// Determine whether an account is dead. - type IsDeadAccount = Balances; - /// The uniquitous event type. - type Event = Event; + /// The type for recording indexing into the account enumeration. If this ever overflows, there + /// will be problems! + type AccountIndex = u32; + /// Use the standard means of resolving an index hint from an id. + type ResolveHint = indices::SimpleResolveHint; + /// Determine whether an account is dead. + type IsDeadAccount = Balances; + /// The uniquitous event type. + type Event = Event; } impl timestamp::Trait for Runtime { - /// A timestamp: seconds since the unix epoch. - type Moment = u64; - type OnTimestampSet = Aura; + /// A timestamp: seconds since the unix epoch. + type Moment = u64; + type OnTimestampSet = Aura; } impl balances::Trait for Runtime { - /// The type for recording an account's balance. - type Balance = u128; - /// What to do if an account's free balance gets zeroed. - type OnFreeBalanceZero = Staking; - /// What to do if a new account is created. - type OnNewAccount = Indices; - /// Restrict whether an account can transfer funds. We don't place any further restrictions. - type EnsureAccountLiquid = (Staking, Actors); - /// The uniquitous event type. - type Event = Event; + /// The type for recording an account's balance. + type Balance = u128; + /// What to do if an account's free balance gets zeroed. + type OnFreeBalanceZero = Staking; + /// What to do if a new account is created. + type OnNewAccount = Indices; + /// Restrict whether an account can transfer funds. We don't place any further restrictions. + type EnsureAccountLiquid = (Staking, Actors); + /// The uniquitous event type. + type Event = Event; } impl fees::Trait for Runtime { - type TransferAsset = Balances; - type Event = Event; + type TransferAsset = Balances; + type Event = Event; } impl sudo::Trait for Runtime { - /// The uniquitous event type. - type Event = Event; - type Proposal = Call; + /// The uniquitous event type. + type Event = Event; + type Proposal = Call; } impl staking::Trait for Runtime { - type Currency = balances::Module; - type OnRewardMinted = (); - type Event = Event; + type Currency = balances::Module; + type OnRewardMinted = (); + type Event = Event; } impl governance::GovernanceCurrency for Runtime { - type Currency = balances::Module; + type Currency = balances::Module; } impl governance::proposals::Trait for Runtime { - type Event = Event; - type Members = Members; + type Event = Event; + type Members = Members; } impl governance::election::Trait for Runtime { - type Event = Event; - type CouncilElected = (Council,); - type Members = Members; + type Event = Event; + type CouncilElected = (Council,); + type Members = Members; } impl governance::council::Trait for Runtime { - type Event = Event; - type CouncilTermEnded = (CouncilElection,); + type Event = Event; + type CouncilTermEnded = (CouncilElection,); } impl memo::Trait for Runtime { - type Event = Event; + type Event = Event; } impl storage::data_object_type_registry::Trait for Runtime { - type Event = Event; - type DataObjectTypeId = u64; + type Event = Event; + type DataObjectTypeId = u64; } -impl storage::data_directory::Trait for Runtime -{ - type Event = Event; - type ContentId = ContentId; - type Members = Members; - type IsActiveDataObjectType = DataObjectTypeRegistry; +impl storage::data_directory::Trait for Runtime { + type Event = Event; + type ContentId = ContentId; + type Members = Members; + type IsActiveDataObjectType = DataObjectTypeRegistry; } -impl storage::downloads::Trait for Runtime -{ - type Event = Event; - type DownloadSessionId = u64; - type ContentHasStorage = DataObjectStorageRegistry; +impl storage::downloads::Trait for Runtime { + type Event = Event; + type DownloadSessionId = u64; + type ContentHasStorage = DataObjectStorageRegistry; } -impl storage::data_object_storage_registry::Trait for Runtime -{ - type Event = Event; - type DataObjectStorageRelationshipId = u64; - type Members = Members; - type ContentIdExists = DataDirectory; +impl storage::data_object_storage_registry::Trait for Runtime { + type Event = Event; + type DataObjectStorageRelationshipId = u64; + type Members = Members; + type ContentIdExists = DataDirectory; } -impl storage::content_directory::Trait for Runtime -{ - type Event = Event; - type MetadataId = u64; - type SchemaId = u64; - type Members = Members; +impl storage::content_directory::Trait for Runtime { + type Event = Event; + type MetadataId = u64; + type SchemaId = u64; + type Members = Members; } impl members::Trait for Runtime { - type Event = Event; - type MemberId = u64; - type PaidTermId = u64; - type SubscriptionId = u64; - type Roles = Actors; + type Event = Event; + type MemberId = u64; + type PaidTermId = u64; + type SubscriptionId = u64; + type Roles = Actors; } impl migration::Trait for Runtime { - type Event = Event; + type Event = Event; } impl actors::Trait for Runtime { - type Event = Event; - type Members = Members; + type Event = Event; + type Members = Members; } construct_runtime!( @@ -332,7 +334,8 @@ pub type Block = generic::Block; /// BlockId type as expected by this runtime. pub type BlockId = generic::BlockId; /// Unchecked extrinsic type as expected by this runtime. -pub type UncheckedExtrinsic = generic::UncheckedMortalCompactExtrinsic; +pub type UncheckedExtrinsic = + generic::UncheckedMortalCompactExtrinsic; /// Extrinsic type that has already been checked. pub type CheckedExtrinsic = generic::CheckedExtrinsic; /// Executive: handles dispatch to the various modules. @@ -340,61 +343,61 @@ pub type Executive = executive::Executive for Runtime { - fn version() -> RuntimeVersion { - VERSION - } - - fn authorities() -> Vec { - Consensus::authorities() - } - - fn execute_block(block: Block) { - Executive::execute_block(block) - } - - fn initialise_block(header: &::Header) { - Executive::initialise_block(header) - } - } - - impl runtime_api::Metadata for Runtime { - fn metadata() -> OpaqueMetadata { - Runtime::metadata().into() - } - } - - impl block_builder_api::BlockBuilder for Runtime { - fn apply_extrinsic(extrinsic: ::Extrinsic) -> ApplyResult { - Executive::apply_extrinsic(extrinsic) - } - - fn finalise_block() -> ::Header { - Executive::finalise_block() - } - - fn inherent_extrinsics(data: InherentData) -> Vec<::Extrinsic> { - data.create_extrinsics() - } - - fn check_inherents(block: Block, data: InherentData) -> CheckInherentsResult { - data.check_extrinsics(&block) - } - - fn random_seed() -> ::Hash { - System::random_seed() - } - } - - impl runtime_api::TaggedTransactionQueue for Runtime { - fn validate_transaction(tx: ::Extrinsic) -> TransactionValidity { - Executive::validate_transaction(tx) - } - } - - impl consensus_aura::AuraApi for Runtime { - fn slot_duration() -> u64 { - Aura::slot_duration() - } - } + impl runtime_api::Core for Runtime { + fn version() -> RuntimeVersion { + VERSION + } + + fn authorities() -> Vec { + Consensus::authorities() + } + + fn execute_block(block: Block) { + Executive::execute_block(block) + } + + fn initialise_block(header: &::Header) { + Executive::initialise_block(header) + } + } + + impl runtime_api::Metadata for Runtime { + fn metadata() -> OpaqueMetadata { + Runtime::metadata().into() + } + } + + impl block_builder_api::BlockBuilder for Runtime { + fn apply_extrinsic(extrinsic: ::Extrinsic) -> ApplyResult { + Executive::apply_extrinsic(extrinsic) + } + + fn finalise_block() -> ::Header { + Executive::finalise_block() + } + + fn inherent_extrinsics(data: InherentData) -> Vec<::Extrinsic> { + data.create_extrinsics() + } + + fn check_inherents(block: Block, data: InherentData) -> CheckInherentsResult { + data.check_extrinsics(&block) + } + + fn random_seed() -> ::Hash { + System::random_seed() + } + } + + impl runtime_api::TaggedTransactionQueue for Runtime { + fn validate_transaction(tx: ::Extrinsic) -> TransactionValidity { + Executive::validate_transaction(tx) + } + } + + impl consensus_aura::AuraApi for Runtime { + fn slot_duration() -> u64 { + Aura::slot_duration() + } + } } diff --git a/src/membership/members.rs b/src/membership/members.rs index 06540c1486..f3f19623bc 100644 --- a/src/membership/members.rs +++ b/src/membership/members.rs @@ -1,27 +1,53 @@ #![cfg_attr(not(feature = "std"), no_std)] -use rstd::prelude::*; +use crate::governance::{BalanceOf, GovernanceCurrency}; +use crate::traits::{Members, Roles}; use parity_codec::Codec; -use parity_codec_derive::{Encode, Decode}; -use srml_support::{StorageMap, StorageValue, dispatch, decl_module, decl_storage, decl_event, ensure, Parameter}; -use srml_support::traits::{Currency}; -use runtime_primitives::traits::{SimpleArithmetic, As, Member, MaybeSerializeDebug}; +use parity_codec_derive::{Decode, Encode}; +use rstd::prelude::*; +use runtime_primitives::traits::{As, MaybeSerializeDebug, Member, SimpleArithmetic}; +use srml_support::traits::Currency; +use srml_support::{ + decl_event, decl_module, decl_storage, dispatch, ensure, Parameter, StorageMap, StorageValue, +}; use system::{self, ensure_signed}; -use crate::governance::{GovernanceCurrency, BalanceOf }; -use {timestamp}; -use crate::traits::{Members, Roles}; +use timestamp; pub trait Trait: system::Trait + GovernanceCurrency + timestamp::Trait { type Event: From> + Into<::Event>; - type MemberId: Parameter + Member + SimpleArithmetic + Codec + Default + Copy - + As + As + MaybeSerializeDebug + PartialEq; - - type PaidTermId: Parameter + Member + SimpleArithmetic + Codec + Default + Copy - + As + As + MaybeSerializeDebug + PartialEq; - - type SubscriptionId: Parameter + Member + SimpleArithmetic + Codec + Default + Copy - + As + As + MaybeSerializeDebug + PartialEq; + type MemberId: Parameter + + Member + + SimpleArithmetic + + Codec + + Default + + Copy + + As + + As + + MaybeSerializeDebug + + PartialEq; + + type PaidTermId: Parameter + + Member + + SimpleArithmetic + + Codec + + Default + + Copy + + As + + As + + MaybeSerializeDebug + + PartialEq; + + type SubscriptionId: Parameter + + Member + + SimpleArithmetic + + Codec + + Default + + Copy + + As + + As + + MaybeSerializeDebug + + PartialEq; type Roles: Roles; } @@ -84,7 +110,7 @@ pub struct PaidMembershipTerms { /// Quantity of native tokens which must be provably burned pub fee: BalanceOf, /// String of capped length describing human readable conditions which are being agreed upon - pub text: Vec + pub text: Vec, } impl Default for PaidMembershipTerms { @@ -92,7 +118,7 @@ impl Default for PaidMembershipTerms { PaidMembershipTerms { id: T::PaidTermId::sa(DEFAULT_PAID_TERM_ID), fee: BalanceOf::::sa(DEFAULT_PAID_TERM_FEE), - text: DEFAULT_PAID_TERM_TEXT.as_bytes().to_vec() + text: DEFAULT_PAID_TERM_TEXT.as_bytes().to_vec(), } } } @@ -179,11 +205,9 @@ impl Members for Module { type Id = T::MemberId; fn is_active_member(who: &T::AccountId) -> bool { - match Self::ensure_is_member(who) - .and_then(|member_id| Self::ensure_profile(member_id)) - { + match Self::ensure_is_member(who).and_then(|member_id| Self::ensure_profile(member_id)) { Ok(profile) => !profile.suspended, - Err(_err) => false + Err(_err) => false, } } @@ -310,18 +334,25 @@ decl_module! { impl Module { fn ensure_not_member(who: &T::AccountId) -> dispatch::Result { - ensure!(!>::exists(who), "account already associated with a membership"); + ensure!( + !>::exists(who), + "account already associated with a membership" + ); Ok(()) } pub fn ensure_is_member(who: &T::AccountId) -> Result { - let member_id = Self::member_id_by_account_id(who).ok_or("no member id found for accountid")?; + let member_id = + Self::member_id_by_account_id(who).ok_or("no member id found for accountid")?; Ok(member_id) } fn ensure_is_member_primary_account(who: T::AccountId) -> Result { let member_id = Self::ensure_is_member(&who)?; - ensure!(Self::account_id_by_member_id(member_id) == who, "not primary account"); + ensure!( + Self::account_id_by_member_id(member_id) == who, + "not primary account" + ); Ok(member_id) } @@ -330,21 +361,33 @@ impl Module { Ok(profile) } - fn ensure_active_terms_id(terms_id: T::PaidTermId) -> Result, &'static str> { + fn ensure_active_terms_id( + terms_id: T::PaidTermId, + ) -> Result, &'static str> { let active_terms = Self::active_paid_membership_terms(); - ensure!(active_terms.iter().any(|&id| id == terms_id), "paid terms id not active"); - let terms = Self::paid_membership_terms_by_id(terms_id).ok_or("paid membership term id does not exist")?; + ensure!( + active_terms.iter().any(|&id| id == terms_id), + "paid terms id not active" + ); + let terms = Self::paid_membership_terms_by_id(terms_id) + .ok_or("paid membership term id does not exist")?; Ok(terms) } - fn ensure_unique_handle(handle: &Vec ) -> dispatch::Result { + fn ensure_unique_handle(handle: &Vec) -> dispatch::Result { ensure!(!>::exists(handle), "handle already registered"); Ok(()) } fn validate_handle(handle: &Vec) -> dispatch::Result { - ensure!(handle.len() >= Self::min_handle_length() as usize, "handle too short"); - ensure!(handle.len() <= Self::max_handle_length() as usize, "handle too long"); + ensure!( + handle.len() >= Self::min_handle_length() as usize, + "handle too short" + ); + ensure!( + handle.len() <= Self::max_handle_length() as usize, + "handle too long" + ); Ok(()) } @@ -355,14 +398,19 @@ impl Module { } fn validate_avatar(uri: &Vec) -> dispatch::Result { - ensure!(uri.len() <= Self::max_avatar_uri_length() as usize, "avatar uri too long"); + ensure!( + uri.len() <= Self::max_avatar_uri_length() as usize, + "avatar uri too long" + ); Ok(()) } /// Basic user input validation fn check_user_registration_info(user_info: UserInfo) -> Result { // Handle is required during registration - let handle = user_info.handle.ok_or("handle must be provided during registration")?; + let handle = user_info + .handle + .ok_or("handle must be provided during registration")?; Self::validate_handle(&handle)?; let about = Self::validate_text(&user_info.about.unwrap_or_default()); @@ -377,7 +425,11 @@ impl Module { } // Mutating methods - fn insert_member(who: &T::AccountId, user_info: &CheckedUserInfo, entry_method: EntryMethod) -> T::MemberId { + fn insert_member( + who: &T::AccountId, + user_info: &CheckedUserInfo, + entry_method: EntryMethod, + ) -> T::MemberId { let new_member_id = Self::next_member_id(); let profile: Profile = Profile { @@ -396,12 +448,14 @@ impl Module { >::insert(new_member_id, who.clone()); >::insert(new_member_id, profile); >::insert(user_info.handle.clone(), new_member_id); - >::mutate(|n| { *n += T::MemberId::sa(1); }); + >::mutate(|n| { + *n += T::MemberId::sa(1); + }); new_member_id } - fn _change_member_about_text (id: T::MemberId, text: &Vec) -> dispatch::Result { + fn _change_member_about_text(id: T::MemberId, text: &Vec) -> dispatch::Result { let mut profile = Self::ensure_profile(id)?; let text = Self::validate_text(text); profile.about = text; diff --git a/src/membership/mock.rs b/src/membership/mock.rs index ca119dcbcb..c4e0317dd7 100644 --- a/src/membership/mock.rs +++ b/src/membership/mock.rs @@ -1,14 +1,14 @@ #![cfg(test)] -pub use crate::governance::{GovernanceCurrency}; -pub use super::{members}; +pub use super::members; +pub use crate::governance::GovernanceCurrency; pub use system; -pub use primitives::{H256, Blake2Hasher}; +pub use primitives::{Blake2Hasher, H256}; pub use runtime_primitives::{ + testing::{Digest, DigestItem, Header, UintAuthorityId}, + traits::{BlakeTwo256, IdentityLookup, OnFinalise}, BuildStorage, - traits::{BlakeTwo256, OnFinalise, IdentityLookup}, - testing::{Digest, DigestItem, Header, UintAuthorityId} }; use srml_support::impl_outer_origin; @@ -77,34 +77,42 @@ impl members::Trait for Test { } pub struct ExtBuilder { - first_member_id: u32, - default_paid_membership_fee: u32, + first_member_id: u32, + default_paid_membership_fee: u32, } impl Default for ExtBuilder { - fn default() -> Self { - Self { - first_member_id: 1, - default_paid_membership_fee: 100, - } - } + fn default() -> Self { + Self { + first_member_id: 1, + default_paid_membership_fee: 100, + } + } } impl ExtBuilder { - pub fn first_member_id(mut self, first_member_id: u32) -> Self { - self.first_member_id = first_member_id; - self - } - pub fn default_paid_membership_fee(mut self, default_paid_membership_fee: u32) -> Self { - self.default_paid_membership_fee = default_paid_membership_fee; - self - } + pub fn first_member_id(mut self, first_member_id: u32) -> Self { + self.first_member_id = first_member_id; + self + } + pub fn default_paid_membership_fee(mut self, default_paid_membership_fee: u32) -> Self { + self.default_paid_membership_fee = default_paid_membership_fee; + self + } pub fn build(self) -> runtime_io::TestExternalities { - let mut t = system::GenesisConfig::::default().build_storage().unwrap().0; - - t.extend(members::GenesisConfig::{ - first_member_id: self.first_member_id, - default_paid_membership_fee: self.default_paid_membership_fee, - }.build_storage().unwrap().0); + let mut t = system::GenesisConfig::::default() + .build_storage() + .unwrap() + .0; + + t.extend( + members::GenesisConfig:: { + first_member_id: self.first_member_id, + default_paid_membership_fee: self.default_paid_membership_fee, + } + .build_storage() + .unwrap() + .0, + ); t.into() } diff --git a/src/membership/mod.rs b/src/membership/mod.rs index 35c272c7ad..4823630e62 100644 --- a/src/membership/mod.rs +++ b/src/membership/mod.rs @@ -3,4 +3,4 @@ pub mod members; mod mock; -mod tests; \ No newline at end of file +mod tests; diff --git a/src/membership/tests.rs b/src/membership/tests.rs index 9e270519d1..c1865ba22f 100644 --- a/src/membership/tests.rs +++ b/src/membership/tests.rs @@ -1,6 +1,5 @@ #![cfg(test)] -use super::*; use super::mock::*; use runtime_io::with_externalities; @@ -8,15 +7,22 @@ use srml_support::*; fn assert_ok_unwrap(value: Option, err: &'static str) -> T { match value { - None => { assert!(false, err); value.unwrap() }, - Some(v) => v + None => { + assert!(false, err); + value.unwrap() + } + Some(v) => v, } } fn get_alice_info() -> members::UserInfo { members::UserInfo { handle: Some(String::from("alice").as_bytes().to_vec()), - avatar_uri: Some(String::from("http://avatar-url.com/alice").as_bytes().to_vec()), + avatar_uri: Some( + String::from("http://avatar-url.com/alice") + .as_bytes() + .to_vec(), + ), about: Some(String::from("my name is alice").as_bytes().to_vec()), } } @@ -24,7 +30,11 @@ fn get_alice_info() -> members::UserInfo { fn get_bob_info() -> members::UserInfo { members::UserInfo { handle: Some(String::from("bobby").as_bytes().to_vec()), - avatar_uri: Some(String::from("http://avatar-url.com/bob").as_bytes().to_vec()), + avatar_uri: Some( + String::from("http://avatar-url.com/bob") + .as_bytes() + .to_vec(), + ), about: Some(String::from("my name is bob").as_bytes().to_vec()), } } @@ -33,7 +43,11 @@ const ALICE_ACCOUNT_ID: u64 = 1; const DEFAULT_TERMS_ID: u32 = 0; fn buy_default_membership_as_alice() -> dispatch::Result { - Members::buy_membership(Origin::signed(ALICE_ACCOUNT_ID), DEFAULT_TERMS_ID, get_alice_info()) + Members::buy_membership( + Origin::signed(ALICE_ACCOUNT_ID), + DEFAULT_TERMS_ID, + get_alice_info(), + ) } fn set_alice_free_balance(balance: u32) { @@ -45,18 +59,24 @@ fn initial_state() { const DEFAULT_FEE: u32 = 500; const DEFAULT_FIRST_ID: u32 = 1000; - with_externalities(&mut ExtBuilder::default() - .default_paid_membership_fee(DEFAULT_FEE) - .first_member_id(DEFAULT_FIRST_ID).build(), || - { - assert_eq!(Members::first_member_id(), DEFAULT_FIRST_ID); - assert_eq!(Members::next_member_id(), DEFAULT_FIRST_ID); - - let default_terms = assert_ok_unwrap(Members::paid_membership_terms_by_id(DEFAULT_TERMS_ID), "default terms not initialized"); - - assert_eq!(default_terms.id, DEFAULT_TERMS_ID); - assert_eq!(default_terms.fee, DEFAULT_FEE); - }); + with_externalities( + &mut ExtBuilder::default() + .default_paid_membership_fee(DEFAULT_FEE) + .first_member_id(DEFAULT_FIRST_ID) + .build(), + || { + assert_eq!(Members::first_member_id(), DEFAULT_FIRST_ID); + assert_eq!(Members::next_member_id(), DEFAULT_FIRST_ID); + + let default_terms = assert_ok_unwrap( + Members::paid_membership_terms_by_id(DEFAULT_TERMS_ID), + "default terms not initialized", + ); + + assert_eq!(default_terms.id, DEFAULT_TERMS_ID); + assert_eq!(default_terms.fee, DEFAULT_FEE); + }, + ); } #[test] @@ -65,56 +85,70 @@ fn buy_membership() { const DEFAULT_FIRST_ID: u32 = 1000; const SURPLUS_BALANCE: u32 = 500; - with_externalities(&mut ExtBuilder::default() - .default_paid_membership_fee(DEFAULT_FEE) - .first_member_id(DEFAULT_FIRST_ID).build(), || - { - let initial_balance = DEFAULT_FEE + SURPLUS_BALANCE; - set_alice_free_balance(initial_balance); - - assert_ok!(buy_default_membership_as_alice()); - - let member_id = assert_ok_unwrap(Members::member_id_by_account_id(&ALICE_ACCOUNT_ID), "member id not assigned"); - - let profile = assert_ok_unwrap(Members::member_profile(&member_id), "member profile not created"); - - assert_eq!(Some(profile.handle), get_alice_info().handle); - assert_eq!(Some(profile.avatar_uri), get_alice_info().avatar_uri); - assert_eq!(Some(profile.about), get_alice_info().about); - - assert_eq!(Balances::free_balance(&ALICE_ACCOUNT_ID), SURPLUS_BALANCE); - - }); + with_externalities( + &mut ExtBuilder::default() + .default_paid_membership_fee(DEFAULT_FEE) + .first_member_id(DEFAULT_FIRST_ID) + .build(), + || { + let initial_balance = DEFAULT_FEE + SURPLUS_BALANCE; + set_alice_free_balance(initial_balance); + + assert_ok!(buy_default_membership_as_alice()); + + let member_id = assert_ok_unwrap( + Members::member_id_by_account_id(&ALICE_ACCOUNT_ID), + "member id not assigned", + ); + + let profile = assert_ok_unwrap( + Members::member_profile(&member_id), + "member profile not created", + ); + + assert_eq!(Some(profile.handle), get_alice_info().handle); + assert_eq!(Some(profile.avatar_uri), get_alice_info().avatar_uri); + assert_eq!(Some(profile.about), get_alice_info().about); + + assert_eq!(Balances::free_balance(&ALICE_ACCOUNT_ID), SURPLUS_BALANCE); + }, + ); } #[test] fn buy_membership_fails_without_enough_balance() { const DEFAULT_FEE: u32 = 500; - with_externalities(&mut ExtBuilder::default() - .default_paid_membership_fee(DEFAULT_FEE).build(), || - { - let initial_balance = DEFAULT_FEE - 1; - set_alice_free_balance(initial_balance); - - assert!(buy_default_membership_as_alice().is_err()); - }); + with_externalities( + &mut ExtBuilder::default() + .default_paid_membership_fee(DEFAULT_FEE) + .build(), + || { + let initial_balance = DEFAULT_FEE - 1; + set_alice_free_balance(initial_balance); + + assert!(buy_default_membership_as_alice().is_err()); + }, + ); } #[test] fn new_memberships_allowed_flag() { const DEFAULT_FEE: u32 = 500; - with_externalities(&mut ExtBuilder::default() - .default_paid_membership_fee(DEFAULT_FEE).build(), || - { - let initial_balance = DEFAULT_FEE + 1; - set_alice_free_balance(initial_balance); + with_externalities( + &mut ExtBuilder::default() + .default_paid_membership_fee(DEFAULT_FEE) + .build(), + || { + let initial_balance = DEFAULT_FEE + 1; + set_alice_free_balance(initial_balance); - >::put(false); + >::put(false); - assert!(buy_default_membership_as_alice().is_err()); - }); + assert!(buy_default_membership_as_alice().is_err()); + }, + ); } #[test] @@ -122,19 +156,21 @@ fn account_cannot_create_multiple_memberships() { const DEFAULT_FEE: u32 = 500; const SURPLUS_BALANCE: u32 = 500; - with_externalities(&mut ExtBuilder::default() - .default_paid_membership_fee(DEFAULT_FEE).build(), || - { - let initial_balance = DEFAULT_FEE + SURPLUS_BALANCE; - set_alice_free_balance(initial_balance); - - // First time it works - assert_ok!(buy_default_membership_as_alice()); - - // second attempt should fail - assert!(buy_default_membership_as_alice().is_err()); - - }); + with_externalities( + &mut ExtBuilder::default() + .default_paid_membership_fee(DEFAULT_FEE) + .build(), + || { + let initial_balance = DEFAULT_FEE + SURPLUS_BALANCE; + set_alice_free_balance(initial_balance); + + // First time it works + assert_ok!(buy_default_membership_as_alice()); + + // second attempt should fail + assert!(buy_default_membership_as_alice().is_err()); + }, + ); } #[test] @@ -142,19 +178,21 @@ fn unique_handles() { const DEFAULT_FEE: u32 = 500; const SURPLUS_BALANCE: u32 = 500; - with_externalities(&mut ExtBuilder::default() - .default_paid_membership_fee(DEFAULT_FEE).build(), || - { - let initial_balance = DEFAULT_FEE + SURPLUS_BALANCE; - set_alice_free_balance(initial_balance); - - // alice's handle already taken - >::insert(get_alice_info().handle.unwrap(), 1); - - // should not be allowed to buy membership with that handle - assert!(buy_default_membership_as_alice().is_err()); - - }); + with_externalities( + &mut ExtBuilder::default() + .default_paid_membership_fee(DEFAULT_FEE) + .build(), + || { + let initial_balance = DEFAULT_FEE + SURPLUS_BALANCE; + set_alice_free_balance(initial_balance); + + // alice's handle already taken + >::insert(get_alice_info().handle.unwrap(), 1); + + // should not be allowed to buy membership with that handle + assert!(buy_default_membership_as_alice().is_err()); + }, + ); } #[test] @@ -162,44 +200,66 @@ fn update_profile() { const DEFAULT_FEE: u32 = 500; const SURPLUS_BALANCE: u32 = 500; - with_externalities(&mut ExtBuilder::default() - .default_paid_membership_fee(DEFAULT_FEE).build(), || - { - let initial_balance = DEFAULT_FEE + SURPLUS_BALANCE; - set_alice_free_balance(initial_balance); - - assert_ok!(buy_default_membership_as_alice()); - - assert_ok!(Members::update_profile(Origin::signed(ALICE_ACCOUNT_ID), get_bob_info())); - - let member_id = assert_ok_unwrap(Members::member_id_by_account_id(&ALICE_ACCOUNT_ID), "member id not assigned"); - - let profile = assert_ok_unwrap(Members::member_profile(&member_id), "member profile created"); - - assert_eq!(Some(profile.handle), get_bob_info().handle); - assert_eq!(Some(profile.avatar_uri), get_bob_info().avatar_uri); - assert_eq!(Some(profile.about), get_bob_info().about); - - }); + with_externalities( + &mut ExtBuilder::default() + .default_paid_membership_fee(DEFAULT_FEE) + .build(), + || { + let initial_balance = DEFAULT_FEE + SURPLUS_BALANCE; + set_alice_free_balance(initial_balance); + + assert_ok!(buy_default_membership_as_alice()); + + assert_ok!(Members::update_profile( + Origin::signed(ALICE_ACCOUNT_ID), + get_bob_info() + )); + + let member_id = assert_ok_unwrap( + Members::member_id_by_account_id(&ALICE_ACCOUNT_ID), + "member id not assigned", + ); + + let profile = assert_ok_unwrap( + Members::member_profile(&member_id), + "member profile created", + ); + + assert_eq!(Some(profile.handle), get_bob_info().handle); + assert_eq!(Some(profile.avatar_uri), get_bob_info().avatar_uri); + assert_eq!(Some(profile.about), get_bob_info().about); + }, + ); } #[test] fn add_screened_member() { - with_externalities(&mut ExtBuilder::default().build(), || - { + with_externalities(&mut ExtBuilder::default().build(), || { let screening_authority = 5; >::put(&screening_authority); - assert_ok!(Members::add_screened_member(Origin::signed(screening_authority), ALICE_ACCOUNT_ID, get_alice_info())); + assert_ok!(Members::add_screened_member( + Origin::signed(screening_authority), + ALICE_ACCOUNT_ID, + get_alice_info() + )); - let member_id = assert_ok_unwrap(Members::member_id_by_account_id(&ALICE_ACCOUNT_ID), "member id not assigned"); + let member_id = assert_ok_unwrap( + Members::member_id_by_account_id(&ALICE_ACCOUNT_ID), + "member id not assigned", + ); - let profile = assert_ok_unwrap(Members::member_profile(&member_id), "member profile created"); + let profile = assert_ok_unwrap( + Members::member_profile(&member_id), + "member profile created", + ); assert_eq!(Some(profile.handle), get_alice_info().handle); assert_eq!(Some(profile.avatar_uri), get_alice_info().avatar_uri); assert_eq!(Some(profile.about), get_alice_info().about); - assert_eq!(members::EntryMethod::Screening(screening_authority), profile.entry); - + assert_eq!( + members::EntryMethod::Screening(screening_authority), + profile.entry + ); }); } diff --git a/src/memo.rs b/src/memo.rs index dd84afab18..142f40a4b2 100644 --- a/src/memo.rs +++ b/src/memo.rs @@ -1,11 +1,11 @@ #![cfg_attr(not(feature = "std"), no_std)] -use srml_support::{StorageMap, decl_module, decl_storage, decl_event, ensure}; -use srml_support::traits::{Currency}; -use runtime_primitives::traits::{Zero}; -use system::{self, ensure_signed}; -use rstd::prelude::*; use crate::governance::GovernanceCurrency; +use rstd::prelude::*; +use runtime_primitives::traits::Zero; +use srml_support::traits::Currency; +use srml_support::{decl_event, decl_module, decl_storage, ensure, StorageMap}; +use system::{self, ensure_signed}; pub trait Trait: system::Trait + GovernanceCurrency { type Event: From> + Into<::Event>; diff --git a/src/migration.rs b/src/migration.rs index c1a85caecb..3aa4027428 100644 --- a/src/migration.rs +++ b/src/migration.rs @@ -1,14 +1,14 @@ #![cfg_attr(not(feature = "std"), no_std)] -use srml_support::{StorageValue, decl_module, decl_storage, decl_event}; -use system; -use rstd::prelude::*; -use runtime_io::print; -use crate::{VERSION}; +use crate::governance::BalanceOf; use crate::membership::members; use crate::roles::actors; -use crate::governance::{BalanceOf}; -use runtime_primitives::traits::{As}; +use crate::VERSION; +use rstd::prelude::*; +use runtime_io::print; +use runtime_primitives::traits::As; +use srml_support::{decl_event, decl_module, decl_storage, StorageValue}; +use system; // When preparing a new major runtime release version bump this value to match it and update // the initialization code in runtime_initialization(). Because of the way substrate runs runtime code @@ -19,34 +19,42 @@ const MIGRATION_FOR_SPEC_VERSION: u32 = 5; impl Module { fn runtime_initialization() { - if VERSION.spec_version != MIGRATION_FOR_SPEC_VERSION { return } + if VERSION.spec_version != MIGRATION_FOR_SPEC_VERSION { + return; + } print("running runtime initializers"); >::initialize_storage(); // Initialize Storage provider role parameters - >::set_role_parameters(actors::Role::Storage, actors::RoleParameters { - min_stake: BalanceOf::::sa(3000), - max_actors: 10, - reward: BalanceOf::::sa(10), - reward_period: T::BlockNumber::sa(600), - unbonding_period: T::BlockNumber::sa(600), - entry_request_fee: BalanceOf::::sa(50), + >::set_role_parameters( + actors::Role::Storage, + actors::RoleParameters { + min_stake: BalanceOf::::sa(3000), + max_actors: 10, + reward: BalanceOf::::sa(10), + reward_period: T::BlockNumber::sa(600), + unbonding_period: T::BlockNumber::sa(600), + entry_request_fee: BalanceOf::::sa(50), - // not currently used - min_actors: 5, - bonding_period: T::BlockNumber::sa(600), - min_service_period: T::BlockNumber::sa(600), - startup_grace_period: T::BlockNumber::sa(600), - }); + // not currently used + min_actors: 5, + bonding_period: T::BlockNumber::sa(600), + min_service_period: T::BlockNumber::sa(600), + startup_grace_period: T::BlockNumber::sa(600), + }, + ); >::set_available_roles(vec![actors::Role::Storage]); // ... // add initialization of other modules introduced in this runtime // ... - Self::deposit_event(RawEvent::Migrated(>::block_number(), VERSION.spec_version)); + Self::deposit_event(RawEvent::Migrated( + >::block_number(), + VERSION.spec_version, + )); } } diff --git a/src/roles/actors.rs b/src/roles/actors.rs index 9ad261d184..cda9927230 100644 --- a/src/roles/actors.rs +++ b/src/roles/actors.rs @@ -3,9 +3,7 @@ use crate::governance::{BalanceOf, GovernanceCurrency}; use parity_codec_derive::{Decode, Encode}; use rstd::prelude::*; -use runtime_primitives::traits::{ - As, Bounded, MaybeDebug, Zero, -}; +use runtime_primitives::traits::{As, Bounded, MaybeDebug, Zero}; use srml_support::traits::{Currency, EnsureAccountLiquid}; use srml_support::{ decl_event, decl_module, decl_storage, dispatch, ensure, StorageMap, StorageValue, @@ -72,7 +70,12 @@ pub trait Trait: system::Trait + GovernanceCurrency + MaybeDebug { pub type MemberId = <::Members as Members>::Id; // actor account, memberid, role, expires -pub type Request = (::AccountId, MemberId, Role, ::BlockNumber); +pub type Request = ( + ::AccountId, + MemberId, + Role, + ::BlockNumber, +); pub type Requests = Vec>; pub const REQUEST_LIFETIME: u64 = 300; diff --git a/src/storage/mod.rs b/src/storage/mod.rs index 39f5743605..d2536f4f3e 100644 --- a/src/storage/mod.rs +++ b/src/storage/mod.rs @@ -1,9 +1,9 @@ #![cfg_attr(not(feature = "std"), no_std)] +pub mod content_directory; pub mod data_directory; pub mod data_object_storage_registry; pub mod data_object_type_registry; pub mod downloads; -pub mod content_directory; mod mock; diff --git a/src/storage/tests.rs b/src/storage/tests.rs index 59236b41d1..73efc8d3f2 100644 --- a/src/storage/tests.rs +++ b/src/storage/tests.rs @@ -1,158 +1,206 @@ #![cfg(test)] -use super::*; use super::mock::*; +use super::*; use runtime_io::with_externalities; -use system::{self, Phase, EventRecord}; +use system::{self, EventRecord, Phase}; #[test] fn initial_state() { const DEFAULT_FIRST_ID: u64 = 1000; - with_externalities(&mut ExtBuilder::default() - .first_data_object_type_id(DEFAULT_FIRST_ID).build(), || { - assert_eq!(TestDataObjectTypeRegistry::first_data_object_type_id(), DEFAULT_FIRST_ID); - }); + with_externalities( + &mut ExtBuilder::default() + .first_data_object_type_id(DEFAULT_FIRST_ID) + .build(), + || { + assert_eq!( + TestDataObjectTypeRegistry::first_data_object_type_id(), + DEFAULT_FIRST_ID + ); + }, + ); } #[test] fn fail_register_without_root() { const DEFAULT_FIRST_ID: u64 = 1000; - with_externalities(&mut ExtBuilder::default() - .first_data_object_type_id(DEFAULT_FIRST_ID).build(), || { - let data: TestDataObjectType = TestDataObjectType { - id: None, - description: "foo".as_bytes().to_vec(), - active: false, - }; - let res = TestDataObjectTypeRegistry::register_data_object_type(Origin::signed(1), data); - assert!(res.is_err()); - }); + with_externalities( + &mut ExtBuilder::default() + .first_data_object_type_id(DEFAULT_FIRST_ID) + .build(), + || { + let data: TestDataObjectType = TestDataObjectType { + id: None, + description: "foo".as_bytes().to_vec(), + active: false, + }; + let res = + TestDataObjectTypeRegistry::register_data_object_type(Origin::signed(1), data); + assert!(res.is_err()); + }, + ); } #[test] fn succeed_register_as_root() { const DEFAULT_FIRST_ID: u64 = 1000; - with_externalities(&mut ExtBuilder::default() - .first_data_object_type_id(DEFAULT_FIRST_ID).build(), || { - let data: TestDataObjectType = TestDataObjectType { - id: None, - description: "foo".as_bytes().to_vec(), - active: false, - }; - let res = TestDataObjectTypeRegistry::register_data_object_type(Origin::ROOT, data); - assert!(res.is_ok()); - }); + with_externalities( + &mut ExtBuilder::default() + .first_data_object_type_id(DEFAULT_FIRST_ID) + .build(), + || { + let data: TestDataObjectType = TestDataObjectType { + id: None, + description: "foo".as_bytes().to_vec(), + active: false, + }; + let res = TestDataObjectTypeRegistry::register_data_object_type(Origin::ROOT, data); + assert!(res.is_ok()); + }, + ); } #[test] fn update_existing() { const DEFAULT_FIRST_ID: u64 = 1000; - with_externalities(&mut ExtBuilder::default() - .first_data_object_type_id(DEFAULT_FIRST_ID).build(), || { - // First register a type - let data: TestDataObjectType = TestDataObjectType { - id: None, - description: "foo".as_bytes().to_vec(), - active: false, - }; - let id_res = TestDataObjectTypeRegistry::register_data_object_type(Origin::ROOT, data); - assert!(id_res.is_ok()); - assert_eq!(*System::events().last().unwrap(), - EventRecord { - phase: Phase::ApplyExtrinsic(0), - event: MetaEvent::data_object_type_registry(data_object_type_registry::RawEvent::DataObjectTypeRegistered(DEFAULT_FIRST_ID)), - } - ); - - - // Now update it with new data - we need the ID to be the same as in - // returned by the previous call. First, though, try and fail without - let updated1: TestDataObjectType = TestDataObjectType { - id: None, - description: "bar".as_bytes().to_vec(), - active: false, - }; - let res = TestDataObjectTypeRegistry::update_data_object_type(Origin::ROOT, updated1); - assert!(res.is_err()); - - // Now try with a bad ID - let updated2: TestDataObjectType = TestDataObjectType { - id: Some(DEFAULT_FIRST_ID + 1), - description: "bar".as_bytes().to_vec(), - active: false, - }; - let res = TestDataObjectTypeRegistry::update_data_object_type(Origin::ROOT, updated2); - assert!(res.is_err()); - - // Finally with an existing ID, it should work. - let updated3: TestDataObjectType = TestDataObjectType { - id: Some(DEFAULT_FIRST_ID), - description: "bar".as_bytes().to_vec(), - active: false, - }; - let res = TestDataObjectTypeRegistry::update_data_object_type(Origin::ROOT, updated3); - assert!(res.is_ok()); - assert_eq!(*System::events().last().unwrap(), - EventRecord { - phase: Phase::ApplyExtrinsic(0), - event: MetaEvent::data_object_type_registry(data_object_type_registry::RawEvent::DataObjectTypeUpdated(DEFAULT_FIRST_ID)), - } - ); - }); + with_externalities( + &mut ExtBuilder::default() + .first_data_object_type_id(DEFAULT_FIRST_ID) + .build(), + || { + // First register a type + let data: TestDataObjectType = TestDataObjectType { + id: None, + description: "foo".as_bytes().to_vec(), + active: false, + }; + let id_res = TestDataObjectTypeRegistry::register_data_object_type(Origin::ROOT, data); + assert!(id_res.is_ok()); + assert_eq!( + *System::events().last().unwrap(), + EventRecord { + phase: Phase::ApplyExtrinsic(0), + event: MetaEvent::data_object_type_registry( + data_object_type_registry::RawEvent::DataObjectTypeRegistered( + DEFAULT_FIRST_ID + ) + ), + } + ); + + // Now update it with new data - we need the ID to be the same as in + // returned by the previous call. First, though, try and fail without + let updated1: TestDataObjectType = TestDataObjectType { + id: None, + description: "bar".as_bytes().to_vec(), + active: false, + }; + let res = TestDataObjectTypeRegistry::update_data_object_type(Origin::ROOT, updated1); + assert!(res.is_err()); + + // Now try with a bad ID + let updated2: TestDataObjectType = TestDataObjectType { + id: Some(DEFAULT_FIRST_ID + 1), + description: "bar".as_bytes().to_vec(), + active: false, + }; + let res = TestDataObjectTypeRegistry::update_data_object_type(Origin::ROOT, updated2); + assert!(res.is_err()); + + // Finally with an existing ID, it should work. + let updated3: TestDataObjectType = TestDataObjectType { + id: Some(DEFAULT_FIRST_ID), + description: "bar".as_bytes().to_vec(), + active: false, + }; + let res = TestDataObjectTypeRegistry::update_data_object_type(Origin::ROOT, updated3); + assert!(res.is_ok()); + assert_eq!( + *System::events().last().unwrap(), + EventRecord { + phase: Phase::ApplyExtrinsic(0), + event: MetaEvent::data_object_type_registry( + data_object_type_registry::RawEvent::DataObjectTypeUpdated( + DEFAULT_FIRST_ID + ) + ), + } + ); + }, + ); } - #[test] fn activate_existing() { const DEFAULT_FIRST_ID: u64 = 1000; - with_externalities(&mut ExtBuilder::default() - .first_data_object_type_id(DEFAULT_FIRST_ID).build(), || { - // First register a type - let data: TestDataObjectType = TestDataObjectType { - id: None, - description: "foo".as_bytes().to_vec(), - active: false, - }; - let id_res = TestDataObjectTypeRegistry::register_data_object_type(Origin::ROOT, data); - assert!(id_res.is_ok()); - assert_eq!(*System::events().last().unwrap(), - EventRecord { - phase: Phase::ApplyExtrinsic(0), - event: MetaEvent::data_object_type_registry(data_object_type_registry::RawEvent::DataObjectTypeRegistered(DEFAULT_FIRST_ID)), - } - ); - - // Retrieve, and ensure it's not active. - let data = TestDataObjectTypeRegistry::data_object_type(DEFAULT_FIRST_ID); - assert!(data.is_some()); - assert!(!data.unwrap().active); - - // Now activate the data object type - let res = TestDataObjectTypeRegistry::activate_data_object_type(Origin::ROOT, DEFAULT_FIRST_ID); - assert!(res.is_ok()); - assert_eq!(*System::events().last().unwrap(), - EventRecord { - phase: Phase::ApplyExtrinsic(0), - event: MetaEvent::data_object_type_registry(data_object_type_registry::RawEvent::DataObjectTypeUpdated(DEFAULT_FIRST_ID)), - } - ); - - // Ensure that the item is actually activated. - let data = TestDataObjectTypeRegistry::data_object_type(DEFAULT_FIRST_ID); - assert!(data.is_some()); - assert!(data.unwrap().active); - - // Deactivate again. - let res = TestDataObjectTypeRegistry::deactivate_data_object_type(Origin::ROOT, DEFAULT_FIRST_ID); - assert!(res.is_ok()); - let data = TestDataObjectTypeRegistry::data_object_type(DEFAULT_FIRST_ID); - assert!(data.is_some()); - assert!(!data.unwrap().active); - }); + with_externalities( + &mut ExtBuilder::default() + .first_data_object_type_id(DEFAULT_FIRST_ID) + .build(), + || { + // First register a type + let data: TestDataObjectType = TestDataObjectType { + id: None, + description: "foo".as_bytes().to_vec(), + active: false, + }; + let id_res = TestDataObjectTypeRegistry::register_data_object_type(Origin::ROOT, data); + assert!(id_res.is_ok()); + assert_eq!( + *System::events().last().unwrap(), + EventRecord { + phase: Phase::ApplyExtrinsic(0), + event: MetaEvent::data_object_type_registry( + data_object_type_registry::RawEvent::DataObjectTypeRegistered( + DEFAULT_FIRST_ID + ) + ), + } + ); + + // Retrieve, and ensure it's not active. + let data = TestDataObjectTypeRegistry::data_object_type(DEFAULT_FIRST_ID); + assert!(data.is_some()); + assert!(!data.unwrap().active); + + // Now activate the data object type + let res = TestDataObjectTypeRegistry::activate_data_object_type( + Origin::ROOT, + DEFAULT_FIRST_ID, + ); + assert!(res.is_ok()); + assert_eq!( + *System::events().last().unwrap(), + EventRecord { + phase: Phase::ApplyExtrinsic(0), + event: MetaEvent::data_object_type_registry( + data_object_type_registry::RawEvent::DataObjectTypeUpdated( + DEFAULT_FIRST_ID + ) + ), + } + ); + + // Ensure that the item is actually activated. + let data = TestDataObjectTypeRegistry::data_object_type(DEFAULT_FIRST_ID); + assert!(data.is_some()); + assert!(data.unwrap().active); + + // Deactivate again. + let res = TestDataObjectTypeRegistry::deactivate_data_object_type( + Origin::ROOT, + DEFAULT_FIRST_ID, + ); + assert!(res.is_ok()); + let data = TestDataObjectTypeRegistry::data_object_type(DEFAULT_FIRST_ID); + assert!(data.is_some()); + assert!(!data.unwrap().active); + }, + ); } diff --git a/src/traits.rs b/src/traits.rs index e3802bc355..3bfea937b6 100644 --- a/src/traits.rs +++ b/src/traits.rs @@ -1,15 +1,23 @@ #![cfg_attr(not(feature = "std"), no_std)] use crate::storage::{data_directory, data_object_storage_registry, data_object_type_registry}; -use system; use parity_codec::Codec; -use srml_support::{Parameter}; -use runtime_primitives::traits::{SimpleArithmetic, As, Member, MaybeSerializeDebug}; +use runtime_primitives::traits::{As, MaybeSerializeDebug, Member, SimpleArithmetic}; +use srml_support::Parameter; +use system; // Members pub trait Members { - type Id : Parameter + Member + SimpleArithmetic + Codec + Default + Copy - + As + As + MaybeSerializeDebug + PartialEq; + type Id: Parameter + + Member + + SimpleArithmetic + + Codec + + Default + + Copy + + As + + As + + MaybeSerializeDebug + + PartialEq; fn is_active_member(account_id: &T::AccountId) -> bool; @@ -37,7 +45,9 @@ pub trait Roles { } impl Roles for () { - fn is_role_account(_who: &T::AccountId) -> bool { false } + fn is_role_account(_who: &T::AccountId) -> bool { + false + } } // Storage From d9151010aba1236bf5e523ebda23cd8ee3fd4af8 Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Wed, 3 Apr 2019 11:21:58 +0300 Subject: [PATCH 138/175] substrate upgrade: export StakerStatus --- src/lib.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/lib.rs b/src/lib.rs index 3aae8a1883..c701b2d2ad 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -51,6 +51,7 @@ pub use balances::Call as BalancesCall; pub use runtime_primitives::{Permill, Perbill}; pub use timestamp::BlockPeriod; pub use srml_support::{StorageValue, construct_runtime}; +pub use staking::StakerStatus; /// The type that is used for identifying authorities. pub type AuthorityId = ::Signer; From 514c5b1f408c23764c0102a6a091e3352e83741f Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Wed, 3 Apr 2019 12:59:19 +0300 Subject: [PATCH 139/175] rustfmt --- src/governance/election.rs | 6 +- src/governance/mock.rs | 4 +- src/governance/mod.rs | 7 +- src/governance/proposals.rs | 13 ++- src/lib.rs | 211 ++++++++++++++++++---------------- src/membership/mock.rs | 6 +- src/roles/actors.rs | 2 +- src/roles/mock.rs | 6 +- src/storage/data_directory.rs | 4 +- 9 files changed, 135 insertions(+), 124 deletions(-) diff --git a/src/governance/election.rs b/src/governance/election.rs index 1586f1ee6a..8715ebef3e 100644 --- a/src/governance/election.rs +++ b/src/governance/election.rs @@ -1849,9 +1849,9 @@ mod tests { } #[test] - fn unlock_transferable_stakes_should_work () { - with_externalities(&mut initial_test_ext(), || { - >::put(vec![10,20,30]); + fn unlock_transferable_stakes_should_work() { + with_externalities(&mut initial_test_ext(), || { + >::put(vec![10, 20, 30]); Balances::deposit_creating(&10, 6000); Balances::reserve(&10, 5000); diff --git a/src/governance/mock.rs b/src/governance/mock.rs index 724bc4433b..8010f371fb 100644 --- a/src/governance/mock.rs +++ b/src/governance/mock.rs @@ -90,8 +90,8 @@ impl balances::Trait for Test { type OnNewAccount = (); type TransactionPayment = (); - type DustRemoval = (); - type TransferPayment = (); + type DustRemoval = (); + type TransferPayment = (); } impl GovernanceCurrency for Test { diff --git a/src/governance/mod.rs b/src/governance/mod.rs index d96fe01c25..74b553e22d 100644 --- a/src/governance/mod.rs +++ b/src/governance/mod.rs @@ -11,10 +11,11 @@ mod sealed_vote; mod stake; pub trait GovernanceCurrency: system::Trait + Sized { - type Currency: Currency + - LockableCurrency; + type Currency: Currency + + LockableCurrency; } -pub type BalanceOf = <::Currency as Currency<::AccountId>>::Balance; +pub type BalanceOf = + <::Currency as Currency<::AccountId>>::Balance; mod mock; diff --git a/src/governance/proposals.rs b/src/governance/proposals.rs index 3390defced..fd48600816 100644 --- a/src/governance/proposals.rs +++ b/src/governance/proposals.rs @@ -5,7 +5,10 @@ use srml_support::traits::Currency; use srml_support::{ decl_event, decl_module, decl_storage, dispatch, ensure, StorageMap, StorageValue, }; -use {consensus, system::{self, ensure_signed}}; +use { + consensus, + system::{self, ensure_signed}, +}; #[cfg(test)] use primitives::storage::well_known_keys; @@ -596,8 +599,8 @@ mod tests { type OnNewAccount = (); type Event = (); type TransactionPayment = (); - type DustRemoval = (); - type TransferPayment = (); + type DustRemoval = (); + type TransferPayment = (); } impl timestamp::Trait for Test { @@ -1044,9 +1047,7 @@ mod tests { with_externalities(&mut new_test_ext(), || { Balances::deposit_creating(&COUNCILOR1, initial_balance()); - assert_ok!(_create_proposal( - Some(COUNCILOR1), None, None, None, None - )); + assert_ok!(_create_proposal(Some(COUNCILOR1), None, None, None, None)); // Check that a vote has been sent automatically, // such as the proposer is a councilor: diff --git a/src/lib.rs b/src/lib.rs index a5b546f981..b8a484e116 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -27,8 +27,6 @@ mod traits; use membership::members; mod migration; mod roles; -use roles::actors; -use rstd::prelude::*; // needed for Vec use client::{ block_builder::api::{self as block_builder_api, CheckInherentsResult, InherentData}, impl_runtime_apis, runtime_api, @@ -36,9 +34,13 @@ use client::{ #[cfg(feature = "std")] use primitives::bytes; use primitives::{ed25519, OpaqueMetadata}; +use roles::actors; +use rstd::prelude::*; // needed for Vec use runtime_primitives::{ - ApplyResult, transaction_validity::TransactionValidity, generic, create_runtime_str, - traits::{self as runtime_traits, BlakeTwo256, Block as BlockT, StaticLookup, Verify}, + create_runtime_str, generic, + traits::{self as runtime_traits, BlakeTwo256, Block as BlockT, StaticLookup, Verify}, + transaction_validity::TransactionValidity, + ApplyResult, }; #[cfg(feature = "std")] @@ -52,8 +54,8 @@ pub use consensus::Call as ConsensusCall; pub use runtime_primitives::BuildStorage; pub use runtime_primitives::{Perbill, Permill}; pub use srml_support::{construct_runtime, StorageValue}; -pub use timestamp::BlockPeriod; pub use staking::StakerStatus; +pub use timestamp::BlockPeriod; pub use timestamp::Call as TimestampCall; /// The type that is used for identifying authorities. @@ -85,25 +87,29 @@ pub type Nonce = u64; /// of data like extrinsics, allowing for them to continue syncing the network through upgrades /// to even the core datastructures. pub mod opaque { - use super::*; - - /// Opaque, encoded, unchecked extrinsic. - #[derive(PartialEq, Eq, Clone, Default, Encode, Decode)] - #[cfg_attr(feature = "std", derive(Serialize, Deserialize, Debug))] - pub struct UncheckedExtrinsic(#[cfg_attr(feature = "std", serde(with="bytes"))] pub Vec); - impl runtime_traits::Extrinsic for UncheckedExtrinsic { - fn is_signed(&self) -> Option { - None - } - } - /// Opaque block header type. - pub type Header = generic::Header>; - /// Opaque block type. - pub type Block = generic::Block; - /// Opaque block identifier type. - pub type BlockId = generic::BlockId; - /// Opaque session key type. - pub type SessionKey = AuthorityId; + use super::*; + + /// Opaque, encoded, unchecked extrinsic. + #[derive(PartialEq, Eq, Clone, Default, Encode, Decode)] + #[cfg_attr(feature = "std", derive(Serialize, Deserialize, Debug))] + pub struct UncheckedExtrinsic(#[cfg_attr(feature = "std", serde(with = "bytes"))] pub Vec); + impl runtime_traits::Extrinsic for UncheckedExtrinsic { + fn is_signed(&self) -> Option { + None + } + } + /// Opaque block header type. + pub type Header = generic::Header< + BlockNumber, + BlakeTwo256, + generic::DigestItem, + >; + /// Opaque block type. + pub type Block = generic::Block; + /// Opaque block identifier type. + pub type BlockId = generic::BlockId; + /// Opaque session key type. + pub type SessionKey = AuthorityId; } /// This runtime version. @@ -155,19 +161,19 @@ impl aura::Trait for Runtime { } impl consensus::Trait for Runtime { - /// The identifier we use to refer to authorities. - type SessionKey = AuthorityId; - // The aura module handles offline-reports internally - // rather than using an explicit report system. - type InherentOfflineReport = (); - /// The ubiquitous log type. - type Log = Log; + /// The identifier we use to refer to authorities. + type SessionKey = AuthorityId; + // The aura module handles offline-reports internally + // rather than using an explicit report system. + type InherentOfflineReport = (); + /// The ubiquitous log type. + type Log = Log; } impl session::Trait for Runtime { - type ConvertAccountIdToSessionKey = (); - type OnSessionChange = (Staking, ); - type Event = Event; + type ConvertAccountIdToSessionKey = (); + type OnSessionChange = (Staking,); + type Event = Event; } impl indices::Trait for Runtime { @@ -189,18 +195,18 @@ impl timestamp::Trait for Runtime { } impl balances::Trait for Runtime { - /// The type for recording an account's balance. - type Balance = u128; - /// What to do if an account's free balance gets zeroed. - type OnFreeBalanceZero = (Staking, Session); - /// What to do if a new account is created. - type OnNewAccount = Indices; - /// The uniquitous event type. - type Event = Event; - - type TransactionPayment = (); - type DustRemoval = (); - type TransferPayment = (); + /// The type for recording an account's balance. + type Balance = u128; + /// What to do if an account's free balance gets zeroed. + type OnFreeBalanceZero = (Staking, Session); + /// What to do if a new account is created. + type OnNewAccount = Indices; + /// The uniquitous event type. + type Event = Event; + + type TransactionPayment = (); + type DustRemoval = (); + type TransferPayment = (); } impl sudo::Trait for Runtime { @@ -210,12 +216,12 @@ impl sudo::Trait for Runtime { } impl staking::Trait for Runtime { - type Currency = balances::Module; - //type CurrencyToVote = CurrencyToVoteHandler; - type OnRewardMinted = (); - type Event = Event; - type Slash = (); - type Reward = (); + type Currency = balances::Module; + //type CurrencyToVote = CurrencyToVoteHandler; + type OnRewardMinted = (); + type Event = Event; + type Slash = (); + type Reward = (); } impl governance::GovernanceCurrency for Runtime { @@ -332,7 +338,8 @@ pub type Block = generic::Block; /// BlockId type as expected by this runtime. pub type BlockId = generic::BlockId; /// Unchecked extrinsic type as expected by this runtime. -pub type UncheckedExtrinsic = generic::UncheckedMortalCompactExtrinsic; +pub type UncheckedExtrinsic = + generic::UncheckedMortalCompactExtrinsic; /// Extrinsic type that has already been checked. pub type CheckedExtrinsic = generic::CheckedExtrinsic; /// Executive: handles dispatch to the various modules. @@ -340,61 +347,61 @@ pub type Executive = executive::Executive for Runtime { - fn version() -> RuntimeVersion { - VERSION - } - - fn authorities() -> Vec { - Consensus::authorities() - } - - fn execute_block(block: Block) { - Executive::execute_block(block) - } - - fn initialise_block(header: &::Header) { - Executive::initialise_block(header) - } - } + impl runtime_api::Core for Runtime { + fn version() -> RuntimeVersion { + VERSION + } + + fn authorities() -> Vec { + Consensus::authorities() + } + + fn execute_block(block: Block) { + Executive::execute_block(block) + } + + fn initialise_block(header: &::Header) { + Executive::initialise_block(header) + } + } - impl runtime_api::Metadata for Runtime { - fn metadata() -> OpaqueMetadata { - Runtime::metadata().into() - } - } + impl runtime_api::Metadata for Runtime { + fn metadata() -> OpaqueMetadata { + Runtime::metadata().into() + } + } - impl block_builder_api::BlockBuilder for Runtime { - fn apply_extrinsic(extrinsic: ::Extrinsic) -> ApplyResult { - Executive::apply_extrinsic(extrinsic) - } + impl block_builder_api::BlockBuilder for Runtime { + fn apply_extrinsic(extrinsic: ::Extrinsic) -> ApplyResult { + Executive::apply_extrinsic(extrinsic) + } - fn finalise_block() -> ::Header { - Executive::finalise_block() - } + fn finalise_block() -> ::Header { + Executive::finalise_block() + } - fn inherent_extrinsics(data: InherentData) -> Vec<::Extrinsic> { - data.create_extrinsics() - } + fn inherent_extrinsics(data: InherentData) -> Vec<::Extrinsic> { + data.create_extrinsics() + } - fn check_inherents(block: Block, data: InherentData) -> CheckInherentsResult { - data.check_extrinsics(&block) - } + fn check_inherents(block: Block, data: InherentData) -> CheckInherentsResult { + data.check_extrinsics(&block) + } - fn random_seed() -> ::Hash { - System::random_seed() - } - } + fn random_seed() -> ::Hash { + System::random_seed() + } + } - impl runtime_api::TaggedTransactionQueue for Runtime { - fn validate_transaction(tx: ::Extrinsic) -> TransactionValidity { - Executive::validate_transaction(tx) - } - } + impl runtime_api::TaggedTransactionQueue for Runtime { + fn validate_transaction(tx: ::Extrinsic) -> TransactionValidity { + Executive::validate_transaction(tx) + } + } - impl consensus_aura::AuraApi for Runtime { - fn slot_duration() -> u64 { - Aura::slot_duration() - } - } + impl consensus_aura::AuraApi for Runtime { + fn slot_duration() -> u64 { + Aura::slot_duration() + } + } } diff --git a/src/membership/mock.rs b/src/membership/mock.rs index 13f5543d22..bdb5e68862 100644 --- a/src/membership/mock.rs +++ b/src/membership/mock.rs @@ -1,8 +1,8 @@ #![cfg(test)] -pub use srml_support::traits::Currency; pub use super::members; pub use crate::governance::GovernanceCurrency; +pub use srml_support::traits::Currency; pub use system; pub use primitives::{Blake2Hasher, H256}; @@ -62,8 +62,8 @@ impl balances::Trait for Test { type OnNewAccount = (); type TransactionPayment = (); - type DustRemoval = (); - type TransferPayment = (); + type DustRemoval = (); + type TransferPayment = (); } impl GovernanceCurrency for Test { diff --git a/src/roles/actors.rs b/src/roles/actors.rs index 5b00f230c4..fa89c2ebf5 100644 --- a/src/roles/actors.rs +++ b/src/roles/actors.rs @@ -3,8 +3,8 @@ use crate::governance::{BalanceOf, GovernanceCurrency}; use parity_codec_derive::{Decode, Encode}; use rstd::prelude::*; -use srml_support::traits::Currency; use runtime_primitives::traits::{As, Bounded, MaybeDebug, Zero}; +use srml_support::traits::Currency; use srml_support::{ decl_event, decl_module, decl_storage, dispatch, ensure, StorageMap, StorageValue, }; diff --git a/src/roles/mock.rs b/src/roles/mock.rs index 25801a73b1..adbf753057 100644 --- a/src/roles/mock.rs +++ b/src/roles/mock.rs @@ -1,9 +1,9 @@ #![cfg(test)] pub use super::actors; -pub use srml_support::traits::{Currency}; pub use crate::governance::GovernanceCurrency; use crate::traits::Members; +pub use srml_support::traits::Currency; pub use system; pub use primitives::{Blake2Hasher, H256}; @@ -63,8 +63,8 @@ impl balances::Trait for Test { type OnNewAccount = (); type TransactionPayment = (); - type DustRemoval = (); - type TransferPayment = (); + type DustRemoval = (); + type TransferPayment = (); } impl GovernanceCurrency for Test { diff --git a/src/storage/data_directory.rs b/src/storage/data_directory.rs index 421822ddd2..c606bd9af8 100644 --- a/src/storage/data_directory.rs +++ b/src/storage/data_directory.rs @@ -6,7 +6,9 @@ use parity_codec::Codec; use parity_codec_derive::{Decode, Encode}; use primitives::ed25519::Signature as Ed25519Signature; use rstd::prelude::*; -use runtime_primitives::traits::{As, MaybeDebug, MaybeSerializeDebug, Member, SimpleArithmetic, Verify}; +use runtime_primitives::traits::{ + As, MaybeDebug, MaybeSerializeDebug, Member, SimpleArithmetic, Verify, +}; use srml_support::{ decl_event, decl_module, decl_storage, dispatch, ensure, Parameter, StorageMap, StorageValue, }; From a60d6253a7d63e25e1e59988c982b3c7179e0aa5 Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Wed, 3 Apr 2019 13:22:01 +0300 Subject: [PATCH 140/175] fix warnings: keep no_std cfg attribute only in crate root --- src/governance/council.rs | 2 -- src/governance/election.rs | 2 -- src/governance/mod.rs | 2 -- src/governance/sealed_vote.rs | 2 -- src/governance/stake.rs | 2 -- src/membership/members.rs | 2 -- src/membership/mod.rs | 2 -- src/memo.rs | 2 -- src/migration.rs | 2 -- src/roles/actors.rs | 4 +--- src/roles/mod.rs | 2 -- src/storage/content_directory.rs | 2 -- src/storage/data_directory.rs | 2 -- src/storage/data_object_storage_registry.rs | 2 -- src/storage/data_object_type_registry.rs | 2 -- src/storage/downloads.rs | 2 -- src/storage/mod.rs | 2 -- src/traits.rs | 2 -- 18 files changed, 1 insertion(+), 37 deletions(-) diff --git a/src/governance/council.rs b/src/governance/council.rs index 2d02895a21..b1c89a9387 100644 --- a/src/governance/council.rs +++ b/src/governance/council.rs @@ -1,5 +1,3 @@ -#![cfg_attr(not(feature = "std"), no_std)] - use rstd::prelude::*; use runtime_primitives::traits::{As, Zero}; use srml_support::{decl_event, decl_module, decl_storage, ensure, StorageValue}; diff --git a/src/governance/election.rs b/src/governance/election.rs index 8715ebef3e..7f926c1962 100644 --- a/src/governance/election.rs +++ b/src/governance/election.rs @@ -1,5 +1,3 @@ -#![cfg_attr(not(feature = "std"), no_std)] - use rstd::prelude::*; use srml_support::traits::Currency; use srml_support::{ diff --git a/src/governance/mod.rs b/src/governance/mod.rs index 74b553e22d..59c9acb444 100644 --- a/src/governance/mod.rs +++ b/src/governance/mod.rs @@ -1,5 +1,3 @@ -#![cfg_attr(not(feature = "std"), no_std)] - use srml_support::traits::{Currency, LockableCurrency}; use system; diff --git a/src/governance/sealed_vote.rs b/src/governance/sealed_vote.rs index ac08ff9e4e..5a018f53db 100644 --- a/src/governance/sealed_vote.rs +++ b/src/governance/sealed_vote.rs @@ -1,5 +1,3 @@ -#![cfg_attr(not(feature = "std"), no_std)] - use parity_codec::Encode; use rstd::vec::Vec; use srml_support::ensure; diff --git a/src/governance/stake.rs b/src/governance/stake.rs index 7a9c6c417d..d26bdb807e 100644 --- a/src/governance/stake.rs +++ b/src/governance/stake.rs @@ -1,5 +1,3 @@ -#![cfg_attr(not(feature = "std"), no_std)] - use rstd::cmp::Ordering; use runtime_primitives::traits::SimpleArithmetic; diff --git a/src/membership/members.rs b/src/membership/members.rs index f3f19623bc..6d32f276f0 100644 --- a/src/membership/members.rs +++ b/src/membership/members.rs @@ -1,5 +1,3 @@ -#![cfg_attr(not(feature = "std"), no_std)] - use crate::governance::{BalanceOf, GovernanceCurrency}; use crate::traits::{Members, Roles}; use parity_codec::Codec; diff --git a/src/membership/mod.rs b/src/membership/mod.rs index 4823630e62..91eca5f127 100644 --- a/src/membership/mod.rs +++ b/src/membership/mod.rs @@ -1,5 +1,3 @@ -#![cfg_attr(not(feature = "std"), no_std)] - pub mod members; mod mock; diff --git a/src/memo.rs b/src/memo.rs index 142f40a4b2..fdda6481d1 100644 --- a/src/memo.rs +++ b/src/memo.rs @@ -1,5 +1,3 @@ -#![cfg_attr(not(feature = "std"), no_std)] - use crate::governance::GovernanceCurrency; use rstd::prelude::*; use runtime_primitives::traits::Zero; diff --git a/src/migration.rs b/src/migration.rs index d234a9b443..d5d78786ce 100644 --- a/src/migration.rs +++ b/src/migration.rs @@ -1,5 +1,3 @@ -#![cfg_attr(not(feature = "std"), no_std)] - use crate::governance::BalanceOf; use crate::membership::members; use crate::roles::actors; diff --git a/src/roles/actors.rs b/src/roles/actors.rs index fa89c2ebf5..a750d284bb 100644 --- a/src/roles/actors.rs +++ b/src/roles/actors.rs @@ -1,12 +1,10 @@ -#![cfg_attr(not(feature = "std"), no_std)] - use crate::governance::{BalanceOf, GovernanceCurrency}; use parity_codec_derive::{Decode, Encode}; use rstd::prelude::*; use runtime_primitives::traits::{As, Bounded, MaybeDebug, Zero}; use srml_support::traits::Currency; use srml_support::{ - decl_event, decl_module, decl_storage, dispatch, ensure, StorageMap, StorageValue, + decl_event, decl_module, decl_storage, ensure, StorageMap, StorageValue, }; use system::{self, ensure_signed}; diff --git a/src/roles/mod.rs b/src/roles/mod.rs index 4ddb9c4f5d..5a7681c3bb 100644 --- a/src/roles/mod.rs +++ b/src/roles/mod.rs @@ -1,5 +1,3 @@ -#![cfg_attr(not(feature = "std"), no_std)] - pub mod actors; mod mock; diff --git a/src/storage/content_directory.rs b/src/storage/content_directory.rs index a66b13ee4d..755aadc8b3 100644 --- a/src/storage/content_directory.rs +++ b/src/storage/content_directory.rs @@ -1,5 +1,3 @@ -#![cfg_attr(not(feature = "std"), no_std)] - use crate::storage::data_object_type_registry::Trait as DOTRTrait; use crate::traits::Members; use parity_codec::Codec; diff --git a/src/storage/data_directory.rs b/src/storage/data_directory.rs index c606bd9af8..d5d805aeff 100644 --- a/src/storage/data_directory.rs +++ b/src/storage/data_directory.rs @@ -1,5 +1,3 @@ -#![cfg_attr(not(feature = "std"), no_std)] - use crate::storage::data_object_type_registry::Trait as DOTRTrait; use crate::traits::{ContentIdExists, IsActiveDataObjectType, Members}; use parity_codec::Codec; diff --git a/src/storage/data_object_storage_registry.rs b/src/storage/data_object_storage_registry.rs index 61b81defbd..33b70dca07 100644 --- a/src/storage/data_object_storage_registry.rs +++ b/src/storage/data_object_storage_registry.rs @@ -1,5 +1,3 @@ -#![cfg_attr(not(feature = "std"), no_std)] - use crate::storage::data_directory::Trait as DDTrait; use crate::traits::{ContentHasStorage, ContentIdExists, Members}; use parity_codec::Codec; diff --git a/src/storage/data_object_type_registry.rs b/src/storage/data_object_type_registry.rs index 9a290cfd2e..8e58a39cf6 100644 --- a/src/storage/data_object_type_registry.rs +++ b/src/storage/data_object_type_registry.rs @@ -1,5 +1,3 @@ -#![cfg_attr(not(feature = "std"), no_std)] - use crate::traits; use parity_codec::Codec; use parity_codec_derive::{Decode, Encode}; diff --git a/src/storage/downloads.rs b/src/storage/downloads.rs index 2c3770a97d..66eba1bf27 100644 --- a/src/storage/downloads.rs +++ b/src/storage/downloads.rs @@ -1,5 +1,3 @@ -#![cfg_attr(not(feature = "std"), no_std)] - /* * XXX This module is not really supposed to be used this way, and therefore also lacks tests. * diff --git a/src/storage/mod.rs b/src/storage/mod.rs index d2536f4f3e..a2b1d3e97d 100644 --- a/src/storage/mod.rs +++ b/src/storage/mod.rs @@ -1,5 +1,3 @@ -#![cfg_attr(not(feature = "std"), no_std)] - pub mod content_directory; pub mod data_directory; pub mod data_object_storage_registry; diff --git a/src/traits.rs b/src/traits.rs index 3bfea937b6..5365ebaf0b 100644 --- a/src/traits.rs +++ b/src/traits.rs @@ -1,5 +1,3 @@ -#![cfg_attr(not(feature = "std"), no_std)] - use crate::storage::{data_directory, data_object_storage_registry, data_object_type_registry}; use parity_codec::Codec; use runtime_primitives::traits::{As, MaybeSerializeDebug, Member, SimpleArithmetic}; From 66c78a46cb2a2ce513df8606ed73f5b9e7cb59c6 Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Wed, 3 Apr 2019 13:35:49 +0300 Subject: [PATCH 141/175] substrate upgrade: fix warnings in test not handling return value --- src/governance/election.rs | 36 +++++++++++++++--------------- src/governance/proposals.rs | 44 ++++++++++++++++++------------------- src/membership/tests.rs | 2 +- src/roles/actors.rs | 4 +--- src/roles/tests.rs | 4 ++-- 5 files changed, 44 insertions(+), 46 deletions(-) diff --git a/src/governance/election.rs b/src/governance/election.rs index 7f926c1962..15917b6992 100644 --- a/src/governance/election.rs +++ b/src/governance/election.rs @@ -1065,7 +1065,7 @@ mod tests { let applicant = 20 as u64; let starting_balance = 1000 as u32; - Balances::deposit_creating(&applicant, starting_balance); + let _ = Balances::deposit_creating(&applicant, starting_balance); let stake = 100 as u32; @@ -1095,7 +1095,7 @@ mod tests { ); let additional_stake = 100 as u32; - Balances::deposit_creating(&applicant, additional_stake); + let _ = Balances::deposit_creating(&applicant, additional_stake); assert!(Election::try_add_applicant(applicant, additional_stake).is_ok()); assert_eq!( @@ -1110,7 +1110,7 @@ mod tests { fn using_transferable_seat_stake_should_work() { with_externalities(&mut initial_test_ext(), || { let applicant = 20 as u64; - Balances::deposit_creating(&applicant, 5000); + let _ = Balances::deposit_creating(&applicant, 5000); >::put(vec![applicant]); save_transferable_stake( @@ -1232,10 +1232,10 @@ mod tests { #[test] fn refunding_applicant_stakes_should_work() { with_externalities(&mut initial_test_ext(), || { - Balances::deposit_creating(&1, 1000); - Balances::deposit_creating(&2, 7000); + let _ = Balances::deposit_creating(&1, 1000); + let _ = Balances::deposit_creating(&2, 7000); Balances::reserve(&2, 5000); - Balances::deposit_creating(&3, 8000); + let _ = Balances::deposit_creating(&3, 8000); Balances::reserve(&3, 5000); >::put(vec![1, 2, 3]); @@ -1310,7 +1310,7 @@ mod tests { #[test] fn voting_should_work() { with_externalities(&mut initial_test_ext(), || { - Balances::deposit_creating(&20, 1000); + let _ = Balances::deposit_creating(&20, 1000); let payload = vec![10u8]; let commitment = ::Hashing::hash(&payload[..]); @@ -1337,7 +1337,7 @@ mod tests { #[test] fn votes_can_be_covered_by_transferable_stake() { with_externalities(&mut initial_test_ext(), || { - Balances::deposit_creating(&20, 1000); + let _ = Balances::deposit_creating(&20, 1000); save_transferable_stake( 20, @@ -1369,7 +1369,7 @@ mod tests { #[test] fn voting_without_enough_balance_should_not_work() { with_externalities(&mut initial_test_ext(), || { - Balances::deposit_creating(&20, 100); + let _ = Balances::deposit_creating(&20, 100); save_transferable_stake( 20, @@ -1392,7 +1392,7 @@ mod tests { #[test] fn voting_with_existing_commitment_should_not_work() { with_externalities(&mut initial_test_ext(), || { - Balances::deposit_creating(&20, 1000); + let _ = Balances::deposit_creating(&20, 1000); save_transferable_stake( 20, @@ -1717,7 +1717,7 @@ mod tests { with_externalities(&mut initial_test_ext(), || { >::put(vec![100, 200, 300]); - Balances::deposit_creating(&100, 2000); + let _ = Balances::deposit_creating(&100, 2000); Balances::reserve(&100, 1000); >::insert( @@ -1771,11 +1771,11 @@ mod tests { fn refunding_voting_stakes_should_work() { with_externalities(&mut initial_test_ext(), || { // voters' balances - Balances::deposit_creating(&10, 6000); + let _ = Balances::deposit_creating(&10, 6000); Balances::reserve(&10, 5000); - Balances::deposit_creating(&20, 7000); + let _ = Balances::deposit_creating(&20, 7000); Balances::reserve(&20, 5000); - Balances::deposit_creating(&30, 8000); + let _ = Balances::deposit_creating(&30, 8000); Balances::reserve(&30, 5000); save_transferable_stake( @@ -1851,7 +1851,7 @@ mod tests { with_externalities(&mut initial_test_ext(), || { >::put(vec![10, 20, 30]); - Balances::deposit_creating(&10, 6000); + let _ = Balances::deposit_creating(&10, 6000); Balances::reserve(&10, 5000); save_transferable_stake( 10, @@ -1861,7 +1861,7 @@ mod tests { }, ); - Balances::deposit_creating(&20, 7000); + let _ = Balances::deposit_creating(&20, 7000); Balances::reserve(&20, 5000); save_transferable_stake( 20, @@ -1871,7 +1871,7 @@ mod tests { }, ); - Balances::deposit_creating(&30, 8000); + let _ = Balances::deposit_creating(&30, 8000); Balances::reserve(&30, 5000); save_transferable_stake( 30, @@ -1938,7 +1938,7 @@ mod tests { >::put(10); for i in 1..30 { - Balances::deposit_creating(&(i as u64), 50000); + let _ = Balances::deposit_creating(&(i as u64), 50000); } System::set_block_number(1); diff --git a/src/governance/proposals.rs b/src/governance/proposals.rs index fd48600816..d425a5e2e5 100644 --- a/src/governance/proposals.rs +++ b/src/governance/proposals.rs @@ -796,7 +796,7 @@ mod tests { #[test] fn member_create_proposal() { with_externalities(&mut new_test_ext(), || { - Balances::deposit_creating(&PROPOSER1, initial_balance()); + let _ = Balances::deposit_creating(&PROPOSER1, initial_balance()); assert_ok!(_create_default_proposal()); assert_eq!(Proposals::active_proposal_ids().len(), 1); @@ -841,7 +841,7 @@ mod tests { #[test] fn cannot_create_proposal_with_small_stake() { with_externalities(&mut new_test_ext(), || { - Balances::deposit_creating(&PROPOSER1, initial_balance()); + let _ = Balances::deposit_creating(&PROPOSER1, initial_balance()); assert_eq!( _create_proposal(None, Some(min_stake() - 1), None, None, None), @@ -857,7 +857,7 @@ mod tests { #[test] fn cannot_create_proposal_when_stake_is_greater_than_balance() { with_externalities(&mut new_test_ext(), || { - Balances::deposit_creating(&PROPOSER1, initial_balance()); + let _ = Balances::deposit_creating(&PROPOSER1, initial_balance()); assert_eq!( _create_proposal(None, Some(initial_balance() + 1), None, None, None), @@ -873,7 +873,7 @@ mod tests { #[test] fn cannot_create_proposal_with_empty_values() { with_externalities(&mut new_test_ext(), || { - Balances::deposit_creating(&PROPOSER1, initial_balance()); + let _ = Balances::deposit_creating(&PROPOSER1, initial_balance()); // Empty name: assert_eq!( @@ -898,7 +898,7 @@ mod tests { #[test] fn cannot_create_proposal_with_too_long_values() { with_externalities(&mut new_test_ext(), || { - Balances::deposit_creating(&PROPOSER1, initial_balance()); + let _ = Balances::deposit_creating(&PROPOSER1, initial_balance()); // Too long name: assert_eq!( @@ -938,7 +938,7 @@ mod tests { #[test] fn owner_cancel_proposal() { with_externalities(&mut new_test_ext(), || { - Balances::deposit_creating(&PROPOSER1, initial_balance()); + let _ = Balances::deposit_creating(&PROPOSER1, initial_balance()); assert_ok!(_create_default_proposal()); assert_ok!(Proposals::cancel_proposal(Origin::signed(PROPOSER1), 1)); @@ -959,7 +959,7 @@ mod tests { #[test] fn owner_cannot_cancel_proposal_if_its_finalized() { with_externalities(&mut new_test_ext(), || { - Balances::deposit_creating(&PROPOSER1, initial_balance()); + let _ = Balances::deposit_creating(&PROPOSER1, initial_balance()); assert_ok!(_create_default_proposal()); assert_ok!(Proposals::cancel_proposal(Origin::signed(PROPOSER1), 1)); @@ -986,8 +986,8 @@ mod tests { #[test] fn not_owner_cannot_cancel_proposal() { with_externalities(&mut new_test_ext(), || { - Balances::deposit_creating(&PROPOSER1, initial_balance()); - Balances::deposit_creating(&PROPOSER2, initial_balance()); + let _ = Balances::deposit_creating(&PROPOSER1, initial_balance()); + let _ = Balances::deposit_creating(&PROPOSER2, initial_balance()); assert_ok!(_create_default_proposal()); assert_eq!( Proposals::cancel_proposal(Origin::signed(PROPOSER2), 1), @@ -1002,7 +1002,7 @@ mod tests { #[test] fn councilor_vote_on_proposal() { with_externalities(&mut new_test_ext(), || { - Balances::deposit_creating(&PROPOSER1, initial_balance()); + let _ = Balances::deposit_creating(&PROPOSER1, initial_balance()); assert_ok!(_create_default_proposal()); @@ -1026,7 +1026,7 @@ mod tests { #[test] fn councilor_cannot_vote_on_proposal_twice() { with_externalities(&mut new_test_ext(), || { - Balances::deposit_creating(&PROPOSER1, initial_balance()); + let _ = Balances::deposit_creating(&PROPOSER1, initial_balance()); assert_ok!(_create_default_proposal()); @@ -1045,7 +1045,7 @@ mod tests { #[test] fn autovote_with_approve_when_councilor_creates_proposal() { with_externalities(&mut new_test_ext(), || { - Balances::deposit_creating(&COUNCILOR1, initial_balance()); + let _ = Balances::deposit_creating(&COUNCILOR1, initial_balance()); assert_ok!(_create_proposal(Some(COUNCILOR1), None, None, None, None)); @@ -1062,7 +1062,7 @@ mod tests { #[test] fn not_councilor_cannot_vote_on_proposal() { with_externalities(&mut new_test_ext(), || { - Balances::deposit_creating(&PROPOSER1, initial_balance()); + let _ = Balances::deposit_creating(&PROPOSER1, initial_balance()); assert_ok!(_create_default_proposal()); assert_eq!( @@ -1075,7 +1075,7 @@ mod tests { #[test] fn councilor_cannot_vote_on_proposal_if_it_has_been_cancelled() { with_externalities(&mut new_test_ext(), || { - Balances::deposit_creating(&PROPOSER1, initial_balance()); + let _ = Balances::deposit_creating(&PROPOSER1, initial_balance()); assert_ok!(_create_default_proposal()); assert_ok!(Proposals::cancel_proposal(Origin::signed(PROPOSER1), 1)); @@ -1089,7 +1089,7 @@ mod tests { #[test] fn councilor_cannot_vote_on_proposal_if_tally_has_been_finalized() { with_externalities(&mut new_test_ext(), || { - Balances::deposit_creating(&PROPOSER1, initial_balance()); + let _ = Balances::deposit_creating(&PROPOSER1, initial_balance()); assert_ok!(_create_default_proposal()); @@ -1129,7 +1129,7 @@ mod tests { #[test] fn approve_proposal_when_all_councilors_approved_it() { with_externalities(&mut new_test_ext(), || { - Balances::deposit_creating(&PROPOSER1, initial_balance()); + let _ = Balances::deposit_creating(&PROPOSER1, initial_balance()); assert_ok!(_create_default_proposal()); @@ -1183,7 +1183,7 @@ mod tests { #[test] fn approve_proposal_when_all_councilors_voted_and_only_quorum_approved() { with_externalities(&mut new_test_ext(), || { - Balances::deposit_creating(&PROPOSER1, initial_balance()); + let _ = Balances::deposit_creating(&PROPOSER1, initial_balance()); assert_ok!(_create_default_proposal()); @@ -1239,7 +1239,7 @@ mod tests { #[test] fn approve_proposal_when_voting_period_expired_if_only_quorum_voted() { with_externalities(&mut new_test_ext(), || { - Balances::deposit_creating(&PROPOSER1, initial_balance()); + let _ = Balances::deposit_creating(&PROPOSER1, initial_balance()); assert_ok!(_create_default_proposal()); @@ -1301,7 +1301,7 @@ mod tests { #[test] fn reject_proposal_when_all_councilors_voted_and_quorum_not_reached() { with_externalities(&mut new_test_ext(), || { - Balances::deposit_creating(&PROPOSER1, initial_balance()); + let _ = Balances::deposit_creating(&PROPOSER1, initial_balance()); assert_ok!(_create_default_proposal()); @@ -1360,7 +1360,7 @@ mod tests { #[test] fn reject_proposal_when_all_councilors_rejected_it() { with_externalities(&mut new_test_ext(), || { - Balances::deposit_creating(&PROPOSER1, initial_balance()); + let _ = Balances::deposit_creating(&PROPOSER1, initial_balance()); assert_ok!(_create_default_proposal()); @@ -1417,7 +1417,7 @@ mod tests { #[test] fn slash_proposal_when_all_councilors_slashed_it() { with_externalities(&mut new_test_ext(), || { - Balances::deposit_creating(&PROPOSER1, initial_balance()); + let _ = Balances::deposit_creating(&PROPOSER1, initial_balance()); assert_ok!(_create_default_proposal()); @@ -1483,7 +1483,7 @@ mod tests { #[test] fn expire_proposal_when_not_all_councilors_voted_and_quorum_not_reached() { with_externalities(&mut new_test_ext(), || { - Balances::deposit_creating(&PROPOSER1, initial_balance()); + let _ = Balances::deposit_creating(&PROPOSER1, initial_balance()); assert_ok!(_create_default_proposal()); diff --git a/src/membership/tests.rs b/src/membership/tests.rs index 4b663e7d4f..8b8796543d 100644 --- a/src/membership/tests.rs +++ b/src/membership/tests.rs @@ -51,7 +51,7 @@ fn buy_default_membership_as_alice() -> dispatch::Result { } fn set_alice_free_balance(balance: u32) { - Balances::deposit_creating(&ALICE_ACCOUNT_ID, balance); + let _ = Balances::deposit_creating(&ALICE_ACCOUNT_ID, balance); } #[test] diff --git a/src/roles/actors.rs b/src/roles/actors.rs index a750d284bb..6f13fb573a 100644 --- a/src/roles/actors.rs +++ b/src/roles/actors.rs @@ -3,9 +3,7 @@ use parity_codec_derive::{Decode, Encode}; use rstd::prelude::*; use runtime_primitives::traits::{As, Bounded, MaybeDebug, Zero}; use srml_support::traits::Currency; -use srml_support::{ - decl_event, decl_module, decl_storage, ensure, StorageMap, StorageValue, -}; +use srml_support::{decl_event, decl_module, decl_storage, ensure, StorageMap, StorageValue}; use system::{self, ensure_signed}; use crate::traits::{Members, Roles}; diff --git a/src/roles/tests.rs b/src/roles/tests.rs index 5715bb81f5..63bc576932 100644 --- a/src/roles/tests.rs +++ b/src/roles/tests.rs @@ -74,7 +74,7 @@ fn make_entry_request() { ); let surplus_balance = 100; - Balances::deposit_creating( + let _ = Balances::deposit_creating( &actor_account, storage_params.entry_request_fee + surplus_balance, ); @@ -117,7 +117,7 @@ fn staking() { >::put(vec![request]); - Balances::deposit_creating(&actor_account, storage_params.min_stake); + let _ = Balances::deposit_creating(&actor_account, storage_params.min_stake); assert!(Actors::stake( Origin::signed(MockMembers::alice_account()), From dfc35d654829ee0fe747898eb9c8ca28f85749e0 Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Wed, 3 Apr 2019 13:43:39 +0300 Subject: [PATCH 142/175] fix warning in migrations, cannot deal with error result --- src/migration.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/migration.rs b/src/migration.rs index d5d78786ce..718ebb059a 100644 --- a/src/migration.rs +++ b/src/migration.rs @@ -26,7 +26,7 @@ impl Module { >::initialize_storage(); // Initialize Storage provider role parameters - >::set_role_parameters( + let _ = >::set_role_parameters( actors::Role::Storage, actors::RoleParameters { min_stake: BalanceOf::::sa(3000), @@ -43,7 +43,7 @@ impl Module { startup_grace_period: T::BlockNumber::sa(600), }, ); - >::set_available_roles(vec![actors::Role::Storage]); + let _ = >::set_available_roles(vec![actors::Role::Storage]); // ... // add initialization of other modules introduced in this runtime From f2f349f6687a34189fdda35c70a321518d3b9c78 Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Wed, 3 Apr 2019 13:49:48 +0300 Subject: [PATCH 143/175] fix additional warnings in tests --- src/governance/election.rs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/governance/election.rs b/src/governance/election.rs index 15917b6992..3f3efe988b 100644 --- a/src/governance/election.rs +++ b/src/governance/election.rs @@ -1234,9 +1234,9 @@ mod tests { with_externalities(&mut initial_test_ext(), || { let _ = Balances::deposit_creating(&1, 1000); let _ = Balances::deposit_creating(&2, 7000); - Balances::reserve(&2, 5000); + let _ = Balances::reserve(&2, 5000); let _ = Balances::deposit_creating(&3, 8000); - Balances::reserve(&3, 5000); + let _ = Balances::reserve(&3, 5000); >::put(vec![1, 2, 3]); @@ -1718,7 +1718,7 @@ mod tests { >::put(vec![100, 200, 300]); let _ = Balances::deposit_creating(&100, 2000); - Balances::reserve(&100, 1000); + let _ = Balances::reserve(&100, 1000); >::insert( 100, @@ -1772,11 +1772,11 @@ mod tests { with_externalities(&mut initial_test_ext(), || { // voters' balances let _ = Balances::deposit_creating(&10, 6000); - Balances::reserve(&10, 5000); + let _ = Balances::reserve(&10, 5000); let _ = Balances::deposit_creating(&20, 7000); - Balances::reserve(&20, 5000); + let _ = Balances::reserve(&20, 5000); let _ = Balances::deposit_creating(&30, 8000); - Balances::reserve(&30, 5000); + let _ = Balances::reserve(&30, 5000); save_transferable_stake( 10, @@ -1852,7 +1852,7 @@ mod tests { >::put(vec![10, 20, 30]); let _ = Balances::deposit_creating(&10, 6000); - Balances::reserve(&10, 5000); + let _ = Balances::reserve(&10, 5000); save_transferable_stake( 10, TransferableStake { @@ -1862,7 +1862,7 @@ mod tests { ); let _ = Balances::deposit_creating(&20, 7000); - Balances::reserve(&20, 5000); + let _ = Balances::reserve(&20, 5000); save_transferable_stake( 20, TransferableStake { @@ -1872,7 +1872,7 @@ mod tests { ); let _ = Balances::deposit_creating(&30, 8000); - Balances::reserve(&30, 5000); + let _ = Balances::reserve(&30, 5000); save_transferable_stake( 30, TransferableStake { From f667a5beaaa12432297f7f34b903e4d881828c94 Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Wed, 3 Apr 2019 14:03:10 +0300 Subject: [PATCH 144/175] substrate upgrade: bump runtime version --- Cargo.toml | 2 +- src/lib.rs | 4 ++-- src/migration.rs | 24 +----------------------- 3 files changed, 4 insertions(+), 26 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 0274a2766b..be05a3d25f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,7 +2,7 @@ authors = ['Joystream'] edition = '2018' name = 'joystream-node-runtime' -version = '1.0.1' +version = '4.1.0' [features] default = ['std'] diff --git a/src/lib.rs b/src/lib.rs index b8a484e116..e8ee741f92 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -116,8 +116,8 @@ pub mod opaque { pub const VERSION: RuntimeVersion = RuntimeVersion { spec_name: create_runtime_str!("joystream-node"), impl_name: create_runtime_str!("joystream-node"), - authoring_version: 3, - spec_version: 5, + authoring_version: 4, + spec_version: 1, impl_version: 0, apis: RUNTIME_API_VERSIONS, }; diff --git a/src/migration.rs b/src/migration.rs index 718ebb059a..71e101ae67 100644 --- a/src/migration.rs +++ b/src/migration.rs @@ -13,7 +13,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 = 5; +const MIGRATION_FOR_SPEC_VERSION: u32 = 2; impl Module { fn runtime_initialization() { @@ -23,28 +23,6 @@ impl Module { print("running runtime initializers"); - >::initialize_storage(); - - // Initialize Storage provider role parameters - let _ = >::set_role_parameters( - actors::Role::Storage, - actors::RoleParameters { - min_stake: BalanceOf::::sa(3000), - max_actors: 10, - reward: BalanceOf::::sa(10), - reward_period: T::BlockNumber::sa(600), - unbonding_period: T::BlockNumber::sa(600), - entry_request_fee: BalanceOf::::sa(50), - - // not currently used - min_actors: 5, - bonding_period: T::BlockNumber::sa(600), - min_service_period: T::BlockNumber::sa(600), - startup_grace_period: T::BlockNumber::sa(600), - }, - ); - let _ = >::set_available_roles(vec![actors::Role::Storage]); - // ... // add initialization of other modules introduced in this runtime // ... From 64859e750ab465f4df62ac8c23d284f2c0acc053 Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Wed, 3 Apr 2019 16:23:58 +0300 Subject: [PATCH 145/175] Cargo.lock to go along with version bump --- wasm/Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wasm/Cargo.lock b/wasm/Cargo.lock index e9af8655fc..c1a70262e0 100644 --- a/wasm/Cargo.lock +++ b/wasm/Cargo.lock @@ -751,7 +751,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "joystream-node-runtime" -version = "1.0.1" +version = "4.1.0" dependencies = [ "parity-codec 3.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec-derive 3.2.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -782,7 +782,7 @@ dependencies = [ name = "joystream-node-runtime-wasm" version = "1.0.1" dependencies = [ - "joystream-node-runtime 1.0.1", + "joystream-node-runtime 4.1.0", ] [[package]] From faf234a31a5d27e3bdd3cbc0c1279c7064becb1a Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Wed, 3 Apr 2019 16:24:28 +0300 Subject: [PATCH 146/175] warnings: remove unused imports --- src/migration.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/migration.rs b/src/migration.rs index 71e101ae67..c3aea084a6 100644 --- a/src/migration.rs +++ b/src/migration.rs @@ -1,10 +1,10 @@ -use crate::governance::BalanceOf; +//use crate::governance::BalanceOf; use crate::membership::members; use crate::roles::actors; use crate::VERSION; use rstd::prelude::*; use runtime_io::print; -use runtime_primitives::traits::As; +//use runtime_primitives::traits::As; use srml_support::{decl_event, decl_module, decl_storage, StorageValue}; use system; From 3d7ff422994458421629531b9be5836857b4faae Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Wed, 3 Apr 2019 17:10:55 +0300 Subject: [PATCH 147/175] substrate upgrade: use substrate v1.0.0rc1 --- Cargo.toml | 36 +-- wasm/Cargo.lock | 732 ++++++++++++++++++++++++------------------------ 2 files changed, 389 insertions(+), 379 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index be05a3d25f..7515a5ad9d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -34,37 +34,37 @@ std = [ default_features = false git = 'https://github.com/joystream/substrate.git' package = 'srml-aura' -rev = '2ba93e317c637ffee06153e15ca7c39f6812e88a' +rev = '59d5ec144704cec017a01f3e4dbb6b73c5542bf7' [dependencies.balances] default_features = false git = 'https://github.com/joystream/substrate.git' package = 'srml-balances' -rev = '2ba93e317c637ffee06153e15ca7c39f6812e88a' +rev = '59d5ec144704cec017a01f3e4dbb6b73c5542bf7' [dependencies.consensus] default_features = false git = 'https://github.com/joystream/substrate.git' package = 'srml-consensus' -rev = '2ba93e317c637ffee06153e15ca7c39f6812e88a' +rev = '59d5ec144704cec017a01f3e4dbb6b73c5542bf7' [dependencies.consensus-aura] default_features = false git = 'https://github.com/joystream/substrate.git' package = 'substrate-consensus-aura-primitives' -rev = '2ba93e317c637ffee06153e15ca7c39f6812e88a' +rev = '59d5ec144704cec017a01f3e4dbb6b73c5542bf7' [dependencies.executive] default_features = false git = 'https://github.com/joystream/substrate.git' package = 'srml-executive' -rev = '2ba93e317c637ffee06153e15ca7c39f6812e88a' +rev = '59d5ec144704cec017a01f3e4dbb6b73c5542bf7' [dependencies.indices] default_features = false git = 'https://github.com/joystream/substrate.git' package = 'srml-indices' -rev = '2ba93e317c637ffee06153e15ca7c39f6812e88a' +rev = '59d5ec144704cec017a01f3e4dbb6b73c5542bf7' [dependencies.parity-codec] default-features = false @@ -78,25 +78,25 @@ version = '3.1' default_features = false git = 'https://github.com/joystream/substrate.git' package = 'substrate-primitives' -rev = '2ba93e317c637ffee06153e15ca7c39f6812e88a' +rev = '59d5ec144704cec017a01f3e4dbb6b73c5542bf7' [dependencies.rstd] default_features = false git = 'https://github.com/joystream/substrate.git' package = 'sr-std' -rev = '2ba93e317c637ffee06153e15ca7c39f6812e88a' +rev = '59d5ec144704cec017a01f3e4dbb6b73c5542bf7' [dependencies.runtime-io] default_features = false git = 'https://github.com/joystream/substrate.git' package = 'sr-io' -rev = '2ba93e317c637ffee06153e15ca7c39f6812e88a' +rev = '59d5ec144704cec017a01f3e4dbb6b73c5542bf7' [dependencies.runtime-primitives] default_features = false git = 'https://github.com/joystream/substrate.git' package = 'sr-primitives' -rev = '2ba93e317c637ffee06153e15ca7c39f6812e88a' +rev = '59d5ec144704cec017a01f3e4dbb6b73c5542bf7' [dependencies.safe-mix] default-features = false @@ -113,45 +113,45 @@ version = '1.0' [dependencies.srml-support] default_features = false git = 'https://github.com/joystream/substrate.git' -rev = '2ba93e317c637ffee06153e15ca7c39f6812e88a' +rev = '59d5ec144704cec017a01f3e4dbb6b73c5542bf7' [dependencies.substrate-client] default_features = false git = 'https://github.com/joystream/substrate.git' -rev = '2ba93e317c637ffee06153e15ca7c39f6812e88a' +rev = '59d5ec144704cec017a01f3e4dbb6b73c5542bf7' [dependencies.sudo] default_features = false git = 'https://github.com/joystream/substrate.git' package = 'srml-sudo' -rev = '2ba93e317c637ffee06153e15ca7c39f6812e88a' +rev = '59d5ec144704cec017a01f3e4dbb6b73c5542bf7' [dependencies.system] default_features = false git = 'https://github.com/joystream/substrate.git' package = 'srml-system' -rev = '2ba93e317c637ffee06153e15ca7c39f6812e88a' +rev = '59d5ec144704cec017a01f3e4dbb6b73c5542bf7' [dependencies.timestamp] default_features = false git = 'https://github.com/joystream/substrate.git' package = 'srml-timestamp' -rev = '2ba93e317c637ffee06153e15ca7c39f6812e88a' +rev = '59d5ec144704cec017a01f3e4dbb6b73c5542bf7' [dependencies.version] default_features = false git = 'https://github.com/joystream/substrate.git' package = 'sr-version' -rev = '2ba93e317c637ffee06153e15ca7c39f6812e88a' +rev = '59d5ec144704cec017a01f3e4dbb6b73c5542bf7' [dependencies.staking] default_features = false git = 'https://github.com/joystream/substrate.git' package = 'srml-staking' -rev = '2ba93e317c637ffee06153e15ca7c39f6812e88a' +rev = '59d5ec144704cec017a01f3e4dbb6b73c5542bf7' [dependencies.session] default_features = false git = 'https://github.com/joystream/substrate.git' package = 'srml-session' -rev = '2ba93e317c637ffee06153e15ca7c39f6812e88a' +rev = '59d5ec144704cec017a01f3e4dbb6b73c5542bf7' diff --git a/wasm/Cargo.lock b/wasm/Cargo.lock index c1a70262e0..e5c0ce4487 100644 --- a/wasm/Cargo.lock +++ b/wasm/Cargo.lock @@ -136,7 +136,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "bitmask" version = "0.5.0" -source = "git+https://github.com/paritytech/bitmask#a84e147be602631617badd18b6b9af83391db4a9" +source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "blake2" @@ -611,12 +611,12 @@ dependencies = [ [[package]] name = "hash-db" -version = "0.11.0" +version = "0.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "hash256-std-hasher" -version = "0.11.0" +version = "0.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "crunchy 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -631,6 +631,11 @@ dependencies = [ "scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "hashmap_core" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "heapsize" version = "0.4.2" @@ -758,24 +763,24 @@ dependencies = [ "safe-mix 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-io 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", - "sr-primitives 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", - "sr-std 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", - "sr-version 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", - "srml-aura 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", - "srml-balances 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", - "srml-consensus 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", - "srml-executive 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", - "srml-indices 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", - "srml-session 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", - "srml-staking 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", - "srml-sudo 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", - "srml-support 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", - "srml-system 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", - "srml-timestamp 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", - "substrate-client 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", - "substrate-consensus-aura-primitives 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", - "substrate-primitives 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "sr-io 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "sr-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "sr-std 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "sr-version 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "srml-aura 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "srml-balances 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "srml-consensus 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "srml-executive 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "srml-indices 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "srml-session 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "srml-staking 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "srml-sudo 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "srml-support 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "srml-system 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "srml-timestamp 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "substrate-client 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "substrate-consensus-aura-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "substrate-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", ] [[package]] @@ -825,30 +830,30 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "libp2p" -version = "0.5.0" -source = "git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20#e8e6ccec7409aa19939230d6720035e3ed28dfd6" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core 0.5.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)", - "libp2p-core-derive 0.5.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)", - "libp2p-dns 0.5.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)", - "libp2p-floodsub 0.5.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)", - "libp2p-identify 0.5.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)", - "libp2p-kad 0.5.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)", - "libp2p-mdns 0.5.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)", - "libp2p-mplex 0.5.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)", - "libp2p-noise 0.3.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)", - "libp2p-ping 0.5.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)", - "libp2p-plaintext 0.5.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)", - "libp2p-ratelimit 0.5.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)", - "libp2p-secio 0.5.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)", - "libp2p-tcp 0.5.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)", - "libp2p-uds 0.5.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)", - "libp2p-yamux 0.5.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)", - "parity-multiaddr 0.2.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)", - "parity-multihash 0.1.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)", + "libp2p-core 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-core-derive 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-dns 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-floodsub 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-identify 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-kad 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-mdns 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-mplex 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-noise 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-ping 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-plaintext 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-ratelimit 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-secio 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-tcp 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-uds 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-yamux 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-multiaddr 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-multihash 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", "stdweb 0.4.15 (registry+https://github.com/rust-lang/crates.io-index)", @@ -859,8 +864,8 @@ dependencies = [ [[package]] name = "libp2p-core" -version = "0.5.0" -source = "git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20#e8e6ccec7409aa19939230d6720035e3ed28dfd6" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "asn1_der 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "bs58 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -871,15 +876,15 @@ dependencies = [ "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "multistream-select 0.3.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)", - "parity-multiaddr 0.2.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)", - "parity-multihash 0.1.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)", + "multistream-select 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-multiaddr 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-multihash 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "protobuf 2.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", "ring 0.14.6 (registry+https://github.com/rust-lang/crates.io-index)", - "rw-stream-sink 0.1.1 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)", + "rw-stream-sink 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "secp256k1 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)", "sha2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", @@ -894,8 +899,8 @@ dependencies = [ [[package]] name = "libp2p-core-derive" -version = "0.5.0" -source = "git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20#e8e6ccec7409aa19939230d6720035e3ed28dfd6" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", "syn 0.15.29 (registry+https://github.com/rust-lang/crates.io-index)", @@ -903,28 +908,28 @@ dependencies = [ [[package]] name = "libp2p-dns" -version = "0.5.0" -source = "git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20#e8e6ccec7409aa19939230d6720035e3ed28dfd6" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core 0.5.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)", + "libp2p-core 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-multiaddr 0.2.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)", + "parity-multiaddr 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-dns-unofficial 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "libp2p-floodsub" -version = "0.5.0" -source = "git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20#e8e6ccec7409aa19939230d6720035e3ed28dfd6" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bs58 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", "cuckoofilter 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core 0.5.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)", + "libp2p-core 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "protobuf 2.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", @@ -935,15 +940,15 @@ dependencies = [ [[package]] name = "libp2p-identify" -version = "0.5.0" -source = "git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20#e8e6ccec7409aa19939230d6720035e3ed28dfd6" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core 0.5.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)", + "libp2p-core 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-multiaddr 0.2.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)", + "parity-multiaddr 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "protobuf 2.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", @@ -956,21 +961,22 @@ dependencies = [ [[package]] name = "libp2p-kad" -version = "0.5.0" -source = "git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20#e8e6ccec7409aa19939230d6720035e3ed28dfd6" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ + "arrayref 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", "arrayvec 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", "bigint 4.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "bs58 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core 0.5.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)", - "libp2p-identify 0.5.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)", - "libp2p-ping 0.5.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)", + "libp2p-core 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-identify 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-ping 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-multiaddr 0.2.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)", - "parity-multihash 0.1.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)", + "parity-multiaddr 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-multihash 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "protobuf 2.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", @@ -984,16 +990,16 @@ dependencies = [ [[package]] name = "libp2p-mdns" -version = "0.5.0" -source = "git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20#e8e6ccec7409aa19939230d6720035e3ed28dfd6" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "data-encoding 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "dns-parser 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core 0.5.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)", + "libp2p-core 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-multiaddr 0.2.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)", + "parity-multiaddr 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1005,13 +1011,13 @@ dependencies = [ [[package]] name = "libp2p-mplex" -version = "0.5.0" -source = "git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20#e8e6ccec7409aa19939230d6720035e3ed28dfd6" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core 0.5.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)", + "libp2p-core 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1021,13 +1027,13 @@ dependencies = [ [[package]] name = "libp2p-noise" -version = "0.3.0" -source = "git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20#e8e6ccec7409aa19939230d6720035e3ed28dfd6" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "curve25519-dalek 1.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core 0.5.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)", + "libp2p-core 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", "ring 0.14.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1039,15 +1045,15 @@ dependencies = [ [[package]] name = "libp2p-ping" -version = "0.5.0" -source = "git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20#e8e6ccec7409aa19939230d6720035e3ed28dfd6" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "arrayvec 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core 0.5.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)", + "libp2p-core 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-multiaddr 0.2.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)", + "parity-multiaddr 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1058,22 +1064,22 @@ dependencies = [ [[package]] name = "libp2p-plaintext" -version = "0.5.0" -source = "git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20#e8e6ccec7409aa19939230d6720035e3ed28dfd6" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core 0.5.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)", + "libp2p-core 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "libp2p-ratelimit" -version = "0.5.0" -source = "git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20#e8e6ccec7409aa19939230d6720035e3ed28dfd6" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "aio-limited 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core 0.5.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)", + "libp2p-core 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-executor 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1081,8 +1087,8 @@ dependencies = [ [[package]] name = "libp2p-secio" -version = "0.5.0" -source = "git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20#e8e6ccec7409aa19939230d6720035e3ed28dfd6" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "aes-ctr 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "asn1_der 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1091,12 +1097,12 @@ dependencies = [ "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", "hmac 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core 0.5.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)", + "libp2p-core 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "protobuf 2.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", "ring 0.14.6 (registry+https://github.com/rust-lang/crates.io-index)", - "rw-stream-sink 0.1.1 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)", + "rw-stream-sink 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "sha2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "stdweb 0.4.15 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1106,13 +1112,13 @@ dependencies = [ [[package]] name = "libp2p-tcp" -version = "0.5.0" -source = "git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20#e8e6ccec7409aa19939230d6720035e3ed28dfd6" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core 0.5.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)", + "libp2p-core 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-multiaddr 0.2.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)", + "parity-multiaddr 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "tk-listen 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-tcp 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1120,23 +1126,23 @@ dependencies = [ [[package]] name = "libp2p-uds" -version = "0.5.0" -source = "git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20#e8e6ccec7409aa19939230d6720035e3ed28dfd6" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core 0.5.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)", + "libp2p-core 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-multiaddr 0.2.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)", + "parity-multiaddr 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-uds 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "libp2p-yamux" -version = "0.5.0" -source = "git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20#e8e6ccec7409aa19939230d6720035e3ed28dfd6" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core 0.5.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)", + "libp2p-core 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", "yamux 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1189,10 +1195,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "memory-db" -version = "0.11.0" +version = "0.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "hash-db 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "hash-db 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)", + "hashmap_core 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1264,8 +1271,8 @@ dependencies = [ [[package]] name = "multistream-select" -version = "0.3.0" -source = "git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20#e8e6ccec7409aa19939230d6720035e3ed28dfd6" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1400,13 +1407,13 @@ dependencies = [ [[package]] name = "parity-multiaddr" version = "0.2.0" -source = "git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20#e8e6ccec7409aa19939230d6720035e3ed28dfd6" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "arrayref 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", "bs58 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "data-encoding 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-multihash 0.1.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)", + "parity-multihash 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", "unsigned-varint 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1414,7 +1421,7 @@ dependencies = [ [[package]] name = "parity-multihash" version = "0.1.0" -source = "git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20#e8e6ccec7409aa19939230d6720035e3ed28dfd6" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "blake2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1824,7 +1831,7 @@ dependencies = [ [[package]] name = "rw-stream-sink" version = "0.1.1" -source = "git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20#e8e6ccec7409aa19939230d6720035e3ed28dfd6" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2023,8 +2030,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "sr-api-macros" -version = "0.1.0" -source = "git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a#2ba93e317c637ffee06153e15ca7c39f6812e88a" +version = "1.0.0" +source = "git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7#59d5ec144704cec017a01f3e4dbb6b73c5542bf7" dependencies = [ "blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro-crate 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2035,25 +2042,25 @@ dependencies = [ [[package]] name = "sr-io" -version = "0.1.0" -source = "git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a#2ba93e317c637ffee06153e15ca7c39f6812e88a" +version = "1.0.0" +source = "git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7#59d5ec144704cec017a01f3e4dbb6b73c5542bf7" dependencies = [ "environmental 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "hash-db 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "hash-db 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)", "libsecp256k1 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-std 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", - "substrate-primitives 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", - "substrate-state-machine 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", - "substrate-trie 0.4.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "sr-std 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "substrate-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "substrate-state-machine 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "substrate-trie 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", "tiny-keccak 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "sr-primitives" -version = "0.1.0" -source = "git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a#2ba93e317c637ffee06153e15ca7c39f6812e88a" +version = "1.0.0" +source = "git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7#59d5ec144704cec017a01f3e4dbb6b73c5542bf7" dependencies = [ "integer-sqrt 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2061,230 +2068,230 @@ dependencies = [ "parity-codec 3.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-io 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", - "sr-std 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", - "substrate-primitives 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "sr-io 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "sr-std 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "substrate-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", ] [[package]] name = "sr-std" -version = "0.1.0" -source = "git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a#2ba93e317c637ffee06153e15ca7c39f6812e88a" +version = "1.0.0" +source = "git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7#59d5ec144704cec017a01f3e4dbb6b73c5542bf7" dependencies = [ "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "sr-version" -version = "0.1.0" -source = "git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a#2ba93e317c637ffee06153e15ca7c39f6812e88a" +version = "1.0.0" +source = "git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7#59d5ec144704cec017a01f3e4dbb6b73c5542bf7" dependencies = [ "impl-serde 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-primitives 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", - "sr-std 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "sr-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "sr-std 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", ] [[package]] name = "srml-aura" -version = "0.1.0" -source = "git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a#2ba93e317c637ffee06153e15ca7c39f6812e88a" +version = "1.0.0" +source = "git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7#59d5ec144704cec017a01f3e4dbb6b73c5542bf7" dependencies = [ "hex-literal 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec-derive 3.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-primitives 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", - "sr-std 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", - "srml-session 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", - "srml-staking 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", - "srml-support 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", - "srml-system 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", - "srml-timestamp 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", - "substrate-inherents 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "sr-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "sr-std 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "srml-session 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "srml-staking 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "srml-support 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "srml-system 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "srml-timestamp 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "substrate-inherents 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", ] [[package]] name = "srml-balances" -version = "0.1.0" -source = "git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a#2ba93e317c637ffee06153e15ca7c39f6812e88a" +version = "1.0.0" +source = "git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7#59d5ec144704cec017a01f3e4dbb6b73c5542bf7" dependencies = [ "hex-literal 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "safe-mix 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-primitives 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", - "sr-std 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", - "srml-support 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", - "srml-system 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", - "substrate-keyring 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "sr-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "sr-std 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "srml-support 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "srml-system 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "substrate-keyring 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", ] [[package]] name = "srml-consensus" -version = "0.1.0" -source = "git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a#2ba93e317c637ffee06153e15ca7c39f6812e88a" +version = "1.0.0" +source = "git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7#59d5ec144704cec017a01f3e4dbb6b73c5542bf7" dependencies = [ "hex-literal 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-primitives 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", - "sr-std 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", - "srml-support 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", - "srml-system 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", - "substrate-inherents 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", - "substrate-primitives 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "sr-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "sr-std 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "srml-support 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "srml-system 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "substrate-inherents 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "substrate-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", ] [[package]] name = "srml-executive" -version = "0.1.0" -source = "git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a#2ba93e317c637ffee06153e15ca7c39f6812e88a" +version = "1.0.0" +source = "git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7#59d5ec144704cec017a01f3e4dbb6b73c5542bf7" dependencies = [ "parity-codec 3.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-io 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", - "sr-primitives 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", - "sr-std 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", - "srml-support 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", - "srml-system 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "sr-io 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "sr-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "sr-std 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "srml-support 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "srml-system 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", ] [[package]] name = "srml-indices" -version = "0.1.0" -source = "git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a#2ba93e317c637ffee06153e15ca7c39f6812e88a" +version = "1.0.0" +source = "git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7#59d5ec144704cec017a01f3e4dbb6b73c5542bf7" dependencies = [ "hex-literal 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec-derive 3.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "safe-mix 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-io 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", - "sr-primitives 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", - "sr-std 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", - "srml-support 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", - "srml-system 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", - "substrate-keyring 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", - "substrate-primitives 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "sr-io 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "sr-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "sr-std 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "srml-support 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "srml-system 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "substrate-keyring 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "substrate-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", ] [[package]] name = "srml-metadata" -version = "0.1.0" -source = "git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a#2ba93e317c637ffee06153e15ca7c39f6812e88a" +version = "1.0.0" +source = "git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7#59d5ec144704cec017a01f3e4dbb6b73c5542bf7" dependencies = [ "parity-codec 3.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-std 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", - "substrate-primitives 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "sr-std 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "substrate-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", ] [[package]] name = "srml-session" -version = "0.1.0" -source = "git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a#2ba93e317c637ffee06153e15ca7c39f6812e88a" +version = "1.0.0" +source = "git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7#59d5ec144704cec017a01f3e4dbb6b73c5542bf7" dependencies = [ "hex-literal 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec-derive 3.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "safe-mix 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-primitives 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", - "sr-std 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", - "srml-consensus 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", - "srml-support 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", - "srml-system 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", - "srml-timestamp 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "sr-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "sr-std 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "srml-consensus 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "srml-support 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "srml-system 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "srml-timestamp 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", ] [[package]] name = "srml-staking" -version = "0.1.0" -source = "git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a#2ba93e317c637ffee06153e15ca7c39f6812e88a" +version = "1.0.0" +source = "git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7#59d5ec144704cec017a01f3e4dbb6b73c5542bf7" dependencies = [ "hex-literal 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "safe-mix 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-io 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", - "sr-primitives 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", - "sr-std 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", - "srml-consensus 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", - "srml-session 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", - "srml-support 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", - "srml-system 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", - "substrate-keyring 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "sr-io 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "sr-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "sr-std 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "srml-consensus 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "srml-session 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "srml-support 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "srml-system 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "substrate-keyring 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", ] [[package]] name = "srml-sudo" -version = "0.1.0" -source = "git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a#2ba93e317c637ffee06153e15ca7c39f6812e88a" +version = "1.0.0" +source = "git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7#59d5ec144704cec017a01f3e4dbb6b73c5542bf7" dependencies = [ "hex-literal 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec-derive 3.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-primitives 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", - "sr-std 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", - "srml-support 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", - "srml-support-procedural 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", - "srml-system 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "sr-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "sr-std 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "srml-support 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "srml-support-procedural 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "srml-system 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", ] [[package]] name = "srml-support" -version = "0.1.0" -source = "git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a#2ba93e317c637ffee06153e15ca7c39f6812e88a" +version = "1.0.0" +source = "git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7#59d5ec144704cec017a01f3e4dbb6b73c5542bf7" dependencies = [ - "bitmask 0.5.0 (git+https://github.com/paritytech/bitmask)", + "bitmask 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "hex-literal 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "once_cell 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "paste 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-io 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", - "sr-primitives 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", - "sr-std 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", - "srml-metadata 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", - "srml-support-procedural 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", - "substrate-inherents 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "sr-io 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "sr-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "sr-std 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "srml-metadata 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "srml-support-procedural 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "substrate-inherents 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", ] [[package]] name = "srml-support-procedural" -version = "0.1.0" -source = "git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a#2ba93e317c637ffee06153e15ca7c39f6812e88a" +version = "1.0.0" +source = "git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7#59d5ec144704cec017a01f3e4dbb6b73c5542bf7" dependencies = [ "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-api-macros 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", - "srml-support-procedural-tools 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "sr-api-macros 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "srml-support-procedural-tools 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", "syn 0.15.29 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "srml-support-procedural-tools" -version = "0.1.0" -source = "git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a#2ba93e317c637ffee06153e15ca7c39f6812e88a" +version = "1.0.0" +source = "git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7#59d5ec144704cec017a01f3e4dbb6b73c5542bf7" dependencies = [ "proc-macro-crate 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", - "srml-support-procedural-tools-derive 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "srml-support-procedural-tools-derive 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", "syn 0.15.29 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "srml-support-procedural-tools-derive" -version = "0.1.0" -source = "git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a#2ba93e317c637ffee06153e15ca7c39f6812e88a" +version = "1.0.0" +source = "git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7#59d5ec144704cec017a01f3e4dbb6b73c5542bf7" dependencies = [ "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2293,34 +2300,34 @@ dependencies = [ [[package]] name = "srml-system" -version = "0.1.0" -source = "git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a#2ba93e317c637ffee06153e15ca7c39f6812e88a" +version = "1.0.0" +source = "git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7#59d5ec144704cec017a01f3e4dbb6b73c5542bf7" dependencies = [ "hex-literal 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "safe-mix 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-io 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", - "sr-primitives 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", - "sr-std 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", - "srml-support 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", - "substrate-primitives 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "sr-io 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "sr-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "sr-std 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "srml-support 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "substrate-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", ] [[package]] name = "srml-timestamp" -version = "0.1.0" -source = "git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a#2ba93e317c637ffee06153e15ca7c39f6812e88a" +version = "1.0.0" +source = "git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7#59d5ec144704cec017a01f3e4dbb6b73c5542bf7" dependencies = [ "hex-literal 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-primitives 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", - "sr-std 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", - "srml-support 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", - "srml-system 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", - "substrate-inherents 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "sr-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "sr-std 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "srml-support 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "srml-system 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "substrate-inherents 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", ] [[package]] @@ -2419,64 +2426,65 @@ dependencies = [ [[package]] name = "substrate-client" -version = "0.1.0" -source = "git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a#2ba93e317c637ffee06153e15ca7c39f6812e88a" +version = "1.0.0" +source = "git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7#59d5ec144704cec017a01f3e4dbb6b73c5542bf7" dependencies = [ "error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", - "hash-db 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "hash-db 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "hex-literal 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "kvdb 0.1.0 (git+https://github.com/paritytech/parity-common?rev=b0317f649ab2c665b7987b8475878fc4d2e1f81d)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-api-macros 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", - "sr-primitives 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", - "sr-std 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", - "sr-version 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", - "substrate-consensus-common 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", - "substrate-executor 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", - "substrate-inherents 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", - "substrate-keyring 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", - "substrate-primitives 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", - "substrate-state-machine 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", - "substrate-telemetry 0.3.1 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", - "substrate-trie 0.4.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "sr-api-macros 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "sr-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "sr-std 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "sr-version 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "substrate-consensus-common 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "substrate-executor 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "substrate-inherents 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "substrate-keyring 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "substrate-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "substrate-state-machine 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "substrate-telemetry 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "substrate-trie 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", ] [[package]] name = "substrate-consensus-aura-primitives" -version = "0.1.0" -source = "git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a#2ba93e317c637ffee06153e15ca7c39f6812e88a" +version = "1.0.0" +source = "git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7#59d5ec144704cec017a01f3e4dbb6b73c5542bf7" dependencies = [ - "substrate-client 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "sr-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "substrate-client 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", ] [[package]] name = "substrate-consensus-common" -version = "0.1.0" -source = "git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a#2ba93e317c637ffee06153e15ca7c39f6812e88a" +version = "1.0.0" +source = "git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7#59d5ec144704cec017a01f3e4dbb6b73c5542bf7" dependencies = [ "crossbeam-channel 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p 0.5.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)", + "libp2p 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec-derive 3.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-primitives 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", - "sr-version 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", - "substrate-inherents 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", - "substrate-primitives 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "sr-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "sr-version 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "substrate-inherents 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "substrate-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", "tokio 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "substrate-executor" -version = "0.1.0" -source = "git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a#2ba93e317c637ffee06153e15ca7c39f6812e88a" +version = "1.0.0" +source = "git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7#59d5ec144704cec017a01f3e4dbb6b73c5542bf7" dependencies = [ "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2487,44 +2495,44 @@ dependencies = [ "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-io 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", - "sr-version 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", - "substrate-panic-handler 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", - "substrate-primitives 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", - "substrate-serializer 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", - "substrate-state-machine 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", - "substrate-trie 0.4.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "sr-io 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "sr-version 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "substrate-panic-handler 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "substrate-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "substrate-serializer 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "substrate-state-machine 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "substrate-trie 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", "tiny-keccak 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "wasmi 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "substrate-inherents" -version = "0.1.0" -source = "git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a#2ba93e317c637ffee06153e15ca7c39f6812e88a" +version = "1.0.0" +source = "git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7#59d5ec144704cec017a01f3e4dbb6b73c5542bf7" dependencies = [ "parity-codec 3.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-primitives 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", - "sr-std 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "sr-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "sr-std 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", ] [[package]] name = "substrate-keyring" -version = "0.1.0" -source = "git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a#2ba93e317c637ffee06153e15ca7c39f6812e88a" +version = "1.0.0" +source = "git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7#59d5ec144704cec017a01f3e4dbb6b73c5542bf7" dependencies = [ "hex-literal 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "strum 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", "strum_macros 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", - "substrate-primitives 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "substrate-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", ] [[package]] name = "substrate-panic-handler" -version = "0.1.0" -source = "git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a#2ba93e317c637ffee06153e15ca7c39f6812e88a" +version = "1.0.0" +source = "git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7#59d5ec144704cec017a01f3e4dbb6b73c5542bf7" dependencies = [ "backtrace 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2532,14 +2540,14 @@ dependencies = [ [[package]] name = "substrate-primitives" -version = "0.1.0" -source = "git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a#2ba93e317c637ffee06153e15ca7c39f6812e88a" +version = "1.0.0" +source = "git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7#59d5ec144704cec017a01f3e4dbb6b73c5542bf7" dependencies = [ "base58 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "hash-db 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", - "hash256-std-hasher 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "hash-db 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)", + "hash256-std-hasher 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)", "hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "hex-literal 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "impl-serde 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2553,7 +2561,7 @@ dependencies = [ "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", "sha2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-std 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", + "sr-std 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", "substrate-bip39 0.2.1 (git+https://github.com/paritytech/substrate-bip39)", "tiny-bip39 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "twox-hash 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2563,8 +2571,8 @@ dependencies = [ [[package]] name = "substrate-serializer" -version = "0.1.0" -source = "git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a#2ba93e317c637ffee06153e15ca7c39f6812e88a" +version = "1.0.0" +source = "git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7#59d5ec144704cec017a01f3e4dbb6b73c5542bf7" dependencies = [ "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2572,26 +2580,26 @@ dependencies = [ [[package]] name = "substrate-state-machine" -version = "0.1.0" -source = "git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a#2ba93e317c637ffee06153e15ca7c39f6812e88a" +version = "1.0.0" +source = "git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7#59d5ec144704cec017a01f3e4dbb6b73c5542bf7" dependencies = [ - "hash-db 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "hash-db 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "hex-literal 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", - "substrate-panic-handler 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", - "substrate-primitives 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", - "substrate-trie 0.4.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)", - "trie-db 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", - "trie-root 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "substrate-panic-handler 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "substrate-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "substrate-trie 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "trie-db 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)", + "trie-root 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "substrate-telemetry" -version = "0.3.1" -source = "git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a#2ba93e317c637ffee06153e15ca7c39f6812e88a" +version = "1.0.0" +source = "git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7#59d5ec144704cec017a01f3e4dbb6b73c5542bf7" dependencies = [ "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2608,14 +2616,14 @@ dependencies = [ [[package]] name = "substrate-trie" -version = "0.4.0" -source = "git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a#2ba93e317c637ffee06153e15ca7c39f6812e88a" +version = "1.0.0" +source = "git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7#59d5ec144704cec017a01f3e4dbb6b73c5542bf7" dependencies = [ - "hash-db 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", - "memory-db 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "hash-db 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)", + "memory-db 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "trie-db 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", - "trie-root 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "trie-db 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)", + "trie-root 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2904,21 +2912,22 @@ dependencies = [ [[package]] name = "trie-db" -version = "0.11.0" +version = "0.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "elastic-array 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)", - "hash-db 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "hash-db 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)", + "hashmap_core 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "trie-root" -version = "0.11.0" +version = "0.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "hash-db 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "hash-db 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -3138,7 +3147,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum base58 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5024ee8015f02155eee35c711107ddd9a9bf3cb689cf2a9089c97e79b6e1ae83" "checksum bigint 4.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ebecac13b3c745150d7b6c3ea7572d372f09d627c2077e893bf26c5c7f70d282" "checksum bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "228047a76f468627ca71776ecdebd732a3423081fcf5125585bcd7c49886ce12" -"checksum bitmask 0.5.0 (git+https://github.com/paritytech/bitmask)" = "" +"checksum bitmask 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5da9b3d9f6f585199287a473f4f8dfab6566cf827d15c00c219f53c645687ead" "checksum blake2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "91721a6330935673395a0607df4d49a9cb90ae12d259f1b3e0a3f6e1d486872e" "checksum blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)" = "5d6d530bdd2d52966a6d03b7a964add7ae1a288d25214066fd4b600f0f796400" "checksum block-buffer 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1339a1042f5d9f295737ad4d9a6ab6bf81c84a933dba110b9200cd6d1448b814" @@ -3198,9 +3207,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum futures-cpupool 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "ab90cde24b3319636588d0c35fe03b1333857621051837ed769faefb4c2162e4" "checksum generic-array 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3c0f28c2f5bfb5960175af447a2da7c18900693738343dc896ffbcabd9839592" "checksum generic-array 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)" = "fceb69994e330afed50c93524be68c42fa898c2d9fd4ee8da03bd7363acd26f2" -"checksum hash-db 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1b03501f6e1a2a97f1618879aba3156f14ca2847faa530c4e28859638bd11483" -"checksum hash256-std-hasher 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f5c13dbac3cc50684760f54af18545c9e80fb75e93a3e586d71ebdc13138f6a4" +"checksum hash-db 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)" = "ba7fb417e5c470acdd61068c79767d0e65962e70836cf6c9dfd2409f06345ce0" +"checksum hash256-std-hasher 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f8b2027c19ec91eb304999abae7307d225cf93be42af53b0039f76e98ed5af86" "checksum hashbrown 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "3bae29b6653b3412c2e71e9d486db9f9df5d701941d86683005efb9f2d28e3da" +"checksum hashmap_core 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "8e04cb7a5051270ef3fa79f8c7604d581ecfa73d520e74f554e45541c4b5881a" "checksum heapsize 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1679e6ea370dee694f91f1dc469bf94cf8f52051d147aec3e1f9497c6fc22461" "checksum heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "20564e78d53d2bb135c343b3f47714a56af2061f1c928fdb541dc7b9fdd94205" "checksum hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "805026a5d0141ffc30abb3be3173848ad46a1b1664fe632428479619a3644d77" @@ -3222,37 +3232,37 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bc5729f27f159ddd61f4df6228e827e86643d4d3e7c32183cb30a1c08f604a14" "checksum lazycell 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b294d6fa9ee409a054354afc4352b0b9ef7ca222c69b8812cbea9e7d2bf3783f" "checksum libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)" = "bedcc7a809076656486ffe045abeeac163da1b558e963a31e29fbfbeba916917" -"checksum libp2p 0.5.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)" = "" -"checksum libp2p-core 0.5.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)" = "" -"checksum libp2p-core-derive 0.5.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)" = "" -"checksum libp2p-dns 0.5.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)" = "" -"checksum libp2p-floodsub 0.5.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)" = "" -"checksum libp2p-identify 0.5.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)" = "" -"checksum libp2p-kad 0.5.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)" = "" -"checksum libp2p-mdns 0.5.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)" = "" -"checksum libp2p-mplex 0.5.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)" = "" -"checksum libp2p-noise 0.3.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)" = "" -"checksum libp2p-ping 0.5.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)" = "" -"checksum libp2p-plaintext 0.5.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)" = "" -"checksum libp2p-ratelimit 0.5.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)" = "" -"checksum libp2p-secio 0.5.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)" = "" -"checksum libp2p-tcp 0.5.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)" = "" -"checksum libp2p-uds 0.5.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)" = "" -"checksum libp2p-yamux 0.5.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)" = "" +"checksum libp2p 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f5b9cd37b1ca54fa2fd0bbf0486adf2f55f8994f2be9410b65265050b24709b2" +"checksum libp2p-core 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bf9c56e6f04cb649fdeb806e963d2da223e3ed17748d9e924fdb836c09f76307" +"checksum libp2p-core-derive 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "debea88a3d5de9fdaf7082bd6d238f2c4c6a0420f14bdf9e1c1083b3e7c69286" +"checksum libp2p-dns 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "350d0018af3668d954f61ce7311e7d64ab7c40f19a8eb895e4750efe24c3455f" +"checksum libp2p-floodsub 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bfbcf36cc58ad5d0252d8ebe9c1a87190693fe2cdbe40fb01d8046779f9a75ad" +"checksum libp2p-identify 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "82e98435973e958d7dea3f5074d7fca53d0dfce2e1ac6924119a21c2991fe443" +"checksum libp2p-kad 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "92bb0153418eaf0ea549008d1e22748a956c9c36af9374fbe7189d44607c14be" +"checksum libp2p-mdns 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "dc915d0cde68a05d26a0dcb125eddce7dd2a425e97c5172ac300c1ee8716f55a" +"checksum libp2p-mplex 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "355bb370dd12809792dc020638b280e7aaf8625318018abd311c51affd0a612d" +"checksum libp2p-noise 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e86291401f4a83f9fa81c03f8a7ccf0b03ce6aaa40cba058a7ec1026a65a6fe4" +"checksum libp2p-ping 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f3277f1f7eaadf5cdde6a76fb4afbf24e0eda6e2b04f288f526c6fa2e4293a6e" +"checksum libp2p-plaintext 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c4842a7ab54c12459b58b9e59cbeb03e3e1fd393fef48079472856f934352772" +"checksum libp2p-ratelimit 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "32ba52ee76aaa94af533526ce5a22fbfcc69a560174fccee82f4cdb557411d33" +"checksum libp2p-secio 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "00f416e1e3d0214bd7df2be2b6be8ef61771d44292b973c9e02bfbbd7f62fe46" +"checksum libp2p-tcp 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "af47af9997d69fc70aa13e6e7cd0d766614ebe74005e69e763221a64d9a0a5ef" +"checksum libp2p-uds 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bfa72d81501aad6998d3b1b964f68f438ef99c3aaf54d921e144e0477fa87568" +"checksum libp2p-yamux 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0dbb8d08cb536a964727e77b868a026c6d92993f08e387d49163565575a478d9" "checksum libsecp256k1 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "688e8d65e495567c2c35ea0001b26b9debf0b4ea11f8cccc954233b75fc3428a" "checksum lock_api 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "62ebf1391f6acad60e5c8b43706dde4582df75c06698ab44511d15016bc2442c" "checksum log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c84ec4b527950aa83a329754b01dbe3f58361d1c5efacd1f6d68c494d08a17c6" "checksum matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08" "checksum memchr 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2efc7bc57c883d4a4d6e3246905283d8dae951bb3bd32f49d6ef297f546e1c39" "checksum memoffset 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0f9dc261e2b62d7a622bf416ea3c5245cdd5d9a7fcc428c0d06804dfce1775b3" -"checksum memory-db 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "94da53143d45f6bad3753f532e56ad57a6a26c0ca6881794583310c7cb4c885f" +"checksum memory-db 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7623b01a4f1b7acb7cf8e3f678f05e15e6ae26cb0b738dfeb5cc186fd6b82ef4" "checksum memory_units 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "71d96e3f3c0b6325d8ccd83c33b28acb183edcb6c67938ba104ec546854b0882" "checksum merlin 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "83c2dda19c01176e8e7148f7bdb88bbdf215a8db0641f89fc40e4b81736aeda5" "checksum mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)" = "71646331f2619b1026cc302f87a2b8b648d5c6dd6937846a16cc8ce0f347f432" "checksum mio-extras 2.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "46e73a04c2fa6250b8d802134d56d554a9ec2922bf977777c805ea5def61ce40" "checksum mio-uds 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)" = "966257a94e196b11bb43aca423754d87429960a768de9414f3691d6957abf125" "checksum miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f2f3b1cf331de6896aabf6e9d55dca90356cc9960cca7eaaf408a355ae919" -"checksum multistream-select 0.3.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)" = "" +"checksum multistream-select 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f989d40aab0ed0d83c1cdb4856b5790e980b96548d1a921f280e985eb049f38d" "checksum net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)" = "42550d9fb7b6684a6d404d9fa7250c2eb2646df731d1c06afc06dcee9e1bcf88" "checksum nodrop 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "2f9667ddcc6cc8a43afc9b7917599d7216aa09c463919ea32c59ed6cac8bc945" "checksum nohash-hasher 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0d138afcce92d219ccb6eb53d9b1e8a96ac0d633cfd3c53cd9856d96d1741bb8" @@ -3268,8 +3278,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum parity-bytes 0.1.0 (git+https://github.com/paritytech/parity-common?rev=b0317f649ab2c665b7987b8475878fc4d2e1f81d)" = "" "checksum parity-codec 3.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0333b2a2973e75c3b4a9bc2a7b28dceacb56e3949907b4ce113ff3a53bcc6713" "checksum parity-codec-derive 3.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "be90eb3f1b4c02a478ccee3e0e64e5152692e7871c7258d2aa8e356359325aa7" -"checksum parity-multiaddr 0.2.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)" = "" -"checksum parity-multihash 0.1.0 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)" = "" +"checksum parity-multiaddr 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "61ae6944d4435d41f4d0f12108c5cbb9207cbb14bc8f2b4984c6e930dc9c8e41" +"checksum parity-multihash 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3e8eab0287ccde7821e337a124dc5a4f1d6e4c25d10cc91e3f9361615dd95076" "checksum parity-wasm 0.31.3 (registry+https://github.com/rust-lang/crates.io-index)" = "511379a8194230c2395d2f5fa627a5a7e108a9f976656ce723ae68fca4097bfc" "checksum parking_lot 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)" = "d4d05f1349491390b1730afba60bb20d55761bef489a954546b58b4b34e1e2ac" "checksum parking_lot 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "f0802bff09003b291ba756dc7e79313e51cc31667e94afbe847def490424cde5" @@ -3315,7 +3325,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum rustc-demangle 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "adacaae16d02b6ec37fdc7acfcddf365978de76d1983d3ee22afc260e1ca9619" "checksum rustc-hex 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "403bb3a286107a04825a5f82e1270acc1e14028d3d554d7a1e08914549575ab8" "checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" -"checksum rw-stream-sink 0.1.1 (git+https://github.com/tomaka/libp2p-rs?branch=substrate-tmp-2019-03-20)" = "" +"checksum rw-stream-sink 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d548a40fe17c3a77d54b82457b79fcc9b8a288d509ca20fbf5aa1dac386d22d6" "checksum ryu 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "eb9e9b8cde282a9fe6a42dd4681319bfb63f121b8a8ee9439c6f4107e58a46f7" "checksum safe-mix 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7f7bf422d23a88c16d5090d455f182bc99c60af4df6a345c63428acf5129e347" "checksum schnorrkel 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b5eff518f9bed3d803a0d002af0ab96339b0ebbedde3bec98a684986134b7a39" @@ -3338,26 +3348,26 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)" = "c4488ae950c49d403731982257768f48fada354a5203fe81f9bb6f43ca9002be" "checksum snow 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "5a64f02fd208ef15bd2d1a65861df4707e416151e1272d02c8faafad1c138100" "checksum spin 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "44363f6f51401c34e7be73db0db371c04705d35efbe9f7d6082e03a921a32c55" -"checksum sr-api-macros 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)" = "" -"checksum sr-io 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)" = "" -"checksum sr-primitives 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)" = "" -"checksum sr-std 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)" = "" -"checksum sr-version 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)" = "" -"checksum srml-aura 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)" = "" -"checksum srml-balances 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)" = "" -"checksum srml-consensus 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)" = "" -"checksum srml-executive 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)" = "" -"checksum srml-indices 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)" = "" -"checksum srml-metadata 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)" = "" -"checksum srml-session 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)" = "" -"checksum srml-staking 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)" = "" -"checksum srml-sudo 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)" = "" -"checksum srml-support 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)" = "" -"checksum srml-support-procedural 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)" = "" -"checksum srml-support-procedural-tools 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)" = "" -"checksum srml-support-procedural-tools-derive 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)" = "" -"checksum srml-system 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)" = "" -"checksum srml-timestamp 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)" = "" +"checksum sr-api-macros 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)" = "" +"checksum sr-io 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)" = "" +"checksum sr-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)" = "" +"checksum sr-std 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)" = "" +"checksum sr-version 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)" = "" +"checksum srml-aura 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)" = "" +"checksum srml-balances 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)" = "" +"checksum srml-consensus 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)" = "" +"checksum srml-executive 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)" = "" +"checksum srml-indices 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)" = "" +"checksum srml-metadata 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)" = "" +"checksum srml-session 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)" = "" +"checksum srml-staking 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)" = "" +"checksum srml-sudo 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)" = "" +"checksum srml-support 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)" = "" +"checksum srml-support-procedural 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)" = "" +"checksum srml-support-procedural-tools 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)" = "" +"checksum srml-support-procedural-tools-derive 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)" = "" +"checksum srml-system 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)" = "" +"checksum srml-timestamp 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)" = "" "checksum stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dba1a27d3efae4351c8051072d619e3ade2820635c3958d826bfea39d59b54c8" "checksum static_assertions 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "c19be23126415861cb3a23e501d34a708f7f9b2183c5252d690941c2e69199d5" "checksum static_slice 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "92a7e0c5e3dfb52e8fbe0e63a1b947bbb17b4036408b151353c4491374931362" @@ -3369,18 +3379,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum strum 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1810e25f576e7ffce1ff5243b37066da5ded0310b3274c20baaeccb1145b2806" "checksum strum_macros 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)" = "572a2f4e53dd4c3483fd79e5cc10ddd773a3acb1169bbfe8762365e107110579" "checksum substrate-bip39 0.2.1 (git+https://github.com/paritytech/substrate-bip39)" = "" -"checksum substrate-client 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)" = "" -"checksum substrate-consensus-aura-primitives 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)" = "" -"checksum substrate-consensus-common 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)" = "" -"checksum substrate-executor 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)" = "" -"checksum substrate-inherents 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)" = "" -"checksum substrate-keyring 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)" = "" -"checksum substrate-panic-handler 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)" = "" -"checksum substrate-primitives 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)" = "" -"checksum substrate-serializer 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)" = "" -"checksum substrate-state-machine 0.1.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)" = "" -"checksum substrate-telemetry 0.3.1 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)" = "" -"checksum substrate-trie 0.4.0 (git+https://github.com/joystream/substrate.git?rev=2ba93e317c637ffee06153e15ca7c39f6812e88a)" = "" +"checksum substrate-client 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)" = "" +"checksum substrate-consensus-aura-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)" = "" +"checksum substrate-consensus-common 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)" = "" +"checksum substrate-executor 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)" = "" +"checksum substrate-inherents 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)" = "" +"checksum substrate-keyring 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)" = "" +"checksum substrate-panic-handler 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)" = "" +"checksum substrate-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)" = "" +"checksum substrate-serializer 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)" = "" +"checksum substrate-state-machine 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)" = "" +"checksum substrate-telemetry 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)" = "" +"checksum substrate-trie 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)" = "" "checksum subtle 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2d67a5a62ba6e01cb2192ff309324cb4875d0c451d55fe2319433abe7a05a8ee" "checksum subtle 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "702662512f3ddeb74a64ce2fbbf3707ee1b6bb663d28bb054e0779bbc720d926" "checksum syn 0.15.29 (registry+https://github.com/rust-lang/crates.io-index)" = "1825685f977249735d510a242a6727b46efe914bb67e38d30c071b1b72b1d5c2" @@ -3407,8 +3417,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum tokio-udp 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "66268575b80f4a4a710ef83d087fdfeeabdce9b74c797535fbac18a2cb906e92" "checksum tokio-uds 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "037ffc3ba0e12a0ab4aca92e5234e0dedeb48fddf6ccd260f1f150a36a9f2445" "checksum toml 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)" = "758664fc71a3a69038656bee8b6be6477d2a6c315a6b81f7081f591bffa4111f" -"checksum trie-db 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3c7319e28ca295f27359d944a682f7f65b419158bf1590c92cadc0000258d788" -"checksum trie-root 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e3c6fef2705af3258ec46a7e22286090394a44216201a1cf7d04b78db825e543" +"checksum trie-db 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1ba73747fd3a64ab531274c04cb588dfa9d30d972d62990831e63fbce2cfec59" +"checksum trie-root 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)" = "cfa2e20c4f1418ac2e71ddc418e35e1b56e34022e2146209ffdbf1b2de8b1bd9" "checksum twofish 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712d261e83e727c8e2dbb75dacac67c36e35db36a958ee504f2164fc052434e1" "checksum twox-hash 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "555cd4909480122bbbf21e34faac4cb08a171f324775670447ed116726c474af" "checksum typenum 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "612d636f949607bdf9b123b4a6f6d966dedf3ff669f7f045890d3a4a73948169" From 044a9e527671fe9409c92b07c3be3143e5c04588 Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Wed, 3 Apr 2019 17:11:29 +0300 Subject: [PATCH 148/175] substrate upgrade: fix english spelling of methods in impl_runtime_apis! --- src/lib.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index e8ee741f92..3c72799585 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -38,7 +38,7 @@ use roles::actors; use rstd::prelude::*; // needed for Vec use runtime_primitives::{ create_runtime_str, generic, - traits::{self as runtime_traits, BlakeTwo256, Block as BlockT, StaticLookup, Verify}, + traits::{self as runtime_traits, BlakeTwo256, Block as BlockT, StaticLookup, Verify, CurrencyToVoteHandler}, transaction_validity::TransactionValidity, ApplyResult, }; @@ -217,7 +217,7 @@ impl sudo::Trait for Runtime { impl staking::Trait for Runtime { type Currency = balances::Module; - //type CurrencyToVote = CurrencyToVoteHandler; + type CurrencyToVote = CurrencyToVoteHandler; type OnRewardMinted = (); type Event = Event; type Slash = (); @@ -360,8 +360,8 @@ impl_runtime_apis! { Executive::execute_block(block) } - fn initialise_block(header: &::Header) { - Executive::initialise_block(header) + fn initialize_block(header: &::Header) { + Executive::initialize_block(header) } } @@ -376,8 +376,8 @@ impl_runtime_apis! { Executive::apply_extrinsic(extrinsic) } - fn finalise_block() -> ::Header { - Executive::finalise_block() + fn finalize_block() -> ::Header { + Executive::finalize_block() } fn inherent_extrinsics(data: InherentData) -> Vec<::Extrinsic> { From 9ecf2f470bdce760845d84748d87926f225fbdd0 Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Wed, 3 Apr 2019 17:26:21 +0300 Subject: [PATCH 149/175] substrate upgrade: use ReservableCurrency trait --- src/governance/election.rs | 2 +- src/governance/mod.rs | 3 ++- src/governance/proposals.rs | 2 +- src/lib.rs | 5 ++++- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/governance/election.rs b/src/governance/election.rs index 3f3efe988b..f60683eff4 100644 --- a/src/governance/election.rs +++ b/src/governance/election.rs @@ -1,5 +1,5 @@ use rstd::prelude::*; -use srml_support::traits::Currency; +use srml_support::traits::{Currency, ReservableCurrency}; use srml_support::{ decl_event, decl_module, decl_storage, dispatch::Result, ensure, StorageMap, StorageValue, }; diff --git a/src/governance/mod.rs b/src/governance/mod.rs index 59c9acb444..9f63204781 100644 --- a/src/governance/mod.rs +++ b/src/governance/mod.rs @@ -1,4 +1,4 @@ -use srml_support::traits::{Currency, LockableCurrency}; +use srml_support::traits::{Currency, LockableCurrency, ReservableCurrency}; use system; pub mod council; @@ -10,6 +10,7 @@ mod stake; pub trait GovernanceCurrency: system::Trait + Sized { type Currency: Currency + + ReservableCurrency + LockableCurrency; } diff --git a/src/governance/proposals.rs b/src/governance/proposals.rs index d425a5e2e5..e7d4222abc 100644 --- a/src/governance/proposals.rs +++ b/src/governance/proposals.rs @@ -1,7 +1,7 @@ use rstd::prelude::*; use runtime_io::print; use runtime_primitives::traits::{As, Hash, Zero}; -use srml_support::traits::Currency; +use srml_support::traits::{Currency, ReservableCurrency}; use srml_support::{ decl_event, decl_module, decl_storage, dispatch, ensure, StorageMap, StorageValue, }; diff --git a/src/lib.rs b/src/lib.rs index 3c72799585..d80d8a5d96 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -38,7 +38,10 @@ use roles::actors; use rstd::prelude::*; // needed for Vec use runtime_primitives::{ create_runtime_str, generic, - traits::{self as runtime_traits, BlakeTwo256, Block as BlockT, StaticLookup, Verify, CurrencyToVoteHandler}, + traits::{ + self as runtime_traits, BlakeTwo256, Block as BlockT, CurrencyToVoteHandler, StaticLookup, + Verify, + }, transaction_validity::TransactionValidity, ApplyResult, }; From 62b9d21cada168c33e1ce73ae26b747699861064 Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Wed, 3 Apr 2019 17:36:57 +0300 Subject: [PATCH 150/175] substrate upgrade: fix timestamp api --- src/governance/proposals.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/governance/proposals.rs b/src/governance/proposals.rs index e7d4222abc..43d4ec9b2e 100644 --- a/src/governance/proposals.rs +++ b/src/governance/proposals.rs @@ -184,7 +184,7 @@ decl_storage! { /// Max duration of proposal in blocks until it will be expired if not enough votes. VotingPeriod get(voting_period) config(): T::BlockNumber = T::BlockNumber::sa(DEFAULT_VOTING_PERIOD_IN_SECS / - >::block_period().as_()); + (>::minimum_period().as_() * 2)); NameMaxLen get(name_max_len) config(): u32 = DEFAULT_NAME_MAX_LEN; DescriptionMaxLen get(description_max_len) config(): u32 = DEFAULT_DESCRIPTION_MAX_LEN; From ef428bea01f02800903ff0aa615d10571b3e2584 Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Wed, 3 Apr 2019 17:42:40 +0300 Subject: [PATCH 151/175] substrate upgrade: fix tests --- src/governance/mock.rs | 2 +- src/governance/proposals.rs | 2 +- src/membership/mock.rs | 2 +- src/roles/mock.rs | 2 +- src/storage/mock.rs | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/governance/mock.rs b/src/governance/mock.rs index 8010f371fb..bdbb7863ff 100644 --- a/src/governance/mock.rs +++ b/src/governance/mock.rs @@ -7,7 +7,7 @@ pub use system; pub use primitives::{Blake2Hasher, H256}; pub use runtime_primitives::{ testing::{Digest, DigestItem, Header, UintAuthorityId}, - traits::{BlakeTwo256, IdentityLookup, OnFinalise}, + traits::{BlakeTwo256, IdentityLookup, OnFinalize}, BuildStorage, }; diff --git a/src/governance/proposals.rs b/src/governance/proposals.rs index 43d4ec9b2e..cde59c1776 100644 --- a/src/governance/proposals.rs +++ b/src/governance/proposals.rs @@ -558,7 +558,7 @@ mod tests { // or public keys. `u64` is used as the `AccountId` and no `Signature`s are requried. use runtime_primitives::{ testing::{Digest, DigestItem, Header, UintAuthorityId}, - traits::{BlakeTwo256, IdentityLookup, OnFinalise}, + traits::{BlakeTwo256, IdentityLookup, OnFinalize}, BuildStorage, }; use srml_support::*; diff --git a/src/membership/mock.rs b/src/membership/mock.rs index bdb5e68862..7cacab22d5 100644 --- a/src/membership/mock.rs +++ b/src/membership/mock.rs @@ -8,7 +8,7 @@ pub use system; pub use primitives::{Blake2Hasher, H256}; pub use runtime_primitives::{ testing::{Digest, DigestItem, Header, UintAuthorityId}, - traits::{BlakeTwo256, IdentityLookup, OnFinalise}, + traits::{BlakeTwo256, IdentityLookup, OnFinalize}, BuildStorage, }; diff --git a/src/roles/mock.rs b/src/roles/mock.rs index adbf753057..3cbabef330 100644 --- a/src/roles/mock.rs +++ b/src/roles/mock.rs @@ -9,7 +9,7 @@ pub use system; pub use primitives::{Blake2Hasher, H256}; pub use runtime_primitives::{ testing::{Digest, DigestItem, Header, UintAuthorityId}, - traits::{BlakeTwo256, IdentityLookup, OnFinalise}, + traits::{BlakeTwo256, IdentityLookup, OnFinalize}, BuildStorage, }; diff --git a/src/storage/mock.rs b/src/storage/mock.rs index ffb95ab550..b8943c69f7 100644 --- a/src/storage/mock.rs +++ b/src/storage/mock.rs @@ -10,7 +10,7 @@ pub use system; pub use primitives::{Blake2Hasher, H256}; pub use runtime_primitives::{ testing::{Digest, DigestItem, Header, UintAuthorityId}, - traits::{BlakeTwo256, IdentityLookup, OnFinalise}, + traits::{BlakeTwo256, IdentityLookup, OnFinalize}, BuildStorage, }; From 5ce1912b6e96cda818bfbc2f67df114d422ea8d6 Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Wed, 3 Apr 2019 17:51:02 +0300 Subject: [PATCH 152/175] substrate upgrade: fix warnings about unused result values in tests --- src/governance/election.rs | 6 +++--- src/governance/proposals.rs | 20 ++++++++++---------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/governance/election.rs b/src/governance/election.rs index f60683eff4..328ed3353c 100644 --- a/src/governance/election.rs +++ b/src/governance/election.rs @@ -1955,7 +1955,7 @@ mod tests { let n = 1 + Election::announcing_period(); System::set_block_number(n); - Election::on_finalise(n); + let _ = Election::on_finalise(n); for i in 1..20 { assert!(Election::vote( @@ -1982,7 +1982,7 @@ mod tests { let n = n + Election::voting_period(); System::set_block_number(n); - Election::on_finalise(n); + let _ = Election::on_finalise(n); for i in 1..20 { assert!(Election::reveal( @@ -2012,7 +2012,7 @@ mod tests { let n = n + Election::revealing_period(); System::set_block_number(n); - Election::on_finalise(n); + let _ = Election::on_finalise(n); assert_eq!( Council::active_council().len(), diff --git a/src/governance/proposals.rs b/src/governance/proposals.rs index cde59c1776..a6151fa40d 100644 --- a/src/governance/proposals.rs +++ b/src/governance/proposals.rs @@ -558,7 +558,7 @@ mod tests { // or public keys. `u64` is used as the `AccountId` and no `Signature`s are requried. use runtime_primitives::{ testing::{Digest, DigestItem, Header, UintAuthorityId}, - traits::{BlakeTwo256, IdentityLookup, OnFinalize}, + traits::{BlakeTwo256, IdentityLookup}, BuildStorage, }; use srml_support::*; @@ -1110,7 +1110,7 @@ mod tests { assert_eq!(Proposals::votes_by_proposal(1), expected_votes); System::set_block_number(2); - Proposals::on_finalise(2); + let _ = Proposals::on_finalise(2); assert!(Proposals::active_proposal_ids().is_empty()); assert_eq!(Proposals::proposals(1).status, Approved); @@ -1152,7 +1152,7 @@ mod tests { assert_runtime_code_empty!(); System::set_block_number(2); - Proposals::on_finalise(2); + let _ = Proposals::on_finalise(2); // Check that runtime code has been updated after proposal approved. assert_runtime_code!(wasm_code()); @@ -1208,7 +1208,7 @@ mod tests { assert_runtime_code_empty!(); System::set_block_number(2); - Proposals::on_finalise(2); + let _ = Proposals::on_finalise(2); // Check that runtime code has been updated after proposal approved. assert_runtime_code!(wasm_code()); @@ -1263,14 +1263,14 @@ mod tests { let expiration_block = System::block_number() + Proposals::voting_period(); System::set_block_number(2); - Proposals::on_finalise(2); + let _ = Proposals::on_finalise(2); // Check that runtime code has NOT been updated yet, // because not all councilors voted and voting period is not expired yet. assert_runtime_code_empty!(); System::set_block_number(expiration_block); - Proposals::on_finalise(expiration_block); + let _ = Proposals::on_finalise(expiration_block); // Check that runtime code has been updated after proposal approved. assert_runtime_code!(wasm_code()); @@ -1326,7 +1326,7 @@ mod tests { assert_runtime_code_empty!(); System::set_block_number(2); - Proposals::on_finalise(2); + let _ = Proposals::on_finalise(2); // Check that runtime code has NOT been updated after proposal slashed. assert_runtime_code_empty!(); @@ -1383,7 +1383,7 @@ mod tests { assert_runtime_code_empty!(); System::set_block_number(2); - Proposals::on_finalise(2); + let _ = Proposals::on_finalise(2); // Check that runtime code has NOT been updated after proposal rejected. assert_runtime_code_empty!(); @@ -1440,7 +1440,7 @@ mod tests { assert_runtime_code_empty!(); System::set_block_number(2); - Proposals::on_finalise(2); + let _ = Proposals::on_finalise(2); // Check that runtime code has NOT been updated after proposal slashed. assert_runtime_code_empty!(); @@ -1507,7 +1507,7 @@ mod tests { let expiration_block = System::block_number() + Proposals::voting_period(); System::set_block_number(expiration_block); - Proposals::on_finalise(expiration_block); + let _ = Proposals::on_finalise(expiration_block); // Check that runtime code has NOT been updated after proposal slashed. assert_runtime_code_empty!(); From 147b06d7c4d8c8d0b70ee08aa32b30ad4a393b92 Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Wed, 3 Apr 2019 18:43:38 +0300 Subject: [PATCH 153/175] substrate upgrade: update impl_runtime_apis! --- Cargo.toml | 16 +++++++ src/lib.rs | 110 +++++++++++++++++++++++++++--------------------- wasm/Cargo.lock | 28 ++++++++++++ 3 files changed, 105 insertions(+), 49 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 7515a5ad9d..ddec8e23eb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -29,6 +29,8 @@ std = [ 'consensus-aura/std', 'staking/std', 'session/std', + 'offchain-primitives/std', + 'consensus-authorities/std', ] [dependencies.aura] default_features = false @@ -155,3 +157,17 @@ default_features = false git = 'https://github.com/joystream/substrate.git' package = 'srml-session' rev = '59d5ec144704cec017a01f3e4dbb6b73c5542bf7' + +[dependencies.offchain-primitives] +default_features = false +git = 'https://github.com/joystream/substrate.git' +package = 'substrate-offchain-primitives' +rev = '59d5ec144704cec017a01f3e4dbb6b73c5542bf7' + +[dependencies.consensus-authorities] +default_features = false +git = 'https://github.com/joystream/substrate.git' +package = 'substrate-consensus-authorities' +rev = '59d5ec144704cec017a01f3e4dbb6b73c5542bf7' + + diff --git a/src/lib.rs b/src/lib.rs index d80d8a5d96..de608d65b4 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -29,7 +29,7 @@ mod migration; mod roles; use client::{ block_builder::api::{self as block_builder_api, CheckInherentsResult, InherentData}, - impl_runtime_apis, runtime_api, + impl_runtime_apis, runtime_api as client_api }; #[cfg(feature = "std")] use primitives::bytes; @@ -40,7 +40,7 @@ use runtime_primitives::{ create_runtime_str, generic, traits::{ self as runtime_traits, BlakeTwo256, Block as BlockT, CurrencyToVoteHandler, StaticLookup, - Verify, + Verify, NumberFor, AuthorityIdFor }, transaction_validity::TransactionValidity, ApplyResult, @@ -350,61 +350,73 @@ pub type Executive = executive::Executive for Runtime { - fn version() -> RuntimeVersion { - VERSION - } + impl client_api::Core for Runtime { + fn version() -> RuntimeVersion { + VERSION + } + + fn execute_block(block: Block) { + Executive::execute_block(block) + } + + fn initialize_block(header: &::Header) { + Executive::initialize_block(header) + } + + fn authorities() -> Vec> { + panic!("Deprecated, please use `AuthoritiesApi`.") + } + } - fn authorities() -> Vec { - Consensus::authorities() - } + impl client_api::Metadata for Runtime { + fn metadata() -> OpaqueMetadata { + Runtime::metadata().into() + } + } - fn execute_block(block: Block) { - Executive::execute_block(block) - } + impl block_builder_api::BlockBuilder for Runtime { + fn apply_extrinsic(extrinsic: ::Extrinsic) -> ApplyResult { + Executive::apply_extrinsic(extrinsic) + } - fn initialize_block(header: &::Header) { - Executive::initialize_block(header) - } - } + fn finalize_block() -> ::Header { + Executive::finalize_block() + } - impl runtime_api::Metadata for Runtime { - fn metadata() -> OpaqueMetadata { - Runtime::metadata().into() - } - } - - impl block_builder_api::BlockBuilder for Runtime { - fn apply_extrinsic(extrinsic: ::Extrinsic) -> ApplyResult { - Executive::apply_extrinsic(extrinsic) - } + fn inherent_extrinsics(data: InherentData) -> Vec<::Extrinsic> { + data.create_extrinsics() + } - fn finalize_block() -> ::Header { - Executive::finalize_block() - } + fn check_inherents(block: Block, data: InherentData) -> CheckInherentsResult { + data.check_extrinsics(&block) + } - fn inherent_extrinsics(data: InherentData) -> Vec<::Extrinsic> { - data.create_extrinsics() - } + fn random_seed() -> ::Hash { + System::random_seed() + } + } - fn check_inherents(block: Block, data: InherentData) -> CheckInherentsResult { - data.check_extrinsics(&block) - } + impl client_api::TaggedTransactionQueue for Runtime { + fn validate_transaction(tx: ::Extrinsic) -> TransactionValidity { + Executive::validate_transaction(tx) + } + } - fn random_seed() -> ::Hash { - System::random_seed() - } - } + impl offchain_primitives::OffchainWorkerApi for Runtime { + fn offchain_worker(number: NumberFor) { + Executive::offchain_worker(number) + } + } - impl runtime_api::TaggedTransactionQueue for Runtime { - fn validate_transaction(tx: ::Extrinsic) -> TransactionValidity { - Executive::validate_transaction(tx) - } - } + impl consensus_aura::AuraApi for Runtime { + fn slot_duration() -> u64 { + Aura::slot_duration() + } + } - impl consensus_aura::AuraApi for Runtime { - fn slot_duration() -> u64 { - Aura::slot_duration() - } - } + impl consensus_authorities::AuthoritiesApi for Runtime { + fn authorities() -> Vec> { + Consensus::authorities() + } + } } diff --git a/wasm/Cargo.lock b/wasm/Cargo.lock index e5c0ce4487..71cebedef0 100644 --- a/wasm/Cargo.lock +++ b/wasm/Cargo.lock @@ -780,6 +780,8 @@ dependencies = [ "srml-timestamp 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", "substrate-client 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", "substrate-consensus-aura-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "substrate-consensus-authorities 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "substrate-offchain-primitives 0.1.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", "substrate-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", ] @@ -2462,6 +2464,21 @@ dependencies = [ "substrate-client 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", ] +[[package]] +name = "substrate-consensus-authorities" +version = "1.0.0" +source = "git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7#59d5ec144704cec017a01f3e4dbb6b73c5542bf7" +dependencies = [ + "parity-codec 3.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sr-io 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "sr-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "sr-std 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "sr-version 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "srml-support 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "substrate-client 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "substrate-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", +] + [[package]] name = "substrate-consensus-common" version = "1.0.0" @@ -2529,6 +2546,15 @@ dependencies = [ "substrate-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", ] +[[package]] +name = "substrate-offchain-primitives" +version = "0.1.0" +source = "git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7#59d5ec144704cec017a01f3e4dbb6b73c5542bf7" +dependencies = [ + "sr-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "substrate-client 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", +] + [[package]] name = "substrate-panic-handler" version = "1.0.0" @@ -3381,10 +3407,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum substrate-bip39 0.2.1 (git+https://github.com/paritytech/substrate-bip39)" = "" "checksum substrate-client 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)" = "" "checksum substrate-consensus-aura-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)" = "" +"checksum substrate-consensus-authorities 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)" = "" "checksum substrate-consensus-common 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)" = "" "checksum substrate-executor 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)" = "" "checksum substrate-inherents 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)" = "" "checksum substrate-keyring 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)" = "" +"checksum substrate-offchain-primitives 0.1.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)" = "" "checksum substrate-panic-handler 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)" = "" "checksum substrate-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)" = "" "checksum substrate-serializer 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)" = "" From 1d75e1a0ccaccfd73a00d93a94ff4f233b88c103 Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Thu, 4 Apr 2019 00:27:16 +0300 Subject: [PATCH 154/175] substrate upgrade: enable GRANDPA --- Cargo.toml | 12 ++++ src/lib.rs | 171 ++++++++++++++++++++++++++++++------------------ wasm/Cargo.lock | 52 +++++++++++++++ 3 files changed, 173 insertions(+), 62 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index ddec8e23eb..2f1021ec9b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -31,6 +31,8 @@ std = [ 'session/std', 'offchain-primitives/std', 'consensus-authorities/std', + 'grandpa/std', + 'finality-tracker/std', ] [dependencies.aura] default_features = false @@ -170,4 +172,14 @@ git = 'https://github.com/joystream/substrate.git' package = 'substrate-consensus-authorities' rev = '59d5ec144704cec017a01f3e4dbb6b73c5542bf7' +[dependencies.grandpa] +default_features = false +git = 'https://github.com/joystream/substrate.git' +package = 'srml-grandpa' +rev = '59d5ec144704cec017a01f3e4dbb6b73c5542bf7' +[dependencies.finality-tracker] +default_features = false +git = 'https://github.com/joystream/substrate.git' +package = 'srml-finality-tracker' +rev = '59d5ec144704cec017a01f3e4dbb6b73c5542bf7' \ No newline at end of file diff --git a/src/lib.rs b/src/lib.rs index de608d65b4..63a7b9887e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -29,8 +29,9 @@ mod migration; mod roles; use client::{ block_builder::api::{self as block_builder_api, CheckInherentsResult, InherentData}, - impl_runtime_apis, runtime_api as client_api + impl_runtime_apis, runtime_api as client_api, }; +use grandpa::fg_primitives::{self, ScheduledChange}; #[cfg(feature = "std")] use primitives::bytes; use primitives::{ed25519, OpaqueMetadata}; @@ -39,8 +40,8 @@ use rstd::prelude::*; // needed for Vec use runtime_primitives::{ create_runtime_str, generic, traits::{ - self as runtime_traits, BlakeTwo256, Block as BlockT, CurrencyToVoteHandler, StaticLookup, - Verify, NumberFor, AuthorityIdFor + self as runtime_traits, AuthorityIdFor, BlakeTwo256, Block as BlockT, + CurrencyToVoteHandler, DigestFor, NumberFor, StaticLookup, Verify, }, transaction_validity::TransactionValidity, ApplyResult, @@ -300,6 +301,16 @@ impl actors::Trait for Runtime { type Members = Members; } +impl grandpa::Trait for Runtime { + type SessionKey = AuthorityId; + type Log = Log; + type Event = Event; +} + +impl finality_tracker::Trait for Runtime { + type OnFinalizationStalled = grandpa::SyncedAuthorities; +} + construct_runtime!( pub enum Runtime with Log(InternalLog: DigestItem) where Block = Block, @@ -315,6 +326,8 @@ construct_runtime!( Session: session, Staking: staking::{default, OfflineWorker}, Sudo: sudo, + FinalityTracker: finality_tracker::{Module, Call, Inherent}, + Grandpa: grandpa::{Module, Call, Storage, Config, Log(), Event}, Proposals: proposals::{Module, Call, Storage, Event, Config}, CouncilElection: election::{Module, Call, Storage, Event, Config}, Council: council::{Module, Call, Storage, Event, Config}, @@ -350,73 +363,107 @@ pub type Executive = executive::Executive for Runtime { - fn version() -> RuntimeVersion { - VERSION - } - - fn execute_block(block: Block) { - Executive::execute_block(block) - } - - fn initialize_block(header: &::Header) { - Executive::initialize_block(header) - } - - fn authorities() -> Vec> { - panic!("Deprecated, please use `AuthoritiesApi`.") - } - } + impl client_api::Core for Runtime { + fn version() -> RuntimeVersion { + VERSION + } - impl client_api::Metadata for Runtime { - fn metadata() -> OpaqueMetadata { - Runtime::metadata().into() - } - } + fn execute_block(block: Block) { + Executive::execute_block(block) + } - impl block_builder_api::BlockBuilder for Runtime { - fn apply_extrinsic(extrinsic: ::Extrinsic) -> ApplyResult { - Executive::apply_extrinsic(extrinsic) - } + fn initialize_block(header: &::Header) { + Executive::initialize_block(header) + } - fn finalize_block() -> ::Header { - Executive::finalize_block() - } + fn authorities() -> Vec> { + panic!("Deprecated, please use `AuthoritiesApi`.") + } + } - fn inherent_extrinsics(data: InherentData) -> Vec<::Extrinsic> { - data.create_extrinsics() - } + impl client_api::Metadata for Runtime { + fn metadata() -> OpaqueMetadata { + Runtime::metadata().into() + } + } - fn check_inherents(block: Block, data: InherentData) -> CheckInherentsResult { - data.check_extrinsics(&block) - } + impl block_builder_api::BlockBuilder for Runtime { + fn apply_extrinsic(extrinsic: ::Extrinsic) -> ApplyResult { + Executive::apply_extrinsic(extrinsic) + } - fn random_seed() -> ::Hash { - System::random_seed() - } - } + fn finalize_block() -> ::Header { + Executive::finalize_block() + } - impl client_api::TaggedTransactionQueue for Runtime { - fn validate_transaction(tx: ::Extrinsic) -> TransactionValidity { - Executive::validate_transaction(tx) - } - } + fn inherent_extrinsics(data: InherentData) -> Vec<::Extrinsic> { + data.create_extrinsics() + } - impl offchain_primitives::OffchainWorkerApi for Runtime { - fn offchain_worker(number: NumberFor) { - Executive::offchain_worker(number) - } - } + fn check_inherents(block: Block, data: InherentData) -> CheckInherentsResult { + data.check_extrinsics(&block) + } - impl consensus_aura::AuraApi for Runtime { - fn slot_duration() -> u64 { - Aura::slot_duration() - } - } + fn random_seed() -> ::Hash { + System::random_seed() + } + } - impl consensus_authorities::AuthoritiesApi for Runtime { - fn authorities() -> Vec> { - Consensus::authorities() - } - } + impl client_api::TaggedTransactionQueue for Runtime { + fn validate_transaction(tx: ::Extrinsic) -> TransactionValidity { + Executive::validate_transaction(tx) + } + } + + impl offchain_primitives::OffchainWorkerApi for Runtime { + fn offchain_worker(number: NumberFor) { + Executive::offchain_worker(number) + } + } + + impl fg_primitives::GrandpaApi for Runtime { + fn grandpa_pending_change(digest: &DigestFor) + -> Option>> + { + for log in digest.logs.iter().filter_map(|l| match l { + Log(InternalLog::grandpa(grandpa_signal)) => Some(grandpa_signal), + _ => None + }) { + if let Some(change) = Grandpa::scrape_digest_change(log) { + return Some(change); + } + } + None + } + + fn grandpa_forced_change(digest: &DigestFor) + -> Option<(NumberFor, ScheduledChange>)> + { + for log in digest.logs.iter().filter_map(|l| match l { + Log(InternalLog::grandpa(grandpa_signal)) => Some(grandpa_signal), + _ => None + }) { + if let Some(change) = Grandpa::scrape_digest_forced_change(log) { + return Some(change); + } + } + None + } + + fn grandpa_authorities() -> Vec<(AuthorityId, u64)> { + Grandpa::grandpa_authorities() + } + } + + impl consensus_aura::AuraApi for Runtime { + fn slot_duration() -> u64 { + Aura::slot_duration() + } + } + + impl consensus_authorities::AuthoritiesApi for Runtime { + fn authorities() -> Vec> { + Consensus::authorities() + } + } } diff --git a/wasm/Cargo.lock b/wasm/Cargo.lock index 71cebedef0..3893b62a75 100644 --- a/wasm/Cargo.lock +++ b/wasm/Cargo.lock @@ -771,6 +771,8 @@ dependencies = [ "srml-balances 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", "srml-consensus 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", "srml-executive 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "srml-finality-tracker 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "srml-grandpa 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", "srml-indices 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", "srml-session 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", "srml-staking 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", @@ -2162,6 +2164,41 @@ dependencies = [ "srml-system 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", ] +[[package]] +name = "srml-finality-tracker" +version = "1.0.0" +source = "git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7#59d5ec144704cec017a01f3e4dbb6b73c5542bf7" +dependencies = [ + "hex-literal 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 3.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", + "sr-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "sr-std 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "srml-support 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "srml-system 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "substrate-inherents 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", +] + +[[package]] +name = "srml-grandpa" +version = "1.0.0" +source = "git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7#59d5ec144704cec017a01f3e4dbb6b73c5542bf7" +dependencies = [ + "parity-codec 3.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", + "sr-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "sr-std 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "srml-consensus 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "srml-finality-tracker 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "srml-session 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "srml-support 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "srml-system 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "substrate-finality-grandpa-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "substrate-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", +] + [[package]] name = "srml-indices" version = "1.0.0" @@ -2523,6 +2560,18 @@ dependencies = [ "wasmi 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "substrate-finality-grandpa-primitives" +version = "1.0.0" +source = "git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7#59d5ec144704cec017a01f3e4dbb6b73c5542bf7" +dependencies = [ + "parity-codec 3.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sr-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "sr-std 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "substrate-client 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "substrate-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", +] + [[package]] name = "substrate-inherents" version = "1.0.0" @@ -3383,6 +3432,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum srml-balances 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)" = "" "checksum srml-consensus 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)" = "" "checksum srml-executive 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)" = "" +"checksum srml-finality-tracker 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)" = "" +"checksum srml-grandpa 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)" = "" "checksum srml-indices 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)" = "" "checksum srml-metadata 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)" = "" "checksum srml-session 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)" = "" @@ -3410,6 +3461,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum substrate-consensus-authorities 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)" = "" "checksum substrate-consensus-common 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)" = "" "checksum substrate-executor 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)" = "" +"checksum substrate-finality-grandpa-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)" = "" "checksum substrate-inherents 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)" = "" "checksum substrate-keyring 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)" = "" "checksum substrate-offchain-primitives 0.1.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)" = "" From 69ab23d569ba1c5a1443d0a3827b53a80fa809a0 Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Thu, 4 Apr 2019 08:24:18 +0300 Subject: [PATCH 155/175] disable creation of account indices --- src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index 63a7b9887e..5ff75c4a43 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -204,7 +204,7 @@ impl balances::Trait for Runtime { /// What to do if an account's free balance gets zeroed. type OnFreeBalanceZero = (Staking, Session); /// What to do if a new account is created. - type OnNewAccount = Indices; + type OnNewAccount = (); /// The uniquitous event type. type Event = Event; From a2cc6f753dcd52f26fa417c0f6ef1b27c84a9618 Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Thu, 4 Apr 2019 09:30:45 +0300 Subject: [PATCH 156/175] substrate upgrade: support both ed and sr signature schemes for account signatures --- src/lib.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 5ff75c4a43..234ee0c8f7 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -44,7 +44,7 @@ use runtime_primitives::{ CurrencyToVoteHandler, DigestFor, NumberFor, StaticLookup, Verify, }, transaction_validity::TransactionValidity, - ApplyResult, + AnySignature, ApplyResult, }; #[cfg(feature = "std")] @@ -72,7 +72,7 @@ pub type AuthoritySignature = ed25519::Signature; pub type AccountId = ::Signer; /// The type used by accounts to prove their ID. -pub type AccountSignature = ed25519::Signature; +pub type AccountSignature = AnySignature; /// Alias for ContentId, used in various places pub type ContentId = u64; From f96bf2ee5fec42201b2f2136ba8a857c1498bf03 Mon Sep 17 00:00:00 2001 From: Jens Finkhaeuser Date: Thu, 4 Apr 2019 13:09:01 +0200 Subject: [PATCH 157/175] Add use of staked storage provider roles to storage subsystem. --- src/lib.rs | 2 + src/roles/actors.rs | 28 +++++++ src/storage/data_directory.rs | 14 ++-- src/storage/data_object_storage_registry.rs | 25 +++++-- src/storage/mock.rs | 81 +++++++++++++++++++-- src/traits.rs | 14 ++++ 6 files changed, 142 insertions(+), 22 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 4600041b62..73e8646f10 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -252,6 +252,7 @@ impl storage::data_directory::Trait for Runtime { type Event = Event; type ContentId = ContentId; type Members = Members; + type Roles = Actors; type IsActiveDataObjectType = DataObjectTypeRegistry; } @@ -265,6 +266,7 @@ impl storage::data_object_storage_registry::Trait for Runtime { type Event = Event; type DataObjectStorageRelationshipId = u64; type Members = Members; + type Roles = Actors; type ContentIdExists = DataDirectory; } diff --git a/src/roles/actors.rs b/src/roles/actors.rs index cda9927230..3a15789610 100644 --- a/src/roles/actors.rs +++ b/src/roles/actors.rs @@ -12,6 +12,8 @@ use system::{self, ensure_signed}; use crate::traits::{Members, Roles}; +static MSG_NO_ACTOR_FOR_ROLE: &str = "For the specified role, no actor is currently staked."; + #[derive(Encode, Decode, Copy, Clone, Eq, PartialEq, Debug)] pub enum Role { Storage, @@ -193,6 +195,32 @@ impl Roles for Module { fn is_role_account(account_id: &T::AccountId) -> bool { >::exists(account_id) || >::exists(account_id) } + + fn account_has_role(account_id: &T::AccountId, role: Role) -> bool { + let res = Self::actor_by_account_id(account_id); + if res.is_none() { + return false; + } + let actor = res.unwrap(); + actor.role == role && >::exists(account_id) + } + + fn random_account_for_role(role: Role) -> Result { + let ids: Vec = Self::actor_account_ids() + .into_iter() + .filter(|actor_id| Self::account_has_role(actor_id, role)) + .collect(); + if 0 == ids.len() { + return Err(MSG_NO_ACTOR_FOR_ROLE); + } + let seed = >::random_seed(); + let mut rand: u64 = 0; + for offset in 0..8 { + rand += (seed.as_ref()[offset] as u64) << offset; + } + let idx = (rand as usize) % ids.len(); + return Ok(ids[idx].clone()); + } } decl_module! { diff --git a/src/storage/data_directory.rs b/src/storage/data_directory.rs index ee1037ddae..a345f40a49 100644 --- a/src/storage/data_directory.rs +++ b/src/storage/data_directory.rs @@ -1,7 +1,8 @@ #![cfg_attr(not(feature = "std"), no_std)] +use crate::roles::actors; use crate::storage::data_object_type_registry::Trait as DOTRTrait; -use crate::traits::{ContentIdExists, IsActiveDataObjectType, Members}; +use crate::traits::{ContentIdExists, IsActiveDataObjectType, Members, Roles}; use parity_codec::Codec; use parity_codec_derive::{Decode, Encode}; use primitives::Ed25519AuthorityId; @@ -27,6 +28,7 @@ pub trait Trait: timestamp::Trait + system::Trait + DOTRTrait + MaybeDebug { + PartialEq; type Members: Members; + type Roles: Roles; type IsActiveDataObjectType: IsActiveDataObjectType; } @@ -120,9 +122,7 @@ decl_module! { // The liaison is something we need to take from staked roles. The idea // is to select the liaison, for now randomly. - // FIXME without that module, we're currently hardcoding it, to the - // origin, which is wrong on many levels. - let liaison = who.clone(); + let liaison = T::Roles::random_account_for_role(actors::Role::Storage)?; // Let's create the entry then let new_id = Self::next_content_id(); @@ -209,9 +209,10 @@ mod tests { _ => (0u64, 0xdeadbeefu64), // invalid value, unlikely to match }; assert_ne!(liaison, 0xdeadbeefu64); + assert_eq!(liaison, TEST_MOCK_LIAISON); // Accepting content should not work with some random origin - let res = TestDataDirectory::accept_content(Origin::signed(42), content_id); + let res = TestDataDirectory::accept_content(Origin::signed(1), content_id); assert!(res.is_err()); // However, with the liaison as origin it should. @@ -235,9 +236,10 @@ mod tests { _ => (0u64, 0xdeadbeefu64), // invalid value, unlikely to match }; assert_ne!(liaison, 0xdeadbeefu64); + assert_eq!(liaison, TEST_MOCK_LIAISON); // Rejecting content should not work with some random origin - let res = TestDataDirectory::reject_content(Origin::signed(42), content_id); + let res = TestDataDirectory::reject_content(Origin::signed(1), content_id); assert!(res.is_err()); // However, with the liaison as origin it should. diff --git a/src/storage/data_object_storage_registry.rs b/src/storage/data_object_storage_registry.rs index 61b81defbd..29a6af3cd7 100644 --- a/src/storage/data_object_storage_registry.rs +++ b/src/storage/data_object_storage_registry.rs @@ -1,7 +1,8 @@ #![cfg_attr(not(feature = "std"), no_std)] +use crate::roles::actors; use crate::storage::data_directory::Trait as DDTrait; -use crate::traits::{ContentHasStorage, ContentIdExists, Members}; +use crate::traits::{ContentHasStorage, ContentIdExists, Members, Roles}; use parity_codec::Codec; use parity_codec_derive::{Decode, Encode}; use rstd::prelude::*; @@ -26,11 +27,14 @@ pub trait Trait: timestamp::Trait + system::Trait + DDTrait + MaybeDebug { + PartialEq; type Members: Members; + type Roles: Roles; type ContentIdExists: ContentIdExists; } static MSG_CID_NOT_FOUND: &str = "Content with this ID not found."; static MSG_DOSR_NOT_FOUND: &str = "No data object storage relationship found for this ID."; +static MSG_ONLY_STORAGE_PROVIDER_MAY_CREATE_DOSR: &str = + "Only storage providers can create data object storage relationships."; static MSG_ONLY_STORAGE_PROVIDER_MAY_CLAIM_READY: &str = "Only the storage provider in a DOSR can decide whether they're ready."; @@ -104,10 +108,9 @@ decl_module! { pub fn add_relationship(origin, cid: T::ContentId) { // Origin has to be a storage provider let who = ensure_signed(origin)?; - // TODO check for being staked as a storage provider - // if !T::Members::is_active_member(&who) { - // return Err(MSG_CREATOR_MUST_BE_MEMBER); - // } + + // Check that the origin is a storage provider + ensure!(::Roles::account_has_role(&who, actors::Role::Storage), MSG_ONLY_STORAGE_PROVIDER_MAY_CREATE_DOSR); // Content ID must exist ensure!(T::ContentIdExists::has_content(&cid), MSG_CID_NOT_FOUND); @@ -190,8 +193,11 @@ mod tests { #[test] fn test_add_relationship() { with_default_mock_builder(|| { - // The content needs to exist - in our mock, that's with the content ID 42 - let res = TestDataObjectStorageRegistry::add_relationship(Origin::signed(1), 42); + // The content needs to exist - in our mock, that's with the content ID TEST_MOCK_EXISTING_CID + let res = TestDataObjectStorageRegistry::add_relationship( + Origin::signed(1), + TEST_MOCK_EXISTING_CID, + ); assert!(res.is_ok()); }); } @@ -208,7 +214,10 @@ mod tests { fn test_toggle_ready() { with_default_mock_builder(|| { // Create a DOSR - let res = TestDataObjectStorageRegistry::add_relationship(Origin::signed(1), 42); + let res = TestDataObjectStorageRegistry::add_relationship( + Origin::signed(1), + TEST_MOCK_EXISTING_CID, + ); assert!(res.is_ok()); // Grab DOSR ID from event diff --git a/src/storage/mock.rs b/src/storage/mock.rs index ffb95ab550..006de60152 100644 --- a/src/storage/mock.rs +++ b/src/storage/mock.rs @@ -3,6 +3,8 @@ pub use super::{ content_directory, data_directory, data_object_storage_registry, data_object_type_registry, }; +use crate::governance::GovernanceCurrency; +use crate::roles::actors; use crate::traits; use runtime_io::with_externalities; pub use system; @@ -26,9 +28,19 @@ impl_outer_event! { data_directory, data_object_storage_registry, content_directory, + actors, + balances, } } +pub const TEST_FIRST_DATA_OBJECT_TYPE_ID: u64 = 1000; +pub const TEST_FIRST_CONTENT_ID: u64 = 2000; +pub const TEST_FIRST_RELATIONSHIP_ID: u64 = 3000; +pub const TEST_FIRST_METADATA_ID: u64 = 4000; + +pub const TEST_MOCK_LIAISON: u64 = 0xd00du64; +pub const TEST_MOCK_EXISTING_CID: u64 = 42; + pub struct MockMembers {} impl traits::Members for MockMembers { type Id = u64; @@ -46,6 +58,27 @@ impl traits::Members for MockMembers { } } +pub struct MockRoles {} +impl traits::Roles for MockRoles { + fn is_role_account(_account_id: &::AccountId) -> bool { + false + } + + fn account_has_role( + _account_id: &::AccountId, + _role: actors::Role, + ) -> bool { + false + } + + fn random_account_for_role( + _role: actors::Role, + ) -> Result<::AccountId, &'static str> { + // We "randomly" select an account Id. + Ok(TEST_MOCK_LIAISON) + } +} + pub struct AnyDataObjectTypeIsActive {} impl traits::IsActiveDataObjectType for AnyDataObjectTypeIsActive @@ -58,21 +91,21 @@ impl traits::IsActiveDataObjectType pub struct MockContent {} impl traits::ContentIdExists for MockContent { fn has_content(which: &::ContentId) -> bool { - *which == 42 + *which == TEST_MOCK_EXISTING_CID } fn get_data_object( which: &::ContentId, ) -> Result, &'static str> { match *which { - 42 => Ok(data_directory::DataObject { + TEST_MOCK_EXISTING_CID => Ok(data_directory::DataObject { data_object_type: 1, signing_key: None, size: 1234, added_at_block: 10, added_at_time: 1024, owner: 1, - liaison: 1, // TODO change to another later + liaison: TEST_MOCK_LIAISON, liaison_judgement: data_directory::LiaisonJudgement::Pending, }), _ => Err("nope, missing"), @@ -108,6 +141,7 @@ impl data_directory::Trait for Test { type Event = MetaEvent; type ContentId = u64; type Members = MockMembers; + type Roles = MockRoles; type IsActiveDataObjectType = AnyDataObjectTypeIsActive; } @@ -115,6 +149,7 @@ impl data_object_storage_registry::Trait for Test { type Event = MetaEvent; type DataObjectStorageRelationshipId = u64; type Members = MockMembers; + type Roles = MockRoles; type ContentIdExists = MockContent; } @@ -125,6 +160,11 @@ impl content_directory::Trait for Test { type Members = MockMembers; } +impl actors::Trait for Test { + type Event = MetaEvent; + type Members = MockMembers; +} + impl timestamp::Trait for Test { type Moment = u64; type OnTimestampSet = (); @@ -136,6 +176,29 @@ impl consensus::Trait for Test { type Log = DigestItem; } +impl balances::Trait for Test { + type Event = MetaEvent; + + /// The balance of an account. + type Balance = u32; + + /// A function which is invoked when the free-balance has fallen below the existential deposit and + /// has been reduced to zero. + /// + /// Gives a chance to clean up resources associated with the given account. + type OnFreeBalanceZero = (); + + /// Handler for when a new account is created. + type OnNewAccount = (); + + /// A function that returns true iff a given account can transfer its funds to another account. + type EnsureAccountLiquid = (); +} + +impl GovernanceCurrency for Test { + type Currency = balances::Module; +} + pub struct ExtBuilder { first_data_object_type_id: u64, first_content_id: u64, @@ -224,11 +287,8 @@ pub type TestDataDirectory = data_directory::Module; // pub type TestDataObject = data_directory::DataObject; pub type TestDataObjectStorageRegistry = data_object_storage_registry::Module; pub type TestContentDirectory = content_directory::Module; +pub type TestActors = actors::Module; -pub const TEST_FIRST_DATA_OBJECT_TYPE_ID: u64 = 1000; -pub const TEST_FIRST_CONTENT_ID: u64 = 2000; -pub const TEST_FIRST_RELATIONSHIP_ID: u64 = 3000; -pub const TEST_FIRST_METADATA_ID: u64 = 4000; pub fn with_default_mock_builder R>(f: F) -> R { with_externalities( &mut ExtBuilder::default() @@ -237,6 +297,11 @@ pub fn with_default_mock_builder R>(f: F) -> R { .first_relationship_id(TEST_FIRST_RELATIONSHIP_ID) .first_metadata_id(TEST_FIRST_METADATA_ID) .build(), - || f(), + || { + let roles: Vec = vec![actors::Role::Storage]; + assert!(TestActors::set_available_roles(roles).is_ok(), ""); + + f() + }, ) } diff --git a/src/traits.rs b/src/traits.rs index 3bfea937b6..c2eba3136a 100644 --- a/src/traits.rs +++ b/src/traits.rs @@ -1,5 +1,6 @@ #![cfg_attr(not(feature = "std"), no_std)] +use crate::roles::actors; use crate::storage::{data_directory, data_object_storage_registry, data_object_type_registry}; use parity_codec::Codec; use runtime_primitives::traits::{As, MaybeSerializeDebug, Member, SimpleArithmetic}; @@ -42,12 +43,25 @@ impl Members for () { // Roles pub trait Roles { fn is_role_account(account_id: &T::AccountId) -> bool; + + fn account_has_role(account_id: &T::AccountId, role: actors::Role) -> bool; + + // If available, return a random account ID for the given role. + fn random_account_for_role(role: actors::Role) -> Result; } impl Roles for () { fn is_role_account(_who: &T::AccountId) -> bool { false } + + fn account_has_role(_account_id: &T::AccountId, _role: actors::Role) -> bool { + false + } + + fn random_account_for_role(_role: actors::Role) -> Result { + Err("not implemented") + } } // Storage From 4d67a7e02b99268ff8e9e0b384ebcdca85e84825 Mon Sep 17 00:00:00 2001 From: Jens Finkhaeuser Date: Thu, 4 Apr 2019 14:47:10 +0200 Subject: [PATCH 158/175] Nope, no issue with badly initialized storage, just an issue with my mocks and tests being bad. Nice, what you can miss. --- src/storage/data_object_storage_registry.rs | 12 +++++++----- src/storage/mock.rs | 4 ++-- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/storage/data_object_storage_registry.rs b/src/storage/data_object_storage_registry.rs index 29a6af3cd7..c55a22e8c2 100644 --- a/src/storage/data_object_storage_registry.rs +++ b/src/storage/data_object_storage_registry.rs @@ -195,7 +195,7 @@ mod tests { with_default_mock_builder(|| { // The content needs to exist - in our mock, that's with the content ID TEST_MOCK_EXISTING_CID let res = TestDataObjectStorageRegistry::add_relationship( - Origin::signed(1), + Origin::signed(TEST_MOCK_LIAISON), TEST_MOCK_EXISTING_CID, ); assert!(res.is_ok()); @@ -215,7 +215,7 @@ mod tests { with_default_mock_builder(|| { // Create a DOSR let res = TestDataObjectStorageRegistry::add_relationship( - Origin::signed(1), + Origin::signed(TEST_MOCK_LIAISON), TEST_MOCK_EXISTING_CID, ); assert!(res.is_ok()); @@ -240,14 +240,16 @@ mod tests { // Toggling with the wrong ID should fail. let res = TestDataObjectStorageRegistry::set_relationship_ready( - Origin::signed(1), + Origin::signed(TEST_MOCK_LIAISON), dosr_id + 1, ); assert!(res.is_err()); // Toggling with the correct ID and origin should succeed - let res = - TestDataObjectStorageRegistry::set_relationship_ready(Origin::signed(1), dosr_id); + let res = TestDataObjectStorageRegistry::set_relationship_ready( + Origin::signed(TEST_MOCK_LIAISON), + dosr_id, + ); assert!(res.is_ok()); assert_eq!(System::events().last().unwrap().event, MetaEvent::data_object_storage_registry(data_object_storage_registry::RawEvent::DataObjectStorageRelationshipReadyUpdated( diff --git a/src/storage/mock.rs b/src/storage/mock.rs index 006de60152..0e7c12cf9a 100644 --- a/src/storage/mock.rs +++ b/src/storage/mock.rs @@ -65,10 +65,10 @@ impl traits::Roles for MockRoles { } fn account_has_role( - _account_id: &::AccountId, + account_id: &::AccountId, _role: actors::Role, ) -> bool { - false + *account_id == TEST_MOCK_LIAISON } fn random_account_for_role( From 80d1b4fa3737511507be67dd1fa947d2240e1d4c Mon Sep 17 00:00:00 2001 From: Jens Finkhaeuser Date: Thu, 4 Apr 2019 14:54:40 +0200 Subject: [PATCH 159/175] After a discussion with Mokhtar, add a fix and a simplification. --- src/roles/actors.rs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/roles/actors.rs b/src/roles/actors.rs index 3a15789610..29b6f21d8e 100644 --- a/src/roles/actors.rs +++ b/src/roles/actors.rs @@ -202,14 +202,11 @@ impl Roles for Module { return false; } let actor = res.unwrap(); - actor.role == role && >::exists(account_id) + actor.role == role } fn random_account_for_role(role: Role) -> Result { - let ids: Vec = Self::actor_account_ids() - .into_iter() - .filter(|actor_id| Self::account_has_role(actor_id, role)) - .collect(); + let ids = Self::account_ids_by_role(role); if 0 == ids.len() { return Err(MSG_NO_ACTOR_FOR_ROLE); } From 47f6729048608955332e604ced52a78ae3d6d69a Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Fri, 5 Apr 2019 16:43:18 +0300 Subject: [PATCH 160/175] add storage role at genesis with default params --- src/lib.rs | 2 +- src/roles/actors.rs | 51 ++++++++++++++++++++++++++++++++++++++------- src/roles/tests.rs | 2 +- 3 files changed, 46 insertions(+), 9 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 234ee0c8f7..47d8f037ac 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -334,7 +334,7 @@ construct_runtime!( Memo: memo::{Module, Call, Storage, Event}, Members: members::{Module, Call, Storage, Event, Config}, Migration: migration::{Module, Call, Storage, Event}, - Actors: actors::{Module, Call, Storage, Event}, + Actors: actors::{Module, Call, Storage, Event, Config}, DataObjectTypeRegistry: data_object_type_registry::{Module, Call, Storage, Event, Config}, DataDirectory: data_directory::{Module, Call, Storage, Event}, DataObjectStorageRegistry: data_object_storage_registry::{Module, Call, Storage, Event, Config}, diff --git a/src/roles/actors.rs b/src/roles/actors.rs index 6f13fb573a..8ebbe28496 100644 --- a/src/roles/actors.rs +++ b/src/roles/actors.rs @@ -50,6 +50,25 @@ pub struct RoleParameters { pub entry_request_fee: BalanceOf, } +impl Default for RoleParameters { + fn default() -> Self { + Self { + min_stake: BalanceOf::::sa(3000), + max_actors: 10, + reward: BalanceOf::::sa(10), + reward_period: T::BlockNumber::sa(600), + unbonding_period: T::BlockNumber::sa(600), + entry_request_fee: BalanceOf::::sa(50), + + // not currently used + min_actors: 5, + bonding_period: T::BlockNumber::sa(600), + min_service_period: T::BlockNumber::sa(600), + startup_grace_period: T::BlockNumber::sa(600), + } + } +} + #[derive(Encode, Decode, Clone)] pub struct Actor { pub member_id: MemberId, @@ -74,16 +93,29 @@ pub type Request = ( ); pub type Requests = Vec>; -pub const REQUEST_LIFETIME: u64 = 300; -pub const DEFAULT_REQUEST_CLEARING_INTERVAL: u64 = 100; +pub const DEFAULT_REQUEST_LIFETIME: u64 = 300; +pub const REQUEST_CLEARING_INTERVAL: u64 = 100; decl_storage! { trait Store for Module as Actors { /// requirements to enter and maintain status in roles - pub Parameters get(parameters) : map Role => Option>; + pub Parameters get(parameters) build(|config: &GenesisConfig| { + if config.enable_storage_role { + let storage_params: RoleParameters = Default::default(); + vec![(Role::Storage, storage_params)] + } else { + vec![] + } + }): map Role => Option>; /// the roles members can enter into - pub AvailableRoles get(available_roles) : Vec; + pub AvailableRoles get(available_roles) build(|config: &GenesisConfig| { + if config.enable_storage_role { + vec![(Role::Storage)] + } else { + vec![] + } + }): Vec; /// Actors list pub ActorAccountIds get(actor_account_ids) : Vec; @@ -106,8 +138,13 @@ decl_storage! { /// The account making the request will be bonded and must have /// sufficient balance to cover the minimum stake for the role. /// Bonding only occurs after successful entry into a role. - /// The request expires after REQUEST_LIFETIME blocks pub RoleEntryRequests get(role_entry_requests) : Requests; + + /// Entry request expires after this number of blocks + pub RequestLifeTime get(request_life_time) config() : u64 = DEFAULT_REQUEST_LIFETIME; + } + add_extra_genesis { + config(enable_storage_role): bool; } } @@ -197,7 +234,7 @@ decl_module! { fn on_initialise(now: T::BlockNumber) { // clear expired requests - if now % T::BlockNumber::sa(DEFAULT_REQUEST_CLEARING_INTERVAL) == T::BlockNumber::zero() { + if now % T::BlockNumber::sa(REQUEST_CLEARING_INTERVAL) == T::BlockNumber::zero() { let requests: Requests = Self::role_entry_requests() .into_iter() .filter(|request| request.3 < now) @@ -274,7 +311,7 @@ decl_module! { let _ = T::Currency::slash(&sender, fee); >::mutate(|requests| { - let expires = >::block_number()+ T::BlockNumber::sa(REQUEST_LIFETIME); + let expires = >::block_number()+ T::BlockNumber::sa(Self::request_life_time()); requests.push((sender.clone(), member_id, role, expires)); }); Self::deposit_event(RawEvent::EntryRequested(sender, role)); diff --git a/src/roles/tests.rs b/src/roles/tests.rs index 63bc576932..c481b0b117 100644 --- a/src/roles/tests.rs +++ b/src/roles/tests.rs @@ -97,7 +97,7 @@ fn make_entry_request() { assert_eq!(request.0, actor_account); assert_eq!(request.1, MockMembers::alice_id()); assert_eq!(request.2, actors::Role::Storage); - assert_eq!(request.3, starting_block + actors::REQUEST_LIFETIME); + assert_eq!(request.3, starting_block + Actors::request_life_time()); }); } From 80bd88b4ae3bd5624534d5b38cdc1a1ed7a6d917 Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Fri, 5 Apr 2019 17:08:15 +0300 Subject: [PATCH 161/175] actors: give RequestLifeTime config a name --- src/roles/actors.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/roles/actors.rs b/src/roles/actors.rs index 8ebbe28496..cd7678a749 100644 --- a/src/roles/actors.rs +++ b/src/roles/actors.rs @@ -141,7 +141,7 @@ decl_storage! { pub RoleEntryRequests get(role_entry_requests) : Requests; /// Entry request expires after this number of blocks - pub RequestLifeTime get(request_life_time) config() : u64 = DEFAULT_REQUEST_LIFETIME; + pub RequestLifeTime get(request_life_time) config(request_life_time) : u64 = DEFAULT_REQUEST_LIFETIME; } add_extra_genesis { config(enable_storage_role): bool; From 2b2e4635c0f1902dab734136ad0459feeb813a65 Mon Sep 17 00:00:00 2001 From: Jens Finkhaeuser Date: Fri, 5 Apr 2019 17:52:50 +0200 Subject: [PATCH 162/175] More idiomatic rust --- src/roles/actors.rs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/roles/actors.rs b/src/roles/actors.rs index 29b6f21d8e..3b2cd9000f 100644 --- a/src/roles/actors.rs +++ b/src/roles/actors.rs @@ -197,12 +197,7 @@ impl Roles for Module { } fn account_has_role(account_id: &T::AccountId, role: Role) -> bool { - let res = Self::actor_by_account_id(account_id); - if res.is_none() { - return false; - } - let actor = res.unwrap(); - actor.role == role + Self::actor_by_account_id(account_id).map_or(false, |actor| actor.role == role) } fn random_account_for_role(role: Role) -> Result { From e40dcfa19b7b57dce32b547fbf065081052f0427 Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Sat, 6 Apr 2019 11:11:56 +0300 Subject: [PATCH 163/175] fix storage mocks for latest substrate --- src/storage/mock.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/storage/mock.rs b/src/storage/mock.rs index df95ca4e2a..a827137484 100644 --- a/src/storage/mock.rs +++ b/src/storage/mock.rs @@ -191,8 +191,9 @@ impl balances::Trait for Test { /// Handler for when a new account is created. type OnNewAccount = (); - /// A function that returns true iff a given account can transfer its funds to another account. - type EnsureAccountLiquid = (); + type TransactionPayment = (); + type DustRemoval = (); + type TransferPayment = (); } impl GovernanceCurrency for Test { From 5c37eee796edc635b5b27b10f5a4399fc926c201 Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Sat, 6 Apr 2019 13:12:52 +0300 Subject: [PATCH 164/175] roles: update bondage mechanism to use LockableCurrency trait --- src/roles/actors.rs | 49 ++++++++++----------------------------------- src/roles/tests.rs | 13 +++++------- 2 files changed, 16 insertions(+), 46 deletions(-) diff --git a/src/roles/actors.rs b/src/roles/actors.rs index e249af866c..32d6e47d75 100644 --- a/src/roles/actors.rs +++ b/src/roles/actors.rs @@ -2,7 +2,7 @@ use crate::governance::{BalanceOf, GovernanceCurrency}; use parity_codec_derive::{Decode, Encode}; use rstd::prelude::*; use runtime_primitives::traits::{As, Bounded, MaybeDebug, Zero}; -use srml_support::traits::Currency; +use srml_support::traits::{Currency, LockIdentifier, LockableCurrency, WithdrawReasons}; use srml_support::{decl_event, decl_module, decl_storage, ensure, StorageMap, StorageValue}; use system::{self, ensure_signed}; @@ -10,6 +10,8 @@ use crate::traits::{Members, Roles}; 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)] pub enum Role { Storage, @@ -131,9 +133,6 @@ decl_storage! { /// actor accounts associated with a member id pub AccountIdsByMemberId get(account_ids_by_member_id) : map MemberId => Vec; - /// tokens locked until given block number - pub Bondage get(bondage) : map T::AccountId => T::BlockNumber; - /// First step before enter a role is registering intent with a new account/key. /// This is done by sending a role_entry_request() from the new account. /// The member must then send a stake() transaction to approve the request and enter the desired role. @@ -215,9 +214,13 @@ impl Module { unbonding_period: T::BlockNumber, ) { // simple unstaking ...only applying unbonding period - >::insert( + let value = T::Currency::free_balance(&actor_account); + T::Currency::set_lock( + STAKING_ID, &actor_account, + value, >::block_number() + unbonding_period, + WithdrawReasons::all(), ); Self::remove_actor_from_service(actor_account, role, member_id); @@ -226,7 +229,7 @@ impl Module { impl Roles for Module { fn is_role_account(account_id: &T::AccountId) -> bool { - >::exists(account_id) || >::exists(account_id) + >::exists(account_id) } fn account_has_role(account_id: &T::AccountId, role: Role) -> bool { @@ -284,26 +287,6 @@ decl_module! { } } - if now % T::BlockNumber::sa(100) == T::BlockNumber::zero() { - // clear unbonded accounts - let actor_accounts: Vec = Self::actor_account_ids() - .into_iter() - .filter(|account| { - if >::exists(account) { - if Self::bondage(account) > now { - true - } else { - >::remove(account); - false - } - } else { - true - } - }) - .collect(); - >::put(actor_accounts); - } - // eject actors not staking the minimum // iterating over available roles, so if a role has been removed at some point // and an actor hasn't unstaked .. this will not apply to them.. which doesn't really matter @@ -366,7 +349,8 @@ decl_module! { >::mutate(role, |accounts| accounts.push(actor_account.clone())); >::mutate(&member_id, |accounts| accounts.push(actor_account.clone())); - >::insert(&actor_account, T::BlockNumber::max_value()); + let value = T::Currency::free_balance(&actor_account); + T::Currency::set_lock(STAKING_ID, &actor_account, value, T::BlockNumber::max_value(), WithdrawReasons::all()); >::insert(&actor_account, Actor { member_id, account: actor_account.clone(), @@ -425,14 +409,3 @@ decl_module! { } } } - -// TODO: Find how balances module checks account liquidity state -// impl EnsureAccountLiquid for Module { -// fn ensure_account_liquid(who: &T::AccountId) -> dispatch::Result { -// if Self::bondage(who) <= >::block_number() { -// Ok(()) -// } else { -// Err("cannot transfer illiquid funds") -// } -// } -// } diff --git a/src/roles/tests.rs b/src/roles/tests.rs index c481b0b117..37f9a9d259 100644 --- a/src/roles/tests.rs +++ b/src/roles/tests.rs @@ -1,7 +1,6 @@ #![cfg(test)] use super::mock::*; -//use super::*; use runtime_io::with_externalities; use srml_support::*; @@ -138,7 +137,8 @@ fn staking() { let account_ids_for_member = Actors::account_ids_by_member_id(MockMembers::alice_id()); assert_eq!(account_ids_for_member, vec![actor_account]); - assert!(>::exists(actor_account)); + let num_of_locks = Balances::locks(&actor_account).len(); + assert_eq!(num_of_locks, 1); }); } @@ -163,7 +163,6 @@ fn unstaking() { >::insert(&actor_account, actor); >::insert(actors::Role::Storage, vec![actor_account]); >::insert(MockMembers::alice_id(), vec![actor_account]); - >::insert(&actor_account, 10000); let current_block = 500; System::set_block_number(current_block); @@ -182,10 +181,8 @@ fn unstaking() { let account_ids_for_member = Actors::account_ids_by_member_id(MockMembers::alice_id()); assert_eq!(account_ids_for_member.len(), 0); - assert!(>::exists(actor_account)); - assert_eq!( - Actors::bondage(actor_account), - current_block + storage_params.unbonding_period - ); + let lock = Balances::locks(&actor_account)[0].clone(); + // assuming this is our lock + assert_eq!(lock.until, current_block + storage_params.unbonding_period); }); } From 2179066ca5141979d150efc61459bc0e82cb731b Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Mon, 8 Apr 2019 10:08:16 +0300 Subject: [PATCH 165/175] substarte update: track upstream branch v1.0 --- Cargo.toml | 44 ++--- src/lib.rs | 8 +- wasm/Cargo.lock | 470 ++++++++++++++++++++++++------------------------ wasm/Cargo.toml | 1 + 4 files changed, 265 insertions(+), 258 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 2f1021ec9b..e6d16fc1c6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -38,37 +38,37 @@ std = [ default_features = false git = 'https://github.com/joystream/substrate.git' package = 'srml-aura' -rev = '59d5ec144704cec017a01f3e4dbb6b73c5542bf7' +rev = '89bbb7b6d0e076f0eda736b330f5f792aa2e2991' [dependencies.balances] default_features = false git = 'https://github.com/joystream/substrate.git' package = 'srml-balances' -rev = '59d5ec144704cec017a01f3e4dbb6b73c5542bf7' +rev = '89bbb7b6d0e076f0eda736b330f5f792aa2e2991' [dependencies.consensus] default_features = false git = 'https://github.com/joystream/substrate.git' package = 'srml-consensus' -rev = '59d5ec144704cec017a01f3e4dbb6b73c5542bf7' +rev = '89bbb7b6d0e076f0eda736b330f5f792aa2e2991' [dependencies.consensus-aura] default_features = false git = 'https://github.com/joystream/substrate.git' package = 'substrate-consensus-aura-primitives' -rev = '59d5ec144704cec017a01f3e4dbb6b73c5542bf7' +rev = '89bbb7b6d0e076f0eda736b330f5f792aa2e2991' [dependencies.executive] default_features = false git = 'https://github.com/joystream/substrate.git' package = 'srml-executive' -rev = '59d5ec144704cec017a01f3e4dbb6b73c5542bf7' +rev = '89bbb7b6d0e076f0eda736b330f5f792aa2e2991' [dependencies.indices] default_features = false git = 'https://github.com/joystream/substrate.git' package = 'srml-indices' -rev = '59d5ec144704cec017a01f3e4dbb6b73c5542bf7' +rev = '89bbb7b6d0e076f0eda736b330f5f792aa2e2991' [dependencies.parity-codec] default-features = false @@ -82,25 +82,25 @@ version = '3.1' default_features = false git = 'https://github.com/joystream/substrate.git' package = 'substrate-primitives' -rev = '59d5ec144704cec017a01f3e4dbb6b73c5542bf7' +rev = '89bbb7b6d0e076f0eda736b330f5f792aa2e2991' [dependencies.rstd] default_features = false git = 'https://github.com/joystream/substrate.git' package = 'sr-std' -rev = '59d5ec144704cec017a01f3e4dbb6b73c5542bf7' +rev = '89bbb7b6d0e076f0eda736b330f5f792aa2e2991' [dependencies.runtime-io] default_features = false git = 'https://github.com/joystream/substrate.git' package = 'sr-io' -rev = '59d5ec144704cec017a01f3e4dbb6b73c5542bf7' +rev = '89bbb7b6d0e076f0eda736b330f5f792aa2e2991' [dependencies.runtime-primitives] default_features = false git = 'https://github.com/joystream/substrate.git' package = 'sr-primitives' -rev = '59d5ec144704cec017a01f3e4dbb6b73c5542bf7' +rev = '89bbb7b6d0e076f0eda736b330f5f792aa2e2991' [dependencies.safe-mix] default-features = false @@ -117,69 +117,69 @@ version = '1.0' [dependencies.srml-support] default_features = false git = 'https://github.com/joystream/substrate.git' -rev = '59d5ec144704cec017a01f3e4dbb6b73c5542bf7' +rev = '89bbb7b6d0e076f0eda736b330f5f792aa2e2991' [dependencies.substrate-client] default_features = false git = 'https://github.com/joystream/substrate.git' -rev = '59d5ec144704cec017a01f3e4dbb6b73c5542bf7' +rev = '89bbb7b6d0e076f0eda736b330f5f792aa2e2991' [dependencies.sudo] default_features = false git = 'https://github.com/joystream/substrate.git' package = 'srml-sudo' -rev = '59d5ec144704cec017a01f3e4dbb6b73c5542bf7' +rev = '89bbb7b6d0e076f0eda736b330f5f792aa2e2991' [dependencies.system] default_features = false git = 'https://github.com/joystream/substrate.git' package = 'srml-system' -rev = '59d5ec144704cec017a01f3e4dbb6b73c5542bf7' +rev = '89bbb7b6d0e076f0eda736b330f5f792aa2e2991' [dependencies.timestamp] default_features = false git = 'https://github.com/joystream/substrate.git' package = 'srml-timestamp' -rev = '59d5ec144704cec017a01f3e4dbb6b73c5542bf7' +rev = '89bbb7b6d0e076f0eda736b330f5f792aa2e2991' [dependencies.version] default_features = false git = 'https://github.com/joystream/substrate.git' package = 'sr-version' -rev = '59d5ec144704cec017a01f3e4dbb6b73c5542bf7' +rev = '89bbb7b6d0e076f0eda736b330f5f792aa2e2991' [dependencies.staking] default_features = false git = 'https://github.com/joystream/substrate.git' package = 'srml-staking' -rev = '59d5ec144704cec017a01f3e4dbb6b73c5542bf7' +rev = '89bbb7b6d0e076f0eda736b330f5f792aa2e2991' [dependencies.session] default_features = false git = 'https://github.com/joystream/substrate.git' package = 'srml-session' -rev = '59d5ec144704cec017a01f3e4dbb6b73c5542bf7' +rev = '89bbb7b6d0e076f0eda736b330f5f792aa2e2991' [dependencies.offchain-primitives] default_features = false git = 'https://github.com/joystream/substrate.git' package = 'substrate-offchain-primitives' -rev = '59d5ec144704cec017a01f3e4dbb6b73c5542bf7' +rev = '89bbb7b6d0e076f0eda736b330f5f792aa2e2991' [dependencies.consensus-authorities] default_features = false git = 'https://github.com/joystream/substrate.git' package = 'substrate-consensus-authorities' -rev = '59d5ec144704cec017a01f3e4dbb6b73c5542bf7' +rev = '89bbb7b6d0e076f0eda736b330f5f792aa2e2991' [dependencies.grandpa] default_features = false git = 'https://github.com/joystream/substrate.git' package = 'srml-grandpa' -rev = '59d5ec144704cec017a01f3e4dbb6b73c5542bf7' +rev = '89bbb7b6d0e076f0eda736b330f5f792aa2e2991' [dependencies.finality-tracker] default_features = false git = 'https://github.com/joystream/substrate.git' package = 'srml-finality-tracker' -rev = '59d5ec144704cec017a01f3e4dbb6b73c5542bf7' \ No newline at end of file +rev = '89bbb7b6d0e076f0eda736b330f5f792aa2e2991' \ No newline at end of file diff --git a/src/lib.rs b/src/lib.rs index 41a349b8a0..057e437b58 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -95,8 +95,14 @@ pub mod opaque { /// Opaque, encoded, unchecked extrinsic. #[derive(PartialEq, Eq, Clone, Default, Encode, Decode)] - #[cfg_attr(feature = "std", derive(Serialize, Deserialize, Debug))] + #[cfg_attr(feature = "std", derive(Serialize, Deserialize))] pub struct UncheckedExtrinsic(#[cfg_attr(feature = "std", serde(with = "bytes"))] pub Vec); + #[cfg(feature = "std")] + impl std::fmt::Debug for UncheckedExtrinsic { + fn fmt(&self, fmt: &mut std::fmt::Formatter) -> std::fmt::Result { + write!(fmt, "{}", primitives::hexdisplay::HexDisplay::from(&self.0)) + } + } impl runtime_traits::Extrinsic for UncheckedExtrinsic { fn is_signed(&self) -> Option { None diff --git a/wasm/Cargo.lock b/wasm/Cargo.lock index 3893b62a75..4098e8ad68 100644 --- a/wasm/Cargo.lock +++ b/wasm/Cargo.lock @@ -763,28 +763,28 @@ dependencies = [ "safe-mix 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-io 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "sr-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "sr-std 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "sr-version 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "srml-aura 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "srml-balances 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "srml-consensus 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "srml-executive 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "srml-finality-tracker 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "srml-grandpa 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "srml-indices 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "srml-session 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "srml-staking 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "srml-sudo 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "srml-support 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "srml-system 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "srml-timestamp 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "substrate-client 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "substrate-consensus-aura-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "substrate-consensus-authorities 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "substrate-offchain-primitives 0.1.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "substrate-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "sr-io 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "sr-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "sr-std 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "sr-version 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "srml-aura 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "srml-balances 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "srml-consensus 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "srml-executive 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "srml-finality-tracker 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "srml-grandpa 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "srml-indices 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "srml-session 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "srml-staking 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "srml-sudo 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "srml-support 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "srml-system 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "srml-timestamp 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "substrate-client 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "substrate-consensus-aura-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "substrate-consensus-authorities 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "substrate-offchain-primitives 0.1.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "substrate-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", ] [[package]] @@ -2035,7 +2035,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "sr-api-macros" version = "1.0.0" -source = "git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7#59d5ec144704cec017a01f3e4dbb6b73c5542bf7" +source = "git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991#89bbb7b6d0e076f0eda736b330f5f792aa2e2991" dependencies = [ "blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro-crate 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2047,24 +2047,24 @@ dependencies = [ [[package]] name = "sr-io" version = "1.0.0" -source = "git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7#59d5ec144704cec017a01f3e4dbb6b73c5542bf7" +source = "git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991#89bbb7b6d0e076f0eda736b330f5f792aa2e2991" dependencies = [ "environmental 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "hash-db 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)", "libsecp256k1 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-std 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "substrate-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "substrate-state-machine 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "substrate-trie 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "sr-std 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "substrate-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "substrate-state-machine 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "substrate-trie 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", "tiny-keccak 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "sr-primitives" version = "1.0.0" -source = "git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7#59d5ec144704cec017a01f3e4dbb6b73c5542bf7" +source = "git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991#89bbb7b6d0e076f0eda736b330f5f792aa2e2991" dependencies = [ "integer-sqrt 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2072,15 +2072,15 @@ dependencies = [ "parity-codec 3.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-io 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "sr-std 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "substrate-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "sr-io 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "sr-std 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "substrate-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", ] [[package]] name = "sr-std" version = "1.0.0" -source = "git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7#59d5ec144704cec017a01f3e4dbb6b73c5542bf7" +source = "git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991#89bbb7b6d0e076f0eda736b330f5f792aa2e2991" dependencies = [ "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2088,205 +2088,205 @@ dependencies = [ [[package]] name = "sr-version" version = "1.0.0" -source = "git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7#59d5ec144704cec017a01f3e4dbb6b73c5542bf7" +source = "git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991#89bbb7b6d0e076f0eda736b330f5f792aa2e2991" dependencies = [ "impl-serde 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "sr-std 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "sr-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "sr-std 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", ] [[package]] name = "srml-aura" version = "1.0.0" -source = "git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7#59d5ec144704cec017a01f3e4dbb6b73c5542bf7" +source = "git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991#89bbb7b6d0e076f0eda736b330f5f792aa2e2991" dependencies = [ "hex-literal 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec-derive 3.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "sr-std 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "srml-session 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "srml-staking 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "srml-support 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "srml-system 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "srml-timestamp 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "substrate-inherents 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "sr-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "sr-std 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "srml-session 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "srml-staking 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "srml-support 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "srml-system 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "srml-timestamp 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "substrate-inherents 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", ] [[package]] name = "srml-balances" version = "1.0.0" -source = "git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7#59d5ec144704cec017a01f3e4dbb6b73c5542bf7" +source = "git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991#89bbb7b6d0e076f0eda736b330f5f792aa2e2991" dependencies = [ "hex-literal 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "safe-mix 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "sr-std 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "srml-support 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "srml-system 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "substrate-keyring 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "sr-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "sr-std 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "srml-support 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "srml-system 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "substrate-keyring 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", ] [[package]] name = "srml-consensus" version = "1.0.0" -source = "git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7#59d5ec144704cec017a01f3e4dbb6b73c5542bf7" +source = "git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991#89bbb7b6d0e076f0eda736b330f5f792aa2e2991" dependencies = [ "hex-literal 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "sr-std 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "srml-support 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "srml-system 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "substrate-inherents 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "substrate-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "sr-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "sr-std 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "srml-support 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "srml-system 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "substrate-inherents 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "substrate-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", ] [[package]] name = "srml-executive" version = "1.0.0" -source = "git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7#59d5ec144704cec017a01f3e4dbb6b73c5542bf7" +source = "git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991#89bbb7b6d0e076f0eda736b330f5f792aa2e2991" dependencies = [ "parity-codec 3.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-io 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "sr-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "sr-std 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "srml-support 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "srml-system 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "sr-io 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "sr-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "sr-std 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "srml-support 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "srml-system 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", ] [[package]] name = "srml-finality-tracker" version = "1.0.0" -source = "git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7#59d5ec144704cec017a01f3e4dbb6b73c5542bf7" +source = "git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991#89bbb7b6d0e076f0eda736b330f5f792aa2e2991" dependencies = [ "hex-literal 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "sr-std 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "srml-support 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "srml-system 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "substrate-inherents 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "sr-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "sr-std 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "srml-support 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "srml-system 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "substrate-inherents 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", ] [[package]] name = "srml-grandpa" version = "1.0.0" -source = "git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7#59d5ec144704cec017a01f3e4dbb6b73c5542bf7" +source = "git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991#89bbb7b6d0e076f0eda736b330f5f792aa2e2991" dependencies = [ "parity-codec 3.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "sr-std 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "srml-consensus 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "srml-finality-tracker 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "srml-session 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "srml-support 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "srml-system 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "substrate-finality-grandpa-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "substrate-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "sr-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "sr-std 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "srml-consensus 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "srml-finality-tracker 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "srml-session 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "srml-support 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "srml-system 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "substrate-finality-grandpa-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "substrate-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", ] [[package]] name = "srml-indices" version = "1.0.0" -source = "git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7#59d5ec144704cec017a01f3e4dbb6b73c5542bf7" +source = "git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991#89bbb7b6d0e076f0eda736b330f5f792aa2e2991" dependencies = [ "hex-literal 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec-derive 3.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "safe-mix 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-io 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "sr-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "sr-std 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "srml-support 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "srml-system 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "substrate-keyring 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "substrate-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "sr-io 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "sr-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "sr-std 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "srml-support 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "srml-system 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "substrate-keyring 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "substrate-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", ] [[package]] name = "srml-metadata" version = "1.0.0" -source = "git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7#59d5ec144704cec017a01f3e4dbb6b73c5542bf7" +source = "git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991#89bbb7b6d0e076f0eda736b330f5f792aa2e2991" dependencies = [ "parity-codec 3.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-std 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "substrate-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "sr-std 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "substrate-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", ] [[package]] name = "srml-session" version = "1.0.0" -source = "git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7#59d5ec144704cec017a01f3e4dbb6b73c5542bf7" +source = "git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991#89bbb7b6d0e076f0eda736b330f5f792aa2e2991" dependencies = [ "hex-literal 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec-derive 3.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "safe-mix 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "sr-std 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "srml-consensus 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "srml-support 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "srml-system 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "srml-timestamp 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "sr-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "sr-std 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "srml-consensus 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "srml-support 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "srml-system 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "srml-timestamp 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", ] [[package]] name = "srml-staking" version = "1.0.0" -source = "git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7#59d5ec144704cec017a01f3e4dbb6b73c5542bf7" +source = "git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991#89bbb7b6d0e076f0eda736b330f5f792aa2e2991" dependencies = [ "hex-literal 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "safe-mix 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-io 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "sr-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "sr-std 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "srml-consensus 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "srml-session 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "srml-support 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "srml-system 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "substrate-keyring 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "sr-io 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "sr-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "sr-std 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "srml-consensus 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "srml-session 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "srml-support 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "srml-system 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "substrate-keyring 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", ] [[package]] name = "srml-sudo" version = "1.0.0" -source = "git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7#59d5ec144704cec017a01f3e4dbb6b73c5542bf7" +source = "git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991#89bbb7b6d0e076f0eda736b330f5f792aa2e2991" dependencies = [ "hex-literal 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec-derive 3.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "sr-std 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "srml-support 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "srml-support-procedural 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "srml-system 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "sr-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "sr-std 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "srml-support 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "srml-support-procedural 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "srml-system 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", ] [[package]] name = "srml-support" version = "1.0.0" -source = "git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7#59d5ec144704cec017a01f3e4dbb6b73c5542bf7" +source = "git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991#89bbb7b6d0e076f0eda736b330f5f792aa2e2991" dependencies = [ "bitmask 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "hex-literal 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2295,42 +2295,42 @@ dependencies = [ "paste 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-io 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "sr-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "sr-std 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "srml-metadata 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "srml-support-procedural 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "substrate-inherents 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "sr-io 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "sr-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "sr-std 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "srml-metadata 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "srml-support-procedural 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "substrate-inherents 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", ] [[package]] name = "srml-support-procedural" version = "1.0.0" -source = "git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7#59d5ec144704cec017a01f3e4dbb6b73c5542bf7" +source = "git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991#89bbb7b6d0e076f0eda736b330f5f792aa2e2991" dependencies = [ "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-api-macros 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "srml-support-procedural-tools 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "sr-api-macros 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "srml-support-procedural-tools 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", "syn 0.15.29 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "srml-support-procedural-tools" version = "1.0.0" -source = "git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7#59d5ec144704cec017a01f3e4dbb6b73c5542bf7" +source = "git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991#89bbb7b6d0e076f0eda736b330f5f792aa2e2991" dependencies = [ "proc-macro-crate 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", - "srml-support-procedural-tools-derive 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "srml-support-procedural-tools-derive 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", "syn 0.15.29 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "srml-support-procedural-tools-derive" version = "1.0.0" -source = "git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7#59d5ec144704cec017a01f3e4dbb6b73c5542bf7" +source = "git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991#89bbb7b6d0e076f0eda736b330f5f792aa2e2991" dependencies = [ "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2340,33 +2340,33 @@ dependencies = [ [[package]] name = "srml-system" version = "1.0.0" -source = "git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7#59d5ec144704cec017a01f3e4dbb6b73c5542bf7" +source = "git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991#89bbb7b6d0e076f0eda736b330f5f792aa2e2991" dependencies = [ "hex-literal 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "safe-mix 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-io 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "sr-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "sr-std 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "srml-support 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "substrate-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "sr-io 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "sr-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "sr-std 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "srml-support 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "substrate-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", ] [[package]] name = "srml-timestamp" version = "1.0.0" -source = "git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7#59d5ec144704cec017a01f3e4dbb6b73c5542bf7" +source = "git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991#89bbb7b6d0e076f0eda736b330f5f792aa2e2991" dependencies = [ "hex-literal 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "sr-std 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "srml-support 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "srml-system 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "substrate-inherents 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "sr-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "sr-std 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "srml-support 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "srml-system 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "substrate-inherents 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", ] [[package]] @@ -2466,7 +2466,7 @@ dependencies = [ [[package]] name = "substrate-client" version = "1.0.0" -source = "git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7#59d5ec144704cec017a01f3e4dbb6b73c5542bf7" +source = "git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991#89bbb7b6d0e076f0eda736b330f5f792aa2e2991" dependencies = [ "error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2478,48 +2478,48 @@ dependencies = [ "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-api-macros 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "sr-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "sr-std 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "sr-version 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "substrate-consensus-common 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "substrate-executor 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "substrate-inherents 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "substrate-keyring 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "substrate-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "substrate-state-machine 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "substrate-telemetry 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "substrate-trie 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "sr-api-macros 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "sr-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "sr-std 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "sr-version 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "substrate-consensus-common 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "substrate-executor 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "substrate-inherents 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "substrate-keyring 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "substrate-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "substrate-state-machine 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "substrate-telemetry 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "substrate-trie 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", ] [[package]] name = "substrate-consensus-aura-primitives" version = "1.0.0" -source = "git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7#59d5ec144704cec017a01f3e4dbb6b73c5542bf7" +source = "git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991#89bbb7b6d0e076f0eda736b330f5f792aa2e2991" dependencies = [ - "sr-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "substrate-client 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "sr-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "substrate-client 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", ] [[package]] name = "substrate-consensus-authorities" version = "1.0.0" -source = "git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7#59d5ec144704cec017a01f3e4dbb6b73c5542bf7" +source = "git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991#89bbb7b6d0e076f0eda736b330f5f792aa2e2991" dependencies = [ "parity-codec 3.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-io 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "sr-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "sr-std 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "sr-version 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "srml-support 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "substrate-client 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "substrate-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "sr-io 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "sr-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "sr-std 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "sr-version 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "srml-support 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "substrate-client 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "substrate-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", ] [[package]] name = "substrate-consensus-common" version = "1.0.0" -source = "git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7#59d5ec144704cec017a01f3e4dbb6b73c5542bf7" +source = "git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991#89bbb7b6d0e076f0eda736b330f5f792aa2e2991" dependencies = [ "crossbeam-channel 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2528,17 +2528,17 @@ dependencies = [ "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec-derive 3.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "sr-version 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "substrate-inherents 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "substrate-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "sr-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "sr-version 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "substrate-inherents 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "substrate-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", "tokio 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "substrate-executor" version = "1.0.0" -source = "git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7#59d5ec144704cec017a01f3e4dbb6b73c5542bf7" +source = "git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991#89bbb7b6d0e076f0eda736b330f5f792aa2e2991" dependencies = [ "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2549,13 +2549,13 @@ dependencies = [ "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-io 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "sr-version 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "substrate-panic-handler 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "substrate-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "substrate-serializer 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "substrate-state-machine 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "substrate-trie 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "sr-io 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "sr-version 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "substrate-panic-handler 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "substrate-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "substrate-serializer 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "substrate-state-machine 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "substrate-trie 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", "tiny-keccak 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "wasmi 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2563,51 +2563,51 @@ dependencies = [ [[package]] name = "substrate-finality-grandpa-primitives" version = "1.0.0" -source = "git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7#59d5ec144704cec017a01f3e4dbb6b73c5542bf7" +source = "git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991#89bbb7b6d0e076f0eda736b330f5f792aa2e2991" dependencies = [ "parity-codec 3.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "sr-std 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "substrate-client 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "substrate-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "sr-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "sr-std 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "substrate-client 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "substrate-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", ] [[package]] name = "substrate-inherents" version = "1.0.0" -source = "git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7#59d5ec144704cec017a01f3e4dbb6b73c5542bf7" +source = "git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991#89bbb7b6d0e076f0eda736b330f5f792aa2e2991" dependencies = [ "parity-codec 3.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "sr-std 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "sr-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "sr-std 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", ] [[package]] name = "substrate-keyring" version = "1.0.0" -source = "git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7#59d5ec144704cec017a01f3e4dbb6b73c5542bf7" +source = "git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991#89bbb7b6d0e076f0eda736b330f5f792aa2e2991" dependencies = [ "hex-literal 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "strum 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", "strum_macros 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", - "substrate-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "substrate-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", ] [[package]] name = "substrate-offchain-primitives" version = "0.1.0" -source = "git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7#59d5ec144704cec017a01f3e4dbb6b73c5542bf7" +source = "git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991#89bbb7b6d0e076f0eda736b330f5f792aa2e2991" dependencies = [ - "sr-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "substrate-client 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "sr-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "substrate-client 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", ] [[package]] name = "substrate-panic-handler" version = "1.0.0" -source = "git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7#59d5ec144704cec017a01f3e4dbb6b73c5542bf7" +source = "git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991#89bbb7b6d0e076f0eda736b330f5f792aa2e2991" dependencies = [ "backtrace 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2616,7 +2616,7 @@ dependencies = [ [[package]] name = "substrate-primitives" version = "1.0.0" -source = "git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7#59d5ec144704cec017a01f3e4dbb6b73c5542bf7" +source = "git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991#89bbb7b6d0e076f0eda736b330f5f792aa2e2991" dependencies = [ "base58 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2636,7 +2636,7 @@ dependencies = [ "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", "sha2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-std 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "sr-std 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", "substrate-bip39 0.2.1 (git+https://github.com/paritytech/substrate-bip39)", "tiny-bip39 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "twox-hash 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2647,7 +2647,7 @@ dependencies = [ [[package]] name = "substrate-serializer" version = "1.0.0" -source = "git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7#59d5ec144704cec017a01f3e4dbb6b73c5542bf7" +source = "git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991#89bbb7b6d0e076f0eda736b330f5f792aa2e2991" dependencies = [ "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2656,7 +2656,7 @@ dependencies = [ [[package]] name = "substrate-state-machine" version = "1.0.0" -source = "git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7#59d5ec144704cec017a01f3e4dbb6b73c5542bf7" +source = "git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991#89bbb7b6d0e076f0eda736b330f5f792aa2e2991" dependencies = [ "hash-db 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2664,9 +2664,9 @@ dependencies = [ "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", - "substrate-panic-handler 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "substrate-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", - "substrate-trie 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)", + "substrate-panic-handler 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "substrate-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "substrate-trie 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", "trie-db 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)", "trie-root 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2674,7 +2674,7 @@ dependencies = [ [[package]] name = "substrate-telemetry" version = "1.0.0" -source = "git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7#59d5ec144704cec017a01f3e4dbb6b73c5542bf7" +source = "git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991#89bbb7b6d0e076f0eda736b330f5f792aa2e2991" dependencies = [ "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2692,7 +2692,7 @@ dependencies = [ [[package]] name = "substrate-trie" version = "1.0.0" -source = "git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7#59d5ec144704cec017a01f3e4dbb6b73c5542bf7" +source = "git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991#89bbb7b6d0e076f0eda736b330f5f792aa2e2991" dependencies = [ "hash-db 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)", "memory-db 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3423,28 +3423,28 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)" = "c4488ae950c49d403731982257768f48fada354a5203fe81f9bb6f43ca9002be" "checksum snow 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "5a64f02fd208ef15bd2d1a65861df4707e416151e1272d02c8faafad1c138100" "checksum spin 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "44363f6f51401c34e7be73db0db371c04705d35efbe9f7d6082e03a921a32c55" -"checksum sr-api-macros 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)" = "" -"checksum sr-io 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)" = "" -"checksum sr-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)" = "" -"checksum sr-std 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)" = "" -"checksum sr-version 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)" = "" -"checksum srml-aura 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)" = "" -"checksum srml-balances 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)" = "" -"checksum srml-consensus 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)" = "" -"checksum srml-executive 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)" = "" -"checksum srml-finality-tracker 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)" = "" -"checksum srml-grandpa 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)" = "" -"checksum srml-indices 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)" = "" -"checksum srml-metadata 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)" = "" -"checksum srml-session 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)" = "" -"checksum srml-staking 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)" = "" -"checksum srml-sudo 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)" = "" -"checksum srml-support 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)" = "" -"checksum srml-support-procedural 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)" = "" -"checksum srml-support-procedural-tools 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)" = "" -"checksum srml-support-procedural-tools-derive 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)" = "" -"checksum srml-system 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)" = "" -"checksum srml-timestamp 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)" = "" +"checksum sr-api-macros 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)" = "" +"checksum sr-io 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)" = "" +"checksum sr-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)" = "" +"checksum sr-std 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)" = "" +"checksum sr-version 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)" = "" +"checksum srml-aura 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)" = "" +"checksum srml-balances 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)" = "" +"checksum srml-consensus 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)" = "" +"checksum srml-executive 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)" = "" +"checksum srml-finality-tracker 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)" = "" +"checksum srml-grandpa 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)" = "" +"checksum srml-indices 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)" = "" +"checksum srml-metadata 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)" = "" +"checksum srml-session 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)" = "" +"checksum srml-staking 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)" = "" +"checksum srml-sudo 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)" = "" +"checksum srml-support 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)" = "" +"checksum srml-support-procedural 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)" = "" +"checksum srml-support-procedural-tools 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)" = "" +"checksum srml-support-procedural-tools-derive 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)" = "" +"checksum srml-system 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)" = "" +"checksum srml-timestamp 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)" = "" "checksum stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dba1a27d3efae4351c8051072d619e3ade2820635c3958d826bfea39d59b54c8" "checksum static_assertions 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "c19be23126415861cb3a23e501d34a708f7f9b2183c5252d690941c2e69199d5" "checksum static_slice 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "92a7e0c5e3dfb52e8fbe0e63a1b947bbb17b4036408b151353c4491374931362" @@ -3456,21 +3456,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum strum 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1810e25f576e7ffce1ff5243b37066da5ded0310b3274c20baaeccb1145b2806" "checksum strum_macros 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)" = "572a2f4e53dd4c3483fd79e5cc10ddd773a3acb1169bbfe8762365e107110579" "checksum substrate-bip39 0.2.1 (git+https://github.com/paritytech/substrate-bip39)" = "" -"checksum substrate-client 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)" = "" -"checksum substrate-consensus-aura-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)" = "" -"checksum substrate-consensus-authorities 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)" = "" -"checksum substrate-consensus-common 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)" = "" -"checksum substrate-executor 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)" = "" -"checksum substrate-finality-grandpa-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)" = "" -"checksum substrate-inherents 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)" = "" -"checksum substrate-keyring 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)" = "" -"checksum substrate-offchain-primitives 0.1.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)" = "" -"checksum substrate-panic-handler 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)" = "" -"checksum substrate-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)" = "" -"checksum substrate-serializer 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)" = "" -"checksum substrate-state-machine 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)" = "" -"checksum substrate-telemetry 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)" = "" -"checksum substrate-trie 1.0.0 (git+https://github.com/joystream/substrate.git?rev=59d5ec144704cec017a01f3e4dbb6b73c5542bf7)" = "" +"checksum substrate-client 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)" = "" +"checksum substrate-consensus-aura-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)" = "" +"checksum substrate-consensus-authorities 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)" = "" +"checksum substrate-consensus-common 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)" = "" +"checksum substrate-executor 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)" = "" +"checksum substrate-finality-grandpa-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)" = "" +"checksum substrate-inherents 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)" = "" +"checksum substrate-keyring 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)" = "" +"checksum substrate-offchain-primitives 0.1.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)" = "" +"checksum substrate-panic-handler 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)" = "" +"checksum substrate-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)" = "" +"checksum substrate-serializer 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)" = "" +"checksum substrate-state-machine 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)" = "" +"checksum substrate-telemetry 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)" = "" +"checksum substrate-trie 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)" = "" "checksum subtle 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2d67a5a62ba6e01cb2192ff309324cb4875d0c451d55fe2319433abe7a05a8ee" "checksum subtle 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "702662512f3ddeb74a64ce2fbbf3707ee1b6bb663d28bb054e0779bbc720d926" "checksum syn 0.15.29 (registry+https://github.com/rust-lang/crates.io-index)" = "1825685f977249735d510a242a6727b46efe914bb67e38d30c071b1b72b1d5c2" diff --git a/wasm/Cargo.toml b/wasm/Cargo.toml index 625bcaf2b7..529e875ebd 100644 --- a/wasm/Cargo.toml +++ b/wasm/Cargo.toml @@ -11,6 +11,7 @@ crate-type = ['cdylib'] [features] default = [] std = ['joystream-node-runtime/std'] + [dependencies.joystream-node-runtime] default-features = false path = '..' From 74c8e0acb53795c6fdaadf6de199d3a81c5dab66 Mon Sep 17 00:00:00 2001 From: Alex Siman Date: Tue, 9 Apr 2019 20:02:27 +0300 Subject: [PATCH 166/175] WIP: Refactor a storage module and integrate it with UI --- src/lib.rs | 69 ++--- src/storage/content_directory.rs | 201 ------------- src/storage/data_directory.rs | 311 +++++++++++++++----- src/storage/data_object_storage_registry.rs | 41 ++- src/storage/data_object_type_registry.rs | 72 +++-- src/storage/downloads.rs | 1 + src/storage/mock.rs | 20 +- src/storage/mod.rs | 1 - 8 files changed, 348 insertions(+), 368 deletions(-) delete mode 100644 src/storage/content_directory.rs diff --git a/src/lib.rs b/src/lib.rs index 73e8646f10..c4ae6835db 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -18,7 +18,7 @@ pub mod governance; use governance::{council, election, proposals}; pub mod storage; use storage::{ - content_directory, data_directory, data_object_storage_registry, data_object_type_registry, + data_directory, data_object_storage_registry, data_object_type_registry, downloads, }; mod membership; @@ -60,8 +60,8 @@ pub use timestamp::Call as TimestampCall; /// Alias to Ed25519 pubkey that identifies an account on the chain. pub type AccountId = primitives::H256; -/// Alias for ContentId, used in various places -pub type ContentId = u64; +/// Alias for ContentId, used in various places. +pub type ContentId = primitives::H256; /// A hash of some data used by the chain. pub type Hash = primitives::H256; @@ -251,6 +251,7 @@ impl storage::data_object_type_registry::Trait for Runtime { impl storage::data_directory::Trait for Runtime { type Event = Event; type ContentId = ContentId; + type SchemaId = u64; type Members = Members; type Roles = Actors; type IsActiveDataObjectType = DataObjectTypeRegistry; @@ -270,13 +271,6 @@ impl storage::data_object_storage_registry::Trait for Runtime { type ContentIdExists = DataDirectory; } -impl storage::content_directory::Trait for Runtime { - type Event = Event; - type MetadataId = u64; - type SchemaId = u64; - type Members = Members; -} - impl members::Trait for Runtime { type Event = Event; type MemberId = u64; @@ -295,34 +289,33 @@ impl actors::Trait for Runtime { } construct_runtime!( - pub enum Runtime with Log(InternalLog: DigestItem) where - Block = Block, - NodeBlock = opaque::Block, - UncheckedExtrinsic = UncheckedExtrinsic - { - System: system::{default, Log(ChangesTrieRoot)}, - Timestamp: timestamp::{Module, Call, Storage, Config, Inherent}, - Consensus: consensus::{Module, Call, Storage, Config, Log(AuthoritiesChange), Inherent}, - Aura: aura::{Module, Inherent(Timestamp)}, - Indices: indices, - Balances: balances, - Session: session, - Staking: staking::{default, OfflineWorker}, - Fees: fees::{Module, Storage, Config, Event}, - Sudo: sudo, - Proposals: proposals::{Module, Call, Storage, Event, Config}, - CouncilElection: election::{Module, Call, Storage, Event, Config}, - Council: council::{Module, Call, Storage, Event, Config}, - Memo: memo::{Module, Call, Storage, Event}, - Members: members::{Module, Call, Storage, Event, Config}, - Migration: migration::{Module, Call, Storage, Event}, - Actors: actors::{Module, Call, Storage, Event}, - DataObjectTypeRegistry: data_object_type_registry::{Module, Call, Storage, Event, Config}, - DataDirectory: data_directory::{Module, Call, Storage, Event}, - DataObjectStorageRegistry: data_object_storage_registry::{Module, Call, Storage, Event, Config}, - DownloadSessions: downloads::{Module, Call, Storage, Event, Config}, - ContentDirectory: content_directory::{Module, Call, Storage, Event, Config}, - } + pub enum Runtime with Log(InternalLog: DigestItem) where + Block = Block, + NodeBlock = opaque::Block, + UncheckedExtrinsic = UncheckedExtrinsic + { + System: system::{default, Log(ChangesTrieRoot)}, + Timestamp: timestamp::{Module, Call, Storage, Config, Inherent}, + Consensus: consensus::{Module, Call, Storage, Config, Log(AuthoritiesChange), Inherent}, + Aura: aura::{Module, Inherent(Timestamp)}, + Indices: indices, + Balances: balances, + Session: session, + Staking: staking::{default, OfflineWorker}, + Fees: fees::{Module, Storage, Config, Event}, + Sudo: sudo, + Proposals: proposals::{Module, Call, Storage, Event, Config}, + CouncilElection: election::{Module, Call, Storage, Event, Config}, + Council: council::{Module, Call, Storage, Event, Config}, + Memo: memo::{Module, Call, Storage, Event}, + Members: members::{Module, Call, Storage, Event, Config}, + Migration: migration::{Module, Call, Storage, Event}, + Actors: actors::{Module, Call, Storage, Event}, + DataObjectTypeRegistry: data_object_type_registry::{Module, Call, Storage, Event, Config}, + DataDirectory: data_directory::{Module, Call, Storage, Event}, + DataObjectStorageRegistry: data_object_storage_registry::{Module, Call, Storage, Event, Config}, + DownloadSessions: downloads::{Module, Call, Storage, Event, Config}, + } ); /// The type used as a helper for interpreting the sender of transactions. diff --git a/src/storage/content_directory.rs b/src/storage/content_directory.rs deleted file mode 100644 index a66b13ee4d..0000000000 --- a/src/storage/content_directory.rs +++ /dev/null @@ -1,201 +0,0 @@ -#![cfg_attr(not(feature = "std"), no_std)] - -use crate::storage::data_object_type_registry::Trait as DOTRTrait; -use crate::traits::Members; -use parity_codec::Codec; -use parity_codec_derive::{Decode, Encode}; -use rstd::prelude::*; -use runtime_primitives::traits::{As, MaybeDebug, MaybeSerializeDebug, Member, SimpleArithmetic}; -use srml_support::{ - decl_event, decl_module, decl_storage, ensure, Parameter, StorageMap, StorageValue, -}; -use system::{self, ensure_signed}; - -pub trait Trait: timestamp::Trait + system::Trait + DOTRTrait + MaybeDebug { - type Event: From> + Into<::Event>; - - type MetadataId: Parameter - + Member - + SimpleArithmetic - + Codec - + Default - + Copy - + As - + As - + MaybeSerializeDebug - + PartialEq; - - // Schema ID should be defined in a different Trait in future - type SchemaId: Parameter - + Member - + SimpleArithmetic - + Codec - + Default - + Copy - + As - + As - + MaybeSerializeDebug - + PartialEq; - - type Members: Members; -} - -static MSG_CREATOR_MUST_BE_MEMBER: &str = "Only active members may create content!"; -// TODO for future: static MSG_INVALID_SCHEMA_ID: &str = "The metadata schema is not known or invalid!"; -static MSG_METADATA_NOT_FOUND: &str = "Metadata with the given ID cannot be found!"; -static MSG_ONLY_OWNER_MAY_PUBLISH: &str = "Only metadata owners may publish their metadata!"; - -const DEFAULT_FIRST_METADATA_ID: u64 = 1; - -#[derive(Clone, Encode, Decode, PartialEq)] -#[cfg_attr(feature = "std", derive(Debug))] -pub enum MetadataState { - Draft, - Published, -} - -impl Default for MetadataState { - fn default() -> Self { - MetadataState::Draft - } -} - -// Content metadata contains two fields: one is the numeric ID of the metadata -// scheme to use, which is currently related to off-chain definitions ONLY. -// The other is the serialized metadata. -#[derive(Clone, Encode, Decode, PartialEq)] -#[cfg_attr(feature = "std", derive(Debug))] -pub struct ContentMetadata { - pub schema: T::SchemaId, - pub metadata: Vec, - pub origin: T::AccountId, - pub state: MetadataState, -} - -decl_event! { - pub enum Event where - ::MetadataId - { - MetadataDraftCreated(MetadataId), - MetadataPublished(MetadataId), - } -} - -decl_storage! { - trait Store for Module as ContentDirectory { - // Start at this value - pub FirstMetadataId get(first_metadata_id) config(first_metadata_id): T::MetadataId = T::MetadataId::sa(DEFAULT_FIRST_METADATA_ID); - - // Increment - pub NextMetadataId get(next_metadata_id) build(|config: &GenesisConfig| config.first_metadata_id): T::MetadataId = T::MetadataId::sa(DEFAULT_FIRST_METADATA_ID); - - // Mapping of Data object types - pub MetadataMap get(metadata): map T::MetadataId => Option>; - } -} - -decl_module! { - pub struct Module for enum Call where origin: T::Origin { - fn deposit_event() = default; - - pub fn add_metadata(origin, schema: T::SchemaId, metadata: Vec) - { - // Origin has to be a member - let who = ensure_signed(origin)?; - ensure!(T::Members::is_active_member(&who), MSG_CREATOR_MUST_BE_MEMBER); - - // TODO in future, we want the schema IDs to correspond to a schema - // registry, and validate the data. For now, we just allow the - // following schema IDs: - // 1 - Video (schema TBD, i.e. handled in UI only) - // 2 - Podcast (schema TBD, i.e. handled in UI only) - // Pseudocode - // if schema not in (1, 2) { - // return Err(MSG_INVALID_SCHEMA_ID); - // } - // - // See https://github.com/Joystream/substrate-runtime-joystream/issues/20 - - // New and data - let new_id = Self::next_metadata_id(); - let data: ContentMetadata = ContentMetadata { - origin: who.clone(), - schema: schema, - metadata: metadata.clone(), - state: MetadataState::Draft, - }; - - // Store - >::insert(new_id, data); - >::mutate(|n| { *n += T::MetadataId::sa(1); }); - - // Publish event - Self::deposit_event(RawEvent::MetadataDraftCreated(new_id)); - } - - pub fn publish_metadata(origin, id: T::MetadataId) - { - // Ensure signed account - let who = ensure_signed(origin)?; - - // Try t find metadata - let mut data = Self::metadata(id).ok_or(MSG_METADATA_NOT_FOUND)?; - - // Ensure it's the metadata creator who publishes - ensure!(data.origin == who, MSG_ONLY_OWNER_MAY_PUBLISH); - - // Modify - data.state = MetadataState::Published; - - // Store - >::insert(id, data); - - // Publish event - Self::deposit_event(RawEvent::MetadataPublished(id)); - } - } -} - -#[cfg(test)] -mod tests { - use crate::storage::mock::*; - - #[test] - fn add_metadata() { - with_default_mock_builder(|| { - let res = - TestContentDirectory::add_metadata(Origin::signed(1), 1, "foo".as_bytes().to_vec()); - assert!(res.is_ok()); - }); - } - - #[test] - fn publish_metadata() { - with_default_mock_builder(|| { - let res = - TestContentDirectory::add_metadata(Origin::signed(1), 1, "foo".as_bytes().to_vec()); - assert!(res.is_ok()); - - // Grab ID from event - let metadata_id = match System::events().last().unwrap().event { - MetaEvent::content_directory( - content_directory::RawEvent::MetadataDraftCreated(metadata_id), - ) => metadata_id, - _ => 0xdeadbeefu64, // invalid value, unlikely to match - }; - assert_ne!(metadata_id, 0xdeadbeefu64); - - // Publishing a bad ID should fail - let res = TestContentDirectory::publish_metadata(Origin::signed(1), metadata_id + 1); - assert!(res.is_err()); - - // Publishing should not work for non-owners - let res = TestContentDirectory::publish_metadata(Origin::signed(2), metadata_id); - assert!(res.is_err()); - - // For the owner, it should work however - let res = TestContentDirectory::publish_metadata(Origin::signed(1), metadata_id); - assert!(res.is_ok()); - }); - } -} diff --git a/src/storage/data_directory.rs b/src/storage/data_directory.rs index a345f40a49..d54c510a69 100644 --- a/src/storage/data_directory.rs +++ b/src/storage/data_directory.rs @@ -5,9 +5,8 @@ use crate::storage::data_object_type_registry::Trait as DOTRTrait; use crate::traits::{ContentIdExists, IsActiveDataObjectType, Members, Roles}; use parity_codec::Codec; use parity_codec_derive::{Decode, Encode}; -use primitives::Ed25519AuthorityId; use rstd::prelude::*; -use runtime_primitives::traits::{As, MaybeDebug, MaybeSerializeDebug, Member, SimpleArithmetic}; +use runtime_primitives::traits::{As, MaybeDebug, MaybeSerializeDebug, Member, MaybeDisplay, SimpleArithmetic}; use srml_support::{ decl_event, decl_module, decl_storage, dispatch, ensure, Parameter, StorageMap, StorageValue, }; @@ -16,16 +15,10 @@ use system::{self, ensure_signed}; pub trait Trait: timestamp::Trait + system::Trait + DOTRTrait + MaybeDebug { type Event: From> + Into<::Event>; - type ContentId: Parameter - + Member - + SimpleArithmetic - + Codec - + Default - + Copy - + As - + As - + MaybeSerializeDebug - + PartialEq; + type ContentId: Parameter + Member + MaybeSerializeDebug + MaybeDisplay + Copy + Ord + Default; + + type SchemaId: Parameter + Member + SimpleArithmetic + Codec + Default + Copy + + As + As + MaybeSerializeDebug + PartialEq; type Members: Members; type Roles: Roles; @@ -38,14 +31,19 @@ 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."; -const DEFAULT_FIRST_CONTENT_ID: u64 = 1; +#[derive(Clone, Encode, Decode, PartialEq)] +#[cfg_attr(feature = "std", derive(Debug))] +pub struct BlockAndTime { + pub block: T::BlockNumber, + pub time: T::Moment, +} #[derive(Clone, Encode, Decode, PartialEq)] #[cfg_attr(feature = "std", derive(Debug))] pub enum LiaisonJudgement { Pending, - Rejected, Accepted, + Rejected, } impl Default for LiaisonJudgement { @@ -57,26 +55,68 @@ impl Default for LiaisonJudgement { #[derive(Clone, Encode, Decode, PartialEq)] #[cfg_attr(feature = "std", derive(Debug))] pub struct DataObject { - pub data_object_type: ::DataObjectTypeId, - pub signing_key: Option, - pub size: u64, - pub added_at_block: T::BlockNumber, - pub added_at_time: T::Moment, pub owner: T::AccountId, + pub added_at: BlockAndTime, + pub type_id: ::DataObjectTypeId, + pub size: u64, pub liaison: T::AccountId, pub liaison_judgement: LiaisonJudgement, + + // TODO signing_key: public key supplied by the uploader, + // they sigh the content with this key + + // TODO add support for this field (Some if judgment == Rejected) + // pub rejection_reason: Option>, +} + +#[derive(Clone, Encode, Decode, PartialEq)] +#[cfg_attr(feature = "std", derive(Debug))] +// TODO ContentVisibility +pub enum ContentVisibility { + Draft, // TODO rename to Unlisted? + Public, +} + +impl Default for ContentVisibility { + fn default() -> Self { + ContentVisibility::Draft // TODO make Public by default? + } +} + +#[derive(Clone, Encode, Decode, PartialEq)] +#[cfg_attr(feature = "std", derive(Debug))] +pub struct ContentMetadata { + pub owner: T::AccountId, + pub added_at: BlockAndTime, + pub children_ids: Vec, + pub visibility: ContentVisibility, + pub schema: T::SchemaId, + pub json: Vec, +} + +#[derive(Clone, Encode, Decode, PartialEq)] +#[cfg_attr(feature = "std", derive(Debug))] +pub struct ContentMetadataUpdate { + pub children_ids: Option>, + pub visibility: Option, + pub schema: Option, + pub json: Option>, } decl_storage! { trait Store for Module as DataDirectory { - // Start at this value - pub FirstContentId get(first_content_id) config(first_content_id): T::ContentId = T::ContentId::sa(DEFAULT_FIRST_CONTENT_ID); - // Increment - pub NextContentId get(next_content_id) build(|config: &GenesisConfig| config.first_content_id): T::ContentId = T::ContentId::sa(DEFAULT_FIRST_CONTENT_ID); + // TODO default_liaison = Joystream storage account id. + + // TODO this list of ids should be moved off-chain once we have Content Indexer. + // TODO deprecated, moved tp storage relationship + KnownContentIds get(known_content_ids): Vec = vec![]; - // Mapping of Content ID to Data Object - pub Contents get(contents): map T::ContentId => Option>; + DataObjectByContentId get(data_object_by_content_id): + map T::ContentId => Option>; + + MetadataByContentId get(metadata_by_content_id): + map T::ContentId => Option>; } } @@ -85,25 +125,16 @@ decl_event! { ::ContentId, ::AccountId { - // The account is the Liaison that was selected + // The account is the one who uploaded the content. ContentAdded(ContentId, AccountId), - // The account is the liaison again - only they can reject or accept + // The account is the liaison - only they can reject or accept ContentAccepted(ContentId, AccountId), ContentRejected(ContentId, AccountId), - } -} -impl ContentIdExists for Module { - fn has_content(which: &T::ContentId) -> bool { - Self::contents(which.clone()).is_some() - } - - fn get_data_object(which: &T::ContentId) -> Result, &'static str> { - match Self::contents(which.clone()) { - None => Err(MSG_CID_NOT_FOUND), - Some(data) => Ok(data), - } + // The account is the owner of the content. + MetadataAdded(ContentId, AccountId), + MetadataUpdated(ContentId, AccountId), } } @@ -111,71 +142,170 @@ decl_module! { pub struct Module for enum Call where origin: T::Origin { fn deposit_event() = default; - pub fn add_content(origin, data_object_type_id: ::DataObjectTypeId, - size: u64, signing_key: Option) { - // Origin has to be a member + // TODO send file_name as param so we could create a Draft metadata in this fn + pub fn add_content( + origin, + content_id: T::ContentId, + type_id: ::DataObjectTypeId, + size: u64 + ) { let who = ensure_signed(origin)?; ensure!(T::Members::is_active_member(&who), MSG_CREATOR_MUST_BE_MEMBER); - // Data object type has to be active - ensure!(T::IsActiveDataObjectType::is_active_data_object_type(&data_object_type_id), MSG_DO_TYPE_MUST_BE_ACTIVE); + ensure!(T::IsActiveDataObjectType::is_active_data_object_type(&type_id), + MSG_DO_TYPE_MUST_BE_ACTIVE); + + ensure!(!>::exists(content_id), + "Data object aready added under this content id"); // The liaison is something we need to take from staked roles. The idea // is to select the liaison, for now randomly. let liaison = T::Roles::random_account_for_role(actors::Role::Storage)?; // Let's create the entry then - let new_id = Self::next_content_id(); let data: DataObject = DataObject { - data_object_type: data_object_type_id, - signing_key: signing_key, - size: size, - added_at_block: >::block_number(), - added_at_time: >::now(), - owner: who, - liaison: liaison.clone(), + type_id, + size, + added_at: Self::current_block_and_time(), + owner: who.clone(), + liaison: liaison, liaison_judgement: LiaisonJudgement::Pending, }; - // If we've constructed the data, we can store it and send an event. - >::insert(new_id, data); - >::mutate(|n| { *n += T::ContentId::sa(1); }); - - Self::deposit_event(RawEvent::ContentAdded(new_id, liaison)); + >::insert(&content_id, data); + Self::deposit_event(RawEvent::ContentAdded(content_id, who)); } // The LiaisonJudgement can be updated, but only by the liaison. - fn accept_content(origin, id: T::ContentId) { + fn accept_content(origin, content_id: T::ContentId) { + let who = ensure_signed(origin)?; + Self::update_content_judgement(&who, content_id.clone(), LiaisonJudgement::Accepted)?; + Self::deposit_event(RawEvent::ContentAccepted(content_id, who)); + } + + fn reject_content(origin, content_id: T::ContentId) { + let who = ensure_signed(origin)?; + Self::update_content_judgement(&who, content_id.clone(), LiaisonJudgement::Rejected)?; + Self::deposit_event(RawEvent::ContentRejected(content_id, who)); + } + + fn add_metadata( + origin, + content_id: T::ContentId, + update: ContentMetadataUpdate + ) { let who = ensure_signed(origin)?; - Self::update_content_judgement(&who, id.clone(), LiaisonJudgement::Accepted)?; - Self::deposit_event(RawEvent::ContentAccepted(id, who)); + ensure!(T::Members::is_active_member(&who), + "Only active members can add content metadata"); + + ensure!(!>::exists(&content_id), + "Metadata aready added under this content id"); + + let schema = update.schema.ok_or("Schema is required")?; + Self::validate_metadata_schema(&schema)?; + + let json = update.json.ok_or("JSON is required")?; + Self::validate_metadata_json(&json)?; + + let meta = ContentMetadata { + owner: who.clone(), + added_at: Self::current_block_and_time(), + children_ids: vec![], + visibility: update.visibility.unwrap_or_default(), + schema, + json, + }; + + // TODO temporary hack!!! + // TODO create Storage Relationship. ready = true + + >::insert(&content_id, meta); + >::mutate(|ids| ids.push(content_id)); + Self::deposit_event(RawEvent::MetadataAdded(content_id, who)); } - fn reject_content(origin, id: T::ContentId) { + fn update_metadata( + origin, + content_id: T::ContentId, + update: ContentMetadataUpdate + ) { let who = ensure_signed(origin)?; - Self::update_content_judgement(&who, id.clone(), LiaisonJudgement::Rejected)?; - Self::deposit_event(RawEvent::ContentRejected(id, who)); + + // Even if origin is an owner of metadata, they stil need to be an active member. + ensure!(T::Members::is_active_member(&who), + "Only active members can update content metadata"); + + let has_updates = update.schema.is_some() || update.json.is_some(); + ensure!(has_updates, "No updates provided"); + + let mut meta = Self::metadata_by_content_id(&content_id) + .ok_or("No metadata found by content id")?; + + ensure!(meta.owner == who.clone(), "Only owner can update content metadata"); + + if let Some(schema) = update.schema { + Self::validate_metadata_schema(&schema)?; + meta.schema = schema; + } + if let Some(json) = update.json { + Self::validate_metadata_json(&json)?; + meta.json = json; + } + if let Some(visibility) = update.visibility { + meta.visibility = visibility; + } + + >::insert(&content_id, meta); + Self::deposit_event(RawEvent::MetadataUpdated(content_id, who)); + } + } +} + +impl ContentIdExists for Module { + + fn has_content(content_id: &T::ContentId) -> bool { + Self::data_object_by_content_id(content_id.clone()).is_some() + } + + fn get_data_object(content_id: &T::ContentId) -> Result, &'static str> { + match Self::data_object_by_content_id(content_id.clone()) { + Some(data) => Ok(data), + None => Err(MSG_CID_NOT_FOUND), } } } impl Module { + + fn current_block_and_time() -> BlockAndTime { + BlockAndTime { + block: >::block_number(), + time: >::now(), + } + } + + fn validate_metadata_schema(_schema: &T::SchemaId) -> dispatch::Result { + // TODO validate that schema id is registered. + Ok(()) + } + + fn validate_metadata_json(_json: &Vec) -> dispatch::Result { + // TODO validate a max length of JSON. + Ok(()) + } + fn update_content_judgement( who: &T::AccountId, - id: T::ContentId, + content_id: T::ContentId, judgement: LiaisonJudgement, ) -> dispatch::Result { - // Find the data - let mut data = Self::contents(&id).ok_or(MSG_CID_NOT_FOUND)?; + let mut data = Self::data_object_by_content_id(&content_id).ok_or(MSG_CID_NOT_FOUND)?; // Make sure the liaison matches ensure!(data.liaison == *who, MSG_LIAISON_REQUIRED); - // At this point we can update the data. data.liaison_judgement = judgement; - - // Update and send event. - >::insert(id, data); + >::insert(content_id, data); Ok(()) } @@ -247,4 +377,45 @@ mod tests { assert!(res.is_ok()); }); } + + // TODO update and add more tests for metadata + + // #[test] + // fn add_metadata() { + // with_default_mock_builder(|| { + // let res = + // TestContentDirectory::add_metadata(Origin::signed(1), 1, "foo".as_bytes().to_vec()); + // assert!(res.is_ok()); + // }); + // } + + // #[test] + // fn publish_metadata() { + // with_default_mock_builder(|| { + // let res = + // TestContentDirectory::add_metadata(Origin::signed(1), 1, "foo".as_bytes().to_vec()); + // assert!(res.is_ok()); + + // // Grab ID from event + // let metadata_id = match System::events().last().unwrap().event { + // MetaEvent::content_directory( + // content_directory::RawEvent::MetadataDraftCreated(metadata_id), + // ) => metadata_id, + // _ => 0xdeadbeefu64, // invalid value, unlikely to match + // }; + // assert_ne!(metadata_id, 0xdeadbeefu64); + + // // Publishing a bad ID should fail + // let res = TestContentDirectory::publish_metadata(Origin::signed(1), metadata_id + 1); + // assert!(res.is_err()); + + // // Publishing should not work for non-owners + // let res = TestContentDirectory::publish_metadata(Origin::signed(2), metadata_id); + // assert!(res.is_err()); + + // // For the owner, it should work however + // let res = TestContentDirectory::publish_metadata(Origin::signed(1), metadata_id); + // assert!(res.is_ok()); + // }); + // } } diff --git a/src/storage/data_object_storage_registry.rs b/src/storage/data_object_storage_registry.rs index c55a22e8c2..bc3597f9a5 100644 --- a/src/storage/data_object_storage_registry.rs +++ b/src/storage/data_object_storage_registry.rs @@ -15,16 +15,9 @@ use system::{self, ensure_signed}; pub trait Trait: timestamp::Trait + system::Trait + DDTrait + MaybeDebug { type Event: From> + Into<::Event>; - type DataObjectStorageRelationshipId: Parameter - + Member - + SimpleArithmetic - + Codec - + Default - + Copy - + As - + As - + MaybeSerializeDebug - + PartialEq; + // TODO deprecated + type DataObjectStorageRelationshipId: Parameter + Member + SimpleArithmetic + Codec + + Default + Copy + As + As + MaybeSerializeDebug + PartialEq; type Members: Members; type Roles: Roles; @@ -38,8 +31,10 @@ static MSG_ONLY_STORAGE_PROVIDER_MAY_CREATE_DOSR: &str = static MSG_ONLY_STORAGE_PROVIDER_MAY_CLAIM_READY: &str = "Only the storage provider in a DOSR can decide whether they're ready."; +// TODO deprecated const DEFAULT_FIRST_RELATIONSHIP_ID: u64 = 1; +// TODO deprecated #[derive(Clone, Encode, Decode, PartialEq)] #[cfg_attr(feature = "std", derive(Debug))] pub struct DataObjectStorageRelationship { @@ -50,17 +45,35 @@ pub struct DataObjectStorageRelationship { decl_storage! { trait Store for Module as DataObjectStorageRegistry { + + // TODO deprecated // Start at this value pub FirstRelationshipId get(first_relationship_id) config(first_relationship_id): T::DataObjectStorageRelationshipId = T::DataObjectStorageRelationshipId::sa(DEFAULT_FIRST_RELATIONSHIP_ID); + // TODO deprecated // Increment pub NextRelationshipId get(next_relationship_id) build(|config: &GenesisConfig| config.first_relationship_id): T::DataObjectStorageRelationshipId = T::DataObjectStorageRelationshipId::sa(DEFAULT_FIRST_RELATIONSHIP_ID); + // TODO deprecated // Mapping of Data object types pub Relationships get(relationships): map T::DataObjectStorageRelationshipId => Option>; + // TODO deprecated // Keep a list of storage relationships per CID pub RelationshipsByContentId get(relationships_by_content_id): map T::ContentId => Vec; + + // ------------------------------------------ + // TODO use next storage items insteam: + + // TODO save only if metadata exists and there is at least one relation w/ ready == true. + ReadyContentIds get(ready_content_ids): Vec = vec![]; + + // TODO need? it can be expressed via StorageProvidersByContentId + pub StorageProviderServesContent get(storage_provider_serves_content): + map (T::AccountId, T::ContentId) => bool; + + pub StorageProvidersByContentId get(storage_providers_by_content_id): + map T::ContentId => Vec; } } @@ -70,12 +83,19 @@ decl_event! { ::DataObjectStorageRelationshipId, ::AccountId { + // TODO deprecated DataObjectStorageRelationshipAdded(DataObjectStorageRelationshipId, ContentId, AccountId), DataObjectStorageRelationshipReadyUpdated(DataObjectStorageRelationshipId, bool), + + // NEW & COOL + StorageProviderAddedContent(AccountId, ContentId), + StorageProviderRemovedContent(AccountId, ContentId), } } impl ContentHasStorage for Module { + + // TODO deprecated fn has_storage_provider(which: &T::ContentId) -> bool { let dosr_list = Self::relationships_by_content_id(which); return dosr_list.iter().any(|&dosr_id| { @@ -88,6 +108,7 @@ impl ContentHasStorage for Module { }); } + // TODO deprecated fn is_ready_at_storage_provider(which: &T::ContentId, provider: &T::AccountId) -> bool { let dosr_list = Self::relationships_by_content_id(which); return dosr_list.iter().any(|&dosr_id| { diff --git a/src/storage/data_object_type_registry.rs b/src/storage/data_object_type_registry.rs index 9a290cfd2e..0e7c23d59d 100644 --- a/src/storage/data_object_type_registry.rs +++ b/src/storage/data_object_type_registry.rs @@ -6,25 +6,20 @@ use parity_codec_derive::{Decode, Encode}; use rstd::prelude::*; use runtime_primitives::traits::{As, MaybeDebug, MaybeSerializeDebug, Member, SimpleArithmetic}; use srml_support::{decl_event, decl_module, decl_storage, Parameter, StorageMap, StorageValue}; -use system::{self, ensure_root}; pub trait Trait: system::Trait + MaybeDebug { type Event: From> + Into<::Event>; - type DataObjectTypeId: Parameter - + Member - + SimpleArithmetic - + Codec - + Default - + Copy - + As - + As - + MaybeSerializeDebug - + PartialEq; + type DataObjectTypeId: Parameter + Member + SimpleArithmetic + Codec + Default + Copy + + As + As + MaybeSerializeDebug + PartialEq; } static MSG_DO_TYPE_NOT_FOUND: &str = "Data Object Type with the given ID not found."; +const DEFAULT_TYPE_DESCRIPTION: &str = "Default data object type for audio and video content."; +const DEFAULT_TYPE_ACTIVE: bool = true; +const CREATE_DETAULT_TYPE: bool = true; + const DEFAULT_FIRST_DATA_OBJECT_TYPE_ID: u64 = 1; #[derive(Clone, Encode, Decode, PartialEq)] @@ -38,8 +33,20 @@ pub struct DataObjectType { // - storage tranches (empty is ok) } +impl Default for DataObjectType { + fn default() -> Self { + DataObjectType { + description: DEFAULT_TYPE_DESCRIPTION.as_bytes().to_vec(), + active: DEFAULT_TYPE_ACTIVE, + } + } +} + decl_storage! { trait Store for Module as DataObjectTypeRegistry { + + // TODO hardcode data object type for ID 1 + // Start at this value pub FirstDataObjectTypeId get(first_data_object_type_id) config(first_data_object_type_id): T::DataObjectTypeId = T::DataObjectTypeId::sa(DEFAULT_FIRST_DATA_OBJECT_TYPE_ID); @@ -47,7 +54,7 @@ decl_storage! { pub NextDataObjectTypeId get(next_data_object_type_id) build(|config: &GenesisConfig| config.first_data_object_type_id): T::DataObjectTypeId = T::DataObjectTypeId::sa(DEFAULT_FIRST_DATA_OBJECT_TYPE_ID); // Mapping of Data object types - pub DataObjectTypeMap get(data_object_type): map T::DataObjectTypeId => Option; + pub DataObjectTypes get(data_object_types): map T::DataObjectTypeId => Option; } } @@ -72,29 +79,38 @@ decl_module! { pub struct Module for enum Call where origin: T::Origin { fn deposit_event() = default; - pub fn register_data_object_type(origin, data_object_type: DataObjectType) { - ensure_root(origin)?; + fn on_initialise() { + // Create a default data object type if it was not created yet. + if CREATE_DETAULT_TYPE && !>::exists(Self::first_data_object_type_id()) { + let do_type: DataObjectType = DataObjectType::default(); + let new_type_id = Self::next_data_object_type_id(); + >::insert(new_type_id, do_type); + >::mutate(|n| { *n += T::DataObjectTypeId::sa(1); }); + } + } + + pub fn register_data_object_type(data_object_type: DataObjectType) { let new_do_type_id = Self::next_data_object_type_id(); let do_type: DataObjectType = DataObjectType { description: data_object_type.description.clone(), active: data_object_type.active, }; - >::insert(new_do_type_id, do_type); + >::insert(new_do_type_id, do_type); >::mutate(|n| { *n += T::DataObjectTypeId::sa(1); }); Self::deposit_event(RawEvent::DataObjectTypeRegistered(new_do_type_id)); } - pub fn update_data_object_type(origin, id: T::DataObjectTypeId, data_object_type: DataObjectType) { - ensure_root(origin)?; + // TODO use DataObjectTypeUpdate + pub fn update_data_object_type(id: T::DataObjectTypeId, data_object_type: DataObjectType) { let mut do_type = Self::ensure_data_object_type(id)?; do_type.description = data_object_type.description.clone(); do_type.active = data_object_type.active; - >::insert(id, do_type); + >::insert(id, do_type); Self::deposit_event(RawEvent::DataObjectTypeUpdated(id)); } @@ -102,34 +118,32 @@ decl_module! { // Activate and deactivate functions as separate functions, because // toggling DO types is likely a more common operation than updating // other aspects. - pub fn activate_data_object_type(origin, id: T::DataObjectTypeId) { - ensure_root(origin)?; + // TODO deprecate or express via update_data_type + pub fn activate_data_object_type(id: T::DataObjectTypeId) { let mut do_type = Self::ensure_data_object_type(id)?; do_type.active = true; - >::insert(id, do_type); + >::insert(id, do_type); Self::deposit_event(RawEvent::DataObjectTypeUpdated(id)); } - pub fn deactivate_data_object_type(origin, id: T::DataObjectTypeId) { - ensure_root(origin)?; + pub fn deactivate_data_object_type(id: T::DataObjectTypeId) { let mut do_type = Self::ensure_data_object_type(id)?; do_type.active = false; - >::insert(id, do_type); + >::insert(id, do_type); Self::deposit_event(RawEvent::DataObjectTypeUpdated(id)); } - } } impl Module { fn ensure_data_object_type(id: T::DataObjectTypeId) -> Result { - return Self::data_object_type(&id).ok_or(MSG_DO_TYPE_NOT_FOUND); + return Self::data_object_types(&id).ok_or(MSG_DO_TYPE_NOT_FOUND); } } @@ -250,7 +264,7 @@ mod tests { ); // Retrieve, and ensure it's not active. - let data = TestDataObjectTypeRegistry::data_object_type(TEST_FIRST_DATA_OBJECT_TYPE_ID); + let data = TestDataObjectTypeRegistry::data_object_types(TEST_FIRST_DATA_OBJECT_TYPE_ID); assert!(data.is_some()); assert!(!data.unwrap().active); @@ -273,7 +287,7 @@ mod tests { ); // Ensure that the item is actually activated. - let data = TestDataObjectTypeRegistry::data_object_type(TEST_FIRST_DATA_OBJECT_TYPE_ID); + let data = TestDataObjectTypeRegistry::data_object_types(TEST_FIRST_DATA_OBJECT_TYPE_ID); assert!(data.is_some()); assert!(data.unwrap().active); @@ -283,7 +297,7 @@ mod tests { TEST_FIRST_DATA_OBJECT_TYPE_ID, ); assert!(res.is_ok()); - let data = TestDataObjectTypeRegistry::data_object_type(TEST_FIRST_DATA_OBJECT_TYPE_ID); + let data = TestDataObjectTypeRegistry::data_object_types(TEST_FIRST_DATA_OBJECT_TYPE_ID); assert!(data.is_some()); assert!(!data.unwrap().active); }); diff --git a/src/storage/downloads.rs b/src/storage/downloads.rs index 2c3770a97d..b0823a3677 100644 --- a/src/storage/downloads.rs +++ b/src/storage/downloads.rs @@ -64,6 +64,7 @@ pub struct DownloadSession { pub content_id: ::ContentId, pub consumer: T::AccountId, pub distributor: T::AccountId, + // TODO use BlockAndTime instead pub initiated_at_block: T::BlockNumber, pub initiated_at_time: T::Moment, pub state: DownloadState, diff --git a/src/storage/mock.rs b/src/storage/mock.rs index 0e7c12cf9a..9f20d9127b 100644 --- a/src/storage/mock.rs +++ b/src/storage/mock.rs @@ -1,7 +1,7 @@ #![cfg(test)] pub use super::{ - content_directory, data_directory, data_object_storage_registry, data_object_type_registry, + data_directory, data_object_storage_registry, data_object_type_registry, }; use crate::governance::GovernanceCurrency; use crate::roles::actors; @@ -27,7 +27,6 @@ impl_outer_event! { data_object_type_registry, data_directory, data_object_storage_registry, - content_directory, actors, balances, } @@ -153,13 +152,6 @@ impl data_object_storage_registry::Trait for Test { type ContentIdExists = MockContent; } -impl content_directory::Trait for Test { - type Event = MetaEvent; - type MetadataId = u64; - type SchemaId = u64; - type Members = MockMembers; -} - impl actors::Trait for Test { type Event = MetaEvent; type Members = MockMembers; @@ -267,15 +259,6 @@ impl ExtBuilder { .0, ); - t.extend( - content_directory::GenesisConfig:: { - first_metadata_id: self.first_metadata_id, - } - .build_storage() - .unwrap() - .0, - ); - t.into() } } @@ -286,7 +269,6 @@ pub type TestDataObjectType = data_object_type_registry::DataObjectType; pub type TestDataDirectory = data_directory::Module; // pub type TestDataObject = data_directory::DataObject; pub type TestDataObjectStorageRegistry = data_object_storage_registry::Module; -pub type TestContentDirectory = content_directory::Module; pub type TestActors = actors::Module; pub fn with_default_mock_builder R>(f: F) -> R { diff --git a/src/storage/mod.rs b/src/storage/mod.rs index d2536f4f3e..16def6f2a1 100644 --- a/src/storage/mod.rs +++ b/src/storage/mod.rs @@ -1,6 +1,5 @@ #![cfg_attr(not(feature = "std"), no_std)] -pub mod content_directory; pub mod data_directory; pub mod data_object_storage_registry; pub mod data_object_type_registry; From 73e89163986c10d7a3974086201a9461166a31d2 Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Wed, 10 Apr 2019 11:19:59 +0300 Subject: [PATCH 167/175] substrate update: change UK spelling to US --- src/governance/council.rs | 2 +- src/governance/election.rs | 8 ++++---- src/governance/proposals.rs | 20 ++++++++++---------- src/migration.rs | 2 +- src/roles/actors.rs | 4 ++-- 5 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/governance/council.rs b/src/governance/council.rs index b1c89a9387..2a954b1651 100644 --- a/src/governance/council.rs +++ b/src/governance/council.rs @@ -66,7 +66,7 @@ decl_module! { pub struct Module for enum Call where origin: T::Origin { fn deposit_event() = default; - fn on_finalise(now: T::BlockNumber) { + fn on_finalize(now: T::BlockNumber) { if now == Self::term_ends_at() { Self::deposit_event(RawEvent::CouncilTermEnded(now)); T::CouncilTermEnded::council_term_ended(); diff --git a/src/governance/election.rs b/src/governance/election.rs index 328ed3353c..31a5de4495 100644 --- a/src/governance/election.rs +++ b/src/governance/election.rs @@ -718,7 +718,7 @@ decl_module! { fn deposit_event() = default; // No origin so this is a priviledged call - fn on_finalise(now: T::BlockNumber) { + fn on_finalize(now: T::BlockNumber) { Self::check_if_stage_is_ending(now); } @@ -1955,7 +1955,7 @@ mod tests { let n = 1 + Election::announcing_period(); System::set_block_number(n); - let _ = Election::on_finalise(n); + let _ = Election::on_finalize(n); for i in 1..20 { assert!(Election::vote( @@ -1982,7 +1982,7 @@ mod tests { let n = n + Election::voting_period(); System::set_block_number(n); - let _ = Election::on_finalise(n); + let _ = Election::on_finalize(n); for i in 1..20 { assert!(Election::reveal( @@ -2012,7 +2012,7 @@ mod tests { let n = n + Election::revealing_period(); System::set_block_number(n); - let _ = Election::on_finalise(n); + let _ = Election::on_finalize(n); assert_eq!( Council::active_council().len(), diff --git a/src/governance/proposals.rs b/src/governance/proposals.rs index a6151fa40d..cf0de52e78 100644 --- a/src/governance/proposals.rs +++ b/src/governance/proposals.rs @@ -323,7 +323,7 @@ decl_module! { } // Called on every block - fn on_finalise(n: T::BlockNumber) { + fn on_finalize(n: T::BlockNumber) { if let Err(e) = Self::end_block(n) { print(e); } @@ -1110,7 +1110,7 @@ mod tests { assert_eq!(Proposals::votes_by_proposal(1), expected_votes); System::set_block_number(2); - let _ = Proposals::on_finalise(2); + let _ = Proposals::end_block(2); assert!(Proposals::active_proposal_ids().is_empty()); assert_eq!(Proposals::proposals(1).status, Approved); @@ -1152,7 +1152,7 @@ mod tests { assert_runtime_code_empty!(); System::set_block_number(2); - let _ = Proposals::on_finalise(2); + let _ = Proposals::end_block(2); // Check that runtime code has been updated after proposal approved. assert_runtime_code!(wasm_code()); @@ -1208,7 +1208,7 @@ mod tests { assert_runtime_code_empty!(); System::set_block_number(2); - let _ = Proposals::on_finalise(2); + let _ = Proposals::end_block(2); // Check that runtime code has been updated after proposal approved. assert_runtime_code!(wasm_code()); @@ -1263,14 +1263,14 @@ mod tests { let expiration_block = System::block_number() + Proposals::voting_period(); System::set_block_number(2); - let _ = Proposals::on_finalise(2); + let _ = Proposals::end_block(2); // Check that runtime code has NOT been updated yet, // because not all councilors voted and voting period is not expired yet. assert_runtime_code_empty!(); System::set_block_number(expiration_block); - let _ = Proposals::on_finalise(expiration_block); + let _ = Proposals::end_block(expiration_block); // Check that runtime code has been updated after proposal approved. assert_runtime_code!(wasm_code()); @@ -1326,7 +1326,7 @@ mod tests { assert_runtime_code_empty!(); System::set_block_number(2); - let _ = Proposals::on_finalise(2); + let _ = Proposals::end_block(2); // Check that runtime code has NOT been updated after proposal slashed. assert_runtime_code_empty!(); @@ -1383,7 +1383,7 @@ mod tests { assert_runtime_code_empty!(); System::set_block_number(2); - let _ = Proposals::on_finalise(2); + let _ = Proposals::end_block(2); // Check that runtime code has NOT been updated after proposal rejected. assert_runtime_code_empty!(); @@ -1440,7 +1440,7 @@ mod tests { assert_runtime_code_empty!(); System::set_block_number(2); - let _ = Proposals::on_finalise(2); + let _ = Proposals::end_block(2); // Check that runtime code has NOT been updated after proposal slashed. assert_runtime_code_empty!(); @@ -1507,7 +1507,7 @@ mod tests { let expiration_block = System::block_number() + Proposals::voting_period(); System::set_block_number(expiration_block); - let _ = Proposals::on_finalise(expiration_block); + let _ = Proposals::end_block(expiration_block); // Check that runtime code has NOT been updated after proposal slashed. assert_runtime_code_empty!(); diff --git a/src/migration.rs b/src/migration.rs index c3aea084a6..b86ef11eba 100644 --- a/src/migration.rs +++ b/src/migration.rs @@ -56,7 +56,7 @@ decl_module! { pub struct Module for enum Call where origin: T::Origin { fn deposit_event() = default; - fn on_initialise(_now: T::BlockNumber) { + fn on_initialize(_now: T::BlockNumber) { if Self::spec_version().map_or(true, |spec_version| VERSION.spec_version > spec_version) { // mark store version with current version of the runtime >::put(VERSION.spec_version); diff --git a/src/roles/actors.rs b/src/roles/actors.rs index 32d6e47d75..781ccddbaf 100644 --- a/src/roles/actors.rs +++ b/src/roles/actors.rs @@ -255,7 +255,7 @@ decl_module! { pub struct Module for enum Call where origin: T::Origin { fn deposit_event() = default; - fn on_initialise(now: T::BlockNumber) { + fn on_initialize(now: T::BlockNumber) { // clear expired requests if now % T::BlockNumber::sa(REQUEST_CLEARING_INTERVAL) == T::BlockNumber::zero() { let requests: Requests = Self::role_entry_requests() @@ -267,7 +267,7 @@ decl_module! { } } - fn on_finalise(now: T::BlockNumber) { + fn on_finalize(now: T::BlockNumber) { // payout rewards to actors for role in Self::available_roles().iter() { From e860ddde97c728332d3e0211d23a6f2ac052946a Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Wed, 10 Apr 2019 17:22:38 +0300 Subject: [PATCH 168/175] hookup OnSessionChange to grandpa::SyncedAuthorities --- src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index 3d7c7b454a..4a7201c46f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -182,7 +182,7 @@ impl consensus::Trait for Runtime { impl session::Trait for Runtime { type ConvertAccountIdToSessionKey = (); - type OnSessionChange = (Staking,); + type OnSessionChange = (Staking, grandpa::SyncedAuthorities); type Event = Event; } From eae109bde34fc68f682d2e75a50d3a7f0fb2ee0e Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Thu, 11 Apr 2019 13:16:16 +0300 Subject: [PATCH 169/175] implement our own CurrencyToVoteHandler to better match our currency configuration --- src/currency.rs | 40 +++++++++++++++++++++++++++++++++++++ src/governance/council.rs | 2 +- src/governance/election.rs | 2 +- src/governance/mock.rs | 3 ++- src/governance/mod.rs | 12 ----------- src/governance/proposals.rs | 2 +- src/lib.rs | 7 ++++--- src/membership/members.rs | 2 +- src/membership/mock.rs | 2 +- src/memo.rs | 2 +- src/migration.rs | 3 --- src/roles/actors.rs | 2 +- src/roles/mock.rs | 2 +- src/storage/mock.rs | 2 +- 14 files changed, 55 insertions(+), 28 deletions(-) create mode 100644 src/currency.rs diff --git a/src/currency.rs b/src/currency.rs new file mode 100644 index 0000000000..7d2e27be7a --- /dev/null +++ b/src/currency.rs @@ -0,0 +1,40 @@ +use runtime_primitives::traits::Convert; +use srml_support::traits::{Currency, LockableCurrency, ReservableCurrency}; +use system; + +pub trait GovernanceCurrency: system::Trait + Sized { + type Currency: Currency + + ReservableCurrency + + LockableCurrency; +} + +pub type BalanceOf = + <::Currency as Currency<::AccountId>>::Balance; + + +/// A structure that converts the currency type into a lossy u64 +/// And back from u128 +pub struct CurrencyToVoteHandler; + +impl Convert for CurrencyToVoteHandler { + fn convert(x: u128) -> u64 { + if x >> 96 == 0 { + x as u64 + } else { + u64::max_value() + } + } +} + +impl Convert for CurrencyToVoteHandler { + fn convert(x: u128) -> u128 { + // if it practically fits in u64 + if x >> 64 == 0 { + x + } + else { + // 0000_0000_FFFF_FFFF_FFFF_FFFF_0000_0000 + u64::max_value() as u128 + } + } +} \ No newline at end of file diff --git a/src/governance/council.rs b/src/governance/council.rs index 2a954b1651..ed006f99f7 100644 --- a/src/governance/council.rs +++ b/src/governance/council.rs @@ -4,7 +4,7 @@ use srml_support::{decl_event, decl_module, decl_storage, ensure, StorageValue}; use system; pub use super::election::{self, CouncilElected, Seat, Seats}; -pub use super::{BalanceOf, GovernanceCurrency}; +pub use crate::currency::{BalanceOf, GovernanceCurrency}; // Hook For announcing that council term has ended pub trait CouncilTermEnded { diff --git a/src/governance/election.rs b/src/governance/election.rs index 31a5de4495..3fca5749ff 100644 --- a/src/governance/election.rs +++ b/src/governance/election.rs @@ -14,7 +14,7 @@ use super::sealed_vote::SealedVote; use super::stake::Stake; use super::council; -pub use super::{BalanceOf, GovernanceCurrency}; +pub use crate::currency::{BalanceOf, GovernanceCurrency}; use crate::traits::Members; diff --git a/src/governance/mock.rs b/src/governance/mock.rs index bdbb7863ff..319594925d 100644 --- a/src/governance/mock.rs +++ b/src/governance/mock.rs @@ -1,6 +1,7 @@ #![cfg(test)] -pub use super::{council, election, proposals, GovernanceCurrency}; +pub use super::{council, election, proposals}; +pub use crate::currency::GovernanceCurrency; use crate::traits::Members; pub use system; diff --git a/src/governance/mod.rs b/src/governance/mod.rs index 9f63204781..8998d99428 100644 --- a/src/governance/mod.rs +++ b/src/governance/mod.rs @@ -1,6 +1,3 @@ -use srml_support::traits::{Currency, LockableCurrency, ReservableCurrency}; -use system; - pub mod council; pub mod election; pub mod proposals; @@ -8,13 +5,4 @@ pub mod proposals; mod sealed_vote; mod stake; -pub trait GovernanceCurrency: system::Trait + Sized { - type Currency: Currency - + ReservableCurrency - + LockableCurrency; -} - -pub type BalanceOf = - <::Currency as Currency<::AccountId>>::Balance; - mod mock; diff --git a/src/governance/proposals.rs b/src/governance/proposals.rs index cf0de52e78..f308ac5f23 100644 --- a/src/governance/proposals.rs +++ b/src/governance/proposals.rs @@ -14,7 +14,7 @@ use { use primitives::storage::well_known_keys; use super::council; -pub use super::{BalanceOf, GovernanceCurrency}; +pub use crate::currency::{BalanceOf, GovernanceCurrency}; use crate::traits::Members; const DEFAULT_APPROVAL_QUORUM: u32 = 60; diff --git a/src/lib.rs b/src/lib.rs index 4a7201c46f..d03c852d06 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -14,6 +14,7 @@ use substrate_client as client; #[macro_use] extern crate parity_codec_derive; +pub mod currency; pub mod governance; use governance::{council, election, proposals}; pub mod storage; @@ -41,7 +42,7 @@ use runtime_primitives::{ create_runtime_str, generic, traits::{ self as runtime_traits, AuthorityIdFor, BlakeTwo256, Block as BlockT, - CurrencyToVoteHandler, DigestFor, NumberFor, StaticLookup, Verify, + DigestFor, NumberFor, StaticLookup, Verify, }, transaction_validity::TransactionValidity, AnySignature, ApplyResult, @@ -227,14 +228,14 @@ impl sudo::Trait for Runtime { impl staking::Trait for Runtime { type Currency = balances::Module; - type CurrencyToVote = CurrencyToVoteHandler; + type CurrencyToVote = currency::CurrencyToVoteHandler; type OnRewardMinted = (); type Event = Event; type Slash = (); type Reward = (); } -impl governance::GovernanceCurrency for Runtime { +impl currency::GovernanceCurrency for Runtime { type Currency = balances::Module; } diff --git a/src/membership/members.rs b/src/membership/members.rs index 6d32f276f0..25c4429358 100644 --- a/src/membership/members.rs +++ b/src/membership/members.rs @@ -1,4 +1,4 @@ -use crate::governance::{BalanceOf, GovernanceCurrency}; +use crate::currency::{BalanceOf, GovernanceCurrency}; use crate::traits::{Members, Roles}; use parity_codec::Codec; use parity_codec_derive::{Decode, Encode}; diff --git a/src/membership/mock.rs b/src/membership/mock.rs index 7cacab22d5..6ae48d415a 100644 --- a/src/membership/mock.rs +++ b/src/membership/mock.rs @@ -1,7 +1,7 @@ #![cfg(test)] pub use super::members; -pub use crate::governance::GovernanceCurrency; +pub use crate::currency::GovernanceCurrency; pub use srml_support::traits::Currency; pub use system; diff --git a/src/memo.rs b/src/memo.rs index fdda6481d1..29294c69dc 100644 --- a/src/memo.rs +++ b/src/memo.rs @@ -1,4 +1,4 @@ -use crate::governance::GovernanceCurrency; +use crate::currency::GovernanceCurrency; use rstd::prelude::*; use runtime_primitives::traits::Zero; use srml_support::traits::Currency; diff --git a/src/migration.rs b/src/migration.rs index b86ef11eba..b1244c05bd 100644 --- a/src/migration.rs +++ b/src/migration.rs @@ -1,10 +1,7 @@ -//use crate::governance::BalanceOf; use crate::membership::members; use crate::roles::actors; use crate::VERSION; -use rstd::prelude::*; use runtime_io::print; -//use runtime_primitives::traits::As; use srml_support::{decl_event, decl_module, decl_storage, StorageValue}; use system; diff --git a/src/roles/actors.rs b/src/roles/actors.rs index 781ccddbaf..7a21ca66e4 100644 --- a/src/roles/actors.rs +++ b/src/roles/actors.rs @@ -1,4 +1,4 @@ -use crate::governance::{BalanceOf, GovernanceCurrency}; +use crate::currency::{BalanceOf, GovernanceCurrency}; use parity_codec_derive::{Decode, Encode}; use rstd::prelude::*; use runtime_primitives::traits::{As, Bounded, MaybeDebug, Zero}; diff --git a/src/roles/mock.rs b/src/roles/mock.rs index 3cbabef330..ba3c5aed7d 100644 --- a/src/roles/mock.rs +++ b/src/roles/mock.rs @@ -1,7 +1,7 @@ #![cfg(test)] pub use super::actors; -pub use crate::governance::GovernanceCurrency; +pub use crate::currency::GovernanceCurrency; use crate::traits::Members; pub use srml_support::traits::Currency; pub use system; diff --git a/src/storage/mock.rs b/src/storage/mock.rs index 6b0b8394e3..9e29dbc054 100644 --- a/src/storage/mock.rs +++ b/src/storage/mock.rs @@ -3,7 +3,7 @@ pub use super::{ data_directory, data_object_storage_registry, data_object_type_registry, }; -use crate::governance::GovernanceCurrency; +use crate::currency::GovernanceCurrency; use crate::roles::actors; use crate::traits; use runtime_io::with_externalities; From d464e2fa2b62f81acca4f3992b101b7911dbe534 Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Thu, 11 Apr 2019 17:34:33 +0300 Subject: [PATCH 170/175] fixing storage runtime tests --- src/storage/data_directory.rs | 8 +++++--- src/storage/data_object_type_registry.rs | 26 +++++------------------- src/storage/mock.rs | 19 ++++++----------- 3 files changed, 16 insertions(+), 37 deletions(-) diff --git a/src/storage/data_directory.rs b/src/storage/data_directory.rs index 48c9dded27..32a86c545a 100644 --- a/src/storage/data_directory.rs +++ b/src/storage/data_directory.rs @@ -319,7 +319,7 @@ mod tests { fn succeed_adding_content() { with_default_mock_builder(|| { // Register a content with 1234 bytes of type 1, which should be recognized. - let res = TestDataDirectory::add_content(Origin::signed(1), 1, 1234, None); + let res = TestDataDirectory::add_content(Origin::signed(1), 1, 1234, 0); assert!(res.is_ok()); }); } @@ -327,7 +327,7 @@ mod tests { #[test] fn accept_content_as_liaison() { with_default_mock_builder(|| { - let res = TestDataDirectory::add_content(Origin::signed(1), 1, 1234, None); + let res = TestDataDirectory::add_content(Origin::signed(1), 1, 1234, 0); assert!(res.is_ok()); // An appropriate event should have been fired. @@ -339,6 +339,7 @@ mod tests { _ => (0u64, 0xdeadbeefu64), // invalid value, unlikely to match }; assert_ne!(liaison, 0xdeadbeefu64); + // FAIL: implementation is setting the origin not liason. What do we want? assert_eq!(liaison, TEST_MOCK_LIAISON); // Accepting content should not work with some random origin @@ -354,7 +355,7 @@ mod tests { #[test] fn reject_content_as_liaison() { with_default_mock_builder(|| { - let res = TestDataDirectory::add_content(Origin::signed(1), 1, 1234, None); + let res = TestDataDirectory::add_content(Origin::signed(1), 1, 1234, 0); assert!(res.is_ok()); // An appropriate event should have been fired. @@ -366,6 +367,7 @@ mod tests { _ => (0u64, 0xdeadbeefu64), // invalid value, unlikely to match }; assert_ne!(liaison, 0xdeadbeefu64); + // FAIL: implementation is setting the origin not liason. What do we want? assert_eq!(liaison, TEST_MOCK_LIAISON); // Rejecting content should not work with some random origin diff --git a/src/storage/data_object_type_registry.rs b/src/storage/data_object_type_registry.rs index bc7ce0f1c2..159726a66b 100644 --- a/src/storage/data_object_type_registry.rs +++ b/src/storage/data_object_type_registry.rs @@ -163,26 +163,13 @@ mod tests { } #[test] - fn fail_register_without_root() { + fn succeed_register() { with_default_mock_builder(|| { let data: TestDataObjectType = TestDataObjectType { description: "foo".as_bytes().to_vec(), active: false, }; - let res = - TestDataObjectTypeRegistry::register_data_object_type(Origin::signed(1), data); - assert!(res.is_err()); - }); - } - - #[test] - fn succeed_register_as_root() { - with_default_mock_builder(|| { - let data: TestDataObjectType = TestDataObjectType { - description: "foo".as_bytes().to_vec(), - active: false, - }; - let res = TestDataObjectTypeRegistry::register_data_object_type(Origin::ROOT, data); + let res = TestDataObjectTypeRegistry::register_data_object_type(data); assert!(res.is_ok()); }); } @@ -195,7 +182,7 @@ mod tests { description: "foo".as_bytes().to_vec(), active: false, }; - let id_res = TestDataObjectTypeRegistry::register_data_object_type(Origin::ROOT, data); + let id_res = TestDataObjectTypeRegistry::register_data_object_type(data); assert!(id_res.is_ok()); let dot_id = match System::events().last().unwrap().event { @@ -213,7 +200,6 @@ mod tests { active: false, }; let res = TestDataObjectTypeRegistry::update_data_object_type( - Origin::ROOT, dot_id + 1, updated1, ); @@ -225,7 +211,7 @@ mod tests { active: false, }; let res = - TestDataObjectTypeRegistry::update_data_object_type(Origin::ROOT, dot_id, updated3); + TestDataObjectTypeRegistry::update_data_object_type(dot_id, updated3); assert!(res.is_ok()); assert_eq!( *System::events().last().unwrap(), @@ -247,7 +233,7 @@ mod tests { description: "foo".as_bytes().to_vec(), active: false, }; - let id_res = TestDataObjectTypeRegistry::register_data_object_type(Origin::ROOT, data); + let id_res = TestDataObjectTypeRegistry::register_data_object_type(data); assert!(id_res.is_ok()); assert_eq!( *System::events().last().unwrap(), @@ -268,7 +254,6 @@ mod tests { // Now activate the data object type let res = TestDataObjectTypeRegistry::activate_data_object_type( - Origin::ROOT, TEST_FIRST_DATA_OBJECT_TYPE_ID, ); assert!(res.is_ok()); @@ -291,7 +276,6 @@ mod tests { // Deactivate again. let res = TestDataObjectTypeRegistry::deactivate_data_object_type( - Origin::ROOT, TEST_FIRST_DATA_OBJECT_TYPE_ID, ); assert!(res.is_ok()); diff --git a/src/storage/mock.rs b/src/storage/mock.rs index 6b0b8394e3..3cc19efe02 100644 --- a/src/storage/mock.rs +++ b/src/storage/mock.rs @@ -98,11 +98,12 @@ impl traits::ContentIdExists for MockContent { ) -> Result, &'static str> { match *which { TEST_MOCK_EXISTING_CID => Ok(data_directory::DataObject { - data_object_type: 1, - signing_key: None, + type_id: 1, size: 1234, - added_at_block: 10, - added_at_time: 1024, + added_at: data_directory::BlockAndTime { + block: 10, + time: 1024, + }, owner: 1, liaison: TEST_MOCK_LIAISON, liaison_judgement: data_directory::LiaisonJudgement::Pending, @@ -142,6 +143,7 @@ impl data_directory::Trait for Test { type Members = MockMembers; type Roles = MockRoles; type IsActiveDataObjectType = AnyDataObjectTypeIsActive; + type SchemaId = u64; } impl data_object_storage_registry::Trait for Test { @@ -242,15 +244,6 @@ impl ExtBuilder { .0, ); - t.extend( - data_directory::GenesisConfig:: { - first_content_id: self.first_content_id, - } - .build_storage() - .unwrap() - .0, - ); - t.extend( data_object_storage_registry::GenesisConfig:: { first_relationship_id: self.first_relationship_id, From e649d6552b2cb8e83ced33f19c7e76daafafc438 Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Thu, 11 Apr 2019 17:45:39 +0300 Subject: [PATCH 171/175] storage tests: update tests for ContentAdded event --- src/storage/data_directory.rs | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/storage/data_directory.rs b/src/storage/data_directory.rs index 32a86c545a..c56f25e0fc 100644 --- a/src/storage/data_directory.rs +++ b/src/storage/data_directory.rs @@ -327,27 +327,27 @@ mod tests { #[test] fn accept_content_as_liaison() { with_default_mock_builder(|| { - let res = TestDataDirectory::add_content(Origin::signed(1), 1, 1234, 0); + let sender = 1 as u64; + let res = TestDataDirectory::add_content(Origin::signed(sender), 1, 1234, 0); assert!(res.is_ok()); // An appropriate event should have been fired. - let (content_id, liaison) = match System::events().last().unwrap().event { + let (content_id, creator) = match System::events().last().unwrap().event { MetaEvent::data_directory(data_directory::RawEvent::ContentAdded( content_id, - liaison, - )) => (content_id, liaison), + creator, + )) => (content_id, creator), _ => (0u64, 0xdeadbeefu64), // invalid value, unlikely to match }; - assert_ne!(liaison, 0xdeadbeefu64); - // FAIL: implementation is setting the origin not liason. What do we want? - assert_eq!(liaison, TEST_MOCK_LIAISON); + assert_ne!(creator, 0xdeadbeefu64); + assert_eq!(creator, sender); // Accepting content should not work with some random origin let res = TestDataDirectory::accept_content(Origin::signed(1), content_id); assert!(res.is_err()); // However, with the liaison as origin it should. - let res = TestDataDirectory::accept_content(Origin::signed(liaison), content_id); + let res = TestDataDirectory::accept_content(Origin::signed(TEST_MOCK_LIAISON), content_id); assert!(res.is_ok()); }); } @@ -355,27 +355,27 @@ mod tests { #[test] fn reject_content_as_liaison() { with_default_mock_builder(|| { - let res = TestDataDirectory::add_content(Origin::signed(1), 1, 1234, 0); + let sender = 1 as u64; + let res = TestDataDirectory::add_content(Origin::signed(sender), 1, 1234, 0); assert!(res.is_ok()); // An appropriate event should have been fired. - let (content_id, liaison) = match System::events().last().unwrap().event { + let (content_id, creator) = match System::events().last().unwrap().event { MetaEvent::data_directory(data_directory::RawEvent::ContentAdded( content_id, - liaison, - )) => (content_id, liaison), + creator, + )) => (content_id, creator), _ => (0u64, 0xdeadbeefu64), // invalid value, unlikely to match }; - assert_ne!(liaison, 0xdeadbeefu64); - // FAIL: implementation is setting the origin not liason. What do we want? - assert_eq!(liaison, TEST_MOCK_LIAISON); + assert_ne!(creator, 0xdeadbeefu64); + assert_eq!(creator, sender); // Rejecting content should not work with some random origin let res = TestDataDirectory::reject_content(Origin::signed(1), content_id); assert!(res.is_err()); // However, with the liaison as origin it should. - let res = TestDataDirectory::reject_content(Origin::signed(liaison), content_id); + let res = TestDataDirectory::reject_content(Origin::signed(TEST_MOCK_LIAISON), content_id); assert!(res.is_ok()); }); } From 8c62ed16c65bfe1886ee5de8ad28c1a5c677a44a Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Thu, 11 Apr 2019 18:17:44 +0300 Subject: [PATCH 172/175] fix uk spelling --- src/storage/data_object_type_registry.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/storage/data_object_type_registry.rs b/src/storage/data_object_type_registry.rs index 159726a66b..8dd6bad1d0 100644 --- a/src/storage/data_object_type_registry.rs +++ b/src/storage/data_object_type_registry.rs @@ -77,7 +77,7 @@ decl_module! { pub struct Module for enum Call where origin: T::Origin { fn deposit_event() = default; - fn on_initialise() { + fn on_initialize() { // Create a default data object type if it was not created yet. if CREATE_DETAULT_TYPE && !>::exists(Self::first_data_object_type_id()) { let do_type: DataObjectType = DataObjectType::default(); From bf905e42b03e3945d0127ff750f262e28cb719c9 Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Fri, 12 Apr 2019 15:29:42 +0300 Subject: [PATCH 173/175] add configuration for fallback storage provider --- src/lib.rs | 2 +- src/storage/data_directory.rs | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 3d7c7b454a..776dbe5b0d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -127,7 +127,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { spec_name: create_runtime_str!("joystream-node"), impl_name: create_runtime_str!("joystream-node"), authoring_version: 4, - spec_version: 1, + spec_version: 3, impl_version: 0, apis: RUNTIME_API_VERSIONS, }; diff --git a/src/storage/data_directory.rs b/src/storage/data_directory.rs index 48c9dded27..dfe17bb70f 100644 --- a/src/storage/data_directory.rs +++ b/src/storage/data_directory.rs @@ -117,6 +117,11 @@ decl_storage! { MetadataByContentId get(metadata_by_content_id): map T::ContentId => Option>; + + // Default storage provider address + pub StorageProviderAddress get(storage_provider_address): Vec; + // Default storage provider repository id + pub StorageProviderRepoId get(storage_provider_repo_id): Vec; } } @@ -258,11 +263,20 @@ decl_module! { >::insert(&content_id, meta); Self::deposit_event(RawEvent::MetadataUpdated(content_id, who)); } + + // Sudo methods + + fn set_storage_provider_repo_id(repo_id: Vec) { + >::put(repo_id); + } + + fn set_storage_provider_address(address: Vec) { + >::put(address); + } } } impl ContentIdExists for Module { - fn has_content(content_id: &T::ContentId) -> bool { Self::data_object_by_content_id(content_id.clone()).is_some() } From a789a9c4c06c46c0933c15c3f199ea7d8f843fe7 Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Sun, 14 Apr 2019 18:49:44 +0300 Subject: [PATCH 174/175] set runtime and package version to v5.1.0 --- Cargo.toml | 2 +- src/lib.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index e6d16fc1c6..f6ee3a1554 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,7 +2,7 @@ authors = ['Joystream'] edition = '2018' name = 'joystream-node-runtime' -version = '4.1.0' +version = '5.1.0' [features] default = ['std'] diff --git a/src/lib.rs b/src/lib.rs index 5b8029df3b..143fc011a0 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -127,8 +127,8 @@ pub mod opaque { pub const VERSION: RuntimeVersion = RuntimeVersion { spec_name: create_runtime_str!("joystream-node"), impl_name: create_runtime_str!("joystream-node"), - authoring_version: 4, - spec_version: 3, + authoring_version: 5, + spec_version: 1, impl_version: 0, apis: RUNTIME_API_VERSIONS, }; From e7b3b2136ab4cce1758eb185cf788d2a1ee414a1 Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Sun, 14 Apr 2019 19:05:38 +0300 Subject: [PATCH 175/175] update to latest commit on substrate v1.0 branch --- Cargo.toml | 44 ++--- wasm/Cargo.lock | 474 ++++++++++++++++++++++++------------------------ 2 files changed, 259 insertions(+), 259 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index f6ee3a1554..c2b1bf3c89 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -38,37 +38,37 @@ std = [ default_features = false git = 'https://github.com/joystream/substrate.git' package = 'srml-aura' -rev = '89bbb7b6d0e076f0eda736b330f5f792aa2e2991' +rev = '6dfc3e8b057bb00322136251a0f10305fbb1ad8f' [dependencies.balances] default_features = false git = 'https://github.com/joystream/substrate.git' package = 'srml-balances' -rev = '89bbb7b6d0e076f0eda736b330f5f792aa2e2991' +rev = '6dfc3e8b057bb00322136251a0f10305fbb1ad8f' [dependencies.consensus] default_features = false git = 'https://github.com/joystream/substrate.git' package = 'srml-consensus' -rev = '89bbb7b6d0e076f0eda736b330f5f792aa2e2991' +rev = '6dfc3e8b057bb00322136251a0f10305fbb1ad8f' [dependencies.consensus-aura] default_features = false git = 'https://github.com/joystream/substrate.git' package = 'substrate-consensus-aura-primitives' -rev = '89bbb7b6d0e076f0eda736b330f5f792aa2e2991' +rev = '6dfc3e8b057bb00322136251a0f10305fbb1ad8f' [dependencies.executive] default_features = false git = 'https://github.com/joystream/substrate.git' package = 'srml-executive' -rev = '89bbb7b6d0e076f0eda736b330f5f792aa2e2991' +rev = '6dfc3e8b057bb00322136251a0f10305fbb1ad8f' [dependencies.indices] default_features = false git = 'https://github.com/joystream/substrate.git' package = 'srml-indices' -rev = '89bbb7b6d0e076f0eda736b330f5f792aa2e2991' +rev = '6dfc3e8b057bb00322136251a0f10305fbb1ad8f' [dependencies.parity-codec] default-features = false @@ -82,25 +82,25 @@ version = '3.1' default_features = false git = 'https://github.com/joystream/substrate.git' package = 'substrate-primitives' -rev = '89bbb7b6d0e076f0eda736b330f5f792aa2e2991' +rev = '6dfc3e8b057bb00322136251a0f10305fbb1ad8f' [dependencies.rstd] default_features = false git = 'https://github.com/joystream/substrate.git' package = 'sr-std' -rev = '89bbb7b6d0e076f0eda736b330f5f792aa2e2991' +rev = '6dfc3e8b057bb00322136251a0f10305fbb1ad8f' [dependencies.runtime-io] default_features = false git = 'https://github.com/joystream/substrate.git' package = 'sr-io' -rev = '89bbb7b6d0e076f0eda736b330f5f792aa2e2991' +rev = '6dfc3e8b057bb00322136251a0f10305fbb1ad8f' [dependencies.runtime-primitives] default_features = false git = 'https://github.com/joystream/substrate.git' package = 'sr-primitives' -rev = '89bbb7b6d0e076f0eda736b330f5f792aa2e2991' +rev = '6dfc3e8b057bb00322136251a0f10305fbb1ad8f' [dependencies.safe-mix] default-features = false @@ -117,69 +117,69 @@ version = '1.0' [dependencies.srml-support] default_features = false git = 'https://github.com/joystream/substrate.git' -rev = '89bbb7b6d0e076f0eda736b330f5f792aa2e2991' +rev = '6dfc3e8b057bb00322136251a0f10305fbb1ad8f' [dependencies.substrate-client] default_features = false git = 'https://github.com/joystream/substrate.git' -rev = '89bbb7b6d0e076f0eda736b330f5f792aa2e2991' +rev = '6dfc3e8b057bb00322136251a0f10305fbb1ad8f' [dependencies.sudo] default_features = false git = 'https://github.com/joystream/substrate.git' package = 'srml-sudo' -rev = '89bbb7b6d0e076f0eda736b330f5f792aa2e2991' +rev = '6dfc3e8b057bb00322136251a0f10305fbb1ad8f' [dependencies.system] default_features = false git = 'https://github.com/joystream/substrate.git' package = 'srml-system' -rev = '89bbb7b6d0e076f0eda736b330f5f792aa2e2991' +rev = '6dfc3e8b057bb00322136251a0f10305fbb1ad8f' [dependencies.timestamp] default_features = false git = 'https://github.com/joystream/substrate.git' package = 'srml-timestamp' -rev = '89bbb7b6d0e076f0eda736b330f5f792aa2e2991' +rev = '6dfc3e8b057bb00322136251a0f10305fbb1ad8f' [dependencies.version] default_features = false git = 'https://github.com/joystream/substrate.git' package = 'sr-version' -rev = '89bbb7b6d0e076f0eda736b330f5f792aa2e2991' +rev = '6dfc3e8b057bb00322136251a0f10305fbb1ad8f' [dependencies.staking] default_features = false git = 'https://github.com/joystream/substrate.git' package = 'srml-staking' -rev = '89bbb7b6d0e076f0eda736b330f5f792aa2e2991' +rev = '6dfc3e8b057bb00322136251a0f10305fbb1ad8f' [dependencies.session] default_features = false git = 'https://github.com/joystream/substrate.git' package = 'srml-session' -rev = '89bbb7b6d0e076f0eda736b330f5f792aa2e2991' +rev = '6dfc3e8b057bb00322136251a0f10305fbb1ad8f' [dependencies.offchain-primitives] default_features = false git = 'https://github.com/joystream/substrate.git' package = 'substrate-offchain-primitives' -rev = '89bbb7b6d0e076f0eda736b330f5f792aa2e2991' +rev = '6dfc3e8b057bb00322136251a0f10305fbb1ad8f' [dependencies.consensus-authorities] default_features = false git = 'https://github.com/joystream/substrate.git' package = 'substrate-consensus-authorities' -rev = '89bbb7b6d0e076f0eda736b330f5f792aa2e2991' +rev = '6dfc3e8b057bb00322136251a0f10305fbb1ad8f' [dependencies.grandpa] default_features = false git = 'https://github.com/joystream/substrate.git' package = 'srml-grandpa' -rev = '89bbb7b6d0e076f0eda736b330f5f792aa2e2991' +rev = '6dfc3e8b057bb00322136251a0f10305fbb1ad8f' [dependencies.finality-tracker] default_features = false git = 'https://github.com/joystream/substrate.git' package = 'srml-finality-tracker' -rev = '89bbb7b6d0e076f0eda736b330f5f792aa2e2991' \ No newline at end of file +rev = '6dfc3e8b057bb00322136251a0f10305fbb1ad8f' \ No newline at end of file diff --git a/wasm/Cargo.lock b/wasm/Cargo.lock index 4098e8ad68..44a5257451 100644 --- a/wasm/Cargo.lock +++ b/wasm/Cargo.lock @@ -756,42 +756,42 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "joystream-node-runtime" -version = "4.1.0" +version = "5.1.0" dependencies = [ "parity-codec 3.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec-derive 3.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "safe-mix 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-io 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "sr-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "sr-std 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "sr-version 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "srml-aura 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "srml-balances 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "srml-consensus 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "srml-executive 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "srml-finality-tracker 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "srml-grandpa 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "srml-indices 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "srml-session 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "srml-staking 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "srml-sudo 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "srml-support 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "srml-system 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "srml-timestamp 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "substrate-client 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "substrate-consensus-aura-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "substrate-consensus-authorities 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "substrate-offchain-primitives 0.1.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "substrate-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "sr-io 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "sr-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "sr-std 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "sr-version 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "srml-aura 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "srml-balances 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "srml-consensus 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "srml-executive 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "srml-finality-tracker 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "srml-grandpa 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "srml-indices 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "srml-session 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "srml-staking 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "srml-sudo 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "srml-support 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "srml-system 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "srml-timestamp 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "substrate-client 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "substrate-consensus-aura-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "substrate-consensus-authorities 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "substrate-offchain-primitives 0.1.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "substrate-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", ] [[package]] name = "joystream-node-runtime-wasm" version = "1.0.1" dependencies = [ - "joystream-node-runtime 4.1.0", + "joystream-node-runtime 5.1.0", ] [[package]] @@ -2035,7 +2035,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "sr-api-macros" version = "1.0.0" -source = "git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991#89bbb7b6d0e076f0eda736b330f5f792aa2e2991" +source = "git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f#6dfc3e8b057bb00322136251a0f10305fbb1ad8f" dependencies = [ "blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro-crate 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2047,24 +2047,24 @@ dependencies = [ [[package]] name = "sr-io" version = "1.0.0" -source = "git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991#89bbb7b6d0e076f0eda736b330f5f792aa2e2991" +source = "git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f#6dfc3e8b057bb00322136251a0f10305fbb1ad8f" dependencies = [ "environmental 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "hash-db 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)", "libsecp256k1 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-std 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "substrate-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "substrate-state-machine 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "substrate-trie 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "sr-std 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "substrate-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "substrate-state-machine 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "substrate-trie 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", "tiny-keccak 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "sr-primitives" version = "1.0.0" -source = "git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991#89bbb7b6d0e076f0eda736b330f5f792aa2e2991" +source = "git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f#6dfc3e8b057bb00322136251a0f10305fbb1ad8f" dependencies = [ "integer-sqrt 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2072,15 +2072,15 @@ dependencies = [ "parity-codec 3.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-io 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "sr-std 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "substrate-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "sr-io 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "sr-std 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "substrate-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", ] [[package]] name = "sr-std" version = "1.0.0" -source = "git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991#89bbb7b6d0e076f0eda736b330f5f792aa2e2991" +source = "git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f#6dfc3e8b057bb00322136251a0f10305fbb1ad8f" dependencies = [ "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2088,205 +2088,205 @@ dependencies = [ [[package]] name = "sr-version" version = "1.0.0" -source = "git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991#89bbb7b6d0e076f0eda736b330f5f792aa2e2991" +source = "git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f#6dfc3e8b057bb00322136251a0f10305fbb1ad8f" dependencies = [ "impl-serde 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "sr-std 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "sr-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "sr-std 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", ] [[package]] name = "srml-aura" version = "1.0.0" -source = "git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991#89bbb7b6d0e076f0eda736b330f5f792aa2e2991" +source = "git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f#6dfc3e8b057bb00322136251a0f10305fbb1ad8f" dependencies = [ "hex-literal 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec-derive 3.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "sr-std 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "srml-session 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "srml-staking 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "srml-support 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "srml-system 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "srml-timestamp 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "substrate-inherents 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "sr-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "sr-std 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "srml-session 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "srml-staking 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "srml-support 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "srml-system 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "srml-timestamp 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "substrate-inherents 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", ] [[package]] name = "srml-balances" version = "1.0.0" -source = "git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991#89bbb7b6d0e076f0eda736b330f5f792aa2e2991" +source = "git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f#6dfc3e8b057bb00322136251a0f10305fbb1ad8f" dependencies = [ "hex-literal 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "safe-mix 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "sr-std 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "srml-support 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "srml-system 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "substrate-keyring 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "sr-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "sr-std 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "srml-support 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "srml-system 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "substrate-keyring 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", ] [[package]] name = "srml-consensus" version = "1.0.0" -source = "git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991#89bbb7b6d0e076f0eda736b330f5f792aa2e2991" +source = "git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f#6dfc3e8b057bb00322136251a0f10305fbb1ad8f" dependencies = [ "hex-literal 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "sr-std 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "srml-support 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "srml-system 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "substrate-inherents 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "substrate-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "sr-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "sr-std 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "srml-support 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "srml-system 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "substrate-inherents 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "substrate-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", ] [[package]] name = "srml-executive" version = "1.0.0" -source = "git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991#89bbb7b6d0e076f0eda736b330f5f792aa2e2991" +source = "git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f#6dfc3e8b057bb00322136251a0f10305fbb1ad8f" dependencies = [ "parity-codec 3.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-io 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "sr-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "sr-std 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "srml-support 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "srml-system 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "sr-io 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "sr-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "sr-std 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "srml-support 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "srml-system 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", ] [[package]] name = "srml-finality-tracker" version = "1.0.0" -source = "git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991#89bbb7b6d0e076f0eda736b330f5f792aa2e2991" +source = "git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f#6dfc3e8b057bb00322136251a0f10305fbb1ad8f" dependencies = [ "hex-literal 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "sr-std 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "srml-support 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "srml-system 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "substrate-inherents 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "sr-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "sr-std 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "srml-support 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "srml-system 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "substrate-inherents 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", ] [[package]] name = "srml-grandpa" version = "1.0.0" -source = "git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991#89bbb7b6d0e076f0eda736b330f5f792aa2e2991" +source = "git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f#6dfc3e8b057bb00322136251a0f10305fbb1ad8f" dependencies = [ "parity-codec 3.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "sr-std 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "srml-consensus 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "srml-finality-tracker 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "srml-session 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "srml-support 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "srml-system 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "substrate-finality-grandpa-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "substrate-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "sr-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "sr-std 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "srml-consensus 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "srml-finality-tracker 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "srml-session 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "srml-support 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "srml-system 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "substrate-finality-grandpa-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "substrate-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", ] [[package]] name = "srml-indices" version = "1.0.0" -source = "git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991#89bbb7b6d0e076f0eda736b330f5f792aa2e2991" +source = "git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f#6dfc3e8b057bb00322136251a0f10305fbb1ad8f" dependencies = [ "hex-literal 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec-derive 3.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "safe-mix 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-io 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "sr-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "sr-std 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "srml-support 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "srml-system 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "substrate-keyring 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "substrate-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "sr-io 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "sr-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "sr-std 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "srml-support 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "srml-system 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "substrate-keyring 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "substrate-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", ] [[package]] name = "srml-metadata" version = "1.0.0" -source = "git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991#89bbb7b6d0e076f0eda736b330f5f792aa2e2991" +source = "git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f#6dfc3e8b057bb00322136251a0f10305fbb1ad8f" dependencies = [ "parity-codec 3.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-std 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "substrate-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "sr-std 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "substrate-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", ] [[package]] name = "srml-session" version = "1.0.0" -source = "git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991#89bbb7b6d0e076f0eda736b330f5f792aa2e2991" +source = "git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f#6dfc3e8b057bb00322136251a0f10305fbb1ad8f" dependencies = [ "hex-literal 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec-derive 3.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "safe-mix 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "sr-std 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "srml-consensus 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "srml-support 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "srml-system 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "srml-timestamp 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "sr-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "sr-std 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "srml-consensus 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "srml-support 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "srml-system 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "srml-timestamp 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", ] [[package]] name = "srml-staking" version = "1.0.0" -source = "git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991#89bbb7b6d0e076f0eda736b330f5f792aa2e2991" +source = "git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f#6dfc3e8b057bb00322136251a0f10305fbb1ad8f" dependencies = [ "hex-literal 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "safe-mix 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-io 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "sr-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "sr-std 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "srml-consensus 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "srml-session 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "srml-support 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "srml-system 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "substrate-keyring 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "sr-io 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "sr-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "sr-std 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "srml-consensus 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "srml-session 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "srml-support 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "srml-system 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "substrate-keyring 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", ] [[package]] name = "srml-sudo" version = "1.0.0" -source = "git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991#89bbb7b6d0e076f0eda736b330f5f792aa2e2991" +source = "git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f#6dfc3e8b057bb00322136251a0f10305fbb1ad8f" dependencies = [ "hex-literal 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec-derive 3.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "sr-std 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "srml-support 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "srml-support-procedural 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "srml-system 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "sr-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "sr-std 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "srml-support 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "srml-support-procedural 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "srml-system 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", ] [[package]] name = "srml-support" version = "1.0.0" -source = "git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991#89bbb7b6d0e076f0eda736b330f5f792aa2e2991" +source = "git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f#6dfc3e8b057bb00322136251a0f10305fbb1ad8f" dependencies = [ "bitmask 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "hex-literal 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2295,42 +2295,42 @@ dependencies = [ "paste 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-io 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "sr-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "sr-std 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "srml-metadata 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "srml-support-procedural 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "substrate-inherents 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "sr-io 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "sr-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "sr-std 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "srml-metadata 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "srml-support-procedural 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "substrate-inherents 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", ] [[package]] name = "srml-support-procedural" version = "1.0.0" -source = "git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991#89bbb7b6d0e076f0eda736b330f5f792aa2e2991" +source = "git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f#6dfc3e8b057bb00322136251a0f10305fbb1ad8f" dependencies = [ "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-api-macros 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "srml-support-procedural-tools 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "sr-api-macros 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "srml-support-procedural-tools 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", "syn 0.15.29 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "srml-support-procedural-tools" version = "1.0.0" -source = "git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991#89bbb7b6d0e076f0eda736b330f5f792aa2e2991" +source = "git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f#6dfc3e8b057bb00322136251a0f10305fbb1ad8f" dependencies = [ "proc-macro-crate 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", - "srml-support-procedural-tools-derive 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "srml-support-procedural-tools-derive 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", "syn 0.15.29 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "srml-support-procedural-tools-derive" version = "1.0.0" -source = "git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991#89bbb7b6d0e076f0eda736b330f5f792aa2e2991" +source = "git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f#6dfc3e8b057bb00322136251a0f10305fbb1ad8f" dependencies = [ "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2340,33 +2340,33 @@ dependencies = [ [[package]] name = "srml-system" version = "1.0.0" -source = "git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991#89bbb7b6d0e076f0eda736b330f5f792aa2e2991" +source = "git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f#6dfc3e8b057bb00322136251a0f10305fbb1ad8f" dependencies = [ "hex-literal 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "safe-mix 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-io 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "sr-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "sr-std 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "srml-support 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "substrate-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "sr-io 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "sr-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "sr-std 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "srml-support 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "substrate-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", ] [[package]] name = "srml-timestamp" version = "1.0.0" -source = "git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991#89bbb7b6d0e076f0eda736b330f5f792aa2e2991" +source = "git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f#6dfc3e8b057bb00322136251a0f10305fbb1ad8f" dependencies = [ "hex-literal 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "sr-std 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "srml-support 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "srml-system 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "substrate-inherents 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "sr-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "sr-std 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "srml-support 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "srml-system 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "substrate-inherents 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", ] [[package]] @@ -2466,7 +2466,7 @@ dependencies = [ [[package]] name = "substrate-client" version = "1.0.0" -source = "git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991#89bbb7b6d0e076f0eda736b330f5f792aa2e2991" +source = "git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f#6dfc3e8b057bb00322136251a0f10305fbb1ad8f" dependencies = [ "error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2478,48 +2478,48 @@ dependencies = [ "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-api-macros 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "sr-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "sr-std 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "sr-version 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "substrate-consensus-common 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "substrate-executor 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "substrate-inherents 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "substrate-keyring 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "substrate-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "substrate-state-machine 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "substrate-telemetry 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "substrate-trie 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "sr-api-macros 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "sr-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "sr-std 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "sr-version 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "substrate-consensus-common 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "substrate-executor 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "substrate-inherents 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "substrate-keyring 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "substrate-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "substrate-state-machine 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "substrate-telemetry 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "substrate-trie 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", ] [[package]] name = "substrate-consensus-aura-primitives" version = "1.0.0" -source = "git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991#89bbb7b6d0e076f0eda736b330f5f792aa2e2991" +source = "git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f#6dfc3e8b057bb00322136251a0f10305fbb1ad8f" dependencies = [ - "sr-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "substrate-client 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "sr-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "substrate-client 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", ] [[package]] name = "substrate-consensus-authorities" version = "1.0.0" -source = "git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991#89bbb7b6d0e076f0eda736b330f5f792aa2e2991" +source = "git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f#6dfc3e8b057bb00322136251a0f10305fbb1ad8f" dependencies = [ "parity-codec 3.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-io 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "sr-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "sr-std 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "sr-version 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "srml-support 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "substrate-client 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "substrate-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "sr-io 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "sr-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "sr-std 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "sr-version 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "srml-support 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "substrate-client 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "substrate-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", ] [[package]] name = "substrate-consensus-common" version = "1.0.0" -source = "git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991#89bbb7b6d0e076f0eda736b330f5f792aa2e2991" +source = "git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f#6dfc3e8b057bb00322136251a0f10305fbb1ad8f" dependencies = [ "crossbeam-channel 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2528,17 +2528,17 @@ dependencies = [ "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec-derive 3.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "sr-version 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "substrate-inherents 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "substrate-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "sr-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "sr-version 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "substrate-inherents 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "substrate-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", "tokio 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "substrate-executor" version = "1.0.0" -source = "git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991#89bbb7b6d0e076f0eda736b330f5f792aa2e2991" +source = "git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f#6dfc3e8b057bb00322136251a0f10305fbb1ad8f" dependencies = [ "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2549,13 +2549,13 @@ dependencies = [ "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-io 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "sr-version 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "substrate-panic-handler 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "substrate-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "substrate-serializer 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "substrate-state-machine 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "substrate-trie 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "sr-io 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "sr-version 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "substrate-panic-handler 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "substrate-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "substrate-serializer 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "substrate-state-machine 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "substrate-trie 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", "tiny-keccak 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "wasmi 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2563,51 +2563,51 @@ dependencies = [ [[package]] name = "substrate-finality-grandpa-primitives" version = "1.0.0" -source = "git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991#89bbb7b6d0e076f0eda736b330f5f792aa2e2991" +source = "git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f#6dfc3e8b057bb00322136251a0f10305fbb1ad8f" dependencies = [ "parity-codec 3.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "sr-std 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "substrate-client 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "substrate-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "sr-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "sr-std 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "substrate-client 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "substrate-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", ] [[package]] name = "substrate-inherents" version = "1.0.0" -source = "git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991#89bbb7b6d0e076f0eda736b330f5f792aa2e2991" +source = "git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f#6dfc3e8b057bb00322136251a0f10305fbb1ad8f" dependencies = [ "parity-codec 3.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "sr-std 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "sr-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "sr-std 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", ] [[package]] name = "substrate-keyring" version = "1.0.0" -source = "git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991#89bbb7b6d0e076f0eda736b330f5f792aa2e2991" +source = "git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f#6dfc3e8b057bb00322136251a0f10305fbb1ad8f" dependencies = [ "hex-literal 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "strum 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", "strum_macros 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", - "substrate-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "substrate-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", ] [[package]] name = "substrate-offchain-primitives" version = "0.1.0" -source = "git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991#89bbb7b6d0e076f0eda736b330f5f792aa2e2991" +source = "git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f#6dfc3e8b057bb00322136251a0f10305fbb1ad8f" dependencies = [ - "sr-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "substrate-client 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "sr-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "substrate-client 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", ] [[package]] name = "substrate-panic-handler" version = "1.0.0" -source = "git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991#89bbb7b6d0e076f0eda736b330f5f792aa2e2991" +source = "git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f#6dfc3e8b057bb00322136251a0f10305fbb1ad8f" dependencies = [ "backtrace 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2616,7 +2616,7 @@ dependencies = [ [[package]] name = "substrate-primitives" version = "1.0.0" -source = "git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991#89bbb7b6d0e076f0eda736b330f5f792aa2e2991" +source = "git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f#6dfc3e8b057bb00322136251a0f10305fbb1ad8f" dependencies = [ "base58 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2636,7 +2636,7 @@ dependencies = [ "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", "sha2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-std 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "sr-std 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", "substrate-bip39 0.2.1 (git+https://github.com/paritytech/substrate-bip39)", "tiny-bip39 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "twox-hash 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2647,7 +2647,7 @@ dependencies = [ [[package]] name = "substrate-serializer" version = "1.0.0" -source = "git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991#89bbb7b6d0e076f0eda736b330f5f792aa2e2991" +source = "git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f#6dfc3e8b057bb00322136251a0f10305fbb1ad8f" dependencies = [ "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2656,7 +2656,7 @@ dependencies = [ [[package]] name = "substrate-state-machine" version = "1.0.0" -source = "git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991#89bbb7b6d0e076f0eda736b330f5f792aa2e2991" +source = "git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f#6dfc3e8b057bb00322136251a0f10305fbb1ad8f" dependencies = [ "hash-db 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2664,9 +2664,9 @@ dependencies = [ "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", - "substrate-panic-handler 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "substrate-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", - "substrate-trie 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)", + "substrate-panic-handler 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "substrate-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", + "substrate-trie 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)", "trie-db 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)", "trie-root 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2674,7 +2674,7 @@ dependencies = [ [[package]] name = "substrate-telemetry" version = "1.0.0" -source = "git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991#89bbb7b6d0e076f0eda736b330f5f792aa2e2991" +source = "git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f#6dfc3e8b057bb00322136251a0f10305fbb1ad8f" dependencies = [ "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2692,7 +2692,7 @@ dependencies = [ [[package]] name = "substrate-trie" version = "1.0.0" -source = "git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991#89bbb7b6d0e076f0eda736b330f5f792aa2e2991" +source = "git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f#6dfc3e8b057bb00322136251a0f10305fbb1ad8f" dependencies = [ "hash-db 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)", "memory-db 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3423,28 +3423,28 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)" = "c4488ae950c49d403731982257768f48fada354a5203fe81f9bb6f43ca9002be" "checksum snow 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "5a64f02fd208ef15bd2d1a65861df4707e416151e1272d02c8faafad1c138100" "checksum spin 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "44363f6f51401c34e7be73db0db371c04705d35efbe9f7d6082e03a921a32c55" -"checksum sr-api-macros 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)" = "" -"checksum sr-io 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)" = "" -"checksum sr-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)" = "" -"checksum sr-std 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)" = "" -"checksum sr-version 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)" = "" -"checksum srml-aura 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)" = "" -"checksum srml-balances 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)" = "" -"checksum srml-consensus 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)" = "" -"checksum srml-executive 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)" = "" -"checksum srml-finality-tracker 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)" = "" -"checksum srml-grandpa 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)" = "" -"checksum srml-indices 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)" = "" -"checksum srml-metadata 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)" = "" -"checksum srml-session 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)" = "" -"checksum srml-staking 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)" = "" -"checksum srml-sudo 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)" = "" -"checksum srml-support 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)" = "" -"checksum srml-support-procedural 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)" = "" -"checksum srml-support-procedural-tools 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)" = "" -"checksum srml-support-procedural-tools-derive 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)" = "" -"checksum srml-system 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)" = "" -"checksum srml-timestamp 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)" = "" +"checksum sr-api-macros 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)" = "" +"checksum sr-io 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)" = "" +"checksum sr-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)" = "" +"checksum sr-std 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)" = "" +"checksum sr-version 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)" = "" +"checksum srml-aura 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)" = "" +"checksum srml-balances 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)" = "" +"checksum srml-consensus 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)" = "" +"checksum srml-executive 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)" = "" +"checksum srml-finality-tracker 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)" = "" +"checksum srml-grandpa 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)" = "" +"checksum srml-indices 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)" = "" +"checksum srml-metadata 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)" = "" +"checksum srml-session 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)" = "" +"checksum srml-staking 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)" = "" +"checksum srml-sudo 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)" = "" +"checksum srml-support 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)" = "" +"checksum srml-support-procedural 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)" = "" +"checksum srml-support-procedural-tools 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)" = "" +"checksum srml-support-procedural-tools-derive 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)" = "" +"checksum srml-system 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)" = "" +"checksum srml-timestamp 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)" = "" "checksum stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dba1a27d3efae4351c8051072d619e3ade2820635c3958d826bfea39d59b54c8" "checksum static_assertions 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "c19be23126415861cb3a23e501d34a708f7f9b2183c5252d690941c2e69199d5" "checksum static_slice 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "92a7e0c5e3dfb52e8fbe0e63a1b947bbb17b4036408b151353c4491374931362" @@ -3456,21 +3456,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum strum 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1810e25f576e7ffce1ff5243b37066da5ded0310b3274c20baaeccb1145b2806" "checksum strum_macros 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)" = "572a2f4e53dd4c3483fd79e5cc10ddd773a3acb1169bbfe8762365e107110579" "checksum substrate-bip39 0.2.1 (git+https://github.com/paritytech/substrate-bip39)" = "" -"checksum substrate-client 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)" = "" -"checksum substrate-consensus-aura-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)" = "" -"checksum substrate-consensus-authorities 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)" = "" -"checksum substrate-consensus-common 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)" = "" -"checksum substrate-executor 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)" = "" -"checksum substrate-finality-grandpa-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)" = "" -"checksum substrate-inherents 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)" = "" -"checksum substrate-keyring 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)" = "" -"checksum substrate-offchain-primitives 0.1.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)" = "" -"checksum substrate-panic-handler 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)" = "" -"checksum substrate-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)" = "" -"checksum substrate-serializer 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)" = "" -"checksum substrate-state-machine 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)" = "" -"checksum substrate-telemetry 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)" = "" -"checksum substrate-trie 1.0.0 (git+https://github.com/joystream/substrate.git?rev=89bbb7b6d0e076f0eda736b330f5f792aa2e2991)" = "" +"checksum substrate-client 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)" = "" +"checksum substrate-consensus-aura-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)" = "" +"checksum substrate-consensus-authorities 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)" = "" +"checksum substrate-consensus-common 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)" = "" +"checksum substrate-executor 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)" = "" +"checksum substrate-finality-grandpa-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)" = "" +"checksum substrate-inherents 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)" = "" +"checksum substrate-keyring 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)" = "" +"checksum substrate-offchain-primitives 0.1.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)" = "" +"checksum substrate-panic-handler 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)" = "" +"checksum substrate-primitives 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)" = "" +"checksum substrate-serializer 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)" = "" +"checksum substrate-state-machine 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)" = "" +"checksum substrate-telemetry 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)" = "" +"checksum substrate-trie 1.0.0 (git+https://github.com/joystream/substrate.git?rev=6dfc3e8b057bb00322136251a0f10305fbb1ad8f)" = "" "checksum subtle 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2d67a5a62ba6e01cb2192ff309324cb4875d0c451d55fe2319433abe7a05a8ee" "checksum subtle 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "702662512f3ddeb74a64ce2fbbf3707ee1b6bb663d28bb054e0779bbc720d926" "checksum syn 0.15.29 (registry+https://github.com/rust-lang/crates.io-index)" = "1825685f977249735d510a242a6727b46efe914bb67e38d30c071b1b72b1d5c2"