From b633f93b007aec7a98f228f6fa42229dfefc91ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Silva?= Date: Thu, 25 Jul 2019 13:22:46 +0100 Subject: [PATCH] srml: staking: track session index of current era start (#3203) * srml: staking: track session index of current era start * node: bump spec_version --- substrate/node/runtime/src/lib.rs | 4 ++-- substrate/srml/staking/src/lib.rs | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/substrate/node/runtime/src/lib.rs b/substrate/node/runtime/src/lib.rs index 834635a312..4e8ff401b8 100644 --- a/substrate/node/runtime/src/lib.rs +++ b/substrate/node/runtime/src/lib.rs @@ -79,8 +79,8 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { // and set impl_version to equal spec_version. If only runtime // implementation changes and behavior does not, then leave spec_version as // is and increment impl_version. - spec_version: 120, - impl_version: 120, + spec_version: 121, + impl_version: 121, apis: RUNTIME_API_VERSIONS, }; diff --git a/substrate/srml/staking/src/lib.rs b/substrate/srml/staking/src/lib.rs index dbf32ca5bd..a1a555bcf5 100644 --- a/substrate/srml/staking/src/lib.rs +++ b/substrate/srml/staking/src/lib.rs @@ -590,6 +590,9 @@ decl_storage! { /// The start of the current era. pub CurrentEraStart get(current_era_start): MomentOf; + /// The session index at which the current era started. + pub CurrentEraStartSessionIndex get(current_era_start_session_index): SessionIndex; + /// Rewards for the current era. Using indices of current elected set. pub CurrentEraRewards: EraRewards; @@ -1169,6 +1172,9 @@ impl Module { // Increment current era. let current_era = CurrentEra::mutate(|s| { *s += 1; *s }); + CurrentEraStartSessionIndex::mutate(|v| { + *v = start_session_index; + }); let bonding_duration = T::BondingDuration::get(); if current_era > bonding_duration {