Unverified Commit ece7544b authored by asynchronous rob's avatar asynchronous rob Committed by GitHub
Browse files

add parachains pallets to Polkadot runtime (#3815)



* add parachains pallets to Polkadot runtime

* some updates

* temp update deposits, fix compile

* lower para byte deposit

* fix genesis

* fmt

* fix spell

* updates to consts

* update benchmark list

* fix merge master

* cargo run --quiet --release --features=runtime-benchmarks -- benchmark --chain=polkadot-dev --steps=50 --repeat=20 --pallet=runtime_common::crowdloan --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --header=./file_header.txt --output=./runtime/polkadot/src/weights/runtime_common_crowdloan.rs

* skip large meta

* cargo run --quiet --release --features=runtime-benchmarks -- benchmark --chain=polkadot-dev --steps=50 --repeat=20 --pallet=runtime_common::crowdloan --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --header=./file_header.txt --output=./runtime/polkadot/src/weights/runtime_common_crowdloan.rs

* cargo run --quiet --release --features=runtime-benchmarks -- benchmark --chain=polkadot-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/polkadot/src/weights/runtime_common_paras_registrar.rs

* fmt

* add and update proxies

* add weight info

* weights

* lower minimum contribution to 5 DOT

* only overwrite when default

Co-authored-by: Shawn Tabrizi's avatarShawn Tabrizi <shawntabrizi@gmail.com>
Co-authored-by: default avatarParity Bot <admin@parity.io>
parent 80a0bfd6
Pipeline #158917 passed with stages
in 47 minutes and 23 seconds
...@@ -6655,6 +6655,7 @@ dependencies = [ ...@@ -6655,6 +6655,7 @@ dependencies = [
"parity-scale-codec", "parity-scale-codec",
"polkadot-primitives", "polkadot-primitives",
"polkadot-runtime-common", "polkadot-runtime-common",
"polkadot-runtime-parachains",
"rustc-hex", "rustc-hex",
"scale-info", "scale-info",
"separator", "separator",
......
...@@ -157,7 +157,12 @@ pub fn wococo_config() -> Result<RococoChainSpec, String> { ...@@ -157,7 +157,12 @@ pub fn wococo_config() -> Result<RococoChainSpec, String> {
} }
/// The default parachains host configuration. /// The default parachains host configuration.
#[cfg(any(feature = "rococo-native", feature = "kusama-native", feature = "westend-native"))] #[cfg(any(
feature = "rococo-native",
feature = "kusama-native",
feature = "westend-native",
feature = "polkadot-native"
))]
fn default_parachains_host_configuration( fn default_parachains_host_configuration(
) -> polkadot_runtime_parachains::configuration::HostConfiguration< ) -> polkadot_runtime_parachains::configuration::HostConfiguration<
polkadot_primitives::v1::BlockNumber, polkadot_primitives::v1::BlockNumber,
...@@ -364,6 +369,10 @@ fn polkadot_staging_testnet_config_genesis(wasm_binary: &[u8]) -> polkadot::Gene ...@@ -364,6 +369,10 @@ fn polkadot_staging_testnet_config_genesis(wasm_binary: &[u8]) -> polkadot::Gene
claims: polkadot::ClaimsConfig { claims: vec![], vesting: vec![] }, claims: polkadot::ClaimsConfig { claims: vec![], vesting: vec![] },
vesting: polkadot::VestingConfig { vesting: vec![] }, vesting: polkadot::VestingConfig { vesting: vec![] },
treasury: Default::default(), treasury: Default::default(),
configuration: polkadot::ConfigurationConfig {
config: default_parachains_host_configuration(),
},
paras: Default::default(),
} }
} }
...@@ -1310,6 +1319,10 @@ pub fn polkadot_testnet_genesis( ...@@ -1310,6 +1319,10 @@ pub fn polkadot_testnet_genesis(
claims: polkadot::ClaimsConfig { claims: vec![], vesting: vec![] }, claims: polkadot::ClaimsConfig { claims: vec![], vesting: vec![] },
vesting: polkadot::VestingConfig { vesting: vec![] }, vesting: polkadot::VestingConfig { vesting: vec![] },
treasury: Default::default(), treasury: Default::default(),
configuration: polkadot::ConfigurationConfig {
config: default_parachains_host_configuration(),
},
paras: Default::default(),
} }
} }
......
...@@ -1942,6 +1942,7 @@ mod benchmarking { ...@@ -1942,6 +1942,7 @@ mod benchmarking {
} }
// Worst case: Refund removes `RemoveKeysLimit` keys, and is fully refunded. // Worst case: Refund removes `RemoveKeysLimit` keys, and is fully refunded.
#[skip_meta]
refund { refund {
let k in 0 .. T::RemoveKeysLimit::get(); let k in 0 .. T::RemoveKeysLimit::get();
let fund_index = create_fund::<T>(1337, 100u32.into()); let fund_index = create_fund::<T>(1337, 100u32.into());
......
...@@ -77,6 +77,7 @@ pallet-session-benchmarking = { git = "https://github.com/paritytech/substrate", ...@@ -77,6 +77,7 @@ pallet-session-benchmarking = { git = "https://github.com/paritytech/substrate",
hex-literal = { version = "0.3.3", optional = true } hex-literal = { version = "0.3.3", optional = true }
runtime-common = { package = "polkadot-runtime-common", path = "../common", default-features = false } runtime-common = { package = "polkadot-runtime-common", path = "../common", default-features = false }
runtime-parachains = { package = "polkadot-runtime-parachains", path = "../parachains", default-features = false }
primitives = { package = "polkadot-primitives", path = "../../primitives", default-features = false } primitives = { package = "polkadot-primitives", path = "../../primitives", default-features = false }
[dev-dependencies] [dev-dependencies]
......
...@@ -39,6 +39,7 @@ pub mod time { ...@@ -39,6 +39,7 @@ pub mod time {
pub const MINUTES: BlockNumber = 60_000 / (MILLISECS_PER_BLOCK as BlockNumber); pub const MINUTES: BlockNumber = 60_000 / (MILLISECS_PER_BLOCK as BlockNumber);
pub const HOURS: BlockNumber = MINUTES * 60; pub const HOURS: BlockNumber = MINUTES * 60;
pub const DAYS: BlockNumber = HOURS * 24; pub const DAYS: BlockNumber = HOURS * 24;
pub const WEEKS: BlockNumber = DAYS * 7;
// 1 in 4 blocks (on average, not counting collisions) will be primary babe blocks. // 1 in 4 blocks (on average, not counting collisions) will be primary babe blocks.
pub const PRIMARY_PROBABILITY: (u64, u64) = (1, 4); pub const PRIMARY_PROBABILITY: (u64, u64) = (1, 4);
......
...@@ -22,9 +22,18 @@ ...@@ -22,9 +22,18 @@
use pallet_transaction_payment::CurrencyAdapter; use pallet_transaction_payment::CurrencyAdapter;
use runtime_common::{ use runtime_common::{
claims, impls::DealWithFees, AssignmentSessionKeyPlaceholder, BlockHashCount, BlockLength, auctions, claims, crowdloan, impls::DealWithFees, paras_registrar, slots, BlockHashCount,
BlockWeights, CurrencyToVote, OffchainSolutionLengthLimit, OffchainSolutionWeightLimit, BlockLength, BlockWeights, CurrencyToVote, OffchainSolutionLengthLimit,
ParachainSessionKeyPlaceholder, RocksDbWeight, SlowAdjustingFeeUpdate, OffchainSolutionWeightLimit, RocksDbWeight, SlowAdjustingFeeUpdate,
};
use runtime_parachains::{
configuration as parachains_configuration, dmp as parachains_dmp, hrmp as parachains_hrmp,
inclusion as parachains_inclusion, initializer as parachains_initializer,
origin as parachains_origin, paras as parachains_paras,
paras_inherent as parachains_paras_inherent, reward_points as parachains_reward_points,
runtime_api_impl::v1 as parachains_runtime_api_impl, scheduler as parachains_scheduler,
session_info as parachains_session_info, shared as parachains_shared, ump as parachains_ump,
}; };
use authority_discovery_primitives::AuthorityId as AuthorityDiscoveryId; use authority_discovery_primitives::AuthorityId as AuthorityDiscoveryId;
...@@ -32,7 +41,7 @@ use beefy_primitives::crypto::AuthorityId as BeefyId; ...@@ -32,7 +41,7 @@ use beefy_primitives::crypto::AuthorityId as BeefyId;
use frame_support::{ use frame_support::{
construct_runtime, parameter_types, construct_runtime, parameter_types,
traits::{Contains, KeyOwnerProofSystem, LockIdentifier, OnRuntimeUpgrade}, traits::{Contains, KeyOwnerProofSystem, LockIdentifier, OnRuntimeUpgrade},
weights::Weight, weights::{constants::WEIGHT_PER_MILLIS, Weight},
PalletId, RuntimeDebug, PalletId, RuntimeDebug,
}; };
use frame_system::{EnsureOneOf, EnsureRoot}; use frame_system::{EnsureOneOf, EnsureRoot};
...@@ -44,9 +53,9 @@ use pallet_transaction_payment::{FeeDetails, RuntimeDispatchInfo}; ...@@ -44,9 +53,9 @@ use pallet_transaction_payment::{FeeDetails, RuntimeDispatchInfo};
use parity_scale_codec::{Decode, Encode, MaxEncodedLen}; use parity_scale_codec::{Decode, Encode, MaxEncodedLen};
use primitives::v1::{ use primitives::v1::{
AccountId, AccountIndex, Balance, BlockNumber, CandidateEvent, CommittedCandidateReceipt, AccountId, AccountIndex, Balance, BlockNumber, CandidateEvent, CommittedCandidateReceipt,
CoreState, GroupRotationInfo, Hash, Id, InboundDownwardMessage, InboundHrmpMessage, Moment, CoreState, GroupRotationInfo, Hash, Id as ParaId, InboundDownwardMessage, InboundHrmpMessage,
Nonce, OccupiedCoreAssumption, PersistedValidationData, SessionInfo, Signature, ValidationCode, Moment, Nonce, OccupiedCoreAssumption, PersistedValidationData, SessionInfo, Signature,
ValidationCodeHash, ValidatorId, ValidatorIndex, ValidationCode, ValidationCodeHash, ValidatorId, ValidatorIndex,
}; };
use sp_core::{ use sp_core::{
u32_trait::{_1, _2, _3, _4, _5}, u32_trait::{_1, _2, _3, _4, _5},
...@@ -148,7 +157,19 @@ impl Contains<Call> for BaseFilter { ...@@ -148,7 +157,19 @@ impl Contains<Call> for BaseFilter {
Call::Multisig(_) | Call::Multisig(_) |
Call::Bounties(_) | Call::Bounties(_) |
Call::Tips(_) | Call::Tips(_) |
Call::ElectionProviderMultiPhase(_) => true, Call::ElectionProviderMultiPhase(_) |
Call::Configuration(_) |
Call::ParasShared(_) |
Call::ParaInclusion(_) |
Call::Paras(_) |
Call::Initializer(_) |
Call::ParaInherent(_) |
Call::Dmp(_) |
Call::Ump(_) |
Call::Hrmp(_) |
Call::Slots(_) => true,
// Disable paras registration, crowdloans, and auctions for now.
Call::Registrar(_) | Call::Auctions(_) | Call::Crowdloan(_) => false,
} }
} }
} }
...@@ -317,8 +338,8 @@ impl_opaque_keys! { ...@@ -317,8 +338,8 @@ impl_opaque_keys! {
pub grandpa: Grandpa, pub grandpa: Grandpa,
pub babe: Babe, pub babe: Babe,
pub im_online: ImOnline, pub im_online: ImOnline,
pub para_validator: ParachainSessionKeyPlaceholder<Runtime>, pub para_validator: Initializer,
pub para_assignment: AssignmentSessionKeyPlaceholder<Runtime>, pub para_assignment: ParaSessionInfo,
pub authority_discovery: AuthorityDiscovery, pub authority_discovery: AuthorityDiscovery,
} }
} }
...@@ -944,6 +965,7 @@ pub enum ProxyType { ...@@ -944,6 +965,7 @@ pub enum ProxyType {
// Skip 4 as it is now removed (was SudoBalances) // Skip 4 as it is now removed (was SudoBalances)
IdentityJudgement = 5, IdentityJudgement = 5,
CancelProxy = 6, CancelProxy = 6,
Auction = 7,
} }
#[cfg(test)] #[cfg(test)]
...@@ -1017,7 +1039,14 @@ impl InstanceFilter<Call> for ProxyType { ...@@ -1017,7 +1039,14 @@ impl InstanceFilter<Call> for ProxyType {
Call::Utility(..) | Call::Utility(..) |
Call::Identity(..) | Call::Identity(..) |
Call::Proxy(..) | Call::Proxy(..) |
Call::Multisig(..) Call::Multisig(..) |
Call::Registrar(paras_registrar::Call::register {..}) |
Call::Registrar(paras_registrar::Call::deregister {..}) |
// Specifically omitting Registrar `swap`
Call::Registrar(paras_registrar::Call::reserve {..}) |
Call::Crowdloan(..) |
Call::Slots(..) |
Call::Auctions(..) // Specifically omitting the entire XCM Pallet
), ),
ProxyType::Governance => matches!( ProxyType::Governance => matches!(
c, c,
...@@ -1037,6 +1066,10 @@ impl InstanceFilter<Call> for ProxyType { ...@@ -1037,6 +1066,10 @@ impl InstanceFilter<Call> for ProxyType {
ProxyType::CancelProxy => { ProxyType::CancelProxy => {
matches!(c, Call::Proxy(pallet_proxy::Call::reject_announcement { .. })) matches!(c, Call::Proxy(pallet_proxy::Call::reject_announcement { .. }))
}, },
ProxyType::Auction => matches!(
c,
Call::Auctions(..) | Call::Crowdloan(..) | Call::Registrar(..) | Call::Slots(..)
),
} }
} }
fn is_superset(&self, o: &Self) -> bool { fn is_superset(&self, o: &Self) -> bool {
...@@ -1065,6 +1098,135 @@ impl pallet_proxy::Config for Runtime { ...@@ -1065,6 +1098,135 @@ impl pallet_proxy::Config for Runtime {
type AnnouncementDepositFactor = AnnouncementDepositFactor; type AnnouncementDepositFactor = AnnouncementDepositFactor;
} }
impl parachains_origin::Config for Runtime {}
impl parachains_configuration::Config for Runtime {
type WeightInfo = weights::runtime_parachains_configuration::WeightInfo<Runtime>;
}
impl parachains_shared::Config for Runtime {}
impl parachains_session_info::Config for Runtime {}
impl parachains_inclusion::Config for Runtime {
type Event = Event;
type DisputesHandler = ();
type RewardValidators = parachains_reward_points::RewardValidatorsWithEraPoints<Runtime>;
}
impl parachains_paras::Config for Runtime {
type Origin = Origin;
type Event = Event;
type WeightInfo = weights::runtime_parachains_paras::WeightInfo<Runtime>;
}
parameter_types! {
pub const FirstMessageFactorPercent: u64 = 100;
}
impl parachains_ump::Config for Runtime {
type Event = Event;
type UmpSink = ();
type FirstMessageFactorPercent = FirstMessageFactorPercent;
type ExecuteOverweightOrigin = EnsureRoot<AccountId>;
}
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>;
}
parameter_types! {
// Mostly arbitrary deposit price, but should provide an adequate incentive not to spam reserve
// `ParaId`s.
pub const ParaDeposit: Balance = 100 * DOLLARS;
pub const ParaDataByteDeposit: Balance = deposit(0, 1);
}
impl paras_registrar::Config for Runtime {
type Event = Event;
type Origin = Origin;
type Currency = Balances;
type OnSwap = (Crowdloan, Slots);
type ParaDeposit = ParaDeposit;
type DataDepositPerByte = ParaDataByteDeposit;
type WeightInfo = weights::runtime_common_paras_registrar::WeightInfo<Runtime>;
}
parameter_types! {
// 12 weeks = 3 months per lease period -> 8 lease periods ~ 2 years
pub const LeasePeriod: BlockNumber = 12 * WEEKS;
}
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 CrowdloanId: PalletId = PalletId(*b"py/cfund");
// Accounts for 10_000 contributions, each using 48 bytes (16 bytes for balance, and 32 bytes
// for a memo).
pub const SubmissionDeposit: Balance = deposit(1, 480_000);
// The minimum crowdloan contribution.
pub const MinContribution: Balance = 5 * DOLLARS;
pub const RemoveKeysLimit: u32 = 1000;
// Allow 32 bytes for an additional memo to a crowdloan.
pub const MaxMemoLength: u8 = 32;
}
impl crowdloan::Config for Runtime {
type Event = Event;
type PalletId = CrowdloanId;
type SubmissionDeposit = SubmissionDeposit;
type MinContribution = MinContribution;
type RemoveKeysLimit = RemoveKeysLimit;
type Registrar = Registrar;
type Auctioneer = Auctions;
type MaxMemoLength = MaxMemoLength;
type WeightInfo = weights::runtime_common_crowdloan::WeightInfo<Runtime>;
}
parameter_types! {
// The average auction is 7 days long, so this will be 70% for ending period.
// 5 Days = 72000 Blocks @ 6 sec per block
pub const EndingPeriod: BlockNumber = 5 * DAYS;
// ~ 1000 samples per day -> ~ 20 blocks per sample -> 2 minute samples
pub const SampleLength: BlockNumber = 2 * MINUTES;
}
type AuctionInitiate = EnsureOneOf<
AccountId,
EnsureRoot<AccountId>,
pallet_collective::EnsureProportionAtLeast<_2, _3, AccountId, CouncilCollective>,
>;
impl auctions::Config for Runtime {
type Event = Event;
type Leaser = Slots;
type Registrar = Registrar;
type EndingPeriod = EndingPeriod;
type SampleLength = SampleLength;
type Randomness = pallet_babe::RandomnessFromOneEpochAgo<Runtime>;
type InitiateOrigin = AuctionInitiate;
type WeightInfo = weights::runtime_common_auctions::WeightInfo<Runtime>;
}
construct_runtime! { construct_runtime! {
pub enum Runtime where pub enum Runtime where
Block = Block, Block = Block,
...@@ -1125,6 +1287,26 @@ construct_runtime! { ...@@ -1125,6 +1287,26 @@ construct_runtime! {
// Election pallet. Only works with staking, but placed here to maintain indices. // Election pallet. Only works with staking, but placed here to maintain indices.
ElectionProviderMultiPhase: pallet_election_provider_multi_phase::{Pallet, Call, Storage, Event<T>, ValidateUnsigned} = 36, ElectionProviderMultiPhase: pallet_election_provider_multi_phase::{Pallet, Call, Storage, Event<T>, ValidateUnsigned} = 36,
// Parachains pallets. Start indices at 50 to leave room.
ParachainsOrigin: parachains_origin::{Pallet, Origin} = 50,
Configuration: parachains_configuration::{Pallet, Call, Storage, Config<T>} = 51,
ParasShared: parachains_shared::{Pallet, Call, Storage} = 52,
ParaInclusion: parachains_inclusion::{Pallet, Call, Storage, Event<T>} = 53,
ParaInherent: parachains_paras_inherent::{Pallet, Call, Storage, Inherent} = 54,
ParaScheduler: parachains_scheduler::{Pallet, Storage} = 55,
Paras: parachains_paras::{Pallet, Call, Storage, Event, Config} = 56,
Initializer: parachains_initializer::{Pallet, Call, Storage} = 57,
Dmp: parachains_dmp::{Pallet, Call, Storage} = 58,
Ump: parachains_ump::{Pallet, Call, Storage, Event} = 59,
Hrmp: parachains_hrmp::{Pallet, Call, Storage, Event<T>} = 60,
ParaSessionInfo: parachains_session_info::{Pallet, Storage} = 61,
// Parachain Onboarding Pallets. Start indices at 70 to leave room.
Registrar: paras_registrar::{Pallet, Call, Storage, Event<T>} = 70,
Slots: slots::{Pallet, Call, Storage, Event<T>} = 71,
Auctions: auctions::{Pallet, Call, Storage, Event<T>} = 72,
Crowdloan: crowdloan::{Pallet, Call, Storage, Event<T>} = 73,
} }
} }
...@@ -1159,6 +1341,7 @@ pub type Executive = frame_executive::Executive< ...@@ -1159,6 +1341,7 @@ pub type Executive = frame_executive::Executive<
Runtime, Runtime,
AllPallets, AllPallets,
( (
SetInitialHostConfiguration,
BountiesPrefixMigration, BountiesPrefixMigration,
CouncilStoragePrefixMigration, CouncilStoragePrefixMigration,
TechnicalCommitteeStoragePrefixMigration, TechnicalCommitteeStoragePrefixMigration,
...@@ -1230,7 +1413,7 @@ impl OnRuntimeUpgrade for CouncilStoragePrefixMigration { ...@@ -1230,7 +1413,7 @@ impl OnRuntimeUpgrade for CouncilStoragePrefixMigration {
} }
const TECHNICAL_COMMITTEE_OLD_PREFIX: &str = "Instance2Collective"; const TECHNICAL_COMMITTEE_OLD_PREFIX: &str = "Instance2Collective";
/// Migrate from 'Instance2Collective' to the new pallet prefix `TechnicalCommittee` /// Migrate from `Instance2Collective` to the new pallet prefix `TechnicalCommittee`
pub struct TechnicalCommitteeStoragePrefixMigration; pub struct TechnicalCommitteeStoragePrefixMigration;
impl OnRuntimeUpgrade for TechnicalCommitteeStoragePrefixMigration { impl OnRuntimeUpgrade for TechnicalCommitteeStoragePrefixMigration {
...@@ -1297,6 +1480,64 @@ impl OnRuntimeUpgrade for TechnicalMembershipStoragePrefixMigration { ...@@ -1297,6 +1480,64 @@ impl OnRuntimeUpgrade for TechnicalMembershipStoragePrefixMigration {
} }
} }
/// Set the initial host configuration for Polkadot.
pub struct SetInitialHostConfiguration;
impl OnRuntimeUpgrade for SetInitialHostConfiguration {
fn on_runtime_upgrade() -> frame_support::weights::Weight {
use parachains_configuration::HostConfiguration;
let active_config: HostConfiguration<BlockNumber> = HostConfiguration {
max_code_size: 10_485_760,
max_head_data_size: 20_480,
max_upward_queue_count: 10,
max_upward_queue_size: 51_200,
max_upward_message_size: 51_200,
max_upward_message_num_per_candidate: 10,
hrmp_max_message_num_per_candidate: 10,
validation_upgrade_frequency: 14_400,
validation_upgrade_delay: 600,
max_pov_size: 5_242_880,
max_downward_message_size: 51_200,
ump_service_total_weight: 100_000_000_000,
hrmp_max_parachain_outbound_channels: 10,
hrmp_max_parathread_outbound_channels: 0,
hrmp_sender_deposit: deposit(1004, 100 * 1024),
hrmp_recipient_deposit: deposit(1004, 100 * 1024),
hrmp_channel_max_capacity: 1_000,
hrmp_channel_max_total_size: 102_400,
hrmp_max_parachain_inbound_channels: 10,
hrmp_max_parathread_inbound_channels: 0,
hrmp_channel_max_message_size: 102_400,
code_retention_period: EPOCH_DURATION_IN_SLOTS * 6,
parathread_cores: 0,
parathread_retries: 0,
group_rotation_frequency: 10,
chain_availability_period: 10,
thread_availability_period: 10,
scheduling_lookahead: 1,
max_validators_per_core: Some(5),
max_validators: Some(200),
dispute_period: 6,
dispute_post_conclusion_acceptance_period: 600,
dispute_max_spam_slots: 2,
dispute_conclusion_by_time_out_period: 600,
no_show_slots: 2,
n_delay_tranches: 89,
zeroth_delay_tranche_width: 0,
needed_approvals: 30,
relay_vrf_modulo_samples: 40,
ump_max_individual_weight: 20 * WEIGHT_PER_MILLIS,
};
// Only set the config if it's needed to be set explicitly.
if Configuration::config() == Default::default() {
Configuration::force_set_active_config(active_config);
}
RocksDbWeight::get().reads(1) + RocksDbWeight::get().writes(1)
}
}
const TIPS_OLD_PREFIX: &str = "Treasury"; const TIPS_OLD_PREFIX: &str = "Treasury";
/// Migrate pallet-tips from `Treasury` to the new pallet prefix `Tips` /// Migrate pallet-tips from `Treasury` to the new pallet prefix `Tips`
pub struct MigrateTipsPalletPrefix; pub struct MigrateTipsPalletPrefix;
...@@ -1380,60 +1621,69 @@ sp_api::impl_runtime_apis! { ...@@ -1380,60 +1621,69 @@ sp_api::impl_runtime_apis! {
impl primitives::v1::ParachainHost<Block, Hash, BlockNumber> for Runtime { impl primitives::v1::ParachainHost<Block, Hash, BlockNumber> for Runtime {
fn validators() -> Vec<ValidatorId> { fn validators() -> Vec<ValidatorId> {
Vec::new() parachains_runtime_api_impl::validators::<Runtime>()
} }
fn validator_groups() -> (Vec<Vec<ValidatorIndex>>, GroupRotationInfo<BlockNumber>) { 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>> { 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>> { -> Option<PersistedValidationData<Hash, BlockNumber>> {
None parachains_runtime_api_impl::persisted_validation_data::<Runtime>(para_id, assumption)
} }
fn check_validation_outputs(_: Id, _: primitives::v1::CandidateCommitments) -> bool { fn check_validation_outputs(
false para_id: ParaId,
outputs: primitives::v1::CandidateCommitments,
) -> bool {
parachains_runtime_api_impl::check_validation_outputs::<Runtime>(para_id, outputs)
} }
fn session_index_for_child() -> SessionIndex { fn session_index_for_child() -> SessionIndex {
0 parachains_runtime_api_impl::session_index_for_child::<Runtime>()
} }
fn session_info(_: SessionIndex) -> Option<SessionInfo> { fn validation_code(para_id: ParaId, assumption: OccupiedCoreAssumption)
None -> Option<ValidationCode> {
parachains_runtime_api_impl::validation_code::<Runtime>(para_id, assumption)
} }
fn validation_code(_: Id, _: OccupiedCoreAssumption) -> Option<ValidationCode> { fn candidate_pending_availability(para_id: ParaId) -> Option<CommittedCandidateReceipt<Hash>> {
None parachains_runtime_api_impl::candidate_pending_availability::<Runtime>(para_id)
} }
fn candidate_pending_availability(_: Id) -> Option<CommittedCandidateReceipt<Hash>> { fn candidate_events() -> Vec<CandidateEvent<Hash>> {
None parachains_runtime_api_impl::candidate_events::<Runtime, _>(|ev| {
match ev {
Event::ParaInclusion(ev) => {
Some(ev)
}
_ => None,
}
})
} }