From 25ac4ac042a854b537d70f37a52666922d72d9b8 Mon Sep 17 00:00:00 2001 From: Xiliang Chen <xlchen1291@gmail.com> Date: Thu, 28 May 2020 14:02:03 +1200 Subject: [PATCH] update AccountId type in mocks to u128 (#189) --- auction/src/mock.rs | 4 ++-- benchmarking/src/tests.rs | 4 ++-- currencies/src/mock.rs | 2 +- gradually-update/src/mock.rs | 2 +- oracle/src/mock.rs | 2 +- oracle/src/tests.rs | 8 ++++---- schedule-update/src/mock.rs | 6 +++--- tokens/src/mock.rs | 2 +- utilities/src/linked_item.rs | 2 +- vesting/src/mock.rs | 2 +- 10 files changed, 17 insertions(+), 17 deletions(-) diff --git a/auction/src/mock.rs b/auction/src/mock.rs index 974ee7d..f5acc36 100644 --- a/auction/src/mock.rs +++ b/auction/src/mock.rs @@ -34,7 +34,7 @@ parameter_types! { pub const AvailableBlockRatio: Perbill = Perbill::one(); } -pub type AccountId = u64; +pub type AccountId = u128; pub type Balance = u64; pub type BlockNumber = u64; pub type AuctionId = u64; @@ -86,7 +86,7 @@ impl AuctionHandler<AccountId, Balance, BlockNumber, AuctionId> for Handler { impl Trait for Runtime { type Event = TestEvent; type Balance = Balance; - type AuctionId = AccountId; + type AuctionId = AuctionId; type Handler = Handler; } pub type AuctionModule = Module<Runtime>; diff --git a/benchmarking/src/tests.rs b/benchmarking/src/tests.rs index 5e2ffab..35e4361 100644 --- a/benchmarking/src/tests.rs +++ b/benchmarking/src/tests.rs @@ -49,7 +49,7 @@ pub trait Trait { type Origin: From<frame_system::RawOrigin<Self::AccountId>> + Into<Result<RawOrigin<Self::AccountId>, Self::Origin>>; } -type AccountId = u64; +type AccountId = u128; #[derive(Clone, Eq, PartialEq)] pub struct Test; @@ -84,7 +84,7 @@ impl Trait for Test { type Event = (); type BlockNumber = u32; type Origin = Origin; - type AccountId = u64; + type AccountId = u128; } // This function basically just builds a genesis storage key/value store according to diff --git a/currencies/src/mock.rs b/currencies/src/mock.rs index e98aa3e..63be37c 100644 --- a/currencies/src/mock.rs +++ b/currencies/src/mock.rs @@ -38,7 +38,7 @@ parameter_types! { pub const AvailableBlockRatio: Perbill = Perbill::one(); } -pub type AccountId = u64; +pub type AccountId = u128; impl frame_system::Trait for Runtime { type Origin = Origin; type Call = (); diff --git a/gradually-update/src/mock.rs b/gradually-update/src/mock.rs index 6963593..40ab82f 100644 --- a/gradually-update/src/mock.rs +++ b/gradually-update/src/mock.rs @@ -34,7 +34,7 @@ parameter_types! { pub const AvailableBlockRatio: Perbill = Perbill::one(); } -pub type AccountId = u64; +pub type AccountId = u128; pub type BlockNumber = u64; impl frame_system::Trait for Runtime { diff --git a/oracle/src/mock.rs b/oracle/src/mock.rs index a9f7f59..05be459 100644 --- a/oracle/src/mock.rs +++ b/oracle/src/mock.rs @@ -22,7 +22,7 @@ impl_outer_dispatch! { } pub type OracleCall = super::Call<Test>; -type AccountId = u64; +pub type AccountId = u128; type Key = u32; type Value = u32; diff --git a/oracle/src/tests.rs b/oracle/src/tests.rs index 9d6c5e6..4546a5f 100644 --- a/oracle/src/tests.rs +++ b/oracle/src/tests.rs @@ -1,7 +1,7 @@ #![cfg(test)] use crate::{ - mock::{new_test_ext, ModuleOracle, OracleCall, Origin, Timestamp}, + mock::{new_test_ext, AccountId, ModuleOracle, OracleCall, Origin, Timestamp}, TimestampedValue, }; use codec::Encode; @@ -33,7 +33,7 @@ fn feed_values_from_session_key( } fn feed_values( - from: u64, + from: AccountId, index: u32, nonce: u32, values: Vec<(u32, u32)>, @@ -46,7 +46,7 @@ fn feed_values( #[test] fn should_feed_values() { new_test_ext().execute_with(|| { - let account_id: u64 = 1; + let account_id: AccountId = 1; assert_ok!(feed_values(account_id, 0, 0, vec![(50, 1000), (51, 900), (52, 800)])); @@ -274,7 +274,7 @@ fn bad_index() { #[test] fn change_member_should_work() { new_test_ext().execute_with(|| { - <ModuleOracle as ChangeMembers<u64>>::change_members_sorted(&[4], &[1], &[2, 3, 4]); + <ModuleOracle as ChangeMembers<AccountId>>::change_members_sorted(&[4], &[1], &[2, 3, 4]); assert_noop!( feed_values_from_session_key(10.into(), 0, 0, vec![(50, 1000)]), diff --git a/schedule-update/src/mock.rs b/schedule-update/src/mock.rs index 5b79004..9edb9dc 100644 --- a/schedule-update/src/mock.rs +++ b/schedule-update/src/mock.rs @@ -41,7 +41,7 @@ parameter_types! { pub const AvailableBlockRatio: Perbill = Perbill::one(); } -pub type AccountId = u64; +pub type AccountId = u128; pub type BlockNumber = u64; impl frame_system::Trait for Runtime { @@ -83,8 +83,8 @@ impl pallet_balances::Trait for Runtime { type AccountStore = System; } -pub const ALICE: AccountId = 1u64; -pub const BOB: AccountId = 2u64; +pub const ALICE: AccountId = 1; +pub const BOB: AccountId = 2; // A mock schedule origin where only `ALICE` has permission. pub struct MockScheduleOrigin; diff --git a/tokens/src/mock.rs b/tokens/src/mock.rs index 32bea4b..c9b86c8 100644 --- a/tokens/src/mock.rs +++ b/tokens/src/mock.rs @@ -36,7 +36,7 @@ parameter_types! { pub const AvailableBlockRatio: Perbill = Perbill::one(); } -type AccountId = u64; +type AccountId = u128; impl frame_system::Trait for Runtime { type Origin = Origin; type Call = (); diff --git a/utilities/src/linked_item.rs b/utilities/src/linked_item.rs index 553f39e..5be0eba 100644 --- a/utilities/src/linked_item.rs +++ b/utilities/src/linked_item.rs @@ -203,7 +203,7 @@ mod tests { type Call = (); type Hash = H256; type Hashing = ::sp_runtime::traits::BlakeTwo256; - type AccountId = u64; + type AccountId = u128; type Lookup = IdentityLookup<Self::AccountId>; type Header = Header; type Event = (); diff --git a/vesting/src/mock.rs b/vesting/src/mock.rs index f9e6668..fcd13e1 100644 --- a/vesting/src/mock.rs +++ b/vesting/src/mock.rs @@ -34,7 +34,7 @@ parameter_types! { pub const AvailableBlockRatio: Perbill = Perbill::one(); } -pub type AccountId = u64; +pub type AccountId = u128; impl frame_system::Trait for Runtime { type Origin = Origin; type Call = (); -- GitLab