Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
33b105b
Decouple the session validators from im-online
liuchengxu Sep 17, 2020
d5ce27f
Merge branch 'master' of https://github.com/paritytech/substrate into…
liuchengxu Sep 18, 2020
1070e51
Merge branch 'master' of https://github.com/paritytech/substrate into…
liuchengxu Sep 20, 2020
526dbd7
.
liuchengxu Sep 20, 2020
5f1ab56
Add SessionInterface trait in im-online
liuchengxu Sep 23, 2020
451179d
Merge branch 'make-im-online-validator-set-flexiable' of https://gith…
liuchengxu Sep 24, 2020
725ca92
Merge branch 'master' of https://github.com/paritytech/substrate into…
liuchengxu Sep 24, 2020
141b27b
Fix merging issue
liuchengxu Sep 24, 2020
9bed321
Make all compile
liuchengxu Sep 24, 2020
1582b7b
Fix tests
liuchengxu Sep 24, 2020
8fded12
Avoid using frame dep in primitives via pallet-session-common
liuchengxu Sep 24, 2020
db2d1a4
Merge ValidatorSet into SessionInterface trait
liuchengxu Sep 24, 2020
9f1344d
Move pallet-sesion-common into pallet-session
liuchengxu Sep 25, 2020
d5a3b4f
Move SessionInterface to sp-session and impl it in session pallet
liuchengxu Sep 25, 2020
004bde7
Split put historical::FullValidatorIdentification trait
liuchengxu Sep 26, 2020
c395c81
Fix line width
liuchengxu Sep 26, 2020
550632d
Merge branch 'master' of https://github.com/paritytech/substrate into…
liuchengxu Sep 26, 2020
4ebb2ef
Fix staking mock
liuchengxu Sep 26, 2020
5a92424
Fix session doc test
liuchengxu Sep 26, 2020
90efb67
Simplify <T as ValidatorIdentification<AccountId>>::ValidatorId as Va…
liuchengxu Sep 27, 2020
1a71e3e
Nits
liuchengxu Sep 27, 2020
e1abd33
Merge branch 'master' of https://github.com/paritytech/substrate into…
liuchengxu Oct 5, 2020
ee947a5
Merge branch 'master' of https://github.com/paritytech/substrate into…
liuchengxu Oct 18, 2020
f274541
Clean up.
tomusdrw Oct 19, 2020
c87f862
Make it compile by commenting out report_offence_im_online bench
liuchengxu Oct 22, 2020
1840186
Tests
liuchengxu Oct 22, 2020
da2d4a5
Nits
liuchengxu Oct 22, 2020
58e9fcc
Move OneSessionHandler to sp-session
liuchengxu Oct 22, 2020
7066c13
Fix tests
liuchengxu Oct 22, 2020
9eea0a3
Merge branch 'master' of https://github.com/paritytech/substrate into…
liuchengxu Oct 22, 2020
1848bd7
Add some docs
liuchengxu Oct 22, 2020
650f279
.
liuchengxu Oct 23, 2020
ee81bf1
Fix typo
liuchengxu Oct 23, 2020
e7598a3
Merge branch 'master' of https://github.com/paritytech/substrate into…
liuchengxu Oct 28, 2020
ff94e6b
Rename to ValidatorSet::session_index()
liuchengxu Oct 28, 2020
7d5cceb
Add some more docs
liuchengxu Oct 28, 2020
de08937
.
liuchengxu Oct 28, 2020
e28377b
Merge branch 'master' of https://github.com/paritytech/substrate into…
liuchengxu Oct 28, 2020
6e07546
Merge branch 'master' of https://github.com/paritytech/substrate into…
liuchengxu Oct 31, 2020
6c42cc8
Merge branch 'master' of https://github.com/paritytech/substrate into…
liuchengxu Nov 2, 2020
fe9e17a
Remove extra empty line
liuchengxu Nov 2, 2020
3fdb3c4
Merge branch 'master' of https://github.com/paritytech/substrate into…
liuchengxu Nov 3, 2020
6d8defa
Merge branch 'master' of https://github.com/paritytech/substrate into…
liuchengxu Nov 4, 2020
aef33ca
Merge branch 'master' of https://github.com/paritytech/substrate into…
liuchengxu Nov 9, 2020
b919689
Merge branch 'master' of https://github.com/paritytech/substrate into…
liuchengxu Jan 4, 2021
516afb2
Merge branch 'master' of https://github.com/paritytech/substrate into…
liuchengxu Jan 14, 2021
c4158d7
Merge branch 'master' of https://github.com/paritytech/substrate into…
liuchengxu Jan 20, 2021
ea357a3
Fix line width check
liuchengxu Jan 20, 2021
6937b72
Merge branch 'master' of https://github.com/paritytech/substrate into…
liuchengxu Jan 21, 2021
7a265af
Merge branch 'master' of https://github.com/paritytech/substrate into…
liuchengxu Jan 24, 2021
d4787ad
Merge branch 'master' of https://github.com/paritytech/substrate into…
liuchengxu Jan 25, 2021
2c007d0
Merge branch 'master' of https://github.com/paritytech/substrate into…
liuchengxu Jan 27, 2021
a34f75c
Merge branch 'master' of https://github.com/paritytech/substrate into…
liuchengxu Feb 1, 2021
04f247c
Merge branch 'make-im-online-validator-set-flexiable' of https://gith…
liuchengxu Feb 1, 2021
865bfd8
Merge branch 'master' of https://github.com/paritytech/substrate into…
liuchengxu Feb 2, 2021
0a39d79
Merge branch 'master' of https://github.com/paritytech/substrate into…
liuchengxu Feb 2, 2021
e8c8ce5
Merge branch 'master' of https://github.com/paritytech/substrate into…
liuchengxu Feb 2, 2021
12ff709
Apply suggestions from code review
liuchengxu Feb 2, 2021
12324f3
Cleaup Cargo.toml
liuchengxu Feb 2, 2021
3551036
Aura has migrated to Pallet now
liuchengxu Feb 2, 2021
8e392fa
Merge branch 'master' of https://github.com/paritytech/substrate into…
liuchengxu Feb 2, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Split put historical::FullValidatorIdentification trait
  • Loading branch information
liuchengxu committed Sep 26, 2020
commit 004bde7857ec5881dc6b1156069d86f513c13add
7 changes: 3 additions & 4 deletions bin/node/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -402,10 +402,11 @@ parameter_types! {
pub const DisabledValidatorsThreshold: Perbill = Perbill::from_percent(17);
}


impl pallet_session::ValidatorIdentification<<Self as frame_system::Trait>::AccountId> for Runtime {
type ValidatorId = <Self as frame_system::Trait>::AccountId;
type ValidatorIdOf = pallet_staking::StashOf<Self>;
}
impl pallet_session::historical::FullValidatorIdentification<<Self as frame_system::Trait>::AccountId> for Runtime {
type FullIdentification = pallet_staking::Exposure<AccountId, Balance>;
type FullIdentificationOf = pallet_staking::ExposureOf<Runtime>;
}
Expand All @@ -421,8 +422,6 @@ impl pallet_session::Trait for Runtime {
type WeightInfo = weights::pallet_session::WeightInfo<Runtime>;
}

impl pallet_session::historical::Trait for Runtime {}

pallet_staking_reward_curve::build! {
const REWARD_CURVE: PiecewiseLinear<'static> = curve!(
min_inflation: 0_025_000,
Expand Down Expand Up @@ -772,7 +771,7 @@ parameter_types! {

impl pallet_offences::Trait for Runtime {
type Event = Event;
type IdentificationTuple = pallet_session::IdentificationTuple<AccountId, Self>;
type IdentificationTuple = pallet_session::historical::IdentificationTuple<AccountId, Self>;
type OnOffenceHandler = Staking;
type WeightSoftLimit = OffencesWeightSoftLimit;
}
Expand Down
4 changes: 2 additions & 2 deletions frame/authority-discovery/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ mod tests {
impl pallet_session::ValidatorIdentification<AuthorityId> for Test {
type ValidatorId = AuthorityId;
type ValidatorIdOf = ConvertInto;
}
impl pallet_session::historical::FullValidatorIdentification<AuthorityId> for Test {
type FullIdentification = ();
type FullIdentificationOf = ();
}
Expand All @@ -131,8 +133,6 @@ mod tests {
type WeightInfo = ();
}

impl pallet_session::historical::Trait for Test {}

pub type BlockNumber = u64;

parameter_types! {
Expand Down
6 changes: 3 additions & 3 deletions frame/babe/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@ impl_opaque_keys! {
impl pallet_session::ValidatorIdentification<DummyValidatorId> for Test {
type ValidatorId = <Self as frame_system::Trait>::AccountId;
type ValidatorIdOf = pallet_staking::StashOf<Self>;
}
impl pallet_session::historical::FullValidatorIdentification<DummyValidatorId> for Test {
type FullIdentification = pallet_staking::Exposure<u64, u128>;
type FullIdentificationOf = pallet_staking::ExposureOf<Self>;
}
Expand All @@ -125,8 +127,6 @@ impl pallet_session::Trait for Test {
type WeightInfo = ();
}

impl pallet_session::historical::Trait for Test {}

parameter_types! {
pub const UncleGenerations: u64 = 0;
}
Expand Down Expand Up @@ -229,7 +229,7 @@ parameter_types! {

impl pallet_offences::Trait for Test {
type Event = ();
type IdentificationTuple = pallet_session::IdentificationTuple<DummyValidatorId, Self>;
type IdentificationTuple = pallet_session::historical::IdentificationTuple<DummyValidatorId, Self>;
type OnOffenceHandler = Staking;
type WeightSoftLimit = OffencesWeightSoftLimit;
}
Expand Down
6 changes: 3 additions & 3 deletions frame/grandpa/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@ parameter_types! {
impl pallet_session::ValidatorIdentification<u64> for Test {
type ValidatorId = u64;
type ValidatorIdOf = pallet_staking::StashOf<Self>;
}
impl pallet_session::historical::FullValidatorIdentification<u64> for Test {
type FullIdentification = pallet_staking::Exposure<u64, u128>;
type FullIdentificationOf = pallet_staking::ExposureOf<Self>;
}
Expand All @@ -140,8 +142,6 @@ impl pallet_session::Trait for Test {
type WeightInfo = ();
}

impl pallet_session::historical::Trait for Test {}

parameter_types! {
pub const UncleGenerations: u64 = 0;
}
Expand Down Expand Up @@ -244,7 +244,7 @@ parameter_types! {

impl pallet_offences::Trait for Test {
type Event = TestEvent;
type IdentificationTuple = pallet_session::IdentificationTuple<u64, Self>;
type IdentificationTuple = pallet_session::historical::IdentificationTuple<u64, Self>;
type OnOffenceHandler = Staking;
type WeightSoftLimit = OffencesWeightSoftLimit;
}
Expand Down
9 changes: 6 additions & 3 deletions frame/im-online/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,10 @@ use frame_system::offchain::{
SendTransactionTypes,
SubmitTransaction,
};
use pallet_session::{IdentificationTuple, ValidatorIdentification};
use pallet_session::{
historical::{FullValidatorIdentification, IdentificationTuple},
ValidatorIdentification,
};

pub mod sr25519 {
mod app_sr25519 {
Expand Down Expand Up @@ -234,7 +237,7 @@ pub trait WeightInfo {

pub trait Trait:
SendTransactionTypes<Call<Self>>
+ ValidatorIdentification<<Self as frame_system::Trait>::AccountId>
+ FullValidatorIdentification<<Self as frame_system::Trait>::AccountId>
+ frame_system::Trait
{
/// The identifier type for an authority.
Expand Down Expand Up @@ -671,7 +674,7 @@ impl<T: Trait> pallet_session::OneSessionHandler<T::AccountId> for Module<T> {
.filter(|(index, id)|
!Self::is_online_aux(*index as u32, id)
).filter_map(|(_, id)|
<T as ValidatorIdentification<T::AccountId>>::FullIdentificationOf::convert(id.clone()).map(|full_id| (id, full_id))
<T as FullValidatorIdentification<T::AccountId>>::FullIdentificationOf::convert(id.clone()).map(|full_id| (id, full_id))
).collect::<Vec<IdentificationTuple<T::AccountId, T>>>();

// Remove all received heartbeats and number of authored blocks from the
Expand Down
4 changes: 2 additions & 2 deletions frame/im-online/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,8 @@ parameter_types! {
impl pallet_session::ValidatorIdentification<u64> for Runtime {
type ValidatorId = u64;
type ValidatorIdOf = ConvertInto;
}
impl pallet_session::historical::FullValidatorIdentification<u64> for Runtime {
type FullIdentification = u64;
type FullIdentificationOf = ConvertInto;
}
Expand All @@ -164,8 +166,6 @@ impl pallet_session::Trait for Runtime {
type WeightInfo = ();
}

impl pallet_session::historical::Trait for Runtime {}

parameter_types! {
pub const UncleGenerations: u32 = 5;
}
Expand Down
7 changes: 5 additions & 2 deletions frame/offences/benchmarking/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,10 @@ use pallet_grandpa::{GrandpaEquivocationOffence, GrandpaTimeSlot};
use pallet_im_online::{Trait as ImOnlineTrait, Module as ImOnline, UnresponsivenessOffence};
use pallet_offences::{Trait as OffencesTrait, Module as Offences};
use pallet_session::historical::{Trait as HistoricalTrait};
use pallet_session::{Trait as SessionTrait, SessionManager, IdentificationTuple, ValidatorIdentification};
use pallet_session::{
Trait as SessionTrait, SessionManager, ValidatorIdentification,
historical::{IdentificationTuple, FullValidatorIdentification},
};
use pallet_staking::{
Module as Staking, Trait as StakingTrait, RewardDestination, ValidatorPrefs,
Exposure, IndividualExposure, ElectionStatus, MAX_NOMINATIONS, Event as StakingEvent
Expand Down Expand Up @@ -170,7 +173,7 @@ fn make_offenders<T: Trait>(num_offenders: u32, num_nominators: u32) -> Result<
let validator_id_of =
<T as ValidatorIdentification<<T as frame_system::Trait>::AccountId>>::ValidatorIdOf::convert;
let full_identification_of =
<T as ValidatorIdentification<<T as frame_system::Trait>::AccountId>>::FullIdentificationOf::convert;
<T as FullValidatorIdentification<<T as frame_system::Trait>::AccountId>>::FullIdentificationOf::convert;

let id_tuples = offenders.iter()
.map(|offender| validator_id_of(offender.controller.clone())
Expand Down
5 changes: 3 additions & 2 deletions frame/offences/benchmarking/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,11 @@ impl pallet_timestamp::Trait for Test {
impl pallet_session::ValidatorIdentification<AccountId> for Test {
type ValidatorId = AccountId;
type ValidatorIdOf = pallet_staking::StashOf<Test>;
}
impl pallet_session::historical::FullValidatorIdentification<AccountId> for Test {
type FullIdentification = pallet_staking::Exposure<AccountId, Balance>;
type FullIdentificationOf = pallet_staking::ExposureOf<Test>;
}
impl pallet_session::historical::Trait for Test {}

sp_runtime::impl_opaque_keys! {
pub struct SessionKeys {
Expand Down Expand Up @@ -203,7 +204,7 @@ parameter_types! {

impl pallet_offences::Trait for Test {
type Event = Event;
type IdentificationTuple = pallet_session::IdentificationTuple<AccountId, Self>;
type IdentificationTuple = pallet_session::historical::IdentificationTuple<AccountId, Self>;
type OnOffenceHandler = Staking;
type WeightSoftLimit = OffencesWeightSoftLimit;
}
Expand Down
3 changes: 2 additions & 1 deletion frame/session/benchmarking/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,11 @@ impl pallet_timestamp::Trait for Test {
impl pallet_session::ValidatorIdentification<AccountId> for Test {
type ValidatorId = AccountId;
type ValidatorIdOf = pallet_staking::StashOf<Test>;
}
impl pallet_session::historical::FullValidatorIdentification<AccountId> for Test {
type FullIdentification = pallet_staking::Exposure<AccountId, Balance>;
type FullIdentificationOf = pallet_staking::ExposureOf<Test>;
}
impl pallet_session::historical::Trait for Test {}

sp_runtime::impl_opaque_keys! {
pub struct SessionKeys {
Expand Down
28 changes: 25 additions & 3 deletions frame/session/src/historical/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,40 @@ use codec::{Encode, Decode};
use sp_runtime::KeyTypeId;
use sp_runtime::traits::{Convert, OpaqueKeys};
use sp_session::{MembershipProof, ValidatorCount};
use frame_support::{decl_module, decl_storage};
use frame_support::{decl_module, decl_storage, Parameter};
use frame_support::print;
use sp_trie::{MemoryDB, Trie, TrieMut, Recorder, EMPTY_PREFIX};
use sp_trie::trie_types::{TrieDBMut, TrieDB};
use super::{SessionIndex, Module as SessionModule, IdentificationTuple};
use super::{SessionIndex, Module as SessionModule, ValidatorIdentification};

mod shared;
pub mod offchain;
pub mod onchain;

pub trait FullValidatorIdentification<AccountId>: ValidatorIdentification<AccountId> {
/// Full identification of the validator.
type FullIdentification: Parameter;

/// A conversion from validator ID to full identification.
///
/// This should contain any references to economic actors associated with the
/// validator, since they may be outdated by the time this is queried from a
/// historical trie.
///
/// It must return the identification for the current session index.
type FullIdentificationOf: Convert<Self::ValidatorId, Option<Self::FullIdentification>>;
}

/// A tuple of the validator's ID and their full identification.
pub type IdentificationTuple<AccountId, T> = (
<T as ValidatorIdentification<AccountId>>::ValidatorId,
<T as FullValidatorIdentification<AccountId>>::FullIdentification
);

/// Trait necessary for the historical module.
pub trait Trait: super::Trait {}
pub trait Trait: FullValidatorIdentification<<Self as frame_system::Trait>::AccountId> + super::Trait {}

impl<T: FullValidatorIdentification<<Self as frame_system::Trait>::AccountId> + super::Trait> Trait for T {}

decl_storage! {
trait Store for Module<T: Trait> as Session {
Expand Down
2 changes: 1 addition & 1 deletion frame/session/src/historical/offchain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ mod tests {

let sample = (
22u32 as <Test as ValidatorIdentification<u64>>::ValidatorId,
7_777_777 as <Test as ValidatorIdentification<u64>>::FullIdentification);
7_777_777 as <Test as crate::historical::FullValidatorIdentification<u64>>::FullIdentification);

let encoded = sample.encode();
let decoded = Decode::decode(&mut encoded.as_slice()).expect("Must decode");
Expand Down
4 changes: 2 additions & 2 deletions frame/session/src/historical/onchain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use sp_runtime::traits::Convert;

use super::super::Trait as SessionTrait;
use super::super::{Module as SessionModule, SessionIndex, ValidatorIdentification};
use super::Trait as HistoricalTrait;
use super::{Trait as HistoricalTrait, FullValidatorIdentification};

use super::shared;
use sp_std::prelude::*;
Expand All @@ -42,7 +42,7 @@ pub fn store_session_validator_set_to_offchain<T: HistoricalTrait + SessionTrait
.into_iter()
.filter_map(|validator_id: <T as ValidatorIdentification<T::AccountId>>::ValidatorId| {
let full_identification =
<<T as ValidatorIdentification<T::AccountId>>::FullIdentificationOf>::convert(validator_id.clone());
<<T as FullValidatorIdentification<T::AccountId>>::FullIdentificationOf>::convert(validator_id.clone());
full_identification.map(|full_identification| (validator_id, full_identification))
})
.collect::<Vec<_>>();
Expand Down
18 changes: 0 additions & 18 deletions frame/session/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,26 +133,8 @@ pub trait ValidatorIdentification<AccountId> {
///
/// Its cost must be at most one storage read.
type ValidatorIdOf: Convert<AccountId, Option<Self::ValidatorId>>;

/// Full identification of the validator.
type FullIdentification: Parameter;

/// A conversion from validator ID to full identification.
///
/// This should contain any references to economic actors associated with the
/// validator, since they may be outdated by the time this is queried from a
/// historical trie.
///
/// It must return the identification for the current session index.
type FullIdentificationOf: Convert<Self::ValidatorId, Option<Self::FullIdentification>>;
}

/// A tuple of the validator's ID and their full identification.
pub type IdentificationTuple<AccountId, T> = (
<T as ValidatorIdentification<AccountId>>::ValidatorId,
<T as ValidatorIdentification<AccountId>>::FullIdentification
);

/// Decides whether the session should be ended.
pub trait ShouldEndSession<BlockNumber> {
/// Return `true` if the session should be ended.
Expand Down
5 changes: 2 additions & 3 deletions frame/session/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,8 @@ parameter_types! {
impl crate::ValidatorIdentification<u64> for Test {
type ValidatorId = u64;
type ValidatorIdOf = ConvertInto;
}
impl crate::historical::FullValidatorIdentification<u64> for Test {
type FullIdentification = u64;
type FullIdentificationOf = sp_runtime::traits::ConvertInto;
}
Expand All @@ -232,8 +234,5 @@ impl Trait for Test {
type WeightInfo = ();
}

#[cfg(feature = "historical")]
impl crate::historical::Trait for Test {}

pub type System = frame_system::Module<Test>;
pub type Session = Module<Test>;
4 changes: 3 additions & 1 deletion frame/staking/fuzzer/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,13 @@ impl pallet_timestamp::Trait for Test {
type MinimumPeriod = MinimumPeriod;
type WeightInfo = ();
}
impl pallet_session::historical::Trait for Test {}

impl pallet_session::ValidatorIdentification<<Self as frame_system::Trait>::AccountId> for Test {
type ValidatorId = AccountId;
type ValidatorIdOf = pallet_staking::StashOf<Test>;
}

impl pallet_session::historical::FullValidatorIdentification<<Self as frame_system::Trait>::AccountId> for Test {
type FullIdentification = pallet_staking::Exposure<AccountId, Balance>;
type FullIdentificationOf = pallet_staking::ExposureOf<Test>;
}
Expand Down
4 changes: 2 additions & 2 deletions frame/staking/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3177,7 +3177,7 @@ impl<T: Trait> Convert<T::AccountId, Option<Exposure<T::AccountId, BalanceOf<T>>
impl <T: Trait>
OnOffenceHandler<
T::AccountId,
pallet_session::IdentificationTuple<<T as frame_system::Trait>::AccountId, T>,
pallet_session::historical::IdentificationTuple<<T as frame_system::Trait>::AccountId, T>,
Weight,
>
for Module<T> where
Expand All @@ -3196,7 +3196,7 @@ for Module<T> where
fn on_offence(
offenders: &[OffenceDetails<
T::AccountId,
pallet_session::IdentificationTuple<<T as frame_system::Trait>::AccountId, T>>
pallet_session::historical::IdentificationTuple<<T as frame_system::Trait>::AccountId, T>>
],
slash_fraction: &[Perbill],
slash_session: SessionIndex,
Expand Down
7 changes: 4 additions & 3 deletions frame/staking/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,8 @@ sp_runtime::impl_opaque_keys! {
impl pallet_session::ValidatorIdentification<AccountId> for Test {
type ValidatorId = AccountId;
type ValidatorIdOf = crate::StashOf<Test>;
}
impl pallet_session::historical::FullValidatorIdentification<AccountId> for Test {
type FullIdentification = crate::Exposure<AccountId, Balance>;
type FullIdentificationOf = crate::ExposureOf<Test>;
}
Expand All @@ -264,7 +266,6 @@ impl pallet_session::Trait for Test {
type WeightInfo = ();
}

impl pallet_session::historical::Trait for Test {}
impl pallet_authorship::Trait for Test {
type FindAuthor = Author11;
type UncleGenerations = UncleGenerations;
Expand Down Expand Up @@ -742,7 +743,7 @@ pub(crate) fn validator_controllers() -> Vec<AccountId> {
pub(crate) fn on_offence_in_era(
offenders: &[OffenceDetails<
AccountId,
pallet_session::IdentificationTuple<AccountId, Test>,
pallet_session::historical::IdentificationTuple<AccountId, Test>,
>],
slash_fraction: &[Perbill],
era: EraIndex,
Expand Down Expand Up @@ -770,7 +771,7 @@ pub(crate) fn on_offence_in_era(
}

pub(crate) fn on_offence_now(
offenders: &[OffenceDetails<AccountId, pallet_session::IdentificationTuple<AccountId, Test>>],
offenders: &[OffenceDetails<AccountId, pallet_session::historical::IdentificationTuple<AccountId, Test>>],
slash_fraction: &[Perbill],
) {
let now = Staking::active_era().unwrap().index;
Expand Down
2 changes: 1 addition & 1 deletion frame/staking/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4578,7 +4578,7 @@ fn offences_weight_calculated_correctly() {

let offenders: Vec<OffenceDetails<
<Test as frame_system::Trait>::AccountId,
pallet_session::IdentificationTuple<<Test as frame_system::Trait>::AccountId, Test>,
pallet_session::historical::IdentificationTuple<<Test as frame_system::Trait>::AccountId, Test>,
>>
= (1..10).map(|i|
OffenceDetails {
Expand Down