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

Commit

Permalink
Merge branch 'master' into ao-disputes-offences-runtime
Browse files Browse the repository at this point in the history
* master:
  Get rid of unnecessary clone. (#5685)
  Remove Kusama Nomination Pools Init (#5605)
  Companion for paritytech/substrate#11631 (#5671)
  Allow relay chain council to send XCMs (#5597)
  Companion for substrate#11618 (#5677)
  Companion to combine iteratons and tolerance in sp-npos-elections API #11498 (#5581)
  Companion for #11661 (#5676)
  Bump lru from 0.7.5 to 0.7.7 (#5675)
  Companion PR for Substrate 11537 (#5619)
  • Loading branch information
ordian committed Jun 17, 2022
2 parents 29376b1 + b4cf84d commit f76a697
Show file tree
Hide file tree
Showing 31 changed files with 321 additions and 323 deletions.
432 changes: 223 additions & 209 deletions Cargo.lock

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion bridges/bin/millau/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,7 @@ parameter_types! {
}

impl pallet_transaction_payment::Config for Runtime {
type Event = Event;
type OnChargeTransaction = pallet_transaction_payment::CurrencyAdapter<Balances, ()>;
type TransactionByteFee = TransactionByteFee;
type OperationalFeeMultiplier = OperationalFeeMultiplier;
Expand Down Expand Up @@ -507,7 +508,7 @@ construct_runtime!(

Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent},
Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>},
TransactionPayment: pallet_transaction_payment::{Pallet, Storage},
TransactionPayment: pallet_transaction_payment::{Pallet, Storage, Event<T>},

// Consensus support.
Session: pallet_session::{Pallet, Call, Storage, Event, Config<T>},
Expand Down
3 changes: 2 additions & 1 deletion bridges/bin/rialto-parachain/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@ impl pallet_balances::Config for Runtime {
}

impl pallet_transaction_payment::Config for Runtime {
type Event = Event;
type OnChargeTransaction = pallet_transaction_payment::CurrencyAdapter<Balances, ()>;
type TransactionByteFee = TransactionByteFee;
type OperationalFeeMultiplier = OperationalFeeMultiplier;
Expand Down Expand Up @@ -457,7 +458,7 @@ construct_runtime!(
Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent},
Sudo: pallet_sudo::{Pallet, Call, Storage, Config<T>, Event<T>},
RandomnessCollectiveFlip: pallet_randomness_collective_flip::{Pallet, Storage},
TransactionPayment: pallet_transaction_payment::{Pallet, Storage},
TransactionPayment: pallet_transaction_payment::{Pallet, Storage, Event<T>},

ParachainSystem: cumulus_pallet_parachain_system::{Pallet, Call, Storage, Inherent, Event<T>} = 20,
ParachainInfo: parachain_info::{Pallet, Storage, Config} = 21,
Expand Down
3 changes: 2 additions & 1 deletion bridges/bin/rialto/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,7 @@ parameter_types! {
}

impl pallet_transaction_payment::Config for Runtime {
type Event = Event;
type OnChargeTransaction = pallet_transaction_payment::CurrencyAdapter<Balances, ()>;
type TransactionByteFee = TransactionByteFee;
type OperationalFeeMultiplier = OperationalFeeMultiplier;
Expand Down Expand Up @@ -486,7 +487,7 @@ construct_runtime!(

Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent},
Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>},
TransactionPayment: pallet_transaction_payment::{Pallet, Storage},
TransactionPayment: pallet_transaction_payment::{Pallet, Storage, Event<T>},

// Consensus support.
AuthorityDiscovery: pallet_authority_discovery::{Pallet, Config},
Expand Down
2 changes: 1 addition & 1 deletion node/core/dispute-coordinator/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ gum = { package = "tracing-gum", path = "../../gum" }
parity-scale-codec = "3.1.2"
kvdb = "0.11.0"
thiserror = "1.0.31"
lru = "0.7.5"
lru = "0.7.7"
fatality = "0.0.6"

polkadot-primitives = { path = "../../../primitives" }
Expand Down
6 changes: 3 additions & 3 deletions node/core/dispute-coordinator/src/initialized.rs
Original file line number Diff line number Diff line change
Expand Up @@ -740,11 +740,11 @@ impl Initialized {
continue
}

match statement.statement().clone() {
match statement.statement() {
DisputeStatement::Valid(valid_kind) => {
let fresh = insert_into_statement_vec(
&mut votes.valid,
valid_kind,
*valid_kind,
*val_index,
statement.validator_signature().clone(),
);
Expand All @@ -759,7 +759,7 @@ impl Initialized {
DisputeStatement::Invalid(invalid_kind) => {
let fresh = insert_into_statement_vec(
&mut votes.invalid,
invalid_kind,
*invalid_kind,
*val_index,
statement.validator_signature().clone(),
);
Expand Down
2 changes: 1 addition & 1 deletion node/network/availability-distribution/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ sp-keystore = { git = "https://github.com/paritytech/substrate", branch = "maste
thiserror = "1.0.31"
rand = "0.8.5"
derive_more = "0.99.17"
lru = "0.7.5"
lru = "0.7.7"
fatality = "0.0.6"

[dev-dependencies]
Expand Down
2 changes: 1 addition & 1 deletion node/network/availability-recovery/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ edition = "2021"

[dependencies]
futures = "0.3.21"
lru = "0.7.5"
lru = "0.7.7"
rand = "0.8.5"
fatality = "0.0.6"
thiserror = "1.0.31"
Expand Down
2 changes: 1 addition & 1 deletion node/network/dispute-distribution/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ sp-application-crypto = { git = "https://github.com/paritytech/substrate", branc
sp-keystore = { git = "https://github.com/paritytech/substrate", branch = "master" }
thiserror = "1.0.31"
fatality = "0.0.6"
lru = "0.7.5"
lru = "0.7.7"

[dev-dependencies]
async-trait = "0.1.53"
Expand Down
2 changes: 1 addition & 1 deletion node/service/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ assert_matches = "1.5.0"
default = ["db", "full-node", "polkadot-native"]

db = [
"service/db"
"service/rocksdb"
]

full-node = [
Expand Down
2 changes: 1 addition & 1 deletion node/subsystem-util/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ thiserror = "1.0.31"
fatality = "0.0.6"
gum = { package = "tracing-gum", path = "../gum" }
derive_more = "0.99.17"
lru = "0.7.5"
lru = "0.7.7"

polkadot-node-subsystem = {path = "../subsystem" }
polkadot-node-jaeger = { path = "../jaeger" }
Expand Down
4 changes: 2 additions & 2 deletions primitives/src/v2/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1290,7 +1290,7 @@ impl DisputeStatement {
}

/// Different kinds of statements of validity on a candidate.
#[derive(Encode, Decode, Clone, PartialEq, RuntimeDebug, TypeInfo)]
#[derive(Encode, Decode, Copy, Clone, PartialEq, RuntimeDebug, TypeInfo)]
#[cfg_attr(feature = "std", derive(MallocSizeOf))]
pub enum ValidDisputeStatementKind {
/// An explicit statement issued as part of a dispute.
Expand All @@ -1308,7 +1308,7 @@ pub enum ValidDisputeStatementKind {
}

/// Different kinds of statements of invalidity on a candidate.
#[derive(Encode, Decode, Clone, PartialEq, RuntimeDebug, TypeInfo)]
#[derive(Encode, Decode, Copy, Clone, PartialEq, RuntimeDebug, TypeInfo)]
#[cfg_attr(feature = "std", derive(MallocSizeOf))]
pub enum InvalidDisputeStatementKind {
/// An explicit statement issued as part of a dispute.
Expand Down
2 changes: 1 addition & 1 deletion rpc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ authors = ["Parity Technologies <admin@parity.io>"]
edition = "2021"

[dependencies]
jsonrpsee = { version = "0.13.1", features = ["server"] }
jsonrpsee = { version = "0.14.0", features = ["server"] }
polkadot-primitives = { path = "../primitives" }
sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "master" }
Expand Down
32 changes: 3 additions & 29 deletions runtime/kusama/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ use frame_support::{
construct_runtime, parameter_types,
traits::{
ConstU32, Contains, EitherOfDiverse, InstanceFilter, KeyOwnerProofSystem, LockIdentifier,
OnRuntimeUpgrade, PrivilegeCmp,
PrivilegeCmp,
},
weights::ConstantMultiplier,
PalletId, RuntimeDebug,
Expand Down Expand Up @@ -327,6 +327,7 @@ parameter_types! {
}

impl pallet_transaction_payment::Config for Runtime {
type Event = Event;
type OnChargeTransaction = CurrencyAdapter<Balances, DealWithFees<Self>>;
type OperationalFeeMultiplier = OperationalFeeMultiplier;
type WeightToFee = WeightToFee;
Expand Down Expand Up @@ -1455,32 +1456,6 @@ impl pallet_nomination_pools::Config for Runtime {
type MinPointsToBalance = MinPointsToBalance;
}

pub struct InitiatePoolConfigs;
impl OnRuntimeUpgrade for InitiatePoolConfigs {
fn on_runtime_upgrade() -> frame_support::weights::Weight {
// we use one as an indicator if this has already been set.
if pallet_nomination_pools::MaxPools::<Runtime>::get().is_none() {
// 1/600 KSM to join a pool.
pallet_nomination_pools::MinJoinBond::<Runtime>::put(50 * CENTS);
// 1 KSM to create a pool.
pallet_nomination_pools::MinCreateBond::<Runtime>::put(UNITS);

// 128 initial pools: only for initial safety: can be set to infinity when needed.
pallet_nomination_pools::MaxPools::<Runtime>::put(128);
// 64k total pool members: only for initial safety: can be set to infinity when needed.
pallet_nomination_pools::MaxPoolMembers::<Runtime>::put(64 * 1024);
// 1024 members per pool: only for initial safety: can be set to infinity when needed.
pallet_nomination_pools::MaxPoolMembersPerPool::<Runtime>::put(1024);

log::info!(target: "runtime::kusama", "pools config initiated 🎉");
<Runtime as frame_system::Config>::DbWeight::get().reads_writes(1, 5)
} else {
log::info!(target: "runtime::kusama", "pools config already initiated 😏");
<Runtime as frame_system::Config>::DbWeight::get().reads(1)
}
}
}

construct_runtime! {
pub enum Runtime where
Block = Block,
Expand All @@ -1496,7 +1471,7 @@ construct_runtime! {
Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent} = 2,
Indices: pallet_indices::{Pallet, Call, Storage, Config<T>, Event<T>} = 3,
Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>} = 4,
TransactionPayment: pallet_transaction_payment::{Pallet, Storage} = 33,
TransactionPayment: pallet_transaction_payment::{Pallet, Storage, Event<T>} = 33,

// Consensus support.
// Authorship must be before session in order to note author in the correct session and era
Expand Down Expand Up @@ -1627,7 +1602,6 @@ pub type Executive = frame_executive::Executive<
(
RenameBagsListToVoterList,
pallet_bags_list::migrations::AddScore<Runtime>,
InitiatePoolConfigs,
pallet_nomination_pools::migration::v1::MigrateToV1<Runtime>,
),
>;
Expand Down
23 changes: 13 additions & 10 deletions runtime/kusama/src/xcm_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,26 +152,29 @@ parameter_types! {
pub const CouncilBodyId: BodyId = BodyId::Executive;
}

/// Type to convert the council origin to a Plurality `MultiLocation` value.
pub type CouncilToPlurality = BackingToPlurality<
Origin,
pallet_collective::Origin<Runtime, CouncilCollective>,
CouncilBodyId,
>;

/// Type to convert an `Origin` type value into a `MultiLocation` value which represents an interior location
/// of this chain.
pub type LocalOriginToLocation = (
// We allow an origin from the Collective pallet to be used in XCM as a corresponding Plurality of the
// `Unit` body.
BackingToPlurality<
Origin,
pallet_collective::Origin<Runtime, CouncilCollective>,
CouncilBodyId,
>,
CouncilToPlurality,
// And a usual Signed origin to be used in XCM as a corresponding AccountId32
SignedToAccountId32<Origin, AccountId, KusamaNetwork>,
);
impl pallet_xcm::Config for Runtime {
type Event = Event;
// We don't allow any messages to be sent via the transaction yet. This is basically safe to
// enable, (safe the possibility of someone spamming the parachain if they're willing to pay
// the DOT to send from the Relay-chain). But it's useless until we bring in XCM v3 which will
// make `DescendOrigin` a bit more useful.
type SendXcmOrigin = xcm_builder::EnsureXcmOrigin<Origin, ()>;
// We only allow the council to send messages. This is basically safe to enable for everyone
// (safe the possibility of someone spamming the parachain if they're willing to pay the KSM to
// send from the Relay-chain), but it's useless until we bring in XCM v3 which will make
// `DescendOrigin` a bit more useful.
type SendXcmOrigin = xcm_builder::EnsureXcmOrigin<Origin, CouncilToPlurality>;
type XcmRouter = XcmRouter;
// Anyone can execute XCM messages locally.
type ExecuteXcmOrigin = xcm_builder::EnsureXcmOrigin<Origin, LocalOriginToLocation>;
Expand Down
2 changes: 1 addition & 1 deletion runtime/parachains/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ edition = "2021"

[dependencies]
bitvec = { version = "1.0.0", default-features = false, features = ["alloc"] }
parity-scale-codec = { version = "3.1.2", default-features = false, features = ["derive"] }
parity-scale-codec = { version = "3.1.2", default-features = false, features = ["derive", "max-encoded-len"] }
log = { version = "0.4.17", default-features = false }
rustc-hex = { version = "2.1.0", default-features = false }
scale-info = { version = "2.1.2", default-features = false, features = ["derive"] }
Expand Down
2 changes: 1 addition & 1 deletion runtime/parachains/src/disputes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,7 @@ struct ImportUndo {
/// The direction of the vote, for block validity (`true`) or invalidity (`false`).
valid: bool,
/// Has the validator participated before, i.e. in backing or
/// with an oposing vote.
/// with an opposing vote.
new_participant: bool,
}

Expand Down
11 changes: 10 additions & 1 deletion runtime/parachains/src/origin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,16 @@ pub mod pallet {

/// Origin for the parachains.
#[pallet::origin]
#[derive(PartialEq, Eq, Clone, Encode, Decode, sp_core::RuntimeDebug, scale_info::TypeInfo)]
#[derive(
PartialEq,
Eq,
Clone,
Encode,
Decode,
sp_core::RuntimeDebug,
scale_info::TypeInfo,
MaxEncodedLen,
)]
pub enum Origin {
/// It comes from a parachain.
Parachain(ParaId),
Expand Down
3 changes: 2 additions & 1 deletion runtime/polkadot/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,7 @@ parameter_types! {
}

impl pallet_transaction_payment::Config for Runtime {
type Event = Event;
type OnChargeTransaction = CurrencyAdapter<Balances, DealWithFees<Runtime>>;
type OperationalFeeMultiplier = OperationalFeeMultiplier;
type WeightToFee = WeightToFee;
Expand Down Expand Up @@ -1404,7 +1405,7 @@ construct_runtime! {
Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent} = 3,
Indices: pallet_indices::{Pallet, Call, Storage, Config<T>, Event<T>} = 4,
Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>} = 5,
TransactionPayment: pallet_transaction_payment::{Pallet, Storage} = 32,
TransactionPayment: pallet_transaction_payment::{Pallet, Storage, Event<T>} = 32,

// Consensus support.
// Authorship must be before session in order to note author in the correct session and era
Expand Down
17 changes: 10 additions & 7 deletions runtime/polkadot/src/xcm_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,24 +157,27 @@ parameter_types! {
pub const AdvertisedXcmVersion: u32 = 2;
}

/// Type to convert a council origin to a Plurality `MultiLocation` value.
pub type CouncilToPlurality = BackingToPlurality<
Origin,
pallet_collective::Origin<Runtime, CouncilCollective>,
CouncilBodyId,
>;

/// Type to convert an `Origin` type value into a `MultiLocation` value which represents an interior location
/// of this chain.
pub type LocalOriginToLocation = (
// We allow an origin from the Collective pallet to be used in XCM as a corresponding Plurality of the
// `Unit` body.
BackingToPlurality<
Origin,
pallet_collective::Origin<Runtime, CouncilCollective>,
CouncilBodyId,
>,
CouncilToPlurality,
// And a usual Signed origin to be used in XCM as a corresponding AccountId32
SignedToAccountId32<Origin, AccountId, PolkadotNetwork>,
);

impl pallet_xcm::Config for Runtime {
type Event = Event;
// Not much use in sending XCM at this point.
type SendXcmOrigin = xcm_builder::EnsureXcmOrigin<Origin, ()>; // == Deny All
// Only allow the council to send messages.
type SendXcmOrigin = xcm_builder::EnsureXcmOrigin<Origin, CouncilToPlurality>;
type XcmRouter = XcmRouter;
// Anyone can execute XCM messages locally...
type ExecuteXcmOrigin = xcm_builder::EnsureXcmOrigin<Origin, LocalOriginToLocation>;
Expand Down
1 change: 1 addition & 0 deletions runtime/rococo/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,7 @@ parameter_types! {
}

impl pallet_transaction_payment::Config for Runtime {
type Event = Event;
type OnChargeTransaction = CurrencyAdapter<Balances, ToAuthor<Runtime>>;
type OperationalFeeMultiplier = OperationalFeeMultiplier;
type WeightToFee = WeightToFee;
Expand Down
3 changes: 2 additions & 1 deletion runtime/test-runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ parameter_types! {
}

impl pallet_transaction_payment::Config for Runtime {
type Event = Event;
type OnChargeTransaction = CurrencyAdapter<Balances, ()>;
type OperationalFeeMultiplier = OperationalFeeMultiplier;
type WeightToFee = WeightToFee;
Expand Down Expand Up @@ -668,7 +669,7 @@ construct_runtime! {
Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent},
Indices: pallet_indices::{Pallet, Call, Storage, Config<T>, Event<T>},
Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>},
TransactionPayment: pallet_transaction_payment::{Pallet, Storage},
TransactionPayment: pallet_transaction_payment::{Pallet, Storage, Event<T>},

// Consensus support.
Authorship: pallet_authorship::{Pallet, Call, Storage},
Expand Down
Loading

0 comments on commit f76a697

Please sign in to comment.