From 6561535467affbffa994f3980fb1bef90559af95 Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Tue, 17 Dec 2019 11:41:40 +0000 Subject: [PATCH] Remove pallet crates to improve compilation time (#55) --- Cargo.toml | 5 ++--- src/events.rs | 3 +-- src/frame/balances.rs | 8 -------- src/frame/system.rs | 24 +++++++++--------------- src/lib.rs | 1 + src/rpc.rs | 2 +- 6 files changed, 14 insertions(+), 29 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 6be87ed520..a0af232227 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -24,9 +24,6 @@ frame-metadata = { git = "https://github.com/paritytech/substrate/", package = " frame-support = { git = "https://github.com/paritytech/substrate/", package = "frame-support" } sp-runtime = { git = "https://github.com/paritytech/substrate/", package = "sp-runtime" } sp-version = { git = "https://github.com/paritytech/substrate/", package = "sp-version" } -frame-system = { git = "https://github.com/paritytech/substrate/", package = "frame-system" } -pallet-balances = { git = "https://github.com/paritytech/substrate/", package = "pallet-balances" } -pallet-contracts = { git = "https://github.com/paritytech/substrate/", package = "pallet-contracts" } pallet-indices = { git = "https://github.com/paritytech/substrate/", package = "pallet-indices" } hex = "0.4.0" sc-rpc-api = { git = "https://github.com/paritytech/substrate/", package = "sc-rpc-api" } @@ -38,5 +35,7 @@ sp-transaction-pool = { git = "https://github.com/paritytech/substrate/", packag env_logger = "0.7" tokio = "0.1" wabt = "0.9" +frame-system = { git = "https://github.com/paritytech/substrate/", package = "frame-system" } node-runtime = { git = "https://github.com/paritytech/substrate/", package = "node-runtime" } +pallet-balances = { git = "https://github.com/paritytech/substrate/", package = "pallet-balances" } sp-keyring = { git = "https://github.com/paritytech/substrate/", package = "sp-keyring" } diff --git a/src/events.rs b/src/events.rs index 64b53fb47b..dfb1dd50e9 100644 --- a/src/events.rs +++ b/src/events.rs @@ -36,8 +36,6 @@ use codec::{ Output, }; -use frame_system::Phase; - use crate::{ frame::balances::Balances, metadata::{ @@ -47,6 +45,7 @@ use crate::{ }, System, SystemEvent, + Phase, }; /// Top level Event that can be produced by a substrate runtime diff --git a/src/frame/balances.rs b/src/frame/balances.rs index 84c273779d..4b8e3d01ba 100644 --- a/src/frame/balances.rs +++ b/src/frame/balances.rs @@ -53,14 +53,6 @@ pub trait Balances: System { + From<::BlockNumber>; } -/// Blanket impl for using existing runtime types -impl Balances for T -where - ::Header: serde::de::DeserializeOwned, -{ - type Balance = T::Balance; -} - /// The Balances extension trait for the Client. pub trait BalancesStore { /// Balances type. diff --git a/src/frame/system.rs b/src/frame/system.rs index 236d451dde..68a02b570a 100644 --- a/src/frame/system.rs +++ b/src/frame/system.rs @@ -37,7 +37,6 @@ use sp_runtime::traits::{ Member, SimpleArithmetic, SimpleBitOps, - StaticLookup, }; use crate::{ @@ -109,20 +108,6 @@ pub trait System: 'static + Eq + Clone + Debug { + DeserializeOwned; } -/// Blanket impl for using existing runtime types -impl System for T -where - ::Header: serde::de::DeserializeOwned, -{ - type Index = T::Index; - type BlockNumber = T::BlockNumber; - type Hash = T::Hash; - type Hashing = T::Hashing; - type AccountId = T::AccountId; - type Address = ::Source; - type Header = T::Header; -} - /// The System extension trait for the Client. pub trait SystemStore { /// System type. @@ -179,3 +164,12 @@ pub enum SystemEvent { /// An extrinsic failed. ExtrinsicFailed(sp_runtime::DispatchError, DispatchInfo), } + +/// A phase of a block's execution. +#[derive(codec::Decode)] +pub enum Phase { + /// Applying an extrinsic. + ApplyExtrinsic(u32), + /// The end. + Finalization, +} diff --git a/src/lib.rs b/src/lib.rs index b7265b38e9..7c6eaf51cc 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -82,6 +82,7 @@ use self::{ system::{ System, SystemEvent, + Phase, SystemStore, }, }, diff --git a/src/rpc.rs b/src/rpc.rs index f917a1146d..33f506a45e 100644 --- a/src/rpc.rs +++ b/src/rpc.rs @@ -39,7 +39,6 @@ use jsonrpc_core_client::{ use num_traits::bounds::Bounded; use frame_metadata::RuntimeMetadataPrefixed; -use frame_system::Phase; use sc_rpc_api::{ author::AuthorClient, chain::ChainClient, @@ -77,6 +76,7 @@ use crate::{ frame::{ balances::Balances, system::{ + Phase, System, SystemEvent, },