mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 08:11:03 +00:00
Add parachains modules to Westend and Kusama runtimes (#2854)
* add `force_set_active_config` * add parachains modules to Westend * add parachains modules to Kusama runtime * use real runtime API impl * add module indices and remove auctions, crowdloan * add benchmarks * remove previous migrations and add host configuration set migration * make compile * Add Call Filter for Registrar and Slots except Root * cargo run --release --features=runtime-benchmarks -- benchmark --chain=westend-dev --steps=50 --repeat=20 --pallet=slots --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --header=./file_header.txt --output=./runtime/westend/src/weights/ * cargo run --release --features=runtime-benchmarks -- benchmark --chain=westend-dev --steps=50 --repeat=20 --pallet=paras_registrar --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --header=./file_header.txt --output=./runtime/westend/src/weights/ * fix build * update `add_benchmark` * cargo run --release --features=runtime-benchmarks -- benchmark --chain=kusama-dev --steps=50 --repeat=20 --pallet=runtime_common::paras_registrar --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --header=./file_header.txt --output=./runtime/kusama/src/weights/runtime_common_paras_registrar.rs * cargo run --release --features=runtime-benchmarks -- benchmark --chain=kusama-dev --steps=50 --repeat=20 --pallet=runtime_common::slots --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --header=./file_header.txt --output=./runtime/kusama/src/weights/runtime_common_slots.rs * cargo run --release --features=runtime-benchmarks -- benchmark --chain=westend-dev --steps=50 --repeat=20 --pallet=runtime_common::paras_registrar --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --header=./file_header.txt --output=./runtime/westend/src/weights/runtime_common_paras_registrar.rs * cargo run --release --features=runtime-benchmarks -- benchmark --chain=westend-dev --steps=50 --repeat=20 --pallet=runtime_common::slots --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --header=./file_header.txt --output=./runtime/westend/src/weights/runtime_common_slots.rs * fix weights * tweak more constants * Fix up the kusama runtime * Westend runtime fixups * Fix MMR & Beefy for westend * Fixes * fix tests * Update runtime/polkadot/src/constants.rs Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com> * Update runtime/westend/src/lib.rs Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com> Co-authored-by: Parity Benchmarking Bot <admin@parity.io> Co-authored-by: Gav Wood <gavin@parity.io>
This commit is contained in:
committed by
GitHub
parent
99b10213a0
commit
2d18b26151
@@ -32,22 +32,25 @@ tx-pool-api = { package = "sp-transaction-pool", git = "https://github.com/parit
|
||||
block-builder-api = { package = "sp-block-builder", 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 }
|
||||
|
||||
frame-executive = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
||||
frame-support = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
||||
frame-system = {git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
||||
frame-system-rpc-runtime-api = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
||||
pallet-authority-discovery = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
||||
pallet-authorship = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
||||
pallet-babe = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
||||
pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
||||
pallet-transaction-payment = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
||||
pallet-transaction-payment-rpc-runtime-api = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
||||
pallet-beefy = { git = "https://github.com/paritytech/grandpa-bridge-gadget", branch = "master", default-features = false }
|
||||
pallet-collective = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
||||
pallet-democracy = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
||||
pallet-elections-phragmen = { package = "pallet-elections-phragmen", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
||||
pallet-election-provider-multi-phase = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
||||
frame-executive = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
||||
pallet-grandpa = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
||||
pallet-identity = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
||||
pallet-im-online = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
||||
pallet-indices = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
||||
pallet-membership = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
||||
pallet-mmr = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
||||
pallet-mmr-primitives = { 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-nicks = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
||||
@@ -58,13 +61,12 @@ pallet-recovery = { git = "https://github.com/paritytech/substrate", branch = "m
|
||||
pallet-scheduler = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
||||
pallet-session = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
||||
pallet-society = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
||||
frame-support = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
||||
pallet-staking = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
||||
pallet-staking-reward-curve = { package = "pallet-staking-reward-curve", git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
pallet-sudo = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
||||
frame-system = {git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
||||
frame-system-rpc-runtime-api = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
||||
pallet-timestamp = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
||||
pallet-transaction-payment = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
||||
pallet-transaction-payment-rpc-runtime-api = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
||||
pallet-treasury = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
||||
pallet-utility = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
||||
pallet-vesting = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
||||
@@ -81,6 +83,10 @@ primitives = { package = "polkadot-primitives", path = "../../primitives", defau
|
||||
polkadot-parachain = { path = "../../parachain", default-features = false }
|
||||
runtime-parachains = { package = "polkadot-runtime-parachains", path = "../parachains", default-features = false }
|
||||
|
||||
xcm = { package = "xcm", path = "../../xcm", default-features = false }
|
||||
xcm-executor = { package = "xcm-executor", path = "../../xcm/xcm-executor", default-features = false }
|
||||
xcm-builder = { package = "xcm-builder", path = "../../xcm/xcm-builder", default-features = false }
|
||||
|
||||
[dev-dependencies]
|
||||
hex-literal = "0.3.1"
|
||||
libsecp256k1 = "0.3.5"
|
||||
@@ -115,6 +121,7 @@ std = [
|
||||
"pallet-authority-discovery/std",
|
||||
"pallet-authorship/std",
|
||||
"pallet-balances/std",
|
||||
"pallet-beefy/std",
|
||||
"pallet-transaction-payment/std",
|
||||
"pallet-transaction-payment-rpc-runtime-api/std",
|
||||
"pallet-collective/std",
|
||||
@@ -126,6 +133,7 @@ std = [
|
||||
"pallet-im-online/std",
|
||||
"pallet-indices/std",
|
||||
"pallet-membership/std",
|
||||
"pallet-mmr/std",
|
||||
"pallet-mmr-primitives/std",
|
||||
"beefy-primitives/std",
|
||||
"pallet-multisig/std",
|
||||
@@ -156,8 +164,12 @@ std = [
|
||||
"babe-primitives/std",
|
||||
"sp-session/std",
|
||||
"runtime-common/std",
|
||||
"runtime-parachains/std",
|
||||
"frame-try-runtime/std",
|
||||
"sp-npos-elections/std",
|
||||
"xcm/std",
|
||||
"xcm-executor/std",
|
||||
"xcm-builder/std",
|
||||
]
|
||||
runtime-benchmarks = [
|
||||
"runtime-common/runtime-benchmarks",
|
||||
@@ -188,6 +200,7 @@ runtime-benchmarks = [
|
||||
"pallet-session-benchmarking",
|
||||
"frame-system-benchmarking",
|
||||
"hex-literal",
|
||||
"xcm-builder/runtime-benchmarks",
|
||||
]
|
||||
try-runtime = [
|
||||
"frame-executive/try-runtime",
|
||||
|
||||
@@ -18,13 +18,13 @@
|
||||
pub mod currency {
|
||||
use primitives::v0::Balance;
|
||||
|
||||
pub const DOTS: Balance = 1_000_000_000_000;
|
||||
pub const DOLLARS: Balance = DOTS;
|
||||
pub const CENTS: Balance = DOLLARS / 100;
|
||||
pub const UNITS: Balance = 1_000_000_000_000;
|
||||
pub const CENTS: Balance = UNITS / 100;
|
||||
pub const MILLICENTS: Balance = CENTS / 1_000;
|
||||
pub const GRAND: Balance = CENTS * 100_000;
|
||||
|
||||
pub const fn deposit(items: u32, bytes: u32) -> Balance {
|
||||
items as Balance * 1 * DOLLARS + (bytes as Balance) * 5 * MILLICENTS
|
||||
items as Balance * 100 * CENTS + (bytes as Balance) * 5 * MILLICENTS
|
||||
}
|
||||
}
|
||||
|
||||
@@ -89,15 +89,15 @@ mod tests {
|
||||
use frame_support::weights::WeightToFeePolynomial;
|
||||
use runtime_common::{MAXIMUM_BLOCK_WEIGHT, ExtrinsicBaseWeight};
|
||||
use super::fee::WeightToFee;
|
||||
use super::currency::{CENTS, DOLLARS, MILLICENTS};
|
||||
use super::currency::{CENTS, MILLICENTS};
|
||||
|
||||
#[test]
|
||||
// This function tests that the fee for `MAXIMUM_BLOCK_WEIGHT` of weight is correct
|
||||
fn full_block_fee_is_correct() {
|
||||
// A full block should cost 16 DOLLARS
|
||||
// A full block should cost 1,600 CENTS
|
||||
println!("Base: {}", ExtrinsicBaseWeight::get());
|
||||
let x = WeightToFee::calc(&MAXIMUM_BLOCK_WEIGHT);
|
||||
let y = 16 * DOLLARS;
|
||||
let y = 16 * 100 * CENTS;
|
||||
assert!(x.max(y) - x.min(y) < MILLICENTS);
|
||||
}
|
||||
|
||||
|
||||
@@ -26,17 +26,42 @@ use sp_std::collections::btree_map::BTreeMap;
|
||||
use parity_scale_codec::{Encode, Decode};
|
||||
use primitives::v1::{
|
||||
AccountId, AccountIndex, Balance, BlockNumber, CandidateEvent, CommittedCandidateReceipt,
|
||||
CoreState, GroupRotationInfo, Hash, Id, Moment, Nonce, OccupiedCoreAssumption,
|
||||
CoreState, GroupRotationInfo, Hash, Id as ParaId, Moment, Nonce, OccupiedCoreAssumption,
|
||||
PersistedValidationData, Signature, ValidationCode, ValidatorId, ValidatorIndex,
|
||||
InboundDownwardMessage, InboundHrmpMessage, SessionInfo,
|
||||
};
|
||||
use runtime_common::{
|
||||
mmr as mmr_common, paras_sudo_wrapper, paras_registrar, xcm_sender, slots,
|
||||
SlowAdjustingFeeUpdate, CurrencyToVote,
|
||||
impls::ToAuthor,
|
||||
BlockHashCount, BlockWeights, BlockLength, RocksDbWeight,
|
||||
OffchainSolutionWeightLimit, OffchainSolutionLengthLimit,
|
||||
ParachainSessionKeyPlaceholder, AssignmentSessionKeyPlaceholder,
|
||||
};
|
||||
|
||||
use runtime_parachains::origin as parachains_origin;
|
||||
use runtime_parachains::configuration as parachains_configuration;
|
||||
use runtime_parachains::shared as parachains_shared;
|
||||
use runtime_parachains::inclusion as parachains_inclusion;
|
||||
use runtime_parachains::paras_inherent as parachains_paras_inherent;
|
||||
use runtime_parachains::initializer as parachains_initializer;
|
||||
use runtime_parachains::session_info as parachains_session_info;
|
||||
use runtime_parachains::paras as parachains_paras;
|
||||
use runtime_parachains::dmp as parachains_dmp;
|
||||
use runtime_parachains::ump as parachains_ump;
|
||||
use runtime_parachains::hrmp as parachains_hrmp;
|
||||
use runtime_parachains::scheduler as parachains_scheduler;
|
||||
use runtime_parachains::reward_points as parachains_reward_points;
|
||||
use runtime_parachains::runtime_api_impl::v1 as parachains_runtime_api_impl;
|
||||
|
||||
use xcm::v0::{MultiLocation, NetworkId};
|
||||
use xcm_executor::XcmExecutor;
|
||||
use xcm_builder::{
|
||||
AccountId32Aliases, ChildParachainConvertsVia, SovereignSignedViaLocation, CurrencyAdapter as XcmCurrencyAdapter,
|
||||
ChildParachainAsNative, SignedAccountId32AsNative, ChildSystemParachainAsSuperuser, LocationInverter, IsConcrete,
|
||||
FixedWeightBounds, TakeWeightCredit, AllowTopLevelPaidExecutionFrom,
|
||||
AllowUnpaidExecutionFrom, IsChildSystemParachain, UsingComponents,};
|
||||
|
||||
use sp_runtime::{
|
||||
create_runtime_str, generic, impl_opaque_keys,
|
||||
ApplyExtrinsicResult, KeyTypeId, Perbill, curve::PiecewiseLinear,
|
||||
@@ -56,7 +81,7 @@ use sp_core::OpaqueMetadata;
|
||||
use sp_staking::SessionIndex;
|
||||
use frame_support::{
|
||||
parameter_types, construct_runtime, RuntimeDebug,
|
||||
traits::{KeyOwnerProofSystem, Randomness, Filter, InstanceFilter},
|
||||
traits::{KeyOwnerProofSystem, Randomness, Filter, InstanceFilter, All},
|
||||
weights::Weight,
|
||||
};
|
||||
use pallet_im_online::sr25519::AuthorityId as ImOnlineId;
|
||||
@@ -77,6 +102,7 @@ pub use pallet_balances::Call as BalancesCall;
|
||||
/// Constant values used within the runtime.
|
||||
pub mod constants;
|
||||
use constants::{time::*, currency::*, fee::*};
|
||||
use sp_runtime::traits::Keccak256;
|
||||
|
||||
// Weights used in the runtime
|
||||
mod weights;
|
||||
@@ -115,11 +141,14 @@ pub fn native_version() -> NativeVersion {
|
||||
}
|
||||
}
|
||||
|
||||
/// Accept all transactions.
|
||||
/// Avoid processing transactions from slots and parachain registrar except by root.
|
||||
pub struct BaseFilter;
|
||||
impl Filter<Call> for BaseFilter {
|
||||
fn filter(_: &Call) -> bool {
|
||||
true
|
||||
fn filter(c: &Call) -> bool {
|
||||
!matches!(c,
|
||||
Call::Registrar(..) |
|
||||
Call::Slots(..)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -204,7 +233,7 @@ impl pallet_babe::Config for Runtime {
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
pub const IndexDeposit: Balance = 1 * DOLLARS;
|
||||
pub const IndexDeposit: Balance = 100 * CENTS;
|
||||
}
|
||||
|
||||
impl pallet_indices::Config for Runtime {
|
||||
@@ -275,6 +304,7 @@ impl_opaque_keys! {
|
||||
pub para_validator: ParachainSessionKeyPlaceholder<Runtime>,
|
||||
pub para_assignment: AssignmentSessionKeyPlaceholder<Runtime>,
|
||||
pub authority_discovery: AuthorityDiscovery,
|
||||
pub beefy: Beefy,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -390,7 +420,7 @@ parameter_types! {
|
||||
pub const LaunchPeriod: BlockNumber = 7 * DAYS;
|
||||
pub const VotingPeriod: BlockNumber = 7 * DAYS;
|
||||
pub const FastTrackVotingPeriod: BlockNumber = 3 * HOURS;
|
||||
pub const MinimumDeposit: Balance = 1 * DOLLARS;
|
||||
pub const MinimumDeposit: Balance = 100 * CENTS;
|
||||
pub const EnactmentPeriod: BlockNumber = 8 * DAYS;
|
||||
pub const CooloffPeriod: BlockNumber = 7 * DAYS;
|
||||
// One cent: $10,000 / MB
|
||||
@@ -505,9 +535,9 @@ impl<C> frame_system::offchain::SendTransactionTypes<C> for Runtime where
|
||||
|
||||
parameter_types! {
|
||||
// Minimum 100 bytes/KSM deposited (1 CENT/byte)
|
||||
pub const BasicDeposit: Balance = 10 * DOLLARS; // 258 bytes on-chain
|
||||
pub const BasicDeposit: Balance = 1000 * CENTS; // 258 bytes on-chain
|
||||
pub const FieldDeposit: Balance = 250 * CENTS; // 66 bytes on-chain
|
||||
pub const SubAccountDeposit: Balance = 2 * DOLLARS; // 53 bytes on-chain
|
||||
pub const SubAccountDeposit: Balance = 200 * CENTS; // 53 bytes on-chain
|
||||
pub const MaxSubAccounts: u32 = 100;
|
||||
pub const MaxAdditionalFields: u32 = 100;
|
||||
pub const MaxRegistrars: u32 = 20;
|
||||
@@ -553,10 +583,10 @@ impl pallet_multisig::Config for Runtime {
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
pub const ConfigDepositBase: Balance = 5 * DOLLARS;
|
||||
pub const ConfigDepositBase: Balance = 500 * CENTS;
|
||||
pub const FriendDepositFactor: Balance = 50 * CENTS;
|
||||
pub const MaxFriends: u16 = 9;
|
||||
pub const RecoveryDeposit: Balance = 5 * DOLLARS;
|
||||
pub const RecoveryDeposit: Balance = 500 * CENTS;
|
||||
}
|
||||
|
||||
impl pallet_recovery::Config for Runtime {
|
||||
@@ -570,7 +600,7 @@ impl pallet_recovery::Config for Runtime {
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
pub const MinVestedTransfer: Balance = 1 * DOLLARS;
|
||||
pub const MinVestedTransfer: Balance = 100 * CENTS;
|
||||
}
|
||||
|
||||
impl pallet_vesting::Config for Runtime {
|
||||
@@ -586,6 +616,24 @@ impl pallet_sudo::Config for Runtime {
|
||||
type Call = Call;
|
||||
}
|
||||
|
||||
impl pallet_beefy::Config for Runtime {
|
||||
type AuthorityId = BeefyId;
|
||||
}
|
||||
|
||||
impl pallet_mmr::Config for Runtime {
|
||||
const INDEXING_PREFIX: &'static [u8] = b"mmr";
|
||||
type Hashing = Keccak256;
|
||||
type Hash = <Keccak256 as sp_runtime::traits::Hash>::Output;
|
||||
type LeafData = mmr_common::Pallet<Runtime>;
|
||||
type OnNewRoot = mmr_common::DepositBeefyDigest<Runtime>;
|
||||
type WeightInfo = ();
|
||||
}
|
||||
|
||||
impl mmr_common::Config for Runtime {
|
||||
type BeefyAuthorityToMerkleLeaf = mmr_common::UncompressBeefyEcdsaKeys;
|
||||
type ParachainHeads = ();
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
// One storage item; key size 32, value size 8; .
|
||||
pub const ProxyDepositBase: Balance = deposit(1, 8);
|
||||
@@ -690,6 +738,149 @@ impl pallet_proxy::Config for Runtime {
|
||||
type AnnouncementDepositFactor = AnnouncementDepositFactor;
|
||||
}
|
||||
|
||||
impl parachains_origin::Config for Runtime {}
|
||||
|
||||
impl parachains_configuration::Config for Runtime {}
|
||||
|
||||
impl parachains_shared::Config for Runtime {}
|
||||
|
||||
impl parachains_session_info::Config for Runtime {}
|
||||
|
||||
impl parachains_inclusion::Config for Runtime {
|
||||
type Event = Event;
|
||||
type RewardValidators = parachains_reward_points::RewardValidatorsWithEraPoints<Runtime>;
|
||||
}
|
||||
|
||||
impl parachains_paras::Config for Runtime {
|
||||
type Origin = Origin;
|
||||
type Event = Event;
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
pub const FirstMessageFactorPercent: u64 = 100;
|
||||
}
|
||||
|
||||
impl parachains_ump::Config for Runtime {
|
||||
type UmpSink = crate::parachains_ump::XcmSink<XcmExecutor<XcmConfig>, Call>;
|
||||
type FirstMessageFactorPercent = FirstMessageFactorPercent;
|
||||
}
|
||||
|
||||
impl parachains_dmp::Config for Runtime {}
|
||||
|
||||
impl parachains_hrmp::Config for Runtime {
|
||||
type Event = Event;
|
||||
type Origin = Origin;
|
||||
type Currency = Balances;
|
||||
}
|
||||
|
||||
impl parachains_paras_inherent::Config for Runtime {}
|
||||
|
||||
impl parachains_scheduler::Config for Runtime {}
|
||||
|
||||
impl parachains_initializer::Config for Runtime {
|
||||
type Randomness = pallet_babe::RandomnessFromOneEpochAgo<Runtime>;
|
||||
type ForceOrigin = EnsureRoot<AccountId>;
|
||||
}
|
||||
|
||||
impl paras_sudo_wrapper::Config for Runtime {}
|
||||
|
||||
parameter_types! {
|
||||
pub const ParaDeposit: Balance = 2000 * CENTS;
|
||||
pub const DataDepositPerByte: Balance = deposit(0, 1);
|
||||
pub const MaxCodeSize: u32 = 5 * 1024 * 1024; // 10 MB
|
||||
pub const MaxHeadSize: u32 = 20 * 1024; // 20 KB
|
||||
}
|
||||
|
||||
impl paras_registrar::Config for Runtime {
|
||||
type Event = Event;
|
||||
type Origin = Origin;
|
||||
type Currency = Balances;
|
||||
type OnSwap = Slots;
|
||||
type ParaDeposit = ParaDeposit;
|
||||
type DataDepositPerByte = DataDepositPerByte;
|
||||
type MaxCodeSize = MaxCodeSize;
|
||||
type MaxHeadSize = MaxHeadSize;
|
||||
type WeightInfo = weights::runtime_common_paras_registrar::WeightInfo<Runtime>;
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
pub const LeasePeriod: BlockNumber = 28 * DAYS;
|
||||
}
|
||||
|
||||
impl slots::Config for Runtime {
|
||||
type Event = Event;
|
||||
type Currency = Balances;
|
||||
type Registrar = Registrar;
|
||||
type LeasePeriod = LeasePeriod;
|
||||
type WeightInfo = weights::runtime_common_slots::WeightInfo<Runtime>;
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
pub const WndLocation: MultiLocation = MultiLocation::Null;
|
||||
pub const Ancestry: MultiLocation = MultiLocation::Null;
|
||||
pub WestendNetwork: NetworkId = NetworkId::Named(b"Westend".to_vec());
|
||||
}
|
||||
|
||||
pub type LocationConverter = (
|
||||
ChildParachainConvertsVia<ParaId, AccountId>,
|
||||
AccountId32Aliases<WestendNetwork, AccountId>,
|
||||
);
|
||||
|
||||
pub type LocalAssetTransactor =
|
||||
XcmCurrencyAdapter<
|
||||
// Use this currency:
|
||||
Balances,
|
||||
// Use this currency when it is a fungible asset matching the given location or name:
|
||||
IsConcrete<WndLocation>,
|
||||
// We can convert the MultiLocations with our converter above:
|
||||
LocationConverter,
|
||||
// Our chain's account ID type (we can't get away without mentioning it explicitly):
|
||||
AccountId,
|
||||
>;
|
||||
|
||||
type LocalOriginConverter = (
|
||||
SovereignSignedViaLocation<LocationConverter, Origin>,
|
||||
ChildParachainAsNative<parachains_origin::Origin, Origin>,
|
||||
SignedAccountId32AsNative<WestendNetwork, Origin>,
|
||||
ChildSystemParachainAsSuperuser<ParaId, Origin>,
|
||||
);
|
||||
|
||||
parameter_types! {
|
||||
pub const BaseXcmWeight: Weight = 10_000_000;
|
||||
}
|
||||
|
||||
/// The XCM router. When we want to send an XCM message, we use this type. It amalgamates all of our
|
||||
/// individual routers.
|
||||
pub type XcmRouter = (
|
||||
// Only one router so far - use DMP to communicate with child parachains.
|
||||
xcm_sender::ChildParachainRouter<Runtime>,
|
||||
);
|
||||
|
||||
/// The barriers one of which must be passed for an XCM message to be executed.
|
||||
pub type Barrier = (
|
||||
// Weight that is paid for may be consumed.
|
||||
TakeWeightCredit,
|
||||
// If the message is one that immediately attemps to pay for execution, then allow it.
|
||||
AllowTopLevelPaidExecutionFrom<All<MultiLocation>>,
|
||||
// Messages coming from system parachains need not pay for execution.
|
||||
AllowUnpaidExecutionFrom<IsChildSystemParachain<ParaId>>,
|
||||
);
|
||||
|
||||
pub struct XcmConfig;
|
||||
impl xcm_executor::Config for XcmConfig {
|
||||
type Call = Call;
|
||||
type XcmSender = XcmRouter;
|
||||
type AssetTransactor = LocalAssetTransactor;
|
||||
type OriginConverter = LocalOriginConverter;
|
||||
type IsReserve = ();
|
||||
type IsTeleporter = ();
|
||||
type LocationInverter = LocationInverter<Ancestry>;
|
||||
type Barrier = ();
|
||||
type Weigher = FixedWeightBounds<BaseXcmWeight, Call>;
|
||||
type Trader = UsingComponents<WeightToFee, WndLocation, AccountId, Balances, ToAuthor<Runtime>>;
|
||||
type ResponseHandler = ();
|
||||
}
|
||||
|
||||
construct_runtime! {
|
||||
pub enum Runtime where
|
||||
Block = Block,
|
||||
@@ -744,6 +935,30 @@ construct_runtime! {
|
||||
|
||||
// Election pallet. Only works with staking, but placed here to maintain indices.
|
||||
ElectionProviderMultiPhase: pallet_election_provider_multi_phase::{Pallet, Call, Storage, Event<T>, ValidateUnsigned} = 24,
|
||||
|
||||
// Bridges support.
|
||||
Mmr: pallet_mmr::{Pallet, Call, Storage} = 28,
|
||||
Beefy: pallet_beefy::{Pallet, Config<T>, Storage} = 29,
|
||||
MmrLeaf: mmr_common::{Pallet, Storage} = 30,
|
||||
|
||||
// Parachains pallets. Start indices at 40 to leave room.
|
||||
ParachainsOrigin: parachains_origin::{Pallet, Origin} = 41,
|
||||
ParachainsConfiguration: parachains_configuration::{Pallet, Call, Storage, Config<T>} = 42,
|
||||
ParasShared: parachains_shared::{Pallet, Call, Storage} = 43,
|
||||
ParasInclusion: parachains_inclusion::{Pallet, Call, Storage, Event<T>} = 44,
|
||||
ParasInherent: parachains_paras_inherent::{Pallet, Call, Storage, Inherent} = 45,
|
||||
ParasScheduler: parachains_scheduler::{Pallet, Call, Storage} = 46,
|
||||
Paras: parachains_paras::{Pallet, Call, Storage, Event} = 47,
|
||||
ParasInitializer: parachains_initializer::{Pallet, Call, Storage} = 48,
|
||||
ParasDmp: parachains_dmp::{Pallet, Call, Storage} = 49,
|
||||
ParasUmp: parachains_ump::{Pallet, Call, Storage} = 50,
|
||||
ParasHrmp: parachains_hrmp::{Pallet, Call, Storage, Event} = 51,
|
||||
ParasSessionInfo: parachains_session_info::{Pallet, Call, Storage} = 52,
|
||||
|
||||
// Parachain Onboarding Pallets. Start indices at 60 to leave room.
|
||||
Registrar: paras_registrar::{Pallet, Call, Storage, Event<T>} = 60,
|
||||
Slots: slots::{Pallet, Call, Storage, Event<T>} = 61,
|
||||
ParasSudoWrapper: paras_sudo_wrapper::{Pallet, Call} = 62,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -753,6 +968,57 @@ impl pallet_babe::migrations::BabePalletPrefix for Runtime {
|
||||
}
|
||||
}
|
||||
|
||||
pub struct ParachainHostConfigurationMigration;
|
||||
impl frame_support::traits::OnRuntimeUpgrade for ParachainHostConfigurationMigration {
|
||||
fn on_runtime_upgrade() -> frame_support::weights::Weight {
|
||||
let config = parachains_configuration::HostConfiguration {
|
||||
max_code_size: MaxCodeSize::get(),
|
||||
max_head_data_size: MaxHeadSize::get(),
|
||||
max_upward_queue_count: 10,
|
||||
max_upward_queue_size: 50 * 1024,
|
||||
max_upward_message_size: 50 * 1024,
|
||||
max_upward_message_num_per_candidate: 10,
|
||||
hrmp_max_message_num_per_candidate: 10,
|
||||
validation_upgrade_frequency: 1 * DAYS,
|
||||
validation_upgrade_delay: EPOCH_DURATION_IN_SLOTS,
|
||||
max_pov_size: 5 * 1024 * 1024,
|
||||
max_downward_message_size: 50 * 1024,
|
||||
preferred_dispatchable_upward_messages_step_weight: 0,
|
||||
hrmp_max_parachain_outbound_channels: 10,
|
||||
hrmp_max_parathread_outbound_channels: 0,
|
||||
hrmp_open_request_ttl: 2,
|
||||
hrmp_sender_deposit: deposit(1004, 100 * 1024),
|
||||
hrmp_recipient_deposit: deposit(1004, 100 * 1024),
|
||||
hrmp_channel_max_capacity: 1000,
|
||||
hrmp_channel_max_total_size: 100 * 1024,
|
||||
hrmp_max_parachain_inbound_channels: 10,
|
||||
hrmp_max_parathread_inbound_channels: 0,
|
||||
hrmp_channel_max_message_size: 100 * 1024,
|
||||
code_retention_period: 2 * DAYS,
|
||||
parathread_cores: 0,
|
||||
parathread_retries: 0,
|
||||
group_rotation_frequency: 1 * MINUTES,
|
||||
chain_availability_period: MINUTES / 2,
|
||||
thread_availability_period: MINUTES / 2,
|
||||
scheduling_lookahead: 1,
|
||||
max_validators_per_core: Some(5),
|
||||
max_validators: Some(200),
|
||||
dispute_period: 6,
|
||||
dispute_post_conclusion_acceptance_period: 1 * HOURS,
|
||||
dispute_max_spam_slots: 2,
|
||||
dispute_conclusion_by_time_out_period: 1 * HOURS,
|
||||
no_show_slots: 2,
|
||||
n_delay_tranches: 40,
|
||||
zeroth_delay_tranche_width: 0,
|
||||
needed_approvals: 15,
|
||||
relay_vrf_modulo_samples: 1,
|
||||
};
|
||||
|
||||
ParachainsConfiguration::force_set_active_config(config);
|
||||
RocksDbWeight::get().writes(1)
|
||||
}
|
||||
}
|
||||
|
||||
/// The address format for describing accounts.
|
||||
pub type Address = sp_runtime::MultiAddress<AccountId, ()>;
|
||||
/// Block header type as expected by this runtime.
|
||||
@@ -782,7 +1048,7 @@ pub type Executive = frame_executive::Executive<
|
||||
frame_system::ChainContext<Runtime>,
|
||||
Runtime,
|
||||
AllPallets,
|
||||
(),
|
||||
ParachainHostConfigurationMigration,
|
||||
>;
|
||||
/// The payload being signed in transactions.
|
||||
pub type SignedPayload = generic::SignedPayload<Call, SignedExtra>;
|
||||
@@ -851,67 +1117,75 @@ sp_api::impl_runtime_apis! {
|
||||
|
||||
impl primitives::v1::ParachainHost<Block, Hash, BlockNumber> for Runtime {
|
||||
fn validators() -> Vec<ValidatorId> {
|
||||
Vec::new()
|
||||
parachains_runtime_api_impl::validators::<Runtime>()
|
||||
}
|
||||
|
||||
fn validator_groups() -> (Vec<Vec<ValidatorIndex>>, GroupRotationInfo<BlockNumber>) {
|
||||
(Vec::new(), GroupRotationInfo { session_start_block: 0, group_rotation_frequency: 0, now: 0 })
|
||||
parachains_runtime_api_impl::validator_groups::<Runtime>()
|
||||
}
|
||||
|
||||
fn availability_cores() -> Vec<CoreState<Hash, BlockNumber>> {
|
||||
Vec::new()
|
||||
parachains_runtime_api_impl::availability_cores::<Runtime>()
|
||||
}
|
||||
|
||||
fn persisted_validation_data(_: Id, _: OccupiedCoreAssumption)
|
||||
fn persisted_validation_data(para_id: ParaId, assumption: OccupiedCoreAssumption)
|
||||
-> Option<PersistedValidationData<Hash, BlockNumber>> {
|
||||
None
|
||||
}
|
||||
|
||||
fn historical_validation_code(_: Id, _: BlockNumber) -> Option<ValidationCode> {
|
||||
None
|
||||
parachains_runtime_api_impl::persisted_validation_data::<Runtime>(para_id, assumption)
|
||||
}
|
||||
|
||||
fn check_validation_outputs(
|
||||
_: Id,
|
||||
_: primitives::v1::CandidateCommitments
|
||||
para_id: ParaId,
|
||||
outputs: primitives::v1::CandidateCommitments,
|
||||
) -> bool {
|
||||
false
|
||||
parachains_runtime_api_impl::check_validation_outputs::<Runtime>(para_id, outputs)
|
||||
}
|
||||
|
||||
fn session_index_for_child() -> SessionIndex {
|
||||
0
|
||||
parachains_runtime_api_impl::session_index_for_child::<Runtime>()
|
||||
}
|
||||
|
||||
fn session_info(_: SessionIndex) -> Option<SessionInfo> {
|
||||
None
|
||||
fn validation_code(para_id: ParaId, assumption: OccupiedCoreAssumption)
|
||||
-> Option<ValidationCode> {
|
||||
parachains_runtime_api_impl::validation_code::<Runtime>(para_id, assumption)
|
||||
}
|
||||
|
||||
fn validation_code(_: Id, _: OccupiedCoreAssumption) -> Option<ValidationCode> {
|
||||
None
|
||||
fn historical_validation_code(para_id: ParaId, context_height: BlockNumber)
|
||||
-> Option<ValidationCode>
|
||||
{
|
||||
parachains_runtime_api_impl::historical_validation_code::<Runtime>(para_id, context_height)
|
||||
}
|
||||
|
||||
fn candidate_pending_availability(_: Id) -> Option<CommittedCandidateReceipt<Hash>> {
|
||||
None
|
||||
fn candidate_pending_availability(para_id: ParaId) -> Option<CommittedCandidateReceipt<Hash>> {
|
||||
parachains_runtime_api_impl::candidate_pending_availability::<Runtime>(para_id)
|
||||
}
|
||||
|
||||
fn candidate_events() -> Vec<CandidateEvent<Hash>> {
|
||||
Vec::new()
|
||||
parachains_runtime_api_impl::candidate_events::<Runtime, _>(|ev| {
|
||||
match ev {
|
||||
Event::parachains_inclusion(ev) => {
|
||||
Some(ev)
|
||||
}
|
||||
_ => None,
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
fn dmq_contents(
|
||||
_recipient: Id,
|
||||
) -> Vec<InboundDownwardMessage<BlockNumber>> {
|
||||
Vec::new()
|
||||
fn session_info(index: SessionIndex) -> Option<SessionInfo> {
|
||||
parachains_runtime_api_impl::session_info::<Runtime>(index)
|
||||
}
|
||||
|
||||
fn dmq_contents(recipient: ParaId) -> Vec<InboundDownwardMessage<BlockNumber>> {
|
||||
parachains_runtime_api_impl::dmq_contents::<Runtime>(recipient)
|
||||
}
|
||||
|
||||
fn inbound_hrmp_channels_contents(
|
||||
_recipient: Id
|
||||
) -> BTreeMap<Id, Vec<InboundHrmpMessage<BlockNumber>>> {
|
||||
BTreeMap::new()
|
||||
recipient: ParaId
|
||||
) -> BTreeMap<ParaId, Vec<InboundHrmpMessage<BlockNumber>>> {
|
||||
parachains_runtime_api_impl::inbound_hrmp_channels_contents::<Runtime>(recipient)
|
||||
}
|
||||
|
||||
fn validation_code_by_hash(_hash: Hash) -> Option<ValidationCode> {
|
||||
None
|
||||
fn validation_code_by_hash(hash: Hash) -> Option<ValidationCode> {
|
||||
parachains_runtime_api_impl::validation_code_by_hash::<Runtime>(hash)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1034,7 +1308,7 @@ sp_api::impl_runtime_apis! {
|
||||
|
||||
impl authority_discovery_primitives::AuthorityDiscoveryApi<Block> for Runtime {
|
||||
fn authorities() -> Vec<AuthorityDiscoveryId> {
|
||||
AuthorityDiscovery::authorities()
|
||||
parachains_runtime_api_impl::relevant_authority_ids::<Runtime>()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1112,6 +1386,12 @@ sp_api::impl_runtime_apis! {
|
||||
let mut batches = Vec::<BenchmarkBatch>::new();
|
||||
let params = (&config, &whitelist);
|
||||
|
||||
// Polkadot
|
||||
// NOTE: Make sure to prefix these `runtime_common::` so that path resolves correctly
|
||||
// in the generated file.
|
||||
add_benchmark!(params, batches, runtime_common::slots, Slots);
|
||||
add_benchmark!(params, batches, runtime_common::paras_registrar, Registrar);
|
||||
// Substrate
|
||||
add_benchmark!(params, batches, pallet_balances, Balances);
|
||||
add_benchmark!(params, batches, pallet_election_provider_multi_phase, ElectionProviderMultiPhase);
|
||||
add_benchmark!(params, batches, pallet_identity, Identity);
|
||||
|
||||
@@ -29,3 +29,5 @@ pub mod pallet_staking;
|
||||
pub mod pallet_timestamp;
|
||||
pub mod pallet_utility;
|
||||
pub mod pallet_vesting;
|
||||
pub mod runtime_common_paras_registrar;
|
||||
pub mod runtime_common_slots;
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
// Copyright 2017-2020 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Polkadot.
|
||||
|
||||
// Polkadot is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// Polkadot is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Polkadot. If not, see <http://www.gnu.org/licenses/>.
|
||||
//! Autogenerated weights for runtime_common::paras_registrar
|
||||
//!
|
||||
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 3.0.0
|
||||
//! DATE: 2021-04-10, STEPS: `[50, ]`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
|
||||
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("westend-dev"), DB CACHE: 128
|
||||
|
||||
// Executed Command:
|
||||
// target/release/polkadot
|
||||
// benchmark
|
||||
// --chain=westend-dev
|
||||
// --steps=50
|
||||
// --repeat=20
|
||||
// --pallet=runtime_common::paras_registrar
|
||||
// --extrinsic=*
|
||||
// --execution=wasm
|
||||
// --wasm-execution=compiled
|
||||
// --heap-pages=4096
|
||||
// --header=./file_header.txt
|
||||
// --output=./runtime/westend/src/weights/runtime_common_paras_registrar.rs
|
||||
|
||||
|
||||
#![allow(unused_parens)]
|
||||
#![allow(unused_imports)]
|
||||
|
||||
use frame_support::{traits::Get, weights::Weight};
|
||||
use sp_std::marker::PhantomData;
|
||||
|
||||
/// Weight functions for runtime_common::paras_registrar.
|
||||
pub struct WeightInfo<T>(PhantomData<T>);
|
||||
impl<T: frame_system::Config> runtime_common::paras_registrar::WeightInfo for WeightInfo<T> {
|
||||
fn register() -> Weight {
|
||||
(8_391_121_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(4 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(4 as Weight))
|
||||
}
|
||||
fn force_register() -> Weight {
|
||||
(8_404_663_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(4 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(4 as Weight))
|
||||
}
|
||||
fn deregister() -> Weight {
|
||||
(88_109_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(4 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(4 as Weight))
|
||||
}
|
||||
fn swap() -> Weight {
|
||||
(66_711_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(8 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(6 as Weight))
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
// Copyright 2017-2020 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Polkadot.
|
||||
|
||||
// Polkadot is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// Polkadot is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Polkadot. If not, see <http://www.gnu.org/licenses/>.
|
||||
//! Autogenerated weights for runtime_common::slots
|
||||
//!
|
||||
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 3.0.0
|
||||
//! DATE: 2021-04-10, STEPS: `[50, ]`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
|
||||
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("westend-dev"), DB CACHE: 128
|
||||
|
||||
// Executed Command:
|
||||
// target/release/polkadot
|
||||
// benchmark
|
||||
// --chain=westend-dev
|
||||
// --steps=50
|
||||
// --repeat=20
|
||||
// --pallet=runtime_common::slots
|
||||
// --extrinsic=*
|
||||
// --execution=wasm
|
||||
// --wasm-execution=compiled
|
||||
// --heap-pages=4096
|
||||
// --header=./file_header.txt
|
||||
// --output=./runtime/westend/src/weights/runtime_common_slots.rs
|
||||
|
||||
|
||||
#![allow(unused_parens)]
|
||||
#![allow(unused_imports)]
|
||||
|
||||
use frame_support::{traits::Get, weights::Weight};
|
||||
use sp_std::marker::PhantomData;
|
||||
|
||||
/// Weight functions for runtime_common::slots.
|
||||
pub struct WeightInfo<T>(PhantomData<T>);
|
||||
impl<T: frame_system::Config> runtime_common::slots::WeightInfo for WeightInfo<T> {
|
||||
fn force_lease() -> Weight {
|
||||
(49_583_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(2 as Weight))
|
||||
}
|
||||
fn manage_lease_period_start(c: u32, t: u32, ) -> Weight {
|
||||
(0 as Weight)
|
||||
// Standard Error: 23_000
|
||||
.saturating_add((18_056_000 as Weight).saturating_mul(c as Weight))
|
||||
// Standard Error: 23_000
|
||||
.saturating_add((37_012_000 as Weight).saturating_mul(t as Weight))
|
||||
.saturating_add(T::DbWeight::get().reads(4 as Weight))
|
||||
.saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(c as Weight)))
|
||||
.saturating_add(T::DbWeight::get().reads((3 as Weight).saturating_mul(t as Weight)))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(c as Weight)))
|
||||
.saturating_add(T::DbWeight::get().writes((3 as Weight).saturating_mul(t as Weight)))
|
||||
}
|
||||
fn clear_all_leases() -> Weight {
|
||||
(208_632_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(9 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(9 as Weight))
|
||||
}
|
||||
fn trigger_onboard() -> Weight {
|
||||
(45_240_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(5 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(3 as Weight))
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user