Separate out staking module into balances and payment (#629)

* Initial commit.

* Split out balances module

* Minimise Balances trait requirements

* Fix up balances, remove balances stuff from staking

* Split off and fix up staking module

* Fix executive tests

* Fix up democracy module

* make council work again

* Remove unneeded cruft from democracy

* Fix up contract module

* Fix up rest of tests

* Fix minor TODOs

* Fix tests

* Remove superfluous code

* Move offline inherents to consensus module.

Fixes #630

* Version needs Decode.

* Move Decode back

* Fix nits

* Refactor to allow custom message
This commit is contained in:
Gav Wood
2018-08-30 18:43:38 +02:00
committed by GitHub
parent 6ae3204f17
commit 8281618e50
52 changed files with 1920 additions and 1688 deletions
@@ -1,18 +1,18 @@
// Copyright 2017 Parity Technologies (UK) Ltd.
// This file is part of Substrate Demo.
// This file is part of Substrate.
// Substrate Demo is free software: you can redistribute it and/or modify
// Substrate is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Substrate Demo is distributed in the hope that it will be useful,
// Substrate is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with Substrate Demo. If not, see <http://www.gnu.org/licenses/>.
// along with Substrate. If not, see <http://www.gnu.org/licenses/>.
//! System manager: Handles lowest level stuff like depositing logs, basic set up and take down of
//! temporary storage entries, access to old block hashes.
@@ -45,7 +45,7 @@ extern crate safe_mix;
use rstd::prelude::*;
use primitives::traits::{self, CheckEqual, SimpleArithmetic, SimpleBitOps, Zero, One, Bounded,
Hash, Member, MaybeDisplay};
Hash, Member, MaybeDisplay, RefInto, MaybeEmpty};
use runtime_support::{StorageValue, StorageMap, Parameter};
use safe_mix::TripletMix;
@@ -69,6 +69,9 @@ pub fn extrinsics_data_root<H: Hash>(xts: Vec<Vec<u8>>) -> H::Output {
}
pub trait Trait: Eq + Clone {
// We require that PublicAux impl MaybeEmpty, since we require that inherents - or unsigned
// user-level extrinsics - can exist.
type PublicAux: RefInto<Self::AccountId> + MaybeEmpty;
type Index: Parameter + Member + Default + MaybeDisplay + SimpleArithmetic + Copy;
type BlockNumber: Parameter + Member + MaybeDisplay + SimpleArithmetic + Default + Bounded + Copy + rstd::hash::Hash;
type Hash: Parameter + Member + MaybeDisplay + SimpleBitOps + Default + Copy + CheckEqual + rstd::hash::Hash + AsRef<[u8]>;
@@ -287,6 +290,7 @@ mod tests {
#[derive(Clone, Eq, PartialEq)]
pub struct Test;
impl Trait for Test {
type PublicAux = u64;
type Index = u64;
type BlockNumber = u64;
type Hash = H256;