Unverified Commit c68121e0 authored by Gavin Wood's avatar Gavin Wood Committed by GitHub
Browse files

Update Substrate, introduce Society/Recovery (#757)

* Bump Substrate

* Bump RT version

* Bump substrate, add new modules

* Fix

* Bump Substrate

* Bump impl version

* Address grumbles
parent b4f03680
Pipeline #74586 passed with stages
in 24 minutes and 19 seconds
This diff is collapsed.
......@@ -48,7 +48,9 @@ membership = { package = "pallet-membership", git = "https://github.com/parityte
nicks = { package = "pallet-nicks", git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-master" }
offences = { package = "pallet-offences", git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-master" }
randomness-collective-flip = { package = "pallet-randomness-collective-flip", git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-master" }
recovery = { package = "pallet-recovery", git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-master" }
session = { package = "pallet-session", git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-master" }
society = { package = "pallet-society", git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-master" }
frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-master" }
staking = { package = "pallet-staking", git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-master" }
pallet-staking-reward-curve = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
......@@ -111,9 +113,11 @@ std = [
"membership/std",
"nicks/std",
"offences/std",
"recovery/std",
"sp-runtime/std",
"sp-staking/std",
"session/std",
"society/std",
"staking/std",
"system/std",
"system_rpc_runtime_api/std",
......
......@@ -78,7 +78,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
impl_name: create_runtime_str!("parity-kusama"),
authoring_version: 2,
spec_version: 1040,
impl_version: 0,
impl_version: 1,
apis: RUNTIME_API_VERSIONS,
};
......@@ -174,7 +174,7 @@ pub type DealWithFees = SplitTwoWays<
impl balances::Trait for Runtime {
type Balance = Balance;
type OnFreeBalanceZero = Staking;
type OnReapAccount = System;
type OnReapAccount = (System, Recovery);
type OnNewAccount = Indices;
type Event = Event;
type DustRemoval = ();
......@@ -546,6 +546,50 @@ impl utility::Trait for Runtime {
type MaxSignatories = MaxSignatories;
}
parameter_types! {
pub const ConfigDepositBase: Balance = 5 * DOLLARS;
pub const FriendDepositFactor: Balance = 50 * CENTS;
pub const MaxFriends: u16 = 9;
pub const RecoveryDeposit: Balance = 5 * DOLLARS;
}
impl recovery::Trait for Runtime {
type Event = Event;
type Call = Call;
type Currency = Balances;
type ConfigDepositBase = ConfigDepositBase;
type FriendDepositFactor = FriendDepositFactor;
type MaxFriends = MaxFriends;
type RecoveryDeposit = RecoveryDeposit;
}
parameter_types! {
pub const CandidateDeposit: Balance = 10 * DOLLARS;
pub const WrongSideDeduction: Balance = 2 * DOLLARS;
pub const MaxStrikes: u32 = 10;
pub const RotationPeriod: BlockNumber = 80 * HOURS;
pub const PeriodSpend: Balance = 500 * DOLLARS;
pub const MaxLockDuration: BlockNumber = 36 * 30 * DAYS;
pub const ChallengePeriod: BlockNumber = 7 * DAYS;
pub const MaxMembers: u32 = 999;
}
impl society::Trait for Runtime {
type Event = Event;
type Currency = Balances;
type Randomness = RandomnessCollectiveFlip;
type CandidateDeposit = CandidateDeposit;
type WrongSideDeduction = WrongSideDeduction;
type MaxStrikes = MaxStrikes;
type PeriodSpend = PeriodSpend;
type MembershipChanged = ();
type RotationPeriod = RotationPeriod;
type MaxLockDuration = MaxLockDuration;
type FounderSetOrigin = collective::EnsureProportionMoreThan<_1, _2, AccountId, CouncilCollective>;
type SuspensionJudgementOrigin = society::EnsureFounder<Runtime>;
type ChallengePeriod = ChallengePeriod;
}
construct_runtime! {
pub enum Runtime where
Block = Block,
......@@ -597,6 +641,12 @@ construct_runtime! {
// Less simple identity module.
Identity: identity::{Module, Call, Storage, Event<T>},
// Society module.
Society: society::{Module, Call, Storage, Event<T>},
// Social recovery module.
Recovery: recovery::{Module, Call, Storage, Event<T>},
}
}
......
......@@ -227,7 +227,7 @@ macro_rules! new_full_start {
}
/// Builds a new object suitable for chain operations.
pub fn new_chain_ops<Runtime, Dispatch, Extrinsic>(config: Configuration)
pub fn new_chain_ops<Runtime, Dispatch, Extrinsic>(mut config: Configuration)
-> Result<impl ServiceBuilderCommand<Block=Block>, ServiceError>
where
Runtime: ConstructRuntimeApi<Block, service::TFullClient<Block, Runtime, Dispatch>> + Send + Sync + 'static,
......@@ -237,6 +237,7 @@ where
Extrinsic: RuntimeExtrinsic,
<Runtime::RuntimeApi as sp_api::ApiExt<Block>>::StateBackend: sp_api::StateBackend<Blake2Hasher>,
{
config.keystore = service::config::KeystoreConfig::InMemory;
Ok(new_full_start!(config, Runtime, Dispatch).0)
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment