Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Decouple the session validators from im-online #7127

Merged
Merged
Show file tree
Hide file tree
Changes from 58 commits
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
6 changes: 6 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions bin/node/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -830,6 +830,7 @@ impl<C> frame_system::offchain::SendTransactionTypes<C> for Runtime where
impl pallet_im_online::Config for Runtime {
type AuthorityId = ImOnlineId;
type Event = Event;
type ValidatorSet = Historical;
type SessionDuration = SessionDuration;
type ReportUnresponsiveness = Offences;
type UnsignedPriority = ImOnlineUnsignedPriority;
Expand Down
2 changes: 2 additions & 0 deletions frame/aura/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ sp-std = { version = "2.0.0", default-features = false, path = "../../primitives
serde = { version = "1.0.101", optional = true }
pallet-session = { version = "2.0.0", default-features = false, path = "../session" }
sp-runtime = { version = "2.0.0", default-features = false, path = "../../primitives/runtime" }
sp-session = { version = "2.0.0", default-features = false, path = "../../primitives/session" }
frame-support = { version = "2.0.0", default-features = false, path = "../support" }
sp-consensus-aura = { version = "0.8.0", path = "../../primitives/consensus/aura", default-features = false }
frame-system = { version = "2.0.0", default-features = false, path = "../system" }
Expand All @@ -41,6 +42,7 @@ std = [
"sp-std/std",
"serde",
"sp-runtime/std",
"sp-session/std",
"frame-support/std",
"sp-consensus-aura/std",
"frame-system/std",
Expand Down
4 changes: 2 additions & 2 deletions frame/aura/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@

use sp_std::{result, prelude::*};
use codec::{Encode, Decode};
use frame_support::{Parameter, traits::{Get, FindAuthor}, ConsensusEngineId};
use frame_support::{Parameter, traits::{Get, FindAuthor, OneSessionHandler}, ConsensusEngineId};
use sp_runtime::{
RuntimeAppPublic,
traits::{SaturatedConversion, Saturating, Zero, Member, IsMember}, generic::DigestItem,
Expand Down Expand Up @@ -144,7 +144,7 @@ impl<T: Config> sp_runtime::BoundToRuntimeAppPublic for Pallet<T> {
type Public = T::AuthorityId;
}

impl<T: Config> pallet_session::OneSessionHandler<T::AccountId> for Pallet<T> {
impl<T: Config> OneSessionHandler<T::AccountId> for Module<T> {
type Key = T::AuthorityId;

fn on_genesis_session<'a, I: 'a>(validators: I)
Expand Down
2 changes: 2 additions & 0 deletions frame/authority-discovery/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ sp-std = { version = "2.0.0", default-features = false, path = "../../primitives
serde = { version = "1.0.101", optional = true }
pallet-session = { version = "2.0.0", features = ["historical" ], path = "../session", default-features = false }
sp-runtime = { version = "2.0.0", default-features = false, path = "../../primitives/runtime" }
sp-session = { version = "2.0.0", default-features = false, path = "../../primitives/session" }
frame-support = { version = "2.0.0", default-features = false, path = "../support" }
frame-system = { version = "2.0.0", default-features = false, path = "../system" }

Expand All @@ -38,6 +39,7 @@ std = [
"serde",
"pallet-session/std",
"sp-runtime/std",
"sp-session/std",
"frame-support/std",
"frame-system/std",
]
6 changes: 3 additions & 3 deletions frame/authority-discovery/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#![cfg_attr(not(feature = "std"), no_std)]

use sp_std::prelude::*;
use frame_support::{decl_module, decl_storage};
use frame_support::{decl_module, decl_storage, traits::OneSessionHandler};
use sp_authority_discovery::AuthorityId;

/// The module's config trait.
Expand Down Expand Up @@ -85,7 +85,7 @@ impl<T: Config> sp_runtime::BoundToRuntimeAppPublic for Module<T> {
type Public = AuthorityId;
}

impl<T: Config> pallet_session::OneSessionHandler<T::AccountId> for Module<T> {
impl<T: Config> OneSessionHandler<T::AccountId> for Module<T> {
type Key = AuthorityId;

fn on_genesis_session<'a, I: 'a>(authorities: I)
Expand Down Expand Up @@ -265,7 +265,7 @@ mod tests {
let mut externalities = TestExternalities::new(t);

externalities.execute_with(|| {
use pallet_session::OneSessionHandler;
use frame_support::traits::OneSessionHandler;

AuthorityDiscovery::on_genesis_session(
first_authorities.iter().map(|id| (id, id.clone()))
Expand Down
4 changes: 2 additions & 2 deletions frame/babe/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use codec::{Decode, Encode};
use frame_support::{
decl_error, decl_module, decl_storage,
dispatch::DispatchResultWithPostInfo,
traits::{FindAuthor, Get, KeyOwnerProofSystem, Randomness as RandomnessT},
traits::{FindAuthor, Get, KeyOwnerProofSystem, OneSessionHandler, Randomness as RandomnessT},
weights::{Pays, Weight},
Parameter,
};
Expand Down Expand Up @@ -769,7 +769,7 @@ impl<T: Config> sp_runtime::BoundToRuntimeAppPublic for Module<T> {
type Public = AuthorityId;
}

impl<T: Config> pallet_session::OneSessionHandler<T::AccountId> for Module<T> {
impl<T: Config> OneSessionHandler<T::AccountId> for Module<T> {
type Key = AuthorityId;

fn on_genesis_session<'a, I: 'a>(validators: I)
Expand Down
4 changes: 2 additions & 2 deletions frame/grandpa/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ use fg_primitives::{
};
use frame_support::{
decl_error, decl_event, decl_module, decl_storage, dispatch::DispatchResultWithPostInfo,
storage, traits::KeyOwnerProofSystem, weights::{Pays, Weight}, Parameter,
storage, traits::{OneSessionHandler, KeyOwnerProofSystem}, weights::{Pays, Weight}, Parameter,
};
use frame_system::{ensure_none, ensure_root, ensure_signed};
use sp_runtime::{
Expand Down Expand Up @@ -587,7 +587,7 @@ impl<T: Config> sp_runtime::BoundToRuntimeAppPublic for Module<T> {
type Public = AuthorityId;
}

impl<T: Config> pallet_session::OneSessionHandler<T::AccountId> for Module<T>
impl<T: Config> OneSessionHandler<T::AccountId> for Module<T>
where T: pallet_session::Config
{
type Key = AuthorityId;
Expand Down
3 changes: 1 addition & 2 deletions frame/grandpa/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,10 @@ use codec::{Decode, Encode};
use fg_primitives::ScheduledChange;
use frame_support::{
assert_err, assert_ok,
traits::{Currency, OnFinalize},
traits::{Currency, OnFinalize, OneSessionHandler},
weights::{GetDispatchInfo, Pays},
};
use frame_system::{EventRecord, Phase};
use pallet_session::OneSessionHandler;
use sp_core::H256;
use sp_keyring::Ed25519Keyring;
use sp_runtime::testing::Digest;
Expand Down
9 changes: 6 additions & 3 deletions frame/im-online/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,28 +19,31 @@ codec = { package = "parity-scale-codec", version = "2.0.0", default-features =
sp-core = { version = "2.0.0", default-features = false, path = "../../primitives/core" }
sp-std = { version = "2.0.0", default-features = false, path = "../../primitives/std" }
serde = { version = "1.0.101", optional = true }
pallet-session = { version = "2.0.0", default-features = false, path = "../session" }
sp-io = { version = "2.0.0", default-features = false, path = "../../primitives/io" }
liuchengxu marked this conversation as resolved.
Show resolved Hide resolved
sp-runtime = { version = "2.0.0", default-features = false, path = "../../primitives/runtime" }
sp-staking = { version = "2.0.0", default-features = false, path = "../../primitives/staking" }
sp-session = { version = "2.0.0", default-features = false, path = "../../primitives/session" }
frame-support = { version = "2.0.0", default-features = false, path = "../support" }
frame-system = { version = "2.0.0", default-features = false, path = "../system" }

frame-benchmarking = { version = "2.0.0", default-features = false, path = "../benchmarking", optional = true }

[dev-dependencies]
pallet-session = { version = "2.0.0", path = "../session" }

[features]
default = ["std", "pallet-session/historical"]
default = ["std"]
std = [
"sp-application-crypto/std",
"pallet-authorship/std",
"codec/std",
"sp-core/std",
"sp-std/std",
"serde",
"pallet-session/std",
"sp-io/std",
"sp-runtime/std",
"sp-staking/std",
"sp-session/std",
"frame-support/std",
"frame-system/std",
]
Expand Down
Loading