Unverified Commit 0ef88069 authored by André Silva's avatar André Silva Committed by GitHub
Browse files

Companion for substrate#9448 (#3527)



* Companion for substrate#9448

* fix on_disabled

* use temporary beefy branch

* revert beefy updates

* update Substrate
Co-authored-by: Andronik Ordian's avatarAndronik Ordian <write@reusable.software>
Co-authored-by: parity-processbot <>
parent dcb81807
Pipeline #160906 passed with stages
in 45 minutes and 20 seconds
This diff is collapsed.
......@@ -307,7 +307,6 @@ impl pallet_session::Config for Runtime {
type SessionManager = pallet_shift_session_manager::Pallet<Runtime>;
type SessionHandler = <SessionKeys as OpaqueKeys>::KeyTypeIdProviders;
type Keys = SessionKeys;
type DisabledValidatorsThreshold = ();
// TODO: update me (https://github.com/paritytech/parity-bridges-common/issues/78)
type WeightInfo = ();
}
......
......@@ -423,7 +423,6 @@ impl pallet_session::Config for Runtime {
type SessionManager = pallet_shift_session_manager::Pallet<Runtime>;
type SessionHandler = <SessionKeys as OpaqueKeys>::KeyTypeIdProviders;
type Keys = SessionKeys;
type DisabledValidatorsThreshold = ();
// TODO: update me (https://github.com/paritytech/parity-bridges-common/issues/78)
type WeightInfo = ();
}
......
......@@ -162,7 +162,6 @@ mod tests {
type SessionManager = ();
type SessionHandler = TestSessionHandler;
type Keys = UintAuthorityId;
type DisabledValidatorsThreshold = ();
type WeightInfo = ();
}
......@@ -176,7 +175,7 @@ mod tests {
fn on_new_session<Ks: sp_runtime::traits::OpaqueKeys>(_: bool, _: &[(AccountId, Ks)], _: &[(AccountId, Ks)]) {}
fn on_disabled(_: usize) {}
fn on_disabled(_: u32) {}
}
fn new_test_ext() -> TestExternalities {
......
......@@ -150,7 +150,7 @@ impl<T: pallet_session::Config> OneSessionHandler<T::AccountId>
{
}
fn on_disabled(_: usize) {}
fn on_disabled(_: u32) {}
}
/// A placeholder since there is currently no provided session key handler for parachain validator
......@@ -179,7 +179,7 @@ impl<T: pallet_session::Config> OneSessionHandler<T::AccountId>
{
}
fn on_disabled(_: usize) {}
fn on_disabled(_: u32) {}
}
#[cfg(test)]
......
......@@ -326,10 +326,6 @@ impl_opaque_keys! {
}
}
parameter_types! {
pub const DisabledValidatorsThreshold: Perbill = Perbill::from_percent(17);
}
impl pallet_session::Config for Runtime {
type Event = Event;
type ValidatorId = AccountId;
......@@ -339,7 +335,6 @@ impl pallet_session::Config for Runtime {
type SessionManager = pallet_session::historical::NoteHistoricalRoot<Self, Staking>;
type SessionHandler = <SessionKeys as OpaqueKeys>::KeyTypeIdProviders;
type Keys = SessionKeys;
type DisabledValidatorsThreshold = DisabledValidatorsThreshold;
type WeightInfo = weights::pallet_session::WeightInfo<Runtime>;
}
......@@ -497,6 +492,7 @@ parameter_types! {
// 27 eras in which slashes can be cancelled (slightly less than 7 days).
pub const SlashDeferDuration: pallet_staking::EraIndex = 27;
pub const MaxNominatorRewardedPerValidator: u32 = 256;
pub const OffendingValidatorsThreshold: Perbill = Perbill::from_percent(17);
}
type SlashCancelOrigin = EnsureOneOf<
......@@ -531,6 +527,7 @@ impl pallet_staking::Config for Runtime {
type EraPayout = EraPayout;
type NextNewSession = Session;
type MaxNominatorRewardedPerValidator = MaxNominatorRewardedPerValidator;
type OffendingValidatorsThreshold = OffendingValidatorsThreshold;
// Use the nominators map to iter voters, but also perform the bags-list migration and keep
// it up-to-date.
type SortedListProvider = runtime_common::elections::UseNominatorsAndUpdateBagsList<Runtime>;
......
......@@ -329,7 +329,7 @@ impl<T: pallet_session::Config + Config> OneSessionHandler<T::AccountId> for Pal
<Pallet<T>>::on_new_session(changed, session_index, validators, Some(queued));
}
fn on_disabled(_i: usize) {}
fn on_disabled(_i: u32) {}
}
#[cfg(test)]
......
......@@ -166,7 +166,7 @@ impl<T: pallet_session::Config + Config> OneSessionHandler<T::AccountId> for Pal
AssignmentKeysUnsafe::<T>::set(assignment_keys);
}
fn on_disabled(_i: usize) {}
fn on_disabled(_i: u32) {}
}
#[cfg(test)]
......
......@@ -348,10 +348,6 @@ impl_opaque_keys! {
}
}
parameter_types! {
pub const DisabledValidatorsThreshold: Perbill = Perbill::from_percent(17);
}
impl pallet_session::Config for Runtime {
type Event = Event;
type ValidatorId = AccountId;
......@@ -361,7 +357,6 @@ impl pallet_session::Config for Runtime {
type SessionManager = pallet_session::historical::NoteHistoricalRoot<Self, Staking>;
type SessionHandler = <SessionKeys as OpaqueKeys>::KeyTypeIdProviders;
type Keys = SessionKeys;
type DisabledValidatorsThreshold = DisabledValidatorsThreshold;
type WeightInfo = weights::pallet_session::WeightInfo<Runtime>;
}
......@@ -464,6 +459,7 @@ parameter_types! {
pub const SlashDeferDuration: pallet_staking::EraIndex = 27;
pub const RewardCurve: &'static PiecewiseLinear<'static> = &REWARD_CURVE;
pub const MaxNominatorRewardedPerValidator: u32 = 256;
pub const OffendingValidatorsThreshold: Perbill = Perbill::from_percent(17);
}
type SlashCancelOrigin = EnsureOneOf<
......@@ -495,6 +491,7 @@ impl pallet_staking::Config for Runtime {
type SessionInterface = Self;
type EraPayout = pallet_staking::ConvertCurve<RewardCurve>;
type MaxNominatorRewardedPerValidator = MaxNominatorRewardedPerValidator;
type OffendingValidatorsThreshold = OffendingValidatorsThreshold;
type NextNewSession = Session;
type ElectionProvider = ElectionProviderMultiPhase;
type GenesisElectionProvider = runtime_common::elections::GenesisElectionOf<Self>;
......
......@@ -55,7 +55,7 @@ use sp_runtime::{
OpaqueKeys, SaturatedConversion, Verify,
},
transaction_validity::{TransactionPriority, TransactionSource, TransactionValidity},
ApplyExtrinsicResult, KeyTypeId, Perbill,
ApplyExtrinsicResult, KeyTypeId,
};
use sp_staking::SessionIndex;
use sp_std::{collections::btree_map::BTreeMap, prelude::*};
......@@ -465,10 +465,6 @@ impl pallet_transaction_payment::Config for Runtime {
type FeeMultiplierUpdate = SlowAdjustingFeeUpdate<Self>;
}
parameter_types! {
pub const DisabledValidatorsThreshold: Perbill = Perbill::from_percent(17);
}
/// Special `ValidatorIdOf` implementation that is just returning the input as result.
pub struct ValidatorIdOf;
impl sp_runtime::traits::Convert<AccountId, Option<AccountId>> for ValidatorIdOf {
......@@ -486,7 +482,6 @@ impl pallet_session::Config for Runtime {
type SessionManager = pallet_session::historical::NoteHistoricalRoot<Self, ValidatorManager>;
type SessionHandler = <SessionKeys as OpaqueKeys>::KeyTypeIdProviders;
type Keys = SessionKeys;
type DisabledValidatorsThreshold = DisabledValidatorsThreshold;
type WeightInfo = ();
}
......
......@@ -273,10 +273,6 @@ impl_opaque_keys! {
}
}
parameter_types! {
pub storage DisabledValidatorsThreshold: Perbill = Perbill::from_percent(17);
}
impl pallet_session::Config for Runtime {
type Event = Event;
type ValidatorId = AccountId;
......@@ -286,7 +282,6 @@ impl pallet_session::Config for Runtime {
type SessionManager = Staking;
type SessionHandler = <SessionKeys as OpaqueKeys>::KeyTypeIdProviders;
type Keys = SessionKeys;
type DisabledValidatorsThreshold = DisabledValidatorsThreshold;
type WeightInfo = ();
}
......@@ -315,6 +310,7 @@ parameter_types! {
pub storage SlashDeferDuration: pallet_staking::EraIndex = 27;
pub const RewardCurve: &'static PiecewiseLinear<'static> = &REWARD_CURVE;
pub storage MaxNominatorRewardedPerValidator: u32 = 64;
pub storage OffendingValidatorsThreshold: Perbill = Perbill::from_percent(17);
pub const MaxAuthorities: u32 = 100_000;
}
......@@ -340,6 +336,7 @@ impl pallet_staking::Config for Runtime {
type SessionInterface = Self;
type EraPayout = pallet_staking::ConvertCurve<RewardCurve>;
type MaxNominatorRewardedPerValidator = MaxNominatorRewardedPerValidator;
type OffendingValidatorsThreshold = OffendingValidatorsThreshold;
type NextNewSession = Session;
type ElectionProvider =
frame_election_provider_support::onchain::OnChainSequentialPhragmen<Self>;
......
......@@ -312,10 +312,6 @@ impl_opaque_keys! {
}
}
parameter_types! {
pub const DisabledValidatorsThreshold: Perbill = Perbill::from_percent(17);
}
impl pallet_session::Config for Runtime {
type Event = Event;
type ValidatorId = AccountId;
......@@ -325,7 +321,6 @@ impl pallet_session::Config for Runtime {
type SessionManager = pallet_session::historical::NoteHistoricalRoot<Self, Staking>;
type SessionHandler = <SessionKeys as OpaqueKeys>::KeyTypeIdProviders;
type Keys = SessionKeys;
type DisabledValidatorsThreshold = DisabledValidatorsThreshold;
type WeightInfo = weights::pallet_session::WeightInfo<Runtime>;
}
......@@ -429,6 +424,7 @@ parameter_types! {
pub const SlashDeferDuration: pallet_staking::EraIndex = 27;
pub const RewardCurve: &'static PiecewiseLinear<'static> = &REWARD_CURVE;
pub const MaxNominatorRewardedPerValidator: u32 = 64;
pub const OffendingValidatorsThreshold: Perbill = Perbill::from_percent(17);
}
impl frame_election_provider_support::onchain::Config for Runtime {
......@@ -454,6 +450,7 @@ impl pallet_staking::Config for Runtime {
type SessionInterface = Self;
type EraPayout = pallet_staking::ConvertCurve<RewardCurve>;
type MaxNominatorRewardedPerValidator = MaxNominatorRewardedPerValidator;
type OffendingValidatorsThreshold = OffendingValidatorsThreshold;
type NextNewSession = Session;
type ElectionProvider = ElectionProviderMultiPhase;
type GenesisElectionProvider = runtime_common::elections::GenesisElectionOf<Self>;
......
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