mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 09:21:04 +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
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user