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

Commit

Permalink
westend to follow polkadot
Browse files Browse the repository at this point in the history
  • Loading branch information
al3mart committed Aug 25, 2023
2 parents 9e2dbe4 + f3da93d commit cc5cccc
Show file tree
Hide file tree
Showing 24 changed files with 354 additions and 830 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release-30_publish-draft-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
- name: Build ${{ matrix.runtime }} runtime
id: srtool_build
uses: chevdor/srtool-actions@v0.7.0
uses: chevdor/srtool-actions@v0.8.0
with:
image: paritytech/srtool
chain: ${{ matrix.runtime }}
Expand Down
376 changes: 190 additions & 186 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions primitives/src/v5/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1165,6 +1165,8 @@ pub struct AbridgedHostConfiguration {
pub validation_upgrade_cooldown: BlockNumber,
/// The delay, in blocks, before a validation upgrade is applied.
pub validation_upgrade_delay: BlockNumber,
/// Asynchronous backing parameters.
pub async_backing_params: super::vstaging::AsyncBackingParams,
}

/// Abridged version of `HrmpChannel` (from the `Hrmp` parachains host runtime module) meant to be
Expand Down
1 change: 1 addition & 0 deletions runtime/kusama/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master
sp-staking = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-session = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-storage = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-version = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
tx-pool-api = { package = "sp-transaction-pool", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
block-builder-api = { package = "sp-block-builder", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
Expand Down
7 changes: 4 additions & 3 deletions runtime/kusama/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ use frame_support::{
PrivilegeCmp, ProcessMessage, ProcessMessageError, StorageMapShim, WithdrawReasons,
},
weights::{ConstantMultiplier, WeightMeter},
PalletId, RuntimeDebug,
PalletId,
};
use frame_system::EnsureRoot;
use pallet_grandpa::{fg_primitives, AuthorityId as GrandpaId};
Expand All @@ -82,7 +82,7 @@ use sp_runtime::{
Keccak256, OpaqueKeys, SaturatedConversion, Verify,
},
transaction_validity::{TransactionPriority, TransactionSource, TransactionValidity},
ApplyExtrinsicResult, FixedU128, KeyTypeId, Perbill, Percent, Permill,
ApplyExtrinsicResult, FixedU128, KeyTypeId, Perbill, Percent, Permill, RuntimeDebug,
};
use sp_staking::SessionIndex;
#[cfg(any(feature = "std", test))]
Expand Down Expand Up @@ -2330,7 +2330,8 @@ sp_api::impl_runtime_apis! {
sp_runtime::RuntimeString,
> {
use frame_support::traits::WhitelistedStorageKeys;
use frame_benchmarking::{Benchmarking, BenchmarkBatch, TrackedStorageKey, BenchmarkError};
use frame_benchmarking::{Benchmarking, BenchmarkBatch, BenchmarkError};
use sp_storage::TrackedStorageKey;
// Trying to add benchmarks directly to some pallets caused cyclic dependency issues.
// To get around that, we separated the benchmarks into its own crate.
use pallet_session_benchmarking::Pallet as SessionBench;
Expand Down
4 changes: 2 additions & 2 deletions runtime/parachains/src/configuration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,13 +124,13 @@ pub struct HostConfiguration<BlockNumber> {
///
/// [#4601]: https://github.com/paritytech/polkadot/issues/4601
pub validation_upgrade_delay: BlockNumber,
/// Asynchronous backing parameters.
pub async_backing_params: AsyncBackingParams,

/**
* The parameters that are not essential, but still may be of interest for parachains.
*/

/// Asynchronous backing parameters.
pub async_backing_params: AsyncBackingParams,
/// The maximum POV block size, in bytes.
pub max_pov_size: u32,
/// The maximum size of a message that can be put in a downward message queue.
Expand Down
5 changes: 4 additions & 1 deletion runtime/parachains/src/configuration/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,9 @@ fn verify_externally_accessible() {
use primitives::{well_known_keys, AbridgedHostConfiguration};

new_test_ext(Default::default()).execute_with(|| {
let ground_truth = HostConfiguration::default();
let mut ground_truth = HostConfiguration::default();
ground_truth.async_backing_params =
AsyncBackingParams { allowed_ancestry_len: 111, max_candidate_depth: 222 };

// Make sure that the configuration is stored in the storage.
ActiveConfig::<Test>::put(ground_truth.clone());
Expand All @@ -511,6 +513,7 @@ fn verify_externally_accessible() {
hrmp_max_message_num_per_candidate: ground_truth.hrmp_max_message_num_per_candidate,
validation_upgrade_cooldown: ground_truth.validation_upgrade_cooldown,
validation_upgrade_delay: ground_truth.validation_upgrade_delay,
async_backing_params: ground_truth.async_backing_params,
},
);
});
Expand Down
1 change: 1 addition & 0 deletions runtime/polkadot/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master
sp-staking = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-session = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-storage = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-version = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-npos-elections = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }

Expand Down
7 changes: 4 additions & 3 deletions runtime/polkadot/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ use frame_support::{
ProcessMessage, ProcessMessageError, WithdrawReasons,
},
weights::{ConstantMultiplier, WeightMeter},
PalletId, RuntimeDebug,
PalletId,
};
use frame_system::EnsureRoot;
use pallet_grandpa::{fg_primitives, AuthorityId as GrandpaId};
Expand All @@ -78,7 +78,7 @@ use sp_runtime::{
OpaqueKeys, SaturatedConversion, Verify,
},
transaction_validity::{TransactionPriority, TransactionSource, TransactionValidity},
ApplyExtrinsicResult, FixedU128, KeyTypeId, Perbill, Percent, Permill,
ApplyExtrinsicResult, FixedU128, KeyTypeId, Perbill, Percent, Permill, RuntimeDebug,
};
use sp_staking::SessionIndex;
use sp_std::{cmp::Ordering, collections::btree_map::BTreeMap, prelude::*};
Expand Down Expand Up @@ -2077,7 +2077,8 @@ sp_api::impl_runtime_apis! {
sp_runtime::RuntimeString,
> {
use frame_support::traits::WhitelistedStorageKeys;
use frame_benchmarking::{Benchmarking, BenchmarkBatch, TrackedStorageKey, BenchmarkError};
use frame_benchmarking::{Benchmarking, BenchmarkBatch, BenchmarkError};
use sp_storage::TrackedStorageKey;
// Trying to add benchmarks directly to some pallets caused cyclic dependency issues.
// To get around that, we separated the benchmarks into its own crate.
use pallet_session_benchmarking::Pallet as SessionBench;
Expand Down
1 change: 1 addition & 0 deletions runtime/rococo/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master
sp-staking = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-session = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-storage = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-version = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
tx-pool-api = { package = "sp-transaction-pool", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
block-builder-api = { package = "sp-block-builder", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
Expand Down
4 changes: 1 addition & 3 deletions runtime/rococo/src/governance/fellowship.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@
//! Elements of governance concerning the Rococo Fellowship.

use frame_support::traits::{MapSuccess, TryMapSuccess};
use sp_runtime::{
traits::{ConstU16, Replace, CheckedReduceBy},
};
use sp_runtime::traits::{CheckedReduceBy, ConstU16, Replace};

use super::*;
use crate::{CENTS, DAYS};
Expand Down
11 changes: 6 additions & 5 deletions runtime/rococo/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ use beefy_primitives::{
use frame_support::{
construct_runtime, parameter_types,
traits::{
Contains, EitherOf, EitherOfDiverse, InstanceFilter, KeyOwnerProofSystem,
PrivilegeCmp, ProcessMessage, ProcessMessageError, StorageMapShim, WithdrawReasons,
Contains, EitherOf, EitherOfDiverse, InstanceFilter, KeyOwnerProofSystem, PrivilegeCmp,
ProcessMessage, ProcessMessageError, StorageMapShim, WithdrawReasons,
},
weights::{ConstantMultiplier, WeightMeter},
PalletId,
Expand All @@ -79,7 +79,7 @@ use sp_runtime::{
Extrinsic as ExtrinsicT, Keccak256, OpaqueKeys, SaturatedConversion, Verify,
},
transaction_validity::{TransactionPriority, TransactionSource, TransactionValidity},
ApplyExtrinsicResult, FixedU128, KeyTypeId, Perbill, Percent, Permill, RuntimeDebug
ApplyExtrinsicResult, FixedU128, KeyTypeId, Perbill, Percent, Permill, RuntimeDebug,
};
use sp_staking::SessionIndex;
#[cfg(any(feature = "std", test))]
Expand Down Expand Up @@ -757,7 +757,7 @@ impl InstanceFilter<RuntimeCall> for ProxyType {
),
ProxyType::Governance => matches!(
c,
RuntimeCall::Bounties(..) |
RuntimeCall::Bounties(..) |
RuntimeCall::Utility(..) |
RuntimeCall::ChildBounties(..) |
// OpenGov calls
Expand Down Expand Up @@ -1927,9 +1927,10 @@ sp_api::impl_runtime_apis! {
sp_runtime::RuntimeString,
> {
use frame_support::traits::WhitelistedStorageKeys;
use frame_benchmarking::{Benchmarking, BenchmarkBatch, TrackedStorageKey, BenchmarkError};
use frame_benchmarking::{Benchmarking, BenchmarkBatch, BenchmarkError};
use frame_system_benchmarking::Pallet as SystemBench;
use frame_benchmarking::baseline::Pallet as Baseline;
use sp_storage::TrackedStorageKey;
use xcm::latest::prelude::*;
use xcm_config::{
LocalCheckAccount, LocationConverter, Rockmine, TokenLocation, XcmConfig,
Expand Down
22 changes: 11 additions & 11 deletions runtime/rococo/src/xcm_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
//! XCM configuration for Rococo.

use super::{
parachains_origin, AccountId, AllPalletsWithSystem, Balances, Fellows, ParaId, Runtime,
RuntimeCall, RuntimeEvent, RuntimeOrigin, WeightToFee, XcmPallet, TransactionByteFee, Dmp,
parachains_origin, AccountId, AllPalletsWithSystem, Balances, Dmp, Fellows, ParaId, Runtime,
RuntimeCall, RuntimeEvent, RuntimeOrigin, TransactionByteFee, WeightToFee, XcmPallet,
};

use crate::governance::StakingAdmin;
Expand All @@ -39,8 +39,8 @@ use sp_core::ConstU32;
use xcm::latest::prelude::*;
use xcm_builder::{
AccountId32Aliases, AllowExplicitUnpaidExecutionFrom, AllowKnownQueryResponses,
AllowSubscriptionsFrom, AllowTopLevelPaidExecutionFrom,
ChildParachainAsNative, ChildParachainConvertsVia, ChildSystemParachainAsSuperuser,
AllowSubscriptionsFrom, AllowTopLevelPaidExecutionFrom, ChildParachainAsNative,
ChildParachainConvertsVia, ChildSystemParachainAsSuperuser,
CurrencyAdapter as XcmCurrencyAdapter, FixedWeightBounds, IsChildSystemParachain, IsConcrete,
MintLocation, OriginToPluralityVoice, SignedAccountId32AsNative, SignedToAccountId32,
SovereignSignedViaLocation, TakeWeightCredit, TrailingSetTopicAsId, UsingComponents,
Expand Down Expand Up @@ -315,8 +315,8 @@ parameter_types! {
pub ReachableDest: Option<MultiLocation> = Some(Parachain(1000).into());
}

/// Type to convert an `Origin` type value into a `MultiLocation` value which represents an interior location
/// of this chain.
/// Type to convert an `Origin` type value into a `MultiLocation` value which represents an interior
/// location of this chain.
pub type LocalOriginToLocation = (
// And a usual Signed origin to be used in XCM as a corresponding AccountId32
SignedToAccountId32<RuntimeOrigin, AccountId, ThisNetwork>,
Expand All @@ -329,8 +329,8 @@ pub type StakingAdminToPlurality =
/// Type to convert the Fellows origin to a Plurality `MultiLocation` value.
pub type FellowsToPlurality = OriginToPluralityVoice<RuntimeOrigin, Fellows, FellowsBodyId>;

/// Type to convert a pallet `Origin` type value into a `MultiLocation` value which represents an interior location
/// of this chain for a destination chain.
/// Type to convert a pallet `Origin` type value into a `MultiLocation` value which represents an
/// interior location of this chain for a destination chain.
pub type LocalPalletOriginToLocation = (
// StakingAdmin origin to be used in XCM as a corresponding Plurality `MultiLocation` value.
StakingAdminToPlurality,
Expand All @@ -341,9 +341,9 @@ pub type LocalPalletOriginToLocation = (
impl pallet_xcm::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
// We only allow the root, fellows and the staking admin 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.
// 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<RuntimeOrigin, LocalPalletOriginToLocation>;
type XcmRouter = XcmRouter;
// Anyone can execute XCM messages locally.
Expand Down
5 changes: 1 addition & 4 deletions runtime/westend/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master
sp-staking = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-session = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-storage = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-version = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
tx-pool-api = { package = "sp-transaction-pool", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
block-builder-api = { package = "sp-block-builder", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
Expand Down Expand Up @@ -68,7 +69,6 @@ pallet-conviction-voting = { git = "https://github.com/paritytech/substrate", br
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 }
pallet-ranked-collective = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-recovery = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-referenda = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-scheduler = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
Expand Down Expand Up @@ -169,7 +169,6 @@ std = [
"pallet-offences/std",
"pallet-preimage/std",
"pallet-proxy/std",
"pallet-ranked-collective/std",
"pallet-recovery/std",
"pallet-referenda/std",
"pallet-scheduler/std",
Expand Down Expand Up @@ -235,7 +234,6 @@ runtime-benchmarks = [
"pallet-nomination-pools-benchmarking/runtime-benchmarks",
"pallet-preimage/runtime-benchmarks",
"pallet-proxy/runtime-benchmarks",
"pallet-ranked-collective/runtime-benchmarks",
"pallet-recovery/runtime-benchmarks",
"pallet-referenda/runtime-benchmarks",
"pallet-scheduler/runtime-benchmarks",
Expand Down Expand Up @@ -287,7 +285,6 @@ try-runtime = [
"pallet-offences/try-runtime",
"pallet-preimage/try-runtime",
"pallet-proxy/try-runtime",
"pallet-ranked-collective/try-runtime",
"pallet-recovery/try-runtime",
"pallet-referenda/try-runtime",
"pallet-scheduler/try-runtime",
Expand Down
20 changes: 20 additions & 0 deletions runtime/westend/constants/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,26 @@ pub mod fee {
}
}

/// XCM protocol related constants.
pub mod xcm {
/// Pluralistic bodies existing within the consensus.
pub mod body {
// Preallocated for the Root body.
#[allow(dead_code)]
const ROOT_INDEX: u32 = 0;
// The bodies corresponding to the Polkadot OpenGov Origins.
pub const FELLOWSHIP_ADMIN_INDEX: u32 = 1;
}
}

/// System Parachains.
pub mod system_parachain {
/// Statemint parachain ID.
pub const WESTMINT_ID: u32 = 1000;
/// Collectives parachain ID.
pub const COLLECTIVES_ID: u32 = 1001;
}

#[cfg(test)]
mod tests {
use super::{
Expand Down
Loading

0 comments on commit cc5cccc

Please sign in to comment.