Skip to content

Commit

Permalink
Merge pull request #99 from AurevoirXavier/chainrelay
Browse files Browse the repository at this point in the history
Fix: #98
  • Loading branch information
hackfisher authored Nov 21, 2019
2 parents 0c88d53 + 71fb97d commit 5f13e2b
Show file tree
Hide file tree
Showing 4 changed files with 167 additions and 209 deletions.
2 changes: 1 addition & 1 deletion node/cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ where
info!("{}", version.name);
info!(" version {}", config.full_version());
info!(" _____ _ _ ");
info!(" | __ \\ (_) (_) ");
info!(" | __ \\ (_) (_) ");
info!(" | | | | __ _ _ ____ ___ _ __ _ __ _ ");
info!(" | | | |/ _` | '__\\ \\ /\\ / / | '_ \\| |/ _` |");
info!(" | |__| | (_| | | \\ V V /| | | | | | (_| |");
Expand Down
7 changes: 4 additions & 3 deletions node/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ use sr_api::impl_runtime_apis;

use node_primitives::{AccountId, AccountIndex, Balance, BlockNumber, Hash, Index, Moment, Signature};
use rstd::prelude::*;
use sr_primitives::traits::{self, BlakeTwo256, Block as BlockT, NumberFor, SaturatedConversion, StaticLookup};
use sr_primitives::traits::{
self, BlakeTwo256, Block as BlockT, NumberFor, OpaqueKeys, SaturatedConversion, StaticLookup,
};
use sr_primitives::transaction_validity::TransactionValidity;
use sr_primitives::weights::Weight;
#[cfg(any(feature = "std", test))]
Expand Down Expand Up @@ -245,7 +247,6 @@ impl authorship::Trait for Runtime {
// TODO: Introduce some structure to tie these together to make it a bit less of a footgun. This
// should be easy, since OneSessionHandler trait provides the `Key` as an associated type. #2858

type SessionHandlers = (Grandpa, Babe, ImOnline, AuthorityDiscovery);
parameter_types! {
pub const DisabledValidatorsThreshold: Perbill = Perbill::from_percent(17);
}
Expand All @@ -255,7 +256,7 @@ impl session::Trait for Runtime {
type ValidatorIdOf = staking::StashOf<Self>;
type ShouldEndSession = Babe;
type OnSessionEnding = Staking;
type SessionHandler = SessionHandlers;
type SessionHandler = <SessionKeys as OpaqueKeys>::KeyTypeIdProviders;
type Keys = SessionKeys;
type DisabledValidatorsThreshold = DisabledValidatorsThreshold;
type SelectInitialValidators = Staking;
Expand Down
6 changes: 3 additions & 3 deletions srml/staking/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1141,13 +1141,13 @@ impl<T: Trait> Module<T> {
CurrentEraStartSessionIndex::mutate(|v| {
*v = start_session_index;
});
let bonding_duration = {
let bonding_era = {
const BONDING_DURATION_ERA_TO_SECS_RATIO: TimeStamp = 300;
(T::BondingDuration::get() / BONDING_DURATION_ERA_TO_SECS_RATIO) as _
};

if current_era > bonding_duration {
let first_kept = current_era - bonding_duration;
if current_era > bonding_era {
let first_kept = current_era - bonding_era;
BondedEras::mutate(|bonded| {
bonded.push((current_era, start_session_index));

Expand Down
Loading

0 comments on commit 5f13e2b

Please sign in to comment.