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

Companion for 12095 #5924

Merged
merged 4 commits into from
Aug 28, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
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
1 change: 1 addition & 0 deletions Cargo.lock

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

7 changes: 5 additions & 2 deletions runtime/kusama/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,9 @@ impl pallet_election_provider_multi_phase::Config for Runtime {
type OffchainRepeat = OffchainRepeat;
type MinerTxPriority = NposSolutionPriority;
type DataProvider = Staking;
#[cfg(feature = "fast-runtime")]
type Fallback = onchain::UnboundedExecution<OnChainSeqPhragmen>;
#[cfg(not(feature = "fast-runtime"))]
type Fallback = pallet_election_provider_multi_phase::NoFallback<Self>;
type GovernanceFallback = onchain::UnboundedExecution<OnChainSeqPhragmen>;
type Solver = SequentialPhragmen<
Expand Down Expand Up @@ -582,7 +585,7 @@ impl pallet_staking::EraPayout<Balance> for EraPayout {

parameter_types! {
// Six sessions in an era (6 hours).
pub const SessionsPerEra: SessionIndex = 6;
pub const SessionsPerEra: SessionIndex = prod_or_fast!(6, 1);
// 28 eras for unbonding (7 days).
pub const BondingDuration: sp_staking::EraIndex = 28;
// 27 eras in which slashes can be cancelled (slightly less than 7 days).
Expand Down Expand Up @@ -1868,7 +1871,7 @@ sp_api::impl_runtime_apis! {
Balance,
> for Runtime {
fn pending_rewards(member: AccountId) -> Balance {
NominationPools::pending_rewards(member)
NominationPools::pending_rewards(member).unwrap_or_default()
}
}

Expand Down
2 changes: 2 additions & 0 deletions runtime/polkadot/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ pallet-indices = { git = "https://github.com/paritytech/substrate", branch = "ma
pallet-membership = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-multisig = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-nomination-pools = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-nomination-pools-runtime-api = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-offences = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-preimage = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-proxy = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
Expand Down Expand Up @@ -145,6 +146,7 @@ std = [
"pallet-membership/std",
"pallet-multisig/std",
"pallet-nomination-pools/std",
"pallet-nomination-pools-runtime-api/std",
"pallet-offences/std",
"pallet-preimage/std",
"pallet-proxy/std",
Expand Down
15 changes: 14 additions & 1 deletion runtime/polkadot/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,9 @@ impl pallet_election_provider_multi_phase::Config for Runtime {
type OffchainRepeat = OffchainRepeat;
type MinerTxPriority = NposSolutionPriority;
type DataProvider = Staking;
#[cfg(feature = "fast-runtime")]
type Fallback = onchain::UnboundedExecution<OnChainSeqPhragmen>;
#[cfg(not(feature = "fast-runtime"))]
type Fallback = pallet_election_provider_multi_phase::NoFallback<Self>;
type GovernanceFallback = onchain::UnboundedExecution<OnChainSeqPhragmen>;
type Solver = SequentialPhragmen<
Expand Down Expand Up @@ -573,7 +576,7 @@ pallet_staking_reward_curve::build! {

parameter_types! {
// Six sessions in an era (24 hours).
pub const SessionsPerEra: SessionIndex = 6;
pub const SessionsPerEra: SessionIndex = prod_or_fast!(6, 1);
// 28 eras for unbonding (28 days).
pub const BondingDuration: sp_staking::EraIndex = 28;
pub const SlashDeferDuration: sp_staking::EraIndex = 27;
Expand Down Expand Up @@ -1673,6 +1676,16 @@ sp_api::impl_runtime_apis! {
}
}

impl pallet_nomination_pools_runtime_api::NominationPoolsApi<
Block,
AccountId,
Balance,
> for Runtime {
fn pending_rewards(member: AccountId) -> Balance {
NominationPools::pending_rewards(member).unwrap_or_default()
}
}

impl tx_pool_api::runtime_api::TaggedTransactionQueue<Block> for Runtime {
fn validate_transaction(
source: TransactionSource,
Expand Down
7 changes: 5 additions & 2 deletions runtime/westend/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,9 @@ impl pallet_election_provider_multi_phase::Config for Runtime {
type OffchainRepeat = OffchainRepeat;
type MinerTxPriority = NposSolutionPriority;
type DataProvider = Staking;
#[cfg(feature = "fast-runtime")]
type Fallback = onchain::UnboundedExecution<OnChainSeqPhragmen>;
#[cfg(not(feature = "fast-runtime"))]
type Fallback = pallet_election_provider_multi_phase::NoFallback<Self>;
type GovernanceFallback = onchain::UnboundedExecution<OnChainSeqPhragmen>;
type Solver = SequentialPhragmen<
Expand Down Expand Up @@ -476,7 +479,7 @@ pallet_staking_reward_curve::build! {

parameter_types! {
// Six sessions in an era (6 hours).
pub const SessionsPerEra: SessionIndex = 6;
pub const SessionsPerEra: SessionIndex = prod_or_fast!(6, 1);
// 2 eras for unbonding (12 hours).
pub const BondingDuration: sp_staking::EraIndex = 2;
// 1 era in which slashes can be cancelled (6 hours).
Expand Down Expand Up @@ -1578,7 +1581,7 @@ sp_api::impl_runtime_apis! {
Balance,
> for Runtime {
fn pending_rewards(member: AccountId) -> Balance {
NominationPools::pending_rewards(member)
NominationPools::pending_rewards(member).unwrap_or_default()
}
}

Expand Down