Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Shrink the number of used modules
  • Loading branch information
bkchr committed Dec 18, 2018
commit 681feb2637a995cb1561da910c0bfa71d90d02cc
6 changes: 0 additions & 6 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 0 additions & 12 deletions runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,7 @@ substrate-keyring = { git = "https://github.com/paritytech/substrate" }
srml-balances = { git = "https://github.com/paritytech/substrate" }
srml-consensus = { git = "https://github.com/paritytech/substrate" }
srml-aura = { git = "https://github.com/paritytech/substrate" }
srml-grandpa = { git = "https://github.com/paritytech/substrate" }
srml-session = { git = "https://github.com/paritytech/substrate" }
srml-treasury = { git = "https://github.com/paritytech/substrate" }
srml-council = { git = "https://github.com/paritytech/substrate" }
srml-staking = { git = "https://github.com/paritytech/substrate" }
srml-executive = { git = "https://github.com/paritytech/substrate" }
srml-democracy = { git = "https://github.com/paritytech/substrate" }
sr-primitives = { git = "https://github.com/paritytech/substrate" }
srml-system = { git = "https://github.com/paritytech/substrate" }
srml-timestamp = { git = "https://github.com/paritytech/substrate" }
Expand All @@ -44,12 +38,6 @@ std = [
"sr-io/std",
"srml-support/std",
"srml-balances/std",
"srml-staking/std",
"srml-council/std",
"srml-grandpa/std",
"srml-democracy/std",
"srml-session/std",
"srml-treasury/std",
"srml-executive/std",
"srml-aura/std",
"sr-primitives/std",
Expand Down
87 changes: 3 additions & 84 deletions runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,29 +29,21 @@ extern crate srml_timestamp as timestamp;
extern crate srml_balances as balances;
extern crate srml_upgrade_key as upgrade_key;
extern crate srml_aura as aura;
extern crate srml_staking as staking;
extern crate srml_treasury as treasury;
extern crate srml_grandpa as grandpa;
extern crate srml_session as session;
extern crate srml_council as council;
extern crate srml_democracy as democracy;
extern crate substrate_consensus_aura_primitives as consensus_aura;

use council::motions as council_motions;
use rstd::prelude::*;
#[cfg(feature = "std")]
use primitives::bytes;
use primitives::{AuthorityId, OpaqueMetadata, u32_trait::{_2, _4}};
use primitives::{AuthorityId, OpaqueMetadata};
use runtime_primitives::{
ApplyResult, transaction_validity::TransactionValidity, Ed25519Signature, generic,
traits::{self, BlakeTwo256, Block as BlockT, ProvideInherent, DigestFor, Convert, NumberFor},
traits::{self, BlakeTwo256, Block as BlockT, ProvideInherent},
BasicInherentData, CheckInherentError
};
use client::{block_builder::api as block_builder_api, runtime_api};
use version::RuntimeVersion;
#[cfg(feature = "std")]
use version::NativeVersion;
use grandpa::fg_primitives::{self, ScheduledChange};
use consensus_aura::api as aura_api;

// A few exports that help ease life for downstream crates.
Expand Down Expand Up @@ -145,27 +137,7 @@ impl system::Trait for Runtime {
}

impl aura::Trait for Runtime {
type HandleReport = aura::StakingSlasher<Runtime>;
}

impl staking::Trait for Runtime {
type OnRewardMinted = Treasury;
type Event = Event;
}

impl council::Trait for Runtime {
type Event = Event;
}

impl council::motions::Trait for Runtime {
type Origin = Origin;
type Proposal = Call;
type Event = Event;
}

impl democracy::Trait for Runtime {
type Proposal = Call;
type Event = Event;
type HandleReport = ();
}

impl consensus::Trait for Runtime {
Expand All @@ -180,26 +152,6 @@ impl consensus::Trait for Runtime {
type Log = Log;
}

impl treasury::Trait for Runtime {
type ApproveOrigin = council_motions::EnsureMembers<_4>;
type RejectOrigin = council_motions::EnsureMembers<_2>;
type Event = Event;
}

/// Session key conversion.
pub struct SessionKeyConversion;
impl Convert<AccountId, opaque::SessionKey> for SessionKeyConversion {
fn convert(a: AccountId) -> opaque::SessionKey {
a.to_fixed_bytes().into()
}
}

impl session::Trait for Runtime {
type ConvertAccountIdToSessionKey = SessionKeyConversion;
type OnSessionChange = (Staking, grandpa::SyncedAuthorities<Runtime>);
type Event = Event;
}

impl timestamp::Trait for Runtime {
/// The position in the block's extrinsics that the timestamp-set inherent must be placed.
const TIMESTAMP_SET_POSITION: u32 = 0;
Expand Down Expand Up @@ -227,12 +179,6 @@ impl upgrade_key::Trait for Runtime {
type Event = Event;
}

impl grandpa::Trait for Runtime {
type SessionKey = opaque::SessionKey;
type Log = Log;
type Event = Event;
}

construct_runtime!(
pub enum Runtime with Log(InternalLog: DigestItem<Hash, AuthorityId>) where
Block = Block,
Expand All @@ -245,13 +191,6 @@ construct_runtime!(
Aura: aura::{Module},
Balances: balances,
UpgradeKey: upgrade_key,
Staking: staking,
Treasury: treasury,
Session: session,
Grandpa: grandpa::{Module, Call, Storage, Config<T>, Log(), Event<T>},
CouncilMotions: council_motions::{Module, Call, Storage, Event<T>, Origin},
Council: council::{Module, Call, Storage, Event<T>},
Democracy: democracy,
}
);

Expand Down Expand Up @@ -341,26 +280,6 @@ impl_runtime_apis! {
}
}

impl fg_primitives::GrandpaApi<Block> for Runtime {
fn grandpa_pending_change(digest: DigestFor<Block>)
-> Option<ScheduledChange<NumberFor<Block>>>
{
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_authorities() -> Vec<(opaque::SessionKey, u64)> {
Grandpa::grandpa_authorities()
}
}

impl aura_api::AuraApi<Block> for Runtime {
fn slot_duration() -> u64 {
Aura::slot_duration()
Expand Down
100 changes: 0 additions & 100 deletions runtime/wasm/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 0 additions & 8 deletions runtime/wasm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,10 @@ substrate-client = { git = "https://github.com/paritytech/substrate", default-fe
sr-std = { git = "https://github.com/paritytech/substrate", default-features = false }
sr-io = { git = "https://github.com/paritytech/substrate", default-features = false }
srml-support = { git = "https://github.com/paritytech/substrate", default-features = false }
srml-staking = { git = "https://github.com/paritytech/substrate", default-features = false }
srml-balances = { git = "https://github.com/paritytech/substrate", default-features = false }
srml-consensus = { git = "https://github.com/paritytech/substrate", default-features = false }
srml-executive = { git = "https://github.com/paritytech/substrate", default-features = false }
srml-aura = { git = "https://github.com/paritytech/substrate", default-features = false }
srml-grandpa = { git = "https://github.com/paritytech/substrate", default-features = false }
srml-session = { git = "https://github.com/paritytech/substrate", default-features = false }
srml-democracy = { git = "https://github.com/paritytech/substrate", default-features = false }
srml-council = { git = "https://github.com/paritytech/substrate", default-features = false }
srml-treasury = { git = "https://github.com/paritytech/substrate", default-features = false }
sr-primitives = { git = "https://github.com/paritytech/substrate", default-features = false }
srml-system = { git = "https://github.com/paritytech/substrate", default-features = false }
srml-timestamp = { git = "https://github.com/paritytech/substrate", default-features = false }
Expand All @@ -46,9 +40,7 @@ std = [
"srml-balances/std",
"srml-consensus/std",
"srml-executive/std",
"srml-council/std",
"srml-aura/std",
"srml-staking/std",
"sr-primitives/std",
"srml-system/std",
"srml-timestamp/std",
Expand Down
Loading