From 4a26ce442b1437c23a09a54cf754f6d3cc4d898e Mon Sep 17 00:00:00 2001 From: Xiliang Chen <xlchen1291@gmail.com> Date: Fri, 31 Jan 2020 18:00:56 +1300 Subject: [PATCH] update substrate (#84) --- auction/src/lib.rs | 4 ++-- oracle/src/lib.rs | 6 +++--- tokens/src/lib.rs | 12 ++++++------ utilities/src/linked_item.rs | 2 +- vesting/src/lib.rs | 2 +- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/auction/src/lib.rs b/auction/src/lib.rs index fd8e733..1864219 100644 --- a/auction/src/lib.rs +++ b/auction/src/lib.rs @@ -37,9 +37,9 @@ type AuctionIdLinkedItem<T> = LinkedItem<<T as Trait>::AuctionId>; decl_storage! { trait Store for Module<T: Trait> as Auction { - pub Auctions get(fn auctions): map T::AuctionId => Option<AuctionInfo<T::AccountId, T::Balance, T::BlockNumber>>; + pub Auctions get(fn auctions): map hasher(blake2_256) T::AuctionId => Option<AuctionInfo<T::AccountId, T::Balance, T::BlockNumber>>; pub AuctionsIndex get(fn auctions_index): T::AuctionId; - pub AuctionEndTime get(fn auction_end_time): map(T::BlockNumber, Option<T::AuctionId>) => Option<AuctionIdLinkedItem<T>>; + pub AuctionEndTime get(fn auction_end_time): map hasher(blake2_256) (T::BlockNumber, Option<T::AuctionId>) => Option<AuctionIdLinkedItem<T>>; } } diff --git a/oracle/src/lib.rs b/oracle/src/lib.rs index 8979c36..ba1f792 100644 --- a/oracle/src/lib.rs +++ b/oracle/src/lib.rs @@ -33,9 +33,9 @@ pub trait Trait: frame_system::Trait { decl_storage! { trait Store for Module<T: Trait> as Oracle { - pub RawValues get(raw_values): double_map T::OracleKey, T::AccountId => Option<TimestampedValueOf<T>>; - pub HasUpdate get(has_update): map T::OracleKey => bool; - pub Values get(values): map T::OracleKey => Option<TimestampedValueOf<T>>; + pub RawValues get(raw_values): double_map hasher(blake2_256) T::OracleKey, hasher(blake2_256) T::AccountId => Option<TimestampedValueOf<T>>; + pub HasUpdate get(has_update): map hasher(blake2_256) T::OracleKey => bool; + pub Values get(values): map hasher(blake2_256) T::OracleKey => Option<TimestampedValueOf<T>>; } } diff --git a/tokens/src/lib.rs b/tokens/src/lib.rs index eaff2b1..2db956a 100644 --- a/tokens/src/lib.rs +++ b/tokens/src/lib.rs @@ -1,10 +1,7 @@ #![cfg_attr(not(feature = "std"), no_std)] use frame_support::{decl_error, decl_event, decl_module, decl_storage, ensure, traits::Get, Parameter}; -use rstd::{ - collections::btree_map::BTreeMap, - convert::{TryFrom, TryInto}, -}; +use rstd::convert::{TryFrom, TryInto}; use sp_runtime::{ traits::{CheckedAdd, CheckedSub, MaybeSerializeDeserialize, Member, SimpleArithmetic, StaticLookup, Zero}, DispatchResult, @@ -14,6 +11,9 @@ use sp_runtime::{ // #3295 https://github.com/paritytech/substrate/issues/3295 use frame_system::{self as system, ensure_signed}; +#[cfg(feature = "std")] +use rstd::collections::btree_map::BTreeMap; + use orml_traits::{ arithmetic::{self, Signed}, MultiCurrency, MultiCurrencyExtended, OnDustRemoval, @@ -57,10 +57,10 @@ decl_storage! { }) .into_iter() .collect::<Vec<_>>() - }): map T::CurrencyId => T::Balance; + }): map hasher(blake2_256) T::CurrencyId => T::Balance; /// The balance of a token type under an account. - pub Balance get(fn balance): double_map T::CurrencyId, T::AccountId => T::Balance; + pub Balance get(fn balance): double_map hasher(blake2_256) T::CurrencyId, hasher(blake2_256) T::AccountId => T::Balance; } add_extra_genesis { config(endowed_accounts): Vec<(T::AccountId, T::CurrencyId, T::Balance)>; diff --git a/utilities/src/linked_item.rs b/utilities/src/linked_item.rs index 1bc376a..9e8f3a8 100644 --- a/utilities/src/linked_item.rs +++ b/utilities/src/linked_item.rs @@ -172,7 +172,7 @@ mod tests { decl_storage! { trait Store for Module<T: Trait> as Test { - pub TestItem get(linked_list): map (Key, Option<Value>) => Option<TestLinkedItem>; + pub TestItem get(linked_list): map hasher(blake2_256) (Key, Option<Value>) => Option<TestLinkedItem>; } } diff --git a/vesting/src/lib.rs b/vesting/src/lib.rs index e3ea10e..395a4bb 100644 --- a/vesting/src/lib.rs +++ b/vesting/src/lib.rs @@ -80,7 +80,7 @@ decl_storage! { (who.clone(), vec![VestingSchedule {start, period, period_count, per_period}]) ) .collect::<Vec<_>>() - }): map T::AccountId => Vec<VestingScheduleOf<T>>; + }): map hasher(blake2_256) T::AccountId => Vec<VestingScheduleOf<T>>; } add_extra_genesis { -- GitLab