Commit ed983813 authored by thiolliere's avatar thiolliere Committed by Gavin Wood
Browse files

Update substrate polkadot-master branch (#268)

* update substrate

* update lock
parent d8ac7ed1
Pipeline #38663 passed with stages
in 23 minutes and 16 seconds
This diff is collapsed.
......@@ -18,7 +18,7 @@
use {grandpa, system};
use codec::Decode;
use sr_primitives::traits::{As, Hash as HashT, BlakeTwo256, Zero};
use sr_primitives::traits::{Hash as HashT, BlakeTwo256, Zero};
use rstd::prelude::*;
pub trait Trait: grandpa::Trait {}
......@@ -42,11 +42,12 @@ decl_module! {
}
fn on_finalize(block_number: T::BlockNumber) {
let shuffle_period = Self::shuffle_period();
// every so often shuffle the voters and issue a change.
let shuffle_period: u64 = Self::shuffle_period().as_();
if shuffle_period == 0 { return }
if shuffle_period.is_zero() { return }
if block_number.as_() % shuffle_period == 0 {
if (block_number % shuffle_period).is_zero() {
let mut voters = grandpa::Module::<T>::grandpa_authorities();
let voter_count = voters.len();
......
......@@ -64,20 +64,18 @@ decl_storage! {
config(parachains): Vec<(ParaId, Vec<u8>, Vec<u8>)>;
config(_phdata): PhantomData<T>;
build(|storage: &mut StorageOverlay, _: &mut ChildrenStorageOverlay, config: &GenesisConfig<T>| {
let storage = std::cell::RefCell::new(storage);
let mut p = config.parachains.clone();
p.sort_unstable_by_key(|&(ref id, _, _)| id.clone());
p.dedup_by_key(|&mut (ref id, _, _)| id.clone());
let only_ids: Vec<_> = p.iter().map(|&(ref id, _, _)| id).cloned().collect();
<Parachains<T> as generator::StorageValue<_>>::put(&only_ids, &storage);
<Parachains<T> as generator::StorageValue<_>>::put(&only_ids, storage);
for (id, code, genesis) in p {
// no ingress -- a chain cannot be routed to until it is live.
<Code<T> as generator::StorageMap<_, _>>::insert(&id, &code, &storage);
<Heads<T> as generator::StorageMap<_, _>>::insert(&id, &genesis, &storage);
<Code<T> as generator::StorageMap<_, _>>::insert(&id, &code, storage);
<Heads<T> as generator::StorageMap<_, _>>::insert(&id, &genesis, storage);
}
});
}
......
......@@ -105,8 +105,8 @@ fn staging_testnet_config_genesis() -> GenesisConfig {
}),
staking: Some(StakingConfig {
current_era: 0,
offline_slash: Perbill::from_billionths(1_000_000),
session_reward: Perbill::from_billionths(2_065),
offline_slash: Perbill::from_parts(1_000_000),
session_reward: Perbill::from_parts(2_065),
current_session_reward: 0,
validator_count: 7,
sessions_per_era: 12,
......
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