1#![cfg_attr(not(feature = "std"), no_std)]
20#![recursion_limit = "512"]
22
23extern crate alloc;
24
25use alloc::{
26 collections::{btree_map::BTreeMap, vec_deque::VecDeque},
27 vec,
28 vec::Vec,
29};
30use codec::{Decode, DecodeWithMemTracking, Encode, MaxEncodedLen};
31use frame_election_provider_support::{bounds::ElectionBoundsBuilder, onchain, SequentialPhragmen};
32use frame_support::{
33 derive_impl,
34 dynamic_params::{dynamic_pallet_params, dynamic_params},
35 genesis_builder_helper::{build_state, get_preset},
36 pallet_prelude::PhantomData,
37 parameter_types,
38 traits::{
39 fungible::HoldConsideration, tokens::UnityOrOuterConversion, AsEnsureOriginWithArg,
40 ConstU32, Contains, EitherOf, EitherOfDiverse, EnsureOriginWithArg, EverythingBut,
41 FromContains, InstanceFilter, KeyOwnerProofSystem, LinearStoragePrice, Nothing,
42 ProcessMessage, ProcessMessageError, VariantCountOf, WithdrawReasons,
43 },
44 weights::{ConstantMultiplier, WeightMeter},
45 PalletId,
46};
47use frame_system::{EnsureRoot, EnsureSigned};
48use pallet_grandpa::{fg_primitives, AuthorityId as GrandpaId};
49use pallet_identity::legacy::IdentityInfo;
50use pallet_nomination_pools::PoolId;
51use pallet_session::historical as session_historical;
52use pallet_staking::UseValidatorsMap;
53use pallet_staking_async_ah_client as ah_client;
54use pallet_staking_async_rc_client as rc_client;
55use pallet_transaction_payment::{FeeDetails, FungibleAdapter, RuntimeDispatchInfo};
56use polkadot_primitives::{
57 slashing,
58 vstaging::{
59 async_backing::Constraints, CandidateEvent,
60 CommittedCandidateReceiptV2 as CommittedCandidateReceipt, CoreState, ScrapedOnChainVotes,
61 },
62 AccountId, AccountIndex, ApprovalVotingParams, Balance, BlockNumber, CandidateHash, CoreIndex,
63 DisputeState, ExecutorParams, GroupRotationInfo, Hash, Id as ParaId, InboundDownwardMessage,
64 InboundHrmpMessage, Moment, NodeFeatures, Nonce, OccupiedCoreAssumption,
65 PersistedValidationData, PvfCheckStatement, SessionInfo, Signature, ValidationCode,
66 ValidationCodeHash, ValidatorId, ValidatorIndex, ValidatorSignature, PARACHAIN_KEY_TYPE_ID,
67};
68use polkadot_runtime_common::{
69 assigned_slots, auctions, crowdloan,
70 elections::OnChainAccuracy,
71 identity_migrator, impl_runtime_weights,
72 impls::{
73 ContainsParts, LocatableAssetConverter, ToAuthor, VersionedLocatableAsset,
74 VersionedLocationConverter,
75 },
76 paras_registrar, paras_sudo_wrapper, prod_or_fast, slots,
77 traits::OnSwap,
78 BalanceToU256, BlockHashCount, BlockLength, SlowAdjustingFeeUpdate, U256ToBalance,
79};
80use polkadot_runtime_parachains::{
81 assigner_coretime as parachains_assigner_coretime, configuration as parachains_configuration,
82 configuration::ActiveConfigHrmpChannelSizeAndCapacityRatio,
83 coretime, disputes as parachains_disputes,
84 disputes::slashing as parachains_slashing,
85 dmp as parachains_dmp, hrmp as parachains_hrmp, inclusion as parachains_inclusion,
86 inclusion::{AggregateMessageOrigin, UmpQueueId},
87 initializer as parachains_initializer, on_demand as parachains_on_demand,
88 origin as parachains_origin, paras as parachains_paras,
89 paras_inherent as parachains_paras_inherent, reward_points as parachains_reward_points,
90 runtime_api_impl::{
91 v11 as parachains_runtime_api_impl, vstaging as parachains_staging_runtime_api_impl,
92 },
93 scheduler as parachains_scheduler, session_info as parachains_session_info,
94 shared as parachains_shared,
95};
96use scale_info::TypeInfo;
97use sp_authority_discovery::AuthorityId as AuthorityDiscoveryId;
98use sp_consensus_beefy::{
99 ecdsa_crypto::{AuthorityId as BeefyId, Signature as BeefySignature},
100 mmr::{BeefyDataProvider, MmrLeafVersion},
101};
102use sp_core::{ConstBool, ConstU8, ConstUint, OpaqueMetadata, RuntimeDebug, H256};
103use sp_runtime::{
104 generic, impl_opaque_keys,
105 traits::{
106 AccountIdConversion, BlakeTwo256, Block as BlockT, ConvertInto, IdentityLookup, Keccak256,
107 OpaqueKeys, SaturatedConversion, Verify,
108 },
109 transaction_validity::{TransactionPriority, TransactionSource, TransactionValidity},
110 ApplyExtrinsicResult, FixedU128, KeyTypeId, MultiSignature, MultiSigner, Percent, Permill,
111};
112use sp_staking::{EraIndex, SessionIndex};
113
114#[cfg(any(feature = "std", test))]
115use sp_version::NativeVersion;
116use sp_version::RuntimeVersion;
117use xcm::{
118 latest::prelude::*, Version as XcmVersion, VersionedAsset, VersionedAssetId, VersionedAssets,
119 VersionedLocation, VersionedXcm,
120};
121use xcm_builder::PayOverXcm;
122
123use xcm_runtime_apis::{
124 dry_run::{CallDryRunEffects, Error as XcmDryRunApiError, XcmDryRunEffects},
125 fees::Error as XcmPaymentApiError,
126};
127
128pub use frame_system::Call as SystemCall;
129pub use pallet_balances::Call as BalancesCall;
130pub use pallet_election_provider_multi_phase::{Call as EPMCall, GeometricDepositBase};
131pub use pallet_timestamp::Call as TimestampCall;
132use pallet_xcm::{EnsureXcm, IsVoiceOfBody};
133use sp_runtime::traits::Get;
134#[cfg(any(feature = "std", test))]
135pub use sp_runtime::BuildStorage;
136
137use westend_runtime_constants::{
139 currency::*,
140 fee::*,
141 system_parachain::{coretime::TIMESLICE_PERIOD, ASSET_HUB_ID, BROKER_ID},
142 time::*,
143};
144
145mod bag_thresholds;
146mod genesis_config_presets;
147mod weights;
148pub mod xcm_config;
149
150mod impls;
152use impls::ToParachainIdentityReaper;
153
154pub mod governance;
156use governance::{
157 pallet_custom_origins, AuctionAdmin, FellowshipAdmin, GeneralAdmin, LeaseAdmin, StakingAdmin,
158 Treasurer, TreasurySpender,
159};
160
161#[cfg(test)]
162mod tests;
163
164impl_runtime_weights!(westend_runtime_constants);
165
166#[cfg(feature = "std")]
168include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs"));
169
170#[cfg(feature = "std")]
171pub mod fast_runtime_binary {
172 include!(concat!(env!("OUT_DIR"), "/fast_runtime_binary.rs"));
173}
174
175#[sp_version::runtime_version]
177pub const VERSION: RuntimeVersion = RuntimeVersion {
178 spec_name: alloc::borrow::Cow::Borrowed("westend"),
179 impl_name: alloc::borrow::Cow::Borrowed("parity-westend"),
180 authoring_version: 2,
181 spec_version: 1_019_003,
182 impl_version: 0,
183 apis: RUNTIME_API_VERSIONS,
184 transaction_version: 27,
185 system_version: 1,
186};
187
188pub const BABE_GENESIS_EPOCH_CONFIG: sp_consensus_babe::BabeEpochConfiguration =
190 sp_consensus_babe::BabeEpochConfiguration {
191 c: PRIMARY_PROBABILITY,
192 allowed_slots: sp_consensus_babe::AllowedSlots::PrimaryAndSecondaryVRFSlots,
193 };
194
195#[cfg(any(feature = "std", test))]
197pub fn native_version() -> NativeVersion {
198 NativeVersion { runtime_version: VERSION, can_author_with: Default::default() }
199}
200
201pub struct IsIdentityCall;
206impl Contains<RuntimeCall> for IsIdentityCall {
207 fn contains(c: &RuntimeCall) -> bool {
208 matches!(c, RuntimeCall::Identity(_))
209 }
210}
211
212parameter_types! {
213 pub const Version: RuntimeVersion = VERSION;
214 pub const SS58Prefix: u8 = 42;
215}
216
217#[derive_impl(frame_system::config_preludes::RelayChainDefaultConfig)]
218impl frame_system::Config for Runtime {
219 type BaseCallFilter = EverythingBut<IsIdentityCall>;
220 type BlockWeights = BlockWeights;
221 type BlockLength = BlockLength;
222 type Nonce = Nonce;
223 type Hash = Hash;
224 type AccountId = AccountId;
225 type Block = Block;
226 type BlockHashCount = BlockHashCount;
227 type DbWeight = RocksDbWeight;
228 type Version = Version;
229 type AccountData = pallet_balances::AccountData<Balance>;
230 type SystemWeightInfo = weights::frame_system::WeightInfo<Runtime>;
231 type ExtensionsWeightInfo = weights::frame_system_extensions::WeightInfo<Runtime>;
232 type SS58Prefix = SS58Prefix;
233 type MaxConsumers = frame_support::traits::ConstU32<16>;
234 type MultiBlockMigrator = MultiBlockMigrations;
235}
236
237parameter_types! {
238 pub MaximumSchedulerWeight: frame_support::weights::Weight = Perbill::from_percent(80) *
239 BlockWeights::get().max_block;
240 pub const MaxScheduledPerBlock: u32 = 50;
241 pub const NoPreimagePostponement: Option<u32> = Some(10);
242}
243
244impl pallet_scheduler::Config for Runtime {
245 type RuntimeOrigin = RuntimeOrigin;
246 type RuntimeEvent = RuntimeEvent;
247 type PalletsOrigin = OriginCaller;
248 type RuntimeCall = RuntimeCall;
249 type MaximumWeight = MaximumSchedulerWeight;
250 type ScheduleOrigin = EitherOf<EnsureRoot<AccountId>, AuctionAdmin>;
253 type MaxScheduledPerBlock = MaxScheduledPerBlock;
254 type WeightInfo = weights::pallet_scheduler::WeightInfo<Runtime>;
255 type OriginPrivilegeCmp = frame_support::traits::EqualPrivilegeOnly;
256 type Preimages = Preimage;
257 type BlockNumberProvider = frame_system::Pallet<Runtime>;
258}
259
260parameter_types! {
261 pub const PreimageBaseDeposit: Balance = deposit(2, 64);
262 pub const PreimageByteDeposit: Balance = deposit(0, 1);
263 pub const PreimageHoldReason: RuntimeHoldReason = RuntimeHoldReason::Preimage(pallet_preimage::HoldReason::Preimage);
264}
265
266#[dynamic_params(RuntimeParameters, pallet_parameters::Parameters::<Runtime>)]
268pub mod dynamic_params {
269 use super::*;
270
271 #[dynamic_pallet_params]
274 #[codec(index = 0)]
275 pub mod inflation {
276 #[codec(index = 0)]
278 pub static MinInflation: Perquintill = Perquintill::from_rational(25u64, 1000u64);
279
280 #[codec(index = 1)]
282 pub static MaxInflation: Perquintill = Perquintill::from_rational(10u64, 100u64);
283
284 #[codec(index = 2)]
286 pub static IdealStake: Perquintill = Perquintill::from_rational(50u64, 100u64);
287
288 #[codec(index = 3)]
290 pub static Falloff: Perquintill = Perquintill::from_rational(50u64, 1000u64);
291
292 #[codec(index = 4)]
295 pub static UseAuctionSlots: bool = false;
296 }
297}
298
299#[cfg(feature = "runtime-benchmarks")]
300impl Default for RuntimeParameters {
301 fn default() -> Self {
302 RuntimeParameters::Inflation(dynamic_params::inflation::Parameters::MinInflation(
303 dynamic_params::inflation::MinInflation,
304 Some(Perquintill::from_rational(25u64, 1000u64)),
305 ))
306 }
307}
308
309impl pallet_parameters::Config for Runtime {
310 type RuntimeEvent = RuntimeEvent;
311 type RuntimeParameters = RuntimeParameters;
312 type AdminOrigin = DynamicParameterOrigin;
313 type WeightInfo = weights::pallet_parameters::WeightInfo<Runtime>;
314}
315
316pub struct DynamicParameterOrigin;
318impl EnsureOriginWithArg<RuntimeOrigin, RuntimeParametersKey> for DynamicParameterOrigin {
319 type Success = ();
320
321 fn try_origin(
322 origin: RuntimeOrigin,
323 key: &RuntimeParametersKey,
324 ) -> Result<Self::Success, RuntimeOrigin> {
325 use crate::RuntimeParametersKey::*;
326
327 match key {
328 Inflation(_) => frame_system::ensure_root(origin.clone()),
329 }
330 .map_err(|_| origin)
331 }
332
333 #[cfg(feature = "runtime-benchmarks")]
334 fn try_successful_origin(_key: &RuntimeParametersKey) -> Result<RuntimeOrigin, ()> {
335 Ok(RuntimeOrigin::root())
337 }
338}
339
340impl pallet_preimage::Config for Runtime {
341 type WeightInfo = weights::pallet_preimage::WeightInfo<Runtime>;
342 type RuntimeEvent = RuntimeEvent;
343 type Currency = Balances;
344 type ManagerOrigin = EnsureRoot<AccountId>;
345 type Consideration = HoldConsideration<
346 AccountId,
347 Balances,
348 PreimageHoldReason,
349 LinearStoragePrice<PreimageBaseDeposit, PreimageByteDeposit, Balance>,
350 >;
351}
352
353parameter_types! {
354 pub const EpochDuration: u64 = prod_or_fast!(
355 EPOCH_DURATION_IN_SLOTS as u64,
356 2 * MINUTES as u64
357 );
358 pub const ExpectedBlockTime: Moment = MILLISECS_PER_BLOCK;
359 pub const ReportLongevity: u64 =
360 BondingDuration::get() as u64 * SessionsPerEra::get() as u64 * EpochDuration::get();
361}
362
363impl pallet_babe::Config for Runtime {
364 type EpochDuration = EpochDuration;
365 type ExpectedBlockTime = ExpectedBlockTime;
366
367 type EpochChangeTrigger = pallet_babe::ExternalTrigger;
369
370 type DisabledValidators = Session;
371
372 type WeightInfo = ();
373
374 type MaxAuthorities = MaxAuthorities;
375 type MaxNominators = MaxNominators;
376
377 type KeyOwnerProof = sp_session::MembershipProof;
378
379 type EquivocationReportSystem =
380 pallet_babe::EquivocationReportSystem<Self, Offences, Historical, ReportLongevity>;
381}
382
383parameter_types! {
384 pub const IndexDeposit: Balance = 100 * CENTS;
385}
386
387impl pallet_indices::Config for Runtime {
388 type AccountIndex = AccountIndex;
389 type Currency = Balances;
390 type Deposit = IndexDeposit;
391 type RuntimeEvent = RuntimeEvent;
392 type WeightInfo = weights::pallet_indices::WeightInfo<Runtime>;
393}
394
395parameter_types! {
396 pub const ExistentialDeposit: Balance = EXISTENTIAL_DEPOSIT;
397 pub const MaxLocks: u32 = 50;
398 pub const MaxReserves: u32 = 50;
399}
400
401impl pallet_balances::Config for Runtime {
402 type Balance = Balance;
403 type DustRemoval = ();
404 type RuntimeEvent = RuntimeEvent;
405 type ExistentialDeposit = ExistentialDeposit;
406 type AccountStore = System;
407 type MaxLocks = MaxLocks;
408 type MaxReserves = MaxReserves;
409 type ReserveIdentifier = [u8; 8];
410 type WeightInfo = weights::pallet_balances::WeightInfo<Runtime>;
411 type RuntimeHoldReason = RuntimeHoldReason;
412 type RuntimeFreezeReason = RuntimeFreezeReason;
413 type FreezeIdentifier = RuntimeFreezeReason;
414 type MaxFreezes = VariantCountOf<RuntimeFreezeReason>;
415 type DoneSlashHandler = ();
416}
417
418parameter_types! {
419 pub const BeefySetIdSessionEntries: u32 = BondingDuration::get() * SessionsPerEra::get();
420}
421
422impl pallet_beefy::Config for Runtime {
423 type BeefyId = BeefyId;
424 type MaxAuthorities = MaxAuthorities;
425 type MaxNominators = MaxNominators;
426 type MaxSetIdSessionEntries = BeefySetIdSessionEntries;
427 type OnNewValidatorSet = BeefyMmrLeaf;
428 type AncestryHelper = BeefyMmrLeaf;
429 type WeightInfo = ();
430 type KeyOwnerProof = sp_session::MembershipProof;
431 type EquivocationReportSystem =
432 pallet_beefy::EquivocationReportSystem<Self, Offences, Historical, ReportLongevity>;
433}
434
435impl pallet_mmr::Config for Runtime {
436 const INDEXING_PREFIX: &'static [u8] = mmr::INDEXING_PREFIX;
437 type Hashing = Keccak256;
438 type OnNewRoot = pallet_beefy_mmr::DepositBeefyDigest<Runtime>;
439 type LeafData = pallet_beefy_mmr::Pallet<Runtime>;
440 type BlockHashProvider = pallet_mmr::DefaultBlockHashProvider<Runtime>;
441 type WeightInfo = weights::pallet_mmr::WeightInfo<Runtime>;
442 #[cfg(feature = "runtime-benchmarks")]
443 type BenchmarkHelper = parachains_paras::benchmarking::mmr_setup::MmrSetup<Runtime>;
444}
445
446mod mmr {
448 use super::Runtime;
449 pub use pallet_mmr::primitives::*;
450
451 pub type Leaf = <<Runtime as pallet_mmr::Config>::LeafData as LeafDataProvider>::LeafData;
452 pub type Hashing = <Runtime as pallet_mmr::Config>::Hashing;
453 pub type Hash = <Hashing as sp_runtime::traits::Hash>::Output;
454}
455
456parameter_types! {
457 pub LeafVersion: MmrLeafVersion = MmrLeafVersion::new(0, 0);
458}
459
460pub struct ParaHeadsRootProvider;
463impl BeefyDataProvider<H256> for ParaHeadsRootProvider {
464 fn extra_data() -> H256 {
465 let para_heads: Vec<(u32, Vec<u8>)> =
466 parachains_paras::Pallet::<Runtime>::sorted_para_heads();
467 binary_merkle_tree::merkle_root::<mmr::Hashing, _>(
468 para_heads.into_iter().map(|pair| pair.encode()),
469 )
470 .into()
471 }
472}
473
474impl pallet_beefy_mmr::Config for Runtime {
475 type LeafVersion = LeafVersion;
476 type BeefyAuthorityToMerkleLeaf = pallet_beefy_mmr::BeefyEcdsaToEthereum;
477 type LeafExtra = H256;
478 type BeefyDataProvider = ParaHeadsRootProvider;
479 type WeightInfo = weights::pallet_beefy_mmr::WeightInfo<Runtime>;
480}
481
482parameter_types! {
483 pub const TransactionByteFee: Balance = 10 * MILLICENTS;
484 pub const OperationalFeeMultiplier: u8 = 5;
487}
488
489impl pallet_transaction_payment::Config for Runtime {
490 type RuntimeEvent = RuntimeEvent;
491 type OnChargeTransaction = FungibleAdapter<Balances, ToAuthor<Runtime>>;
492 type OperationalFeeMultiplier = OperationalFeeMultiplier;
493 type WeightToFee = WeightToFee;
494 type LengthToFee = ConstantMultiplier<Balance, TransactionByteFee>;
495 type FeeMultiplierUpdate = SlowAdjustingFeeUpdate<Self>;
496 type WeightInfo = weights::pallet_transaction_payment::WeightInfo<Runtime>;
497}
498
499parameter_types! {
500 pub const MinimumPeriod: u64 = SLOT_DURATION / 2;
501}
502impl pallet_timestamp::Config for Runtime {
503 type Moment = u64;
504 type OnTimestampSet = Babe;
505 type MinimumPeriod = MinimumPeriod;
506 type WeightInfo = weights::pallet_timestamp::WeightInfo<Runtime>;
507}
508
509impl pallet_authorship::Config for Runtime {
510 type FindAuthor = pallet_session::FindAccountFromAuthorIndex<Self, Babe>;
511 type EventHandler = AssetHubStakingClient;
512}
513
514parameter_types! {
515 pub const Period: BlockNumber = 10 * MINUTES;
516 pub const Offset: BlockNumber = 0;
517}
518
519impl_opaque_keys! {
520 pub struct SessionKeys {
521 pub grandpa: Grandpa,
522 pub babe: Babe,
523 pub para_validator: Initializer,
524 pub para_assignment: ParaSessionInfo,
525 pub authority_discovery: AuthorityDiscovery,
526 pub beefy: Beefy,
527 }
528}
529
530impl pallet_session::Config for Runtime {
531 type RuntimeEvent = RuntimeEvent;
532 type ValidatorId = AccountId;
533 type ValidatorIdOf = ConvertInto;
534 type ShouldEndSession = Babe;
535 type NextSessionRotation = Babe;
536 type SessionManager = session_historical::NoteHistoricalRoot<Self, AssetHubStakingClient>;
537 type SessionHandler = <SessionKeys as OpaqueKeys>::KeyTypeIdProviders;
538 type Keys = SessionKeys;
539 type DisablingStrategy = pallet_session::disabling::UpToLimitWithReEnablingDisablingStrategy;
540 type WeightInfo = weights::pallet_session::WeightInfo<Runtime>;
541}
542
543impl pallet_session::historical::Config for Runtime {
544 type RuntimeEvent = RuntimeEvent;
545 type FullIdentification = sp_staking::Exposure<AccountId, Balance>;
546 type FullIdentificationOf = pallet_staking::DefaultExposureOf<Self>;
547}
548
549pub struct MaybeSignedPhase;
550
551impl Get<u32> for MaybeSignedPhase {
552 fn get() -> u32 {
553 if pallet_staking::CurrentEra::<Runtime>::get().unwrap_or(1) % 28 == 0 {
556 0
557 } else {
558 SignedPhase::get()
559 }
560 }
561}
562
563parameter_types! {
564 pub SignedPhase: u32 = prod_or_fast!(
566 EPOCH_DURATION_IN_SLOTS / 4,
567 (1 * MINUTES).min(EpochDuration::get().saturated_into::<u32>() / 2)
568 );
569 pub UnsignedPhase: u32 = prod_or_fast!(
570 EPOCH_DURATION_IN_SLOTS / 4,
571 (1 * MINUTES).min(EpochDuration::get().saturated_into::<u32>() / 2)
572 );
573
574 pub const SignedMaxSubmissions: u32 = 128;
576 pub const SignedMaxRefunds: u32 = 128 / 4;
577 pub const SignedFixedDeposit: Balance = deposit(2, 0);
578 pub const SignedDepositIncreaseFactor: Percent = Percent::from_percent(10);
579 pub const SignedDepositByte: Balance = deposit(0, 10) / 1024;
580 pub SignedRewardBase: Balance = 1 * UNITS;
582
583 pub OffchainRepeat: BlockNumber = UnsignedPhase::get() / 4;
585
586 pub const MaxElectingVoters: u32 = 22_500;
587 pub ElectionBounds: frame_election_provider_support::bounds::ElectionBounds =
591 ElectionBoundsBuilder::default().voters_count(MaxElectingVoters::get().into()).build();
592 pub const MaxActiveValidators: u32 = 1000;
594 pub const MaxWinnersPerPage: u32 = MaxActiveValidators::get();
596 pub const MaxBackersPerWinner: u32 = MaxElectingVoters::get();
598}
599
600frame_election_provider_support::generate_solution_type!(
601 #[compact]
602 pub struct NposCompactSolution16::<
603 VoterIndex = u32,
604 TargetIndex = u16,
605 Accuracy = sp_runtime::PerU16,
606 MaxVoters = MaxElectingVoters,
607 >(16)
608);
609
610pub struct OnChainSeqPhragmen;
611impl onchain::Config for OnChainSeqPhragmen {
612 type Sort = ConstBool<true>;
613 type System = Runtime;
614 type Solver = SequentialPhragmen<AccountId, OnChainAccuracy>;
615 type DataProvider = Staking;
616 type WeightInfo = weights::frame_election_provider_support::WeightInfo<Runtime>;
617 type Bounds = ElectionBounds;
618 type MaxBackersPerWinner = MaxBackersPerWinner;
619 type MaxWinnersPerPage = MaxWinnersPerPage;
620}
621
622impl pallet_election_provider_multi_phase::MinerConfig for Runtime {
623 type AccountId = AccountId;
624 type MaxLength = OffchainSolutionLengthLimit;
625 type MaxWeight = OffchainSolutionWeightLimit;
626 type Solution = NposCompactSolution16;
627 type MaxVotesPerVoter = <
628 <Self as pallet_election_provider_multi_phase::Config>::DataProvider
629 as
630 frame_election_provider_support::ElectionDataProvider
631 >::MaxVotesPerVoter;
632 type MaxBackersPerWinner = MaxBackersPerWinner;
633 type MaxWinners = MaxWinnersPerPage;
634
635 fn solution_weight(v: u32, t: u32, a: u32, d: u32) -> Weight {
638 <
639 <Self as pallet_election_provider_multi_phase::Config>::WeightInfo
640 as
641 pallet_election_provider_multi_phase::WeightInfo
642 >::submit_unsigned(v, t, a, d)
643 }
644}
645
646impl pallet_election_provider_multi_phase::Config for Runtime {
647 type RuntimeEvent = RuntimeEvent;
648 type Currency = Balances;
649 type EstimateCallFee = TransactionPayment;
650 type SignedPhase = MaybeSignedPhase;
651 type UnsignedPhase = UnsignedPhase;
652 type SignedMaxSubmissions = SignedMaxSubmissions;
653 type SignedMaxRefunds = SignedMaxRefunds;
654 type SignedRewardBase = SignedRewardBase;
655 type SignedDepositBase =
656 GeometricDepositBase<Balance, SignedFixedDeposit, SignedDepositIncreaseFactor>;
657 type SignedDepositByte = SignedDepositByte;
658 type SignedDepositWeight = ();
659 type SignedMaxWeight =
660 <Self::MinerConfig as pallet_election_provider_multi_phase::MinerConfig>::MaxWeight;
661 type MinerConfig = Self;
662 type SlashHandler = (); type RewardHandler = (); type BetterSignedThreshold = ();
665 type OffchainRepeat = OffchainRepeat;
666 type MinerTxPriority = NposSolutionPriority;
667 type MaxWinners = MaxWinnersPerPage;
668 type MaxBackersPerWinner = MaxBackersPerWinner;
669 type DataProvider = Staking;
670 #[cfg(any(feature = "fast-runtime", feature = "runtime-benchmarks"))]
671 type Fallback = onchain::OnChainExecution<OnChainSeqPhragmen>;
672 #[cfg(not(any(feature = "fast-runtime", feature = "runtime-benchmarks")))]
673 type Fallback = frame_election_provider_support::NoElection<(
674 AccountId,
675 BlockNumber,
676 Staking,
677 MaxWinnersPerPage,
678 MaxBackersPerWinner,
679 )>;
680 type GovernanceFallback = onchain::OnChainExecution<OnChainSeqPhragmen>;
681 type Solver = SequentialPhragmen<
682 AccountId,
683 pallet_election_provider_multi_phase::SolutionAccuracyOf<Self>,
684 (),
685 >;
686 type BenchmarkingConfig = polkadot_runtime_common::elections::BenchmarkConfig;
687 type ForceOrigin = EnsureRoot<AccountId>;
688 type WeightInfo = weights::pallet_election_provider_multi_phase::WeightInfo<Self>;
689 type ElectionBounds = ElectionBounds;
690}
691
692parameter_types! {
693 pub const BagThresholds: &'static [u64] = &bag_thresholds::THRESHOLDS;
694}
695
696type VoterBagsListInstance = pallet_bags_list::Instance1;
697impl pallet_bags_list::Config<VoterBagsListInstance> for Runtime {
698 type RuntimeEvent = RuntimeEvent;
699 type ScoreProvider = Staking;
700 type WeightInfo = weights::pallet_bags_list::WeightInfo<Runtime>;
701 type BagThresholds = BagThresholds;
702 type Score = sp_npos_elections::VoteWeight;
703}
704
705pub struct EraPayout;
706impl pallet_staking::EraPayout<Balance> for EraPayout {
707 fn era_payout(
708 _total_staked: Balance,
709 _total_issuance: Balance,
710 era_duration_millis: u64,
711 ) -> (Balance, Balance) {
712 const MILLISECONDS_PER_YEAR: u64 = (1000 * 3600 * 24 * 36525) / 100;
713 let relative_era_len =
715 FixedU128::from_rational(era_duration_millis.into(), MILLISECONDS_PER_YEAR.into());
716
717 let fixed_total_issuance: i128 = 5_216_342_402_773_185_773;
719 let fixed_inflation_rate = FixedU128::from_rational(8, 100);
720 let yearly_emission = fixed_inflation_rate.saturating_mul_int(fixed_total_issuance);
721
722 let era_emission = relative_era_len.saturating_mul_int(yearly_emission);
723 let to_treasury = FixedU128::from_rational(15, 100).saturating_mul_int(era_emission);
725 let to_stakers = era_emission.saturating_sub(to_treasury);
726
727 (to_stakers.saturated_into(), to_treasury.saturated_into())
728 }
729}
730
731parameter_types! {
732 pub const SessionsPerEra: SessionIndex = prod_or_fast!(6, 1);
734 pub const BondingDuration: EraIndex = 2;
736 pub const SlashDeferDuration: EraIndex = 1;
738 pub const MaxExposurePageSize: u32 = 64;
739 pub const MaxNominators: u32 = 64;
743 pub const MaxNominations: u32 = <NposCompactSolution16 as frame_election_provider_support::NposSolution>::LIMIT as u32;
744 pub const MaxControllersInDeprecationBatch: u32 = 751;
745}
746
747impl pallet_staking::Config for Runtime {
748 type OldCurrency = Balances;
749 type Currency = Balances;
750 type CurrencyBalance = Balance;
751 type RuntimeHoldReason = RuntimeHoldReason;
752 type UnixTime = Timestamp;
753 type CurrencyToVote = sp_staking::currency_to_vote::SaturatingCurrencyToVote;
755 type RewardRemainder = ();
756 type RuntimeEvent = RuntimeEvent;
757 type Slash = ();
758 type Reward = ();
759 type SessionsPerEra = SessionsPerEra;
760 type BondingDuration = BondingDuration;
761 type SlashDeferDuration = SlashDeferDuration;
762 type AdminOrigin = EitherOf<EnsureRoot<AccountId>, StakingAdmin>;
763 type SessionInterface = Self;
764 type EraPayout = EraPayout;
765 type MaxExposurePageSize = MaxExposurePageSize;
766 type NextNewSession = Session;
767 type ElectionProvider = ElectionProviderMultiPhase;
768 type GenesisElectionProvider = onchain::OnChainExecution<OnChainSeqPhragmen>;
769 type VoterList = VoterList;
770 type TargetList = UseValidatorsMap<Self>;
771 type MaxValidatorSet = MaxActiveValidators;
772 type NominationsQuota = pallet_staking::FixedNominationsQuota<{ MaxNominations::get() }>;
773 type MaxUnlockingChunks = frame_support::traits::ConstU32<32>;
774 type HistoryDepth = frame_support::traits::ConstU32<84>;
775 type MaxControllersInDeprecationBatch = MaxControllersInDeprecationBatch;
776 type BenchmarkingConfig = polkadot_runtime_common::StakingBenchmarkingConfig;
777 type EventListeners = (NominationPools, DelegatedStaking);
778 type WeightInfo = weights::pallet_staking::WeightInfo<Runtime>;
779 type Filter = Nothing;
781}
782
783#[derive(Encode, Decode)]
784enum AssetHubRuntimePallets<AccountId> {
785 #[codec(index = 89)]
787 RcClient(RcClientCalls<AccountId>),
788}
789
790#[derive(Encode, Decode)]
791enum RcClientCalls<AccountId> {
792 #[codec(index = 0)]
794 RelaySessionReport(rc_client::SessionReport<AccountId>),
795 #[codec(index = 1)]
797 RelayNewOffence(SessionIndex, Vec<rc_client::Offence<AccountId>>),
798}
799
800pub struct AssetHubLocation;
801impl Get<Location> for AssetHubLocation {
802 fn get() -> Location {
803 Location::new(0, [Junction::Parachain(ASSET_HUB_ID)])
804 }
805}
806
807pub struct XcmToAssetHub<T: SendXcm>(PhantomData<T>);
808impl<T: SendXcm> ah_client::SendToAssetHub for XcmToAssetHub<T> {
809 type AccountId = AccountId;
810
811 fn relay_session_report(session_report: rc_client::SessionReport<Self::AccountId>) {
812 let message = Xcm(vec![
813 Instruction::UnpaidExecution {
814 weight_limit: WeightLimit::Unlimited,
815 check_origin: None,
816 },
817 Self::mk_asset_hub_call(RcClientCalls::RelaySessionReport(session_report)),
818 ]);
819 if let Err(err) = send_xcm::<T>(AssetHubLocation::get(), message) {
820 log::error!(target: "runtime", "Failed to send relay session report message: {:?}", err);
821 }
822 }
823
824 fn relay_new_offence(
825 session_index: SessionIndex,
826 offences: Vec<rc_client::Offence<Self::AccountId>>,
827 ) {
828 let message = Xcm(vec![
829 Instruction::UnpaidExecution {
830 weight_limit: WeightLimit::Unlimited,
831 check_origin: None,
832 },
833 Self::mk_asset_hub_call(RcClientCalls::RelayNewOffence(session_index, offences)),
834 ]);
835 if let Err(err) = send_xcm::<T>(AssetHubLocation::get(), message) {
836 log::error!(target: "runtime", "Failed to send relay offence message: {:?}", err);
837 }
838 }
839}
840
841impl<T: SendXcm> XcmToAssetHub<T> {
842 fn mk_asset_hub_call(
843 call: RcClientCalls<<Self as ah_client::SendToAssetHub>::AccountId>,
844 ) -> Instruction<()> {
845 Instruction::Transact {
846 origin_kind: OriginKind::Superuser,
847 fallback_max_weight: None,
848 call: AssetHubRuntimePallets::RcClient(call).encode().into(),
849 }
850 }
851}
852
853pub struct EnsureAssetHub;
854impl frame_support::traits::EnsureOrigin<RuntimeOrigin> for EnsureAssetHub {
855 type Success = ();
856 fn try_origin(o: RuntimeOrigin) -> Result<Self::Success, RuntimeOrigin> {
857 match <RuntimeOrigin as Into<Result<parachains_origin::Origin, RuntimeOrigin>>>::into(
858 o.clone(),
859 ) {
860 Ok(parachains_origin::Origin::Parachain(id)) if id == ASSET_HUB_ID.into() => Ok(()),
861 _ => Err(o),
862 }
863 }
864
865 #[cfg(feature = "runtime-benchmarks")]
866 fn try_successful_origin() -> Result<RuntimeOrigin, ()> {
867 Ok(RuntimeOrigin::root())
868 }
869}
870
871impl ah_client::Config for Runtime {
875 type CurrencyBalance = Balance;
876 type AssetHubOrigin =
877 frame_support::traits::EitherOfDiverse<EnsureRoot<AccountId>, EnsureAssetHub>;
878 type AdminOrigin = EnsureRoot<AccountId>;
879 type SessionInterface = Self;
880 type SendToAssetHub = XcmToAssetHub<crate::xcm_config::XcmRouter>;
881 type MinimumValidatorSetSize = ConstU32<4>;
882 type UnixTime = Timestamp;
883 type PointsPerBlock = ConstU32<20>;
884 type Fallback = Staking;
885}
886
887impl pallet_fast_unstake::Config for Runtime {
888 type RuntimeEvent = RuntimeEvent;
889 type Currency = Balances;
890 type BatchSize = frame_support::traits::ConstU32<64>;
891 type Deposit = frame_support::traits::ConstU128<{ UNITS }>;
892 type ControlOrigin = EnsureRoot<AccountId>;
893 type Staking = Staking;
894 type MaxErasToCheckPerBlock = ConstU32<1>;
895 type WeightInfo = weights::pallet_fast_unstake::WeightInfo<Runtime>;
896}
897
898parameter_types! {
899 pub const SpendPeriod: BlockNumber = 6 * DAYS;
900 pub const Burn: Permill = Permill::from_perthousand(2);
901 pub const TreasuryPalletId: PalletId = PalletId(*b"py/trsry");
902 pub const PayoutSpendPeriod: BlockNumber = 30 * DAYS;
903 pub TreasuryInteriorLocation: InteriorLocation = PalletInstance(37).into();
906
907 pub const TipCountdown: BlockNumber = 1 * DAYS;
908 pub const TipFindersFee: Percent = Percent::from_percent(20);
909 pub const TipReportDepositBase: Balance = 100 * CENTS;
910 pub const DataDepositPerByte: Balance = 1 * CENTS;
911 pub const MaxApprovals: u32 = 100;
912 pub const MaxAuthorities: u32 = 100_000;
913 pub const MaxKeys: u32 = 10_000;
914 pub const MaxPeerInHeartbeats: u32 = 10_000;
915 pub const MaxBalance: Balance = Balance::max_value();
916}
917
918impl pallet_treasury::Config for Runtime {
919 type PalletId = TreasuryPalletId;
920 type Currency = Balances;
921 type RejectOrigin = EitherOfDiverse<EnsureRoot<AccountId>, Treasurer>;
922 type RuntimeEvent = RuntimeEvent;
923 type SpendPeriod = SpendPeriod;
924 type Burn = Burn;
925 type BurnDestination = ();
926 type MaxApprovals = MaxApprovals;
927 type WeightInfo = weights::pallet_treasury::WeightInfo<Runtime>;
928 type SpendFunds = ();
929 type SpendOrigin = TreasurySpender;
930 type AssetKind = VersionedLocatableAsset;
931 type Beneficiary = VersionedLocation;
932 type BeneficiaryLookup = IdentityLookup<Self::Beneficiary>;
933 type Paymaster = PayOverXcm<
934 TreasuryInteriorLocation,
935 crate::xcm_config::XcmRouter,
936 crate::XcmPallet,
937 ConstU32<{ 6 * HOURS }>,
938 Self::Beneficiary,
939 Self::AssetKind,
940 LocatableAssetConverter,
941 VersionedLocationConverter,
942 >;
943 type BalanceConverter = UnityOrOuterConversion<
944 ContainsParts<
945 FromContains<
946 xcm_builder::IsChildSystemParachain<ParaId>,
947 xcm_builder::IsParentsOnly<ConstU8<1>>,
948 >,
949 >,
950 AssetRate,
951 >;
952 type PayoutPeriod = PayoutSpendPeriod;
953 type BlockNumberProvider = System;
954 #[cfg(feature = "runtime-benchmarks")]
955 type BenchmarkHelper = polkadot_runtime_common::impls::benchmarks::TreasuryArguments;
956}
957
958impl pallet_offences::Config for Runtime {
959 type RuntimeEvent = RuntimeEvent;
960 type IdentificationTuple = session_historical::IdentificationTuple<Self>;
961 type OnOffenceHandler = AssetHubStakingClient;
962}
963
964impl pallet_authority_discovery::Config for Runtime {
965 type MaxAuthorities = MaxAuthorities;
966}
967
968parameter_types! {
969 pub const NposSolutionPriority: TransactionPriority = TransactionPriority::max_value() / 2;
970}
971
972parameter_types! {
973 pub const MaxSetIdSessionEntries: u32 = BondingDuration::get() * SessionsPerEra::get();
974}
975
976impl pallet_grandpa::Config for Runtime {
977 type RuntimeEvent = RuntimeEvent;
978
979 type WeightInfo = ();
980 type MaxAuthorities = MaxAuthorities;
981 type MaxNominators = MaxNominators;
982 type MaxSetIdSessionEntries = MaxSetIdSessionEntries;
983
984 type KeyOwnerProof = sp_session::MembershipProof;
985
986 type EquivocationReportSystem =
987 pallet_grandpa::EquivocationReportSystem<Self, Offences, Historical, ReportLongevity>;
988}
989
990impl frame_system::offchain::SigningTypes for Runtime {
991 type Public = <Signature as Verify>::Signer;
992 type Signature = Signature;
993}
994
995impl<C> frame_system::offchain::CreateTransactionBase<C> for Runtime
996where
997 RuntimeCall: From<C>,
998{
999 type RuntimeCall = RuntimeCall;
1000 type Extrinsic = UncheckedExtrinsic;
1001}
1002
1003impl<LocalCall> frame_system::offchain::CreateTransaction<LocalCall> for Runtime
1004where
1005 RuntimeCall: From<LocalCall>,
1006{
1007 type Extension = TxExtension;
1008
1009 fn create_transaction(call: RuntimeCall, extension: TxExtension) -> UncheckedExtrinsic {
1010 UncheckedExtrinsic::new_transaction(call, extension)
1011 }
1012}
1013
1014impl<LocalCall> frame_system::offchain::CreateSignedTransaction<LocalCall> for Runtime
1017where
1018 RuntimeCall: From<LocalCall>,
1019{
1020 fn create_signed_transaction<
1021 C: frame_system::offchain::AppCrypto<Self::Public, Self::Signature>,
1022 >(
1023 call: RuntimeCall,
1024 public: <Signature as Verify>::Signer,
1025 account: AccountId,
1026 nonce: <Runtime as frame_system::Config>::Nonce,
1027 ) -> Option<UncheckedExtrinsic> {
1028 use sp_runtime::traits::StaticLookup;
1029 let period =
1031 BlockHashCount::get().checked_next_power_of_two().map(|c| c / 2).unwrap_or(2) as u64;
1032
1033 let current_block = System::block_number()
1034 .saturated_into::<u64>()
1035 .saturating_sub(1);
1038 let tip = 0;
1039 let tx_ext: TxExtension = (
1040 frame_system::AuthorizeCall::<Runtime>::new(),
1041 frame_system::CheckNonZeroSender::<Runtime>::new(),
1042 frame_system::CheckSpecVersion::<Runtime>::new(),
1043 frame_system::CheckTxVersion::<Runtime>::new(),
1044 frame_system::CheckGenesis::<Runtime>::new(),
1045 frame_system::CheckMortality::<Runtime>::from(generic::Era::mortal(
1046 period,
1047 current_block,
1048 )),
1049 frame_system::CheckNonce::<Runtime>::from(nonce),
1050 frame_system::CheckWeight::<Runtime>::new(),
1051 pallet_transaction_payment::ChargeTransactionPayment::<Runtime>::from(tip),
1052 frame_metadata_hash_extension::CheckMetadataHash::<Runtime>::new(true),
1053 frame_system::WeightReclaim::<Runtime>::new(),
1054 )
1055 .into();
1056 let raw_payload = SignedPayload::new(call, tx_ext)
1057 .map_err(|e| {
1058 log::warn!("Unable to create signed payload: {:?}", e);
1059 })
1060 .ok()?;
1061 let signature = raw_payload.using_encoded(|payload| C::sign(payload, public))?;
1062 let (call, tx_ext, _) = raw_payload.deconstruct();
1063 let address = <Runtime as frame_system::Config>::Lookup::unlookup(account);
1064 let transaction = UncheckedExtrinsic::new_signed(call, address, signature, tx_ext);
1065 Some(transaction)
1066 }
1067}
1068
1069impl<LocalCall> frame_system::offchain::CreateBare<LocalCall> for Runtime
1070where
1071 RuntimeCall: From<LocalCall>,
1072{
1073 fn create_bare(call: RuntimeCall) -> UncheckedExtrinsic {
1074 UncheckedExtrinsic::new_bare(call)
1075 }
1076}
1077
1078impl<LocalCall> frame_system::offchain::CreateAuthorizedTransaction<LocalCall> for Runtime
1079where
1080 RuntimeCall: From<LocalCall>,
1081{
1082 fn create_extension() -> Self::Extension {
1083 (
1084 frame_system::AuthorizeCall::<Runtime>::new(),
1085 frame_system::CheckNonZeroSender::<Runtime>::new(),
1086 frame_system::CheckSpecVersion::<Runtime>::new(),
1087 frame_system::CheckTxVersion::<Runtime>::new(),
1088 frame_system::CheckGenesis::<Runtime>::new(),
1089 frame_system::CheckMortality::<Runtime>::from(generic::Era::Immortal),
1090 frame_system::CheckNonce::<Runtime>::from(0),
1091 frame_system::CheckWeight::<Runtime>::new(),
1092 pallet_transaction_payment::ChargeTransactionPayment::<Runtime>::from(0),
1093 frame_metadata_hash_extension::CheckMetadataHash::<Runtime>::new(false),
1094 frame_system::WeightReclaim::<Runtime>::new(),
1095 )
1096 }
1097}
1098
1099parameter_types! {
1100 pub const BasicDeposit: Balance = 1000 * CENTS; pub const ByteDeposit: Balance = deposit(0, 1);
1103 pub const UsernameDeposit: Balance = deposit(0, 32);
1104 pub const SubAccountDeposit: Balance = 200 * CENTS; pub const MaxSubAccounts: u32 = 100;
1106 pub const MaxAdditionalFields: u32 = 100;
1107 pub const MaxRegistrars: u32 = 20;
1108}
1109
1110impl pallet_identity::Config for Runtime {
1111 type RuntimeEvent = RuntimeEvent;
1112 type Currency = Balances;
1113 type Slashed = ();
1114 type BasicDeposit = BasicDeposit;
1115 type ByteDeposit = ByteDeposit;
1116 type UsernameDeposit = UsernameDeposit;
1117 type SubAccountDeposit = SubAccountDeposit;
1118 type MaxSubAccounts = MaxSubAccounts;
1119 type IdentityInformation = IdentityInfo<MaxAdditionalFields>;
1120 type MaxRegistrars = MaxRegistrars;
1121 type ForceOrigin = EitherOf<EnsureRoot<Self::AccountId>, GeneralAdmin>;
1122 type RegistrarOrigin = EitherOf<EnsureRoot<Self::AccountId>, GeneralAdmin>;
1123 type OffchainSignature = Signature;
1124 type SigningPublicKey = <Signature as Verify>::Signer;
1125 type UsernameAuthorityOrigin = EnsureRoot<Self::AccountId>;
1126 type PendingUsernameExpiration = ConstU32<{ 7 * DAYS }>;
1127 type UsernameGracePeriod = ConstU32<{ 30 * DAYS }>;
1128 type MaxSuffixLength = ConstU32<7>;
1129 type MaxUsernameLength = ConstU32<32>;
1130 #[cfg(feature = "runtime-benchmarks")]
1131 type BenchmarkHelper = ();
1132 type WeightInfo = weights::pallet_identity::WeightInfo<Runtime>;
1133}
1134
1135impl pallet_utility::Config for Runtime {
1136 type RuntimeEvent = RuntimeEvent;
1137 type RuntimeCall = RuntimeCall;
1138 type PalletsOrigin = OriginCaller;
1139 type WeightInfo = weights::pallet_utility::WeightInfo<Runtime>;
1140}
1141
1142parameter_types! {
1143 pub const DepositBase: Balance = deposit(1, 88);
1145 pub const DepositFactor: Balance = deposit(0, 32);
1147 pub const MaxSignatories: u32 = 100;
1148}
1149
1150impl pallet_multisig::Config for Runtime {
1151 type RuntimeEvent = RuntimeEvent;
1152 type RuntimeCall = RuntimeCall;
1153 type Currency = Balances;
1154 type DepositBase = DepositBase;
1155 type DepositFactor = DepositFactor;
1156 type MaxSignatories = MaxSignatories;
1157 type WeightInfo = weights::pallet_multisig::WeightInfo<Runtime>;
1158 type BlockNumberProvider = frame_system::Pallet<Runtime>;
1159}
1160
1161parameter_types! {
1162 pub const ConfigDepositBase: Balance = 500 * CENTS;
1163 pub const FriendDepositFactor: Balance = 50 * CENTS;
1164 pub const MaxFriends: u16 = 9;
1165 pub const RecoveryDeposit: Balance = 500 * CENTS;
1166}
1167
1168impl pallet_recovery::Config for Runtime {
1169 type RuntimeEvent = RuntimeEvent;
1170 type WeightInfo = ();
1171 type RuntimeCall = RuntimeCall;
1172 type BlockNumberProvider = System;
1173 type Currency = Balances;
1174 type ConfigDepositBase = ConfigDepositBase;
1175 type FriendDepositFactor = FriendDepositFactor;
1176 type MaxFriends = MaxFriends;
1177 type RecoveryDeposit = RecoveryDeposit;
1178}
1179
1180parameter_types! {
1181 pub const MinVestedTransfer: Balance = 100 * CENTS;
1182 pub UnvestedFundsAllowedWithdrawReasons: WithdrawReasons =
1183 WithdrawReasons::except(WithdrawReasons::TRANSFER | WithdrawReasons::RESERVE);
1184}
1185
1186impl pallet_vesting::Config for Runtime {
1187 type RuntimeEvent = RuntimeEvent;
1188 type Currency = Balances;
1189 type BlockNumberToBalance = ConvertInto;
1190 type MinVestedTransfer = MinVestedTransfer;
1191 type WeightInfo = weights::pallet_vesting::WeightInfo<Runtime>;
1192 type UnvestedFundsAllowedWithdrawReasons = UnvestedFundsAllowedWithdrawReasons;
1193 type BlockNumberProvider = System;
1194 const MAX_VESTING_SCHEDULES: u32 = 28;
1195}
1196
1197impl pallet_sudo::Config for Runtime {
1198 type RuntimeEvent = RuntimeEvent;
1199 type RuntimeCall = RuntimeCall;
1200 type WeightInfo = weights::pallet_sudo::WeightInfo<Runtime>;
1201}
1202
1203parameter_types! {
1204 pub const ProxyDepositBase: Balance = deposit(1, 8);
1206 pub const ProxyDepositFactor: Balance = deposit(0, 33);
1208 pub const MaxProxies: u16 = 32;
1209 pub const AnnouncementDepositBase: Balance = deposit(1, 8);
1210 pub const AnnouncementDepositFactor: Balance = deposit(0, 66);
1211 pub const MaxPending: u16 = 32;
1212}
1213
1214#[derive(
1216 Copy,
1217 Clone,
1218 Eq,
1219 PartialEq,
1220 Ord,
1221 PartialOrd,
1222 Encode,
1223 Decode,
1224 DecodeWithMemTracking,
1225 RuntimeDebug,
1226 MaxEncodedLen,
1227 TypeInfo,
1228)]
1229pub enum ProxyType {
1230 Any,
1231 NonTransfer,
1232 Governance,
1233 Staking,
1234 SudoBalances,
1235 IdentityJudgement,
1236 CancelProxy,
1237 Auction,
1238 NominationPools,
1239 ParaRegistration,
1240}
1241impl Default for ProxyType {
1242 fn default() -> Self {
1243 Self::Any
1244 }
1245}
1246impl InstanceFilter<RuntimeCall> for ProxyType {
1247 fn filter(&self, c: &RuntimeCall) -> bool {
1248 match self {
1249 ProxyType::Any => true,
1250 ProxyType::NonTransfer => matches!(
1251 c,
1252 RuntimeCall::System(..) |
1253 RuntimeCall::Babe(..) |
1254 RuntimeCall::Timestamp(..) |
1255 RuntimeCall::Indices(pallet_indices::Call::claim{..}) |
1256 RuntimeCall::Indices(pallet_indices::Call::free{..}) |
1257 RuntimeCall::Indices(pallet_indices::Call::freeze{..}) |
1258 RuntimeCall::Staking(..) |
1261 RuntimeCall::Session(..) |
1262 RuntimeCall::Grandpa(..) |
1263 RuntimeCall::Utility(..) |
1264 RuntimeCall::Identity(..) |
1265 RuntimeCall::ConvictionVoting(..) |
1266 RuntimeCall::Referenda(..) |
1267 RuntimeCall::Whitelist(..) |
1268 RuntimeCall::Recovery(pallet_recovery::Call::as_recovered{..}) |
1269 RuntimeCall::Recovery(pallet_recovery::Call::vouch_recovery{..}) |
1270 RuntimeCall::Recovery(pallet_recovery::Call::claim_recovery{..}) |
1271 RuntimeCall::Recovery(pallet_recovery::Call::close_recovery{..}) |
1272 RuntimeCall::Recovery(pallet_recovery::Call::remove_recovery{..}) |
1273 RuntimeCall::Recovery(pallet_recovery::Call::cancel_recovered{..}) |
1274 RuntimeCall::Vesting(pallet_vesting::Call::vest{..}) |
1276 RuntimeCall::Vesting(pallet_vesting::Call::vest_other{..}) |
1277 RuntimeCall::Scheduler(..) |
1279 RuntimeCall::Proxy(..) |
1281 RuntimeCall::Multisig(..) |
1282 RuntimeCall::Registrar(paras_registrar::Call::register{..}) |
1283 RuntimeCall::Registrar(paras_registrar::Call::deregister{..}) |
1284 RuntimeCall::Registrar(paras_registrar::Call::reserve{..}) |
1286 RuntimeCall::Crowdloan(..) |
1287 RuntimeCall::Slots(..) |
1288 RuntimeCall::Auctions(..) | RuntimeCall::VoterList(..) |
1290 RuntimeCall::NominationPools(..) |
1291 RuntimeCall::FastUnstake(..)
1292 ),
1293 ProxyType::Staking => {
1294 matches!(
1295 c,
1296 RuntimeCall::Staking(..) |
1297 RuntimeCall::Session(..) |
1298 RuntimeCall::Utility(..) |
1299 RuntimeCall::FastUnstake(..) |
1300 RuntimeCall::VoterList(..) |
1301 RuntimeCall::NominationPools(..)
1302 )
1303 },
1304 ProxyType::NominationPools => {
1305 matches!(c, RuntimeCall::NominationPools(..) | RuntimeCall::Utility(..))
1306 },
1307 ProxyType::SudoBalances => match c {
1308 RuntimeCall::Sudo(pallet_sudo::Call::sudo { call: ref x }) => {
1309 matches!(x.as_ref(), &RuntimeCall::Balances(..))
1310 },
1311 RuntimeCall::Utility(..) => true,
1312 _ => false,
1313 },
1314 ProxyType::Governance => matches!(
1315 c,
1316 RuntimeCall::ConvictionVoting(..) |
1318 RuntimeCall::Referenda(..) |
1319 RuntimeCall::Whitelist(..)
1320 ),
1321 ProxyType::IdentityJudgement => matches!(
1322 c,
1323 RuntimeCall::Identity(pallet_identity::Call::provide_judgement { .. }) |
1324 RuntimeCall::Utility(..)
1325 ),
1326 ProxyType::CancelProxy => {
1327 matches!(c, RuntimeCall::Proxy(pallet_proxy::Call::reject_announcement { .. }))
1328 },
1329 ProxyType::Auction => matches!(
1330 c,
1331 RuntimeCall::Auctions(..) |
1332 RuntimeCall::Crowdloan(..) |
1333 RuntimeCall::Registrar(..) |
1334 RuntimeCall::Slots(..)
1335 ),
1336 ProxyType::ParaRegistration => matches!(
1337 c,
1338 RuntimeCall::Registrar(paras_registrar::Call::reserve { .. }) |
1339 RuntimeCall::Registrar(paras_registrar::Call::register { .. }) |
1340 RuntimeCall::Utility(pallet_utility::Call::batch { .. }) |
1341 RuntimeCall::Utility(pallet_utility::Call::batch_all { .. }) |
1342 RuntimeCall::Utility(pallet_utility::Call::force_batch { .. }) |
1343 RuntimeCall::Proxy(pallet_proxy::Call::remove_proxy { .. })
1344 ),
1345 }
1346 }
1347 fn is_superset(&self, o: &Self) -> bool {
1348 match (self, o) {
1349 (x, y) if x == y => true,
1350 (ProxyType::Any, _) => true,
1351 (_, ProxyType::Any) => false,
1352 (ProxyType::NonTransfer, _) => true,
1353 _ => false,
1354 }
1355 }
1356}
1357
1358impl pallet_proxy::Config for Runtime {
1359 type RuntimeEvent = RuntimeEvent;
1360 type RuntimeCall = RuntimeCall;
1361 type Currency = Balances;
1362 type ProxyType = ProxyType;
1363 type ProxyDepositBase = ProxyDepositBase;
1364 type ProxyDepositFactor = ProxyDepositFactor;
1365 type MaxProxies = MaxProxies;
1366 type WeightInfo = weights::pallet_proxy::WeightInfo<Runtime>;
1367 type MaxPending = MaxPending;
1368 type CallHasher = BlakeTwo256;
1369 type AnnouncementDepositBase = AnnouncementDepositBase;
1370 type AnnouncementDepositFactor = AnnouncementDepositFactor;
1371 type BlockNumberProvider = frame_system::Pallet<Runtime>;
1372}
1373
1374impl parachains_origin::Config for Runtime {}
1375
1376impl parachains_configuration::Config for Runtime {
1377 type WeightInfo = weights::polkadot_runtime_parachains_configuration::WeightInfo<Runtime>;
1378}
1379
1380impl parachains_shared::Config for Runtime {
1381 type DisabledValidators = Session;
1382}
1383
1384impl parachains_session_info::Config for Runtime {
1385 type ValidatorSet = Historical;
1386}
1387
1388impl parachains_inclusion::Config for Runtime {
1389 type RuntimeEvent = RuntimeEvent;
1390 type DisputesHandler = ParasDisputes;
1391 type RewardValidators =
1392 parachains_reward_points::RewardValidatorsWithEraPoints<Runtime, AssetHubStakingClient>;
1393 type MessageQueue = MessageQueue;
1394 type WeightInfo = weights::polkadot_runtime_parachains_inclusion::WeightInfo<Runtime>;
1395}
1396
1397parameter_types! {
1398 pub const ParasUnsignedPriority: TransactionPriority = TransactionPriority::max_value();
1399}
1400
1401impl parachains_paras::Config for Runtime {
1402 type RuntimeEvent = RuntimeEvent;
1403 type WeightInfo = weights::polkadot_runtime_parachains_paras::WeightInfo<Runtime>;
1404 type UnsignedPriority = ParasUnsignedPriority;
1405 type QueueFootprinter = ParaInclusion;
1406 type NextSessionRotation = Babe;
1407 type OnNewHead = ();
1408 type AssignCoretime = CoretimeAssignmentProvider;
1409 type Fungible = Balances;
1410 type CooldownRemovalMultiplier = ConstUint<{ 1000 * UNITS / DAYS as u128 }>;
1412 type AuthorizeCurrentCodeOrigin = EitherOfDiverse<
1413 EnsureRoot<AccountId>,
1414 AsEnsureOriginWithArg<
1416 EnsureXcm<IsVoiceOfBody<xcm_config::Collectives, xcm_config::DDayBodyId>>,
1417 >,
1418 >;
1419}
1420
1421parameter_types! {
1422 pub MessageQueueServiceWeight: Weight = Perbill::from_percent(20) * BlockWeights::get().max_block;
1428 pub const MessageQueueHeapSize: u32 = 128 * 1024;
1429 pub const MessageQueueMaxStale: u32 = 48;
1430}
1431
1432pub struct MessageProcessor;
1434impl ProcessMessage for MessageProcessor {
1435 type Origin = AggregateMessageOrigin;
1436
1437 fn process_message(
1438 message: &[u8],
1439 origin: Self::Origin,
1440 meter: &mut WeightMeter,
1441 id: &mut [u8; 32],
1442 ) -> Result<bool, ProcessMessageError> {
1443 let para = match origin {
1444 AggregateMessageOrigin::Ump(UmpQueueId::Para(para)) => para,
1445 };
1446 xcm_builder::ProcessXcmMessage::<
1447 Junction,
1448 xcm_executor::XcmExecutor<xcm_config::XcmConfig>,
1449 RuntimeCall,
1450 >::process_message(message, Junction::Parachain(para.into()), meter, id)
1451 }
1452}
1453
1454impl pallet_message_queue::Config for Runtime {
1455 type RuntimeEvent = RuntimeEvent;
1456 type Size = u32;
1457 type HeapSize = MessageQueueHeapSize;
1458 type MaxStale = MessageQueueMaxStale;
1459 type ServiceWeight = MessageQueueServiceWeight;
1460 type IdleMaxServiceWeight = MessageQueueServiceWeight;
1461 #[cfg(not(feature = "runtime-benchmarks"))]
1462 type MessageProcessor = MessageProcessor;
1463 #[cfg(feature = "runtime-benchmarks")]
1464 type MessageProcessor =
1465 pallet_message_queue::mock_helpers::NoopMessageProcessor<AggregateMessageOrigin>;
1466 type QueueChangeHandler = ParaInclusion;
1467 type QueuePausedQuery = ();
1468 type WeightInfo = weights::pallet_message_queue::WeightInfo<Runtime>;
1469}
1470
1471impl parachains_dmp::Config for Runtime {}
1472
1473parameter_types! {
1474 pub const HrmpChannelSizeAndCapacityWithSystemRatio: Percent = Percent::from_percent(100);
1475}
1476
1477impl parachains_hrmp::Config for Runtime {
1478 type RuntimeOrigin = RuntimeOrigin;
1479 type RuntimeEvent = RuntimeEvent;
1480 type ChannelManager = EnsureRoot<AccountId>;
1481 type Currency = Balances;
1482 type DefaultChannelSizeAndCapacityWithSystem = ActiveConfigHrmpChannelSizeAndCapacityRatio<
1483 Runtime,
1484 HrmpChannelSizeAndCapacityWithSystemRatio,
1485 >;
1486 type VersionWrapper = crate::XcmPallet;
1487 type WeightInfo = weights::polkadot_runtime_parachains_hrmp::WeightInfo<Self>;
1488}
1489
1490impl parachains_paras_inherent::Config for Runtime {
1491 type WeightInfo = weights::polkadot_runtime_parachains_paras_inherent::WeightInfo<Runtime>;
1492}
1493
1494impl parachains_scheduler::Config for Runtime {
1495 type AssignmentProvider = CoretimeAssignmentProvider;
1498}
1499
1500parameter_types! {
1501 pub const BrokerId: u32 = BROKER_ID;
1502 pub const BrokerPalletId: PalletId = PalletId(*b"py/broke");
1503 pub MaxXcmTransactWeight: Weight = Weight::from_parts(200_000_000, 20_000);
1504}
1505
1506pub struct BrokerPot;
1507impl Get<InteriorLocation> for BrokerPot {
1508 fn get() -> InteriorLocation {
1509 Junction::AccountId32 { network: None, id: BrokerPalletId::get().into_account_truncating() }
1510 .into()
1511 }
1512}
1513
1514impl coretime::Config for Runtime {
1515 type RuntimeOrigin = RuntimeOrigin;
1516 type RuntimeEvent = RuntimeEvent;
1517 type BrokerId = BrokerId;
1518 type BrokerPotLocation = BrokerPot;
1519 type WeightInfo = weights::polkadot_runtime_parachains_coretime::WeightInfo<Runtime>;
1520 type SendXcm = crate::xcm_config::XcmRouter;
1521 type AssetTransactor = crate::xcm_config::LocalAssetTransactor;
1522 type AccountToLocation = xcm_builder::AliasesIntoAccountId32<
1523 xcm_config::ThisNetwork,
1524 <Runtime as frame_system::Config>::AccountId,
1525 >;
1526 type MaxXcmTransactWeight = MaxXcmTransactWeight;
1527}
1528
1529parameter_types! {
1530 pub const OnDemandTrafficDefaultValue: FixedU128 = FixedU128::from_u32(1);
1531 pub const MaxHistoricalRevenue: BlockNumber = 2 * TIMESLICE_PERIOD;
1533 pub const OnDemandPalletId: PalletId = PalletId(*b"py/ondmd");
1534}
1535
1536impl parachains_on_demand::Config for Runtime {
1537 type RuntimeEvent = RuntimeEvent;
1538 type Currency = Balances;
1539 type TrafficDefaultValue = OnDemandTrafficDefaultValue;
1540 type WeightInfo = weights::polkadot_runtime_parachains_on_demand::WeightInfo<Runtime>;
1541 type MaxHistoricalRevenue = MaxHistoricalRevenue;
1542 type PalletId = OnDemandPalletId;
1543}
1544
1545impl parachains_assigner_coretime::Config for Runtime {}
1546
1547impl parachains_initializer::Config for Runtime {
1548 type Randomness = pallet_babe::RandomnessFromOneEpochAgo<Runtime>;
1549 type ForceOrigin = EnsureRoot<AccountId>;
1550 type WeightInfo = weights::polkadot_runtime_parachains_initializer::WeightInfo<Runtime>;
1551 type CoretimeOnNewSession = Coretime;
1552}
1553
1554impl paras_sudo_wrapper::Config for Runtime {}
1555
1556parameter_types! {
1557 pub const PermanentSlotLeasePeriodLength: u32 = 26;
1558 pub const TemporarySlotLeasePeriodLength: u32 = 1;
1559 pub const MaxTemporarySlotPerLeasePeriod: u32 = 5;
1560}
1561
1562impl assigned_slots::Config for Runtime {
1563 type RuntimeEvent = RuntimeEvent;
1564 type AssignSlotOrigin = EnsureRoot<AccountId>;
1565 type Leaser = Slots;
1566 type PermanentSlotLeasePeriodLength = PermanentSlotLeasePeriodLength;
1567 type TemporarySlotLeasePeriodLength = TemporarySlotLeasePeriodLength;
1568 type MaxTemporarySlotPerLeasePeriod = MaxTemporarySlotPerLeasePeriod;
1569 type WeightInfo = weights::polkadot_runtime_common_assigned_slots::WeightInfo<Runtime>;
1570}
1571
1572impl parachains_disputes::Config for Runtime {
1573 type RuntimeEvent = RuntimeEvent;
1574 type RewardValidators =
1575 parachains_reward_points::RewardValidatorsWithEraPoints<Runtime, AssetHubStakingClient>;
1576 type SlashingHandler = parachains_slashing::SlashValidatorsForDisputes<ParasSlashing>;
1577 type WeightInfo = weights::polkadot_runtime_parachains_disputes::WeightInfo<Runtime>;
1578}
1579
1580impl parachains_slashing::Config for Runtime {
1581 type KeyOwnerProofSystem = Historical;
1582 type KeyOwnerProof =
1583 <Self::KeyOwnerProofSystem as KeyOwnerProofSystem<(KeyTypeId, ValidatorId)>>::Proof;
1584 type KeyOwnerIdentification = <Self::KeyOwnerProofSystem as KeyOwnerProofSystem<(
1585 KeyTypeId,
1586 ValidatorId,
1587 )>>::IdentificationTuple;
1588 type HandleReports = parachains_slashing::SlashingReportHandler<
1589 Self::KeyOwnerIdentification,
1590 Offences,
1591 ReportLongevity,
1592 >;
1593 type WeightInfo = weights::polkadot_runtime_parachains_disputes_slashing::WeightInfo<Runtime>;
1594 type BenchmarkingConfig = parachains_slashing::BenchConfig<300>;
1595}
1596
1597parameter_types! {
1598 pub const ParaDeposit: Balance = 2000 * CENTS;
1599 pub const RegistrarDataDepositPerByte: Balance = deposit(0, 1);
1600}
1601
1602impl paras_registrar::Config for Runtime {
1603 type RuntimeOrigin = RuntimeOrigin;
1604 type RuntimeEvent = RuntimeEvent;
1605 type Currency = Balances;
1606 type OnSwap = (Crowdloan, Slots, SwapLeases);
1607 type ParaDeposit = ParaDeposit;
1608 type DataDepositPerByte = RegistrarDataDepositPerByte;
1609 type WeightInfo = weights::polkadot_runtime_common_paras_registrar::WeightInfo<Runtime>;
1610}
1611
1612parameter_types! {
1613 pub const LeasePeriod: BlockNumber = 28 * DAYS;
1614}
1615
1616impl slots::Config for Runtime {
1617 type RuntimeEvent = RuntimeEvent;
1618 type Currency = Balances;
1619 type Registrar = Registrar;
1620 type LeasePeriod = LeasePeriod;
1621 type LeaseOffset = ();
1622 type ForceOrigin = EitherOf<EnsureRoot<Self::AccountId>, LeaseAdmin>;
1623 type WeightInfo = weights::polkadot_runtime_common_slots::WeightInfo<Runtime>;
1624}
1625
1626parameter_types! {
1627 pub const CrowdloanId: PalletId = PalletId(*b"py/cfund");
1628 pub const SubmissionDeposit: Balance = 100 * 100 * CENTS;
1629 pub const MinContribution: Balance = 100 * CENTS;
1630 pub const RemoveKeysLimit: u32 = 500;
1631 pub const MaxMemoLength: u8 = 32;
1633}
1634
1635impl crowdloan::Config for Runtime {
1636 type RuntimeEvent = RuntimeEvent;
1637 type PalletId = CrowdloanId;
1638 type SubmissionDeposit = SubmissionDeposit;
1639 type MinContribution = MinContribution;
1640 type RemoveKeysLimit = RemoveKeysLimit;
1641 type Registrar = Registrar;
1642 type Auctioneer = Auctions;
1643 type MaxMemoLength = MaxMemoLength;
1644 type WeightInfo = weights::polkadot_runtime_common_crowdloan::WeightInfo<Runtime>;
1645}
1646
1647parameter_types! {
1648 pub const EndingPeriod: BlockNumber = 5 * DAYS;
1651 pub const SampleLength: BlockNumber = 2 * MINUTES;
1653}
1654
1655impl auctions::Config for Runtime {
1656 type RuntimeEvent = RuntimeEvent;
1657 type Leaser = Slots;
1658 type Registrar = Registrar;
1659 type EndingPeriod = EndingPeriod;
1660 type SampleLength = SampleLength;
1661 type Randomness = pallet_babe::RandomnessFromOneEpochAgo<Runtime>;
1662 type InitiateOrigin = EitherOf<EnsureRoot<Self::AccountId>, AuctionAdmin>;
1663 type WeightInfo = weights::polkadot_runtime_common_auctions::WeightInfo<Runtime>;
1664}
1665
1666impl identity_migrator::Config for Runtime {
1667 type RuntimeEvent = RuntimeEvent;
1668 type Reaper = EnsureSigned<AccountId>;
1669 type ReapIdentityHandler = ToParachainIdentityReaper<Runtime, Self::AccountId>;
1670 type WeightInfo = weights::polkadot_runtime_common_identity_migrator::WeightInfo<Runtime>;
1671}
1672
1673parameter_types! {
1674 pub const PoolsPalletId: PalletId = PalletId(*b"py/nopls");
1675 pub const MaxPointsToBalance: u8 = 10;
1676}
1677
1678impl pallet_nomination_pools::Config for Runtime {
1679 type RuntimeEvent = RuntimeEvent;
1680 type WeightInfo = weights::pallet_nomination_pools::WeightInfo<Self>;
1681 type Currency = Balances;
1682 type RuntimeFreezeReason = RuntimeFreezeReason;
1683 type RewardCounter = FixedU128;
1684 type BalanceToU256 = BalanceToU256;
1685 type U256ToBalance = U256ToBalance;
1686 type StakeAdapter =
1687 pallet_nomination_pools::adapter::DelegateStake<Self, Staking, DelegatedStaking>;
1688 type PostUnbondingPoolsWindow = ConstU32<4>;
1689 type MaxMetadataLen = ConstU32<256>;
1690 type MaxUnbonding = <Self as pallet_staking::Config>::MaxUnlockingChunks;
1692 type PalletId = PoolsPalletId;
1693 type MaxPointsToBalance = MaxPointsToBalance;
1694 type AdminOrigin = EitherOf<EnsureRoot<AccountId>, StakingAdmin>;
1695 type BlockNumberProvider = System;
1696 type Filter = Nothing;
1697}
1698
1699parameter_types! {
1700 pub const DelegatedStakingPalletId: PalletId = PalletId(*b"py/dlstk");
1701 pub const SlashRewardFraction: Perbill = Perbill::from_percent(1);
1702}
1703
1704impl pallet_delegated_staking::Config for Runtime {
1705 type RuntimeEvent = RuntimeEvent;
1706 type PalletId = DelegatedStakingPalletId;
1707 type Currency = Balances;
1708 type OnSlash = ();
1709 type SlashRewardFraction = SlashRewardFraction;
1710 type RuntimeHoldReason = RuntimeHoldReason;
1711 type CoreStaking = Staking;
1712}
1713
1714impl pallet_root_testing::Config for Runtime {
1715 type RuntimeEvent = RuntimeEvent;
1716}
1717
1718parameter_types! {
1719 pub MbmServiceWeight: Weight = Perbill::from_percent(80) * BlockWeights::get().max_block;
1720}
1721
1722impl pallet_migrations::Config for Runtime {
1723 type RuntimeEvent = RuntimeEvent;
1724 #[cfg(not(feature = "runtime-benchmarks"))]
1725 type Migrations = pallet_identity::migration::v2::LazyMigrationV1ToV2<Runtime>;
1726 #[cfg(feature = "runtime-benchmarks")]
1728 type Migrations = pallet_migrations::mock_helpers::MockedMigrations;
1729 type CursorMaxLen = ConstU32<65_536>;
1730 type IdentifierMaxLen = ConstU32<256>;
1731 type MigrationStatusHandler = ();
1732 type FailedMigrationHandler = frame_support::migrations::FreezeChainOnFailedMigration;
1733 type MaxServiceWeight = MbmServiceWeight;
1734 type WeightInfo = weights::pallet_migrations::WeightInfo<Runtime>;
1735}
1736
1737parameter_types! {
1738 pub const MigrationSignedDepositPerItem: Balance = 1 * CENTS;
1740 pub const MigrationSignedDepositBase: Balance = 20 * CENTS * 100;
1741 pub const MigrationMaxKeyLen: u32 = 512;
1742}
1743
1744impl pallet_asset_rate::Config for Runtime {
1745 type WeightInfo = weights::pallet_asset_rate::WeightInfo<Runtime>;
1746 type RuntimeEvent = RuntimeEvent;
1747 type CreateOrigin = EnsureRoot<AccountId>;
1748 type RemoveOrigin = EnsureRoot<AccountId>;
1749 type UpdateOrigin = EnsureRoot<AccountId>;
1750 type Currency = Balances;
1751 type AssetKind = <Runtime as pallet_treasury::Config>::AssetKind;
1752 #[cfg(feature = "runtime-benchmarks")]
1753 type BenchmarkHelper = polkadot_runtime_common::impls::benchmarks::AssetRateArguments;
1754}
1755
1756pub struct SwapLeases;
1758impl OnSwap for SwapLeases {
1759 fn on_swap(one: ParaId, other: ParaId) {
1760 coretime::Pallet::<Runtime>::on_legacy_lease_swap(one, other);
1761 }
1762}
1763
1764pub type MetaTxExtension = (
1765 pallet_verify_signature::VerifySignature<Runtime>,
1766 pallet_meta_tx::MetaTxMarker<Runtime>,
1767 frame_system::CheckNonZeroSender<Runtime>,
1768 frame_system::CheckSpecVersion<Runtime>,
1769 frame_system::CheckTxVersion<Runtime>,
1770 frame_system::CheckGenesis<Runtime>,
1771 frame_system::CheckMortality<Runtime>,
1772 frame_system::CheckNonce<Runtime>,
1773 frame_metadata_hash_extension::CheckMetadataHash<Runtime>,
1774);
1775
1776impl pallet_meta_tx::Config for Runtime {
1777 type WeightInfo = weights::pallet_meta_tx::WeightInfo<Runtime>;
1778 type RuntimeEvent = RuntimeEvent;
1779 #[cfg(not(feature = "runtime-benchmarks"))]
1780 type Extension = MetaTxExtension;
1781 #[cfg(feature = "runtime-benchmarks")]
1782 type Extension = pallet_meta_tx::WeightlessExtension<Runtime>;
1783}
1784
1785impl pallet_verify_signature::Config for Runtime {
1786 type Signature = MultiSignature;
1787 type AccountIdentifier = MultiSigner;
1788 type WeightInfo = weights::pallet_verify_signature::WeightInfo<Runtime>;
1789 #[cfg(feature = "runtime-benchmarks")]
1790 type BenchmarkHelper = ();
1791}
1792
1793#[frame_support::runtime(legacy_ordering)]
1794mod runtime {
1795 #[runtime::runtime]
1796 #[runtime::derive(
1797 RuntimeCall,
1798 RuntimeEvent,
1799 RuntimeError,
1800 RuntimeOrigin,
1801 RuntimeFreezeReason,
1802 RuntimeHoldReason,
1803 RuntimeSlashReason,
1804 RuntimeLockId,
1805 RuntimeTask,
1806 RuntimeViewFunction
1807 )]
1808 pub struct Runtime;
1809
1810 #[runtime::pallet_index(0)]
1812 pub type System = frame_system;
1813
1814 #[runtime::pallet_index(1)]
1816 pub type Babe = pallet_babe;
1817
1818 #[runtime::pallet_index(2)]
1819 pub type Timestamp = pallet_timestamp;
1820 #[runtime::pallet_index(3)]
1821 pub type Indices = pallet_indices;
1822 #[runtime::pallet_index(4)]
1823 pub type Balances = pallet_balances;
1824 #[runtime::pallet_index(26)]
1825 pub type TransactionPayment = pallet_transaction_payment;
1826
1827 #[runtime::pallet_index(5)]
1830 pub type Authorship = pallet_authorship;
1831 #[runtime::pallet_index(6)]
1832 pub type Staking = pallet_staking;
1833 #[runtime::pallet_index(7)]
1834 pub type Offences = pallet_offences;
1835 #[runtime::pallet_index(27)]
1836 pub type Historical = session_historical;
1837 #[runtime::pallet_index(70)]
1838 pub type Parameters = pallet_parameters;
1839
1840 #[runtime::pallet_index(8)]
1841 pub type Session = pallet_session;
1842 #[runtime::pallet_index(10)]
1843 pub type Grandpa = pallet_grandpa;
1844 #[runtime::pallet_index(12)]
1845 pub type AuthorityDiscovery = pallet_authority_discovery;
1846
1847 #[runtime::pallet_index(16)]
1849 pub type Utility = pallet_utility;
1850
1851 #[runtime::pallet_index(17)]
1853 pub type Identity = pallet_identity;
1854
1855 #[runtime::pallet_index(18)]
1857 pub type Recovery = pallet_recovery;
1858
1859 #[runtime::pallet_index(19)]
1861 pub type Vesting = pallet_vesting;
1862
1863 #[runtime::pallet_index(20)]
1865 pub type Scheduler = pallet_scheduler;
1866
1867 #[runtime::pallet_index(28)]
1869 pub type Preimage = pallet_preimage;
1870
1871 #[runtime::pallet_index(21)]
1873 pub type Sudo = pallet_sudo;
1874
1875 #[runtime::pallet_index(22)]
1877 pub type Proxy = pallet_proxy;
1878
1879 #[runtime::pallet_index(23)]
1881 pub type Multisig = pallet_multisig;
1882
1883 #[runtime::pallet_index(24)]
1885 pub type ElectionProviderMultiPhase = pallet_election_provider_multi_phase;
1886
1887 #[runtime::pallet_index(25)]
1889 pub type VoterList = pallet_bags_list<Instance1>;
1890
1891 #[runtime::pallet_index(29)]
1893 pub type NominationPools = pallet_nomination_pools;
1894
1895 #[runtime::pallet_index(30)]
1897 pub type FastUnstake = pallet_fast_unstake;
1898
1899 #[runtime::pallet_index(31)]
1901 pub type ConvictionVoting = pallet_conviction_voting;
1902 #[runtime::pallet_index(32)]
1903 pub type Referenda = pallet_referenda;
1904 #[runtime::pallet_index(35)]
1905 pub type Origins = pallet_custom_origins;
1906 #[runtime::pallet_index(36)]
1907 pub type Whitelist = pallet_whitelist;
1908
1909 #[runtime::pallet_index(37)]
1911 pub type Treasury = pallet_treasury;
1912
1913 #[runtime::pallet_index(38)]
1915 pub type DelegatedStaking = pallet_delegated_staking;
1916
1917 #[runtime::pallet_index(41)]
1919 pub type ParachainsOrigin = parachains_origin;
1920 #[runtime::pallet_index(42)]
1921 pub type Configuration = parachains_configuration;
1922 #[runtime::pallet_index(43)]
1923 pub type ParasShared = parachains_shared;
1924 #[runtime::pallet_index(44)]
1925 pub type ParaInclusion = parachains_inclusion;
1926 #[runtime::pallet_index(45)]
1927 pub type ParaInherent = parachains_paras_inherent;
1928 #[runtime::pallet_index(46)]
1929 pub type ParaScheduler = parachains_scheduler;
1930 #[runtime::pallet_index(47)]
1931 pub type Paras = parachains_paras;
1932 #[runtime::pallet_index(48)]
1933 pub type Initializer = parachains_initializer;
1934 #[runtime::pallet_index(49)]
1935 pub type Dmp = parachains_dmp;
1936 #[runtime::pallet_index(51)]
1938 pub type Hrmp = parachains_hrmp;
1939 #[runtime::pallet_index(52)]
1940 pub type ParaSessionInfo = parachains_session_info;
1941 #[runtime::pallet_index(53)]
1942 pub type ParasDisputes = parachains_disputes;
1943 #[runtime::pallet_index(54)]
1944 pub type ParasSlashing = parachains_slashing;
1945 #[runtime::pallet_index(56)]
1946 pub type OnDemandAssignmentProvider = parachains_on_demand;
1947 #[runtime::pallet_index(57)]
1948 pub type CoretimeAssignmentProvider = parachains_assigner_coretime;
1949
1950 #[runtime::pallet_index(60)]
1952 pub type Registrar = paras_registrar;
1953 #[runtime::pallet_index(61)]
1954 pub type Slots = slots;
1955 #[runtime::pallet_index(62)]
1956 pub type ParasSudoWrapper = paras_sudo_wrapper;
1957 #[runtime::pallet_index(63)]
1958 pub type Auctions = auctions;
1959 #[runtime::pallet_index(64)]
1960 pub type Crowdloan = crowdloan;
1961 #[runtime::pallet_index(65)]
1962 pub type AssignedSlots = assigned_slots;
1963 #[runtime::pallet_index(66)]
1964 pub type Coretime = coretime;
1965 #[runtime::pallet_index(67)]
1966 pub type AssetHubStakingClient = pallet_staking_async_ah_client;
1967
1968 #[runtime::pallet_index(98)]
1970 pub type MultiBlockMigrations = pallet_migrations;
1971
1972 #[runtime::pallet_index(99)]
1974 pub type XcmPallet = pallet_xcm;
1975
1976 #[runtime::pallet_index(100)]
1978 pub type MessageQueue = pallet_message_queue;
1979
1980 #[runtime::pallet_index(101)]
1982 pub type AssetRate = pallet_asset_rate;
1983
1984 #[runtime::pallet_index(102)]
1986 pub type RootTesting = pallet_root_testing;
1987
1988 #[runtime::pallet_index(103)]
1989 pub type MetaTx = pallet_meta_tx::Pallet<Runtime>;
1990
1991 #[runtime::pallet_index(104)]
1992 pub type VerifySignature = pallet_verify_signature::Pallet<Runtime>;
1993
1994 #[runtime::pallet_index(200)]
1996 pub type Beefy = pallet_beefy;
1997 #[runtime::pallet_index(201)]
2000 pub type Mmr = pallet_mmr;
2001 #[runtime::pallet_index(202)]
2002 pub type BeefyMmrLeaf = pallet_beefy_mmr;
2003
2004 #[runtime::pallet_index(248)]
2006 pub type IdentityMigrator = identity_migrator;
2007}
2008
2009pub type Address = sp_runtime::MultiAddress<AccountId, ()>;
2011pub type Header = generic::Header<BlockNumber, BlakeTwo256>;
2013pub type Block = generic::Block<Header, UncheckedExtrinsic>;
2015pub type SignedBlock = generic::SignedBlock<Block>;
2017pub type BlockId = generic::BlockId<Block>;
2019pub type TxExtension = (
2021 frame_system::AuthorizeCall<Runtime>,
2022 frame_system::CheckNonZeroSender<Runtime>,
2023 frame_system::CheckSpecVersion<Runtime>,
2024 frame_system::CheckTxVersion<Runtime>,
2025 frame_system::CheckGenesis<Runtime>,
2026 frame_system::CheckMortality<Runtime>,
2027 frame_system::CheckNonce<Runtime>,
2028 frame_system::CheckWeight<Runtime>,
2029 pallet_transaction_payment::ChargeTransactionPayment<Runtime>,
2030 frame_metadata_hash_extension::CheckMetadataHash<Runtime>,
2031 frame_system::WeightReclaim<Runtime>,
2032);
2033
2034parameter_types! {
2035 pub const MaxAgentsToMigrate: u32 = 300;
2037}
2038
2039pub type Migrations = migrations::Unreleased;
2044
2045#[allow(deprecated, missing_docs)]
2047pub mod migrations {
2048 use super::*;
2049
2050 pub type Unreleased = (
2052 pallet_delegated_staking::migration::unversioned::ProxyDelegatorMigration<
2054 Runtime,
2055 MaxAgentsToMigrate,
2056 >,
2057 parachains_shared::migration::MigrateToV1<Runtime>,
2058 parachains_scheduler::migration::MigrateV2ToV3<Runtime>,
2059 pallet_staking::migrations::v16::MigrateV15ToV16<Runtime>,
2060 pallet_session::migrations::v1::MigrateV0ToV1<
2061 Runtime,
2062 pallet_staking::migrations::v17::MigrateDisabledToSession<Runtime>,
2063 >,
2064 pallet_xcm::migration::MigrateToLatestXcmVersion<Runtime>,
2066 );
2067}
2068
2069pub type UncheckedExtrinsic =
2071 generic::UncheckedExtrinsic<Address, RuntimeCall, Signature, TxExtension>;
2072pub type UncheckedSignaturePayload =
2074 generic::UncheckedSignaturePayload<Address, Signature, TxExtension>;
2075
2076pub type Executive = frame_executive::Executive<
2078 Runtime,
2079 Block,
2080 frame_system::ChainContext<Runtime>,
2081 Runtime,
2082 AllPalletsWithSystem,
2083 Migrations,
2084>;
2085pub type SignedPayload = generic::SignedPayload<RuntimeCall, TxExtension>;
2087
2088#[cfg(feature = "runtime-benchmarks")]
2089mod benches {
2090 frame_benchmarking::define_benchmarks!(
2091 [polkadot_runtime_common::assigned_slots, AssignedSlots]
2095 [polkadot_runtime_common::auctions, Auctions]
2096 [polkadot_runtime_common::crowdloan, Crowdloan]
2097 [polkadot_runtime_common::identity_migrator, IdentityMigrator]
2098 [polkadot_runtime_common::paras_registrar, Registrar]
2099 [polkadot_runtime_common::slots, Slots]
2100 [polkadot_runtime_parachains::configuration, Configuration]
2101 [polkadot_runtime_parachains::disputes, ParasDisputes]
2102 [polkadot_runtime_parachains::disputes::slashing, ParasSlashing]
2103 [polkadot_runtime_parachains::hrmp, Hrmp]
2104 [polkadot_runtime_parachains::inclusion, ParaInclusion]
2105 [polkadot_runtime_parachains::initializer, Initializer]
2106 [polkadot_runtime_parachains::paras, Paras]
2107 [polkadot_runtime_parachains::paras_inherent, ParaInherent]
2108 [polkadot_runtime_parachains::on_demand, OnDemandAssignmentProvider]
2109 [polkadot_runtime_parachains::coretime, Coretime]
2110 [pallet_bags_list, VoterList]
2112 [pallet_balances, Balances]
2113 [pallet_beefy_mmr, BeefyMmrLeaf]
2114 [pallet_conviction_voting, ConvictionVoting]
2115 [pallet_election_provider_multi_phase, ElectionProviderMultiPhase]
2116 [frame_election_provider_support, ElectionProviderBench::<Runtime>]
2117 [pallet_fast_unstake, FastUnstake]
2118 [pallet_identity, Identity]
2119 [pallet_indices, Indices]
2120 [pallet_message_queue, MessageQueue]
2121 [pallet_migrations, MultiBlockMigrations]
2122 [pallet_mmr, Mmr]
2123 [pallet_multisig, Multisig]
2124 [pallet_nomination_pools, NominationPoolsBench::<Runtime>]
2125 [pallet_offences, OffencesBench::<Runtime>]
2126 [pallet_parameters, Parameters]
2127 [pallet_preimage, Preimage]
2128 [pallet_proxy, Proxy]
2129 [pallet_recovery, Recovery]
2130 [pallet_referenda, Referenda]
2131 [pallet_scheduler, Scheduler]
2132 [pallet_session, SessionBench::<Runtime>]
2133 [pallet_staking, Staking]
2134 [pallet_sudo, Sudo]
2135 [frame_system, SystemBench::<Runtime>]
2136 [frame_system_extensions, SystemExtensionsBench::<Runtime>]
2137 [pallet_timestamp, Timestamp]
2138 [pallet_transaction_payment, TransactionPayment]
2139 [pallet_treasury, Treasury]
2140 [pallet_utility, Utility]
2141 [pallet_vesting, Vesting]
2142 [pallet_whitelist, Whitelist]
2143 [pallet_asset_rate, AssetRate]
2144 [pallet_meta_tx, MetaTx]
2145 [pallet_verify_signature, VerifySignature]
2146 [pallet_xcm, PalletXcmExtrinsicsBenchmark::<Runtime>]
2148 [pallet_xcm_benchmarks::fungible, XcmBalances]
2150 [pallet_xcm_benchmarks::generic, XcmGeneric]
2151 );
2152}
2153
2154sp_api::impl_runtime_apis! {
2155 impl sp_api::Core<Block> for Runtime {
2156 fn version() -> RuntimeVersion {
2157 VERSION
2158 }
2159
2160 fn execute_block(block: Block) {
2161 Executive::execute_block(block);
2162 }
2163
2164 fn initialize_block(header: &<Block as BlockT>::Header) -> sp_runtime::ExtrinsicInclusionMode {
2165 Executive::initialize_block(header)
2166 }
2167 }
2168
2169 impl sp_api::Metadata<Block> for Runtime {
2170 fn metadata() -> OpaqueMetadata {
2171 OpaqueMetadata::new(Runtime::metadata().into())
2172 }
2173
2174 fn metadata_at_version(version: u32) -> Option<OpaqueMetadata> {
2175 Runtime::metadata_at_version(version)
2176 }
2177
2178 fn metadata_versions() -> alloc::vec::Vec<u32> {
2179 Runtime::metadata_versions()
2180 }
2181 }
2182
2183 impl frame_support::view_functions::runtime_api::RuntimeViewFunction<Block> for Runtime {
2184 fn execute_view_function(id: frame_support::view_functions::ViewFunctionId, input: Vec<u8>) -> Result<Vec<u8>, frame_support::view_functions::ViewFunctionDispatchError> {
2185 Runtime::execute_view_function(id, input)
2186 }
2187 }
2188
2189 impl sp_block_builder::BlockBuilder<Block> for Runtime {
2190 fn apply_extrinsic(extrinsic: <Block as BlockT>::Extrinsic) -> ApplyExtrinsicResult {
2191 Executive::apply_extrinsic(extrinsic)
2192 }
2193
2194 fn finalize_block() -> <Block as BlockT>::Header {
2195 Executive::finalize_block()
2196 }
2197
2198 fn inherent_extrinsics(data: sp_inherents::InherentData) -> Vec<<Block as BlockT>::Extrinsic> {
2199 data.create_extrinsics()
2200 }
2201
2202 fn check_inherents(
2203 block: Block,
2204 data: sp_inherents::InherentData,
2205 ) -> sp_inherents::CheckInherentsResult {
2206 data.check_extrinsics(&block)
2207 }
2208 }
2209
2210 impl sp_transaction_pool::runtime_api::TaggedTransactionQueue<Block> for Runtime {
2211 fn validate_transaction(
2212 source: TransactionSource,
2213 tx: <Block as BlockT>::Extrinsic,
2214 block_hash: <Block as BlockT>::Hash,
2215 ) -> TransactionValidity {
2216 Executive::validate_transaction(source, tx, block_hash)
2217 }
2218 }
2219
2220 impl sp_offchain::OffchainWorkerApi<Block> for Runtime {
2221 fn offchain_worker(header: &<Block as BlockT>::Header) {
2222 Executive::offchain_worker(header)
2223 }
2224 }
2225
2226 #[api_version(13)]
2227 impl polkadot_primitives::runtime_api::ParachainHost<Block> for Runtime {
2228 fn validators() -> Vec<ValidatorId> {
2229 parachains_runtime_api_impl::validators::<Runtime>()
2230 }
2231
2232 fn validator_groups() -> (Vec<Vec<ValidatorIndex>>, GroupRotationInfo<BlockNumber>) {
2233 parachains_runtime_api_impl::validator_groups::<Runtime>()
2234 }
2235
2236 fn availability_cores() -> Vec<CoreState<Hash, BlockNumber>> {
2237 parachains_runtime_api_impl::availability_cores::<Runtime>()
2238 }
2239
2240 fn persisted_validation_data(para_id: ParaId, assumption: OccupiedCoreAssumption)
2241 -> Option<PersistedValidationData<Hash, BlockNumber>> {
2242 parachains_runtime_api_impl::persisted_validation_data::<Runtime>(para_id, assumption)
2243 }
2244
2245 fn assumed_validation_data(
2246 para_id: ParaId,
2247 expected_persisted_validation_data_hash: Hash,
2248 ) -> Option<(PersistedValidationData<Hash, BlockNumber>, ValidationCodeHash)> {
2249 parachains_runtime_api_impl::assumed_validation_data::<Runtime>(
2250 para_id,
2251 expected_persisted_validation_data_hash,
2252 )
2253 }
2254
2255 fn check_validation_outputs(
2256 para_id: ParaId,
2257 outputs: polkadot_primitives::CandidateCommitments,
2258 ) -> bool {
2259 parachains_runtime_api_impl::check_validation_outputs::<Runtime>(para_id, outputs)
2260 }
2261
2262 fn session_index_for_child() -> SessionIndex {
2263 parachains_runtime_api_impl::session_index_for_child::<Runtime>()
2264 }
2265
2266 fn validation_code(para_id: ParaId, assumption: OccupiedCoreAssumption)
2267 -> Option<ValidationCode> {
2268 parachains_runtime_api_impl::validation_code::<Runtime>(para_id, assumption)
2269 }
2270
2271 fn candidate_pending_availability(para_id: ParaId) -> Option<CommittedCandidateReceipt<Hash>> {
2272 #[allow(deprecated)]
2273 parachains_runtime_api_impl::candidate_pending_availability::<Runtime>(para_id)
2274 }
2275
2276 fn candidate_events() -> Vec<CandidateEvent<Hash>> {
2277 parachains_runtime_api_impl::candidate_events::<Runtime, _>(|ev| {
2278 match ev {
2279 RuntimeEvent::ParaInclusion(ev) => {
2280 Some(ev)
2281 }
2282 _ => None,
2283 }
2284 })
2285 }
2286
2287 fn session_info(index: SessionIndex) -> Option<SessionInfo> {
2288 parachains_runtime_api_impl::session_info::<Runtime>(index)
2289 }
2290
2291 fn session_executor_params(session_index: SessionIndex) -> Option<ExecutorParams> {
2292 parachains_runtime_api_impl::session_executor_params::<Runtime>(session_index)
2293 }
2294
2295 fn dmq_contents(recipient: ParaId) -> Vec<InboundDownwardMessage<BlockNumber>> {
2296 parachains_runtime_api_impl::dmq_contents::<Runtime>(recipient)
2297 }
2298
2299 fn inbound_hrmp_channels_contents(
2300 recipient: ParaId
2301 ) -> BTreeMap<ParaId, Vec<InboundHrmpMessage<BlockNumber>>> {
2302 parachains_runtime_api_impl::inbound_hrmp_channels_contents::<Runtime>(recipient)
2303 }
2304
2305 fn validation_code_by_hash(hash: ValidationCodeHash) -> Option<ValidationCode> {
2306 parachains_runtime_api_impl::validation_code_by_hash::<Runtime>(hash)
2307 }
2308
2309 fn on_chain_votes() -> Option<ScrapedOnChainVotes<Hash>> {
2310 parachains_runtime_api_impl::on_chain_votes::<Runtime>()
2311 }
2312
2313 fn submit_pvf_check_statement(
2314 stmt: PvfCheckStatement,
2315 signature: ValidatorSignature,
2316 ) {
2317 parachains_runtime_api_impl::submit_pvf_check_statement::<Runtime>(stmt, signature)
2318 }
2319
2320 fn pvfs_require_precheck() -> Vec<ValidationCodeHash> {
2321 parachains_runtime_api_impl::pvfs_require_precheck::<Runtime>()
2322 }
2323
2324 fn validation_code_hash(para_id: ParaId, assumption: OccupiedCoreAssumption)
2325 -> Option<ValidationCodeHash>
2326 {
2327 parachains_runtime_api_impl::validation_code_hash::<Runtime>(para_id, assumption)
2328 }
2329
2330 fn disputes() -> Vec<(SessionIndex, CandidateHash, DisputeState<BlockNumber>)> {
2331 parachains_runtime_api_impl::get_session_disputes::<Runtime>()
2332 }
2333
2334 fn unapplied_slashes(
2335 ) -> Vec<(SessionIndex, CandidateHash, slashing::PendingSlashes)> {
2336 parachains_runtime_api_impl::unapplied_slashes::<Runtime>()
2337 }
2338
2339 fn key_ownership_proof(
2340 validator_id: ValidatorId,
2341 ) -> Option<slashing::OpaqueKeyOwnershipProof> {
2342 use codec::Encode;
2343
2344 Historical::prove((PARACHAIN_KEY_TYPE_ID, validator_id))
2345 .map(|p| p.encode())
2346 .map(slashing::OpaqueKeyOwnershipProof::new)
2347 }
2348
2349 fn submit_report_dispute_lost(
2350 dispute_proof: slashing::DisputeProof,
2351 key_ownership_proof: slashing::OpaqueKeyOwnershipProof,
2352 ) -> Option<()> {
2353 parachains_runtime_api_impl::submit_unsigned_slashing_report::<Runtime>(
2354 dispute_proof,
2355 key_ownership_proof,
2356 )
2357 }
2358
2359 fn minimum_backing_votes() -> u32 {
2360 parachains_runtime_api_impl::minimum_backing_votes::<Runtime>()
2361 }
2362
2363 fn para_backing_state(para_id: ParaId) -> Option<polkadot_primitives::vstaging::async_backing::BackingState> {
2364 #[allow(deprecated)]
2365 parachains_runtime_api_impl::backing_state::<Runtime>(para_id)
2366 }
2367
2368 fn async_backing_params() -> polkadot_primitives::AsyncBackingParams {
2369 #[allow(deprecated)]
2370 parachains_runtime_api_impl::async_backing_params::<Runtime>()
2371 }
2372
2373 fn approval_voting_params() -> ApprovalVotingParams {
2374 parachains_runtime_api_impl::approval_voting_params::<Runtime>()
2375 }
2376
2377 fn disabled_validators() -> Vec<ValidatorIndex> {
2378 parachains_runtime_api_impl::disabled_validators::<Runtime>()
2379 }
2380
2381 fn node_features() -> NodeFeatures {
2382 parachains_runtime_api_impl::node_features::<Runtime>()
2383 }
2384
2385 fn claim_queue() -> BTreeMap<CoreIndex, VecDeque<ParaId>> {
2386 parachains_runtime_api_impl::claim_queue::<Runtime>()
2387 }
2388
2389 fn candidates_pending_availability(para_id: ParaId) -> Vec<CommittedCandidateReceipt<Hash>> {
2390 parachains_runtime_api_impl::candidates_pending_availability::<Runtime>(para_id)
2391 }
2392
2393 fn backing_constraints(para_id: ParaId) -> Option<Constraints> {
2394 parachains_staging_runtime_api_impl::backing_constraints::<Runtime>(para_id)
2395 }
2396
2397 fn scheduling_lookahead() -> u32 {
2398 parachains_staging_runtime_api_impl::scheduling_lookahead::<Runtime>()
2399 }
2400
2401 fn validation_code_bomb_limit() -> u32 {
2402 parachains_staging_runtime_api_impl::validation_code_bomb_limit::<Runtime>()
2403 }
2404 }
2405
2406 #[api_version(5)]
2407 impl sp_consensus_beefy::BeefyApi<Block, BeefyId> for Runtime {
2408 fn beefy_genesis() -> Option<BlockNumber> {
2409 pallet_beefy::GenesisBlock::<Runtime>::get()
2410 }
2411
2412 fn validator_set() -> Option<sp_consensus_beefy::ValidatorSet<BeefyId>> {
2413 Beefy::validator_set()
2414 }
2415
2416 fn submit_report_double_voting_unsigned_extrinsic(
2417 equivocation_proof: sp_consensus_beefy::DoubleVotingProof<
2418 BlockNumber,
2419 BeefyId,
2420 BeefySignature,
2421 >,
2422 key_owner_proof: sp_consensus_beefy::OpaqueKeyOwnershipProof,
2423 ) -> Option<()> {
2424 let key_owner_proof = key_owner_proof.decode()?;
2425
2426 Beefy::submit_unsigned_double_voting_report(
2427 equivocation_proof,
2428 key_owner_proof,
2429 )
2430 }
2431
2432 fn submit_report_fork_voting_unsigned_extrinsic(
2433 equivocation_proof:
2434 sp_consensus_beefy::ForkVotingProof<
2435 <Block as BlockT>::Header,
2436 BeefyId,
2437 sp_runtime::OpaqueValue
2438 >,
2439 key_owner_proof: sp_consensus_beefy::OpaqueKeyOwnershipProof,
2440 ) -> Option<()> {
2441 Beefy::submit_unsigned_fork_voting_report(
2442 equivocation_proof.try_into()?,
2443 key_owner_proof.decode()?,
2444 )
2445 }
2446
2447 fn submit_report_future_block_voting_unsigned_extrinsic(
2448 equivocation_proof: sp_consensus_beefy::FutureBlockVotingProof<BlockNumber, BeefyId>,
2449 key_owner_proof: sp_consensus_beefy::OpaqueKeyOwnershipProof,
2450 ) -> Option<()> {
2451 Beefy::submit_unsigned_future_block_voting_report(
2452 equivocation_proof,
2453 key_owner_proof.decode()?,
2454 )
2455 }
2456
2457 fn generate_key_ownership_proof(
2458 _set_id: sp_consensus_beefy::ValidatorSetId,
2459 authority_id: BeefyId,
2460 ) -> Option<sp_consensus_beefy::OpaqueKeyOwnershipProof> {
2461 use codec::Encode;
2462
2463 Historical::prove((sp_consensus_beefy::KEY_TYPE, authority_id))
2464 .map(|p| p.encode())
2465 .map(sp_consensus_beefy::OpaqueKeyOwnershipProof::new)
2466 }
2467
2468 fn generate_ancestry_proof(
2469 prev_block_number: BlockNumber,
2470 best_known_block_number: Option<BlockNumber>,
2471 ) -> Option<sp_runtime::OpaqueValue> {
2472 use sp_consensus_beefy::AncestryHelper;
2473
2474 BeefyMmrLeaf::generate_proof(prev_block_number, best_known_block_number)
2475 .map(|p| p.encode())
2476 .map(sp_runtime::OpaqueValue::new)
2477 }
2478 }
2479
2480 impl mmr::MmrApi<Block, Hash, BlockNumber> for Runtime {
2481 fn mmr_root() -> Result<mmr::Hash, mmr::Error> {
2482 Ok(pallet_mmr::RootHash::<Runtime>::get())
2483 }
2484
2485 fn mmr_leaf_count() -> Result<mmr::LeafIndex, mmr::Error> {
2486 Ok(pallet_mmr::NumberOfLeaves::<Runtime>::get())
2487 }
2488
2489 fn generate_proof(
2490 block_numbers: Vec<BlockNumber>,
2491 best_known_block_number: Option<BlockNumber>,
2492 ) -> Result<(Vec<mmr::EncodableOpaqueLeaf>, mmr::LeafProof<mmr::Hash>), mmr::Error> {
2493 Mmr::generate_proof(block_numbers, best_known_block_number).map(
2494 |(leaves, proof)| {
2495 (
2496 leaves
2497 .into_iter()
2498 .map(|leaf| mmr::EncodableOpaqueLeaf::from_leaf(&leaf))
2499 .collect(),
2500 proof,
2501 )
2502 },
2503 )
2504 }
2505
2506 fn verify_proof(leaves: Vec<mmr::EncodableOpaqueLeaf>, proof: mmr::LeafProof<mmr::Hash>)
2507 -> Result<(), mmr::Error>
2508 {
2509 let leaves = leaves.into_iter().map(|leaf|
2510 leaf.into_opaque_leaf()
2511 .try_decode()
2512 .ok_or(mmr::Error::Verify)).collect::<Result<Vec<mmr::Leaf>, mmr::Error>>()?;
2513 Mmr::verify_leaves(leaves, proof)
2514 }
2515
2516 fn verify_proof_stateless(
2517 root: mmr::Hash,
2518 leaves: Vec<mmr::EncodableOpaqueLeaf>,
2519 proof: mmr::LeafProof<mmr::Hash>
2520 ) -> Result<(), mmr::Error> {
2521 let nodes = leaves.into_iter().map(|leaf|mmr::DataOrHash::Data(leaf.into_opaque_leaf())).collect();
2522 pallet_mmr::verify_leaves_proof::<mmr::Hashing, _>(root, nodes, proof)
2523 }
2524 }
2525
2526 impl pallet_beefy_mmr::BeefyMmrApi<Block, Hash> for RuntimeApi {
2527 fn authority_set_proof() -> sp_consensus_beefy::mmr::BeefyAuthoritySet<Hash> {
2528 BeefyMmrLeaf::authority_set_proof()
2529 }
2530
2531 fn next_authority_set_proof() -> sp_consensus_beefy::mmr::BeefyNextAuthoritySet<Hash> {
2532 BeefyMmrLeaf::next_authority_set_proof()
2533 }
2534 }
2535
2536 impl fg_primitives::GrandpaApi<Block> for Runtime {
2537 fn grandpa_authorities() -> Vec<(GrandpaId, u64)> {
2538 Grandpa::grandpa_authorities()
2539 }
2540
2541 fn current_set_id() -> fg_primitives::SetId {
2542 pallet_grandpa::CurrentSetId::<Runtime>::get()
2543 }
2544
2545 fn submit_report_equivocation_unsigned_extrinsic(
2546 equivocation_proof: fg_primitives::EquivocationProof<
2547 <Block as BlockT>::Hash,
2548 sp_runtime::traits::NumberFor<Block>,
2549 >,
2550 key_owner_proof: fg_primitives::OpaqueKeyOwnershipProof,
2551 ) -> Option<()> {
2552 let key_owner_proof = key_owner_proof.decode()?;
2553
2554 Grandpa::submit_unsigned_equivocation_report(
2555 equivocation_proof,
2556 key_owner_proof,
2557 )
2558 }
2559
2560 fn generate_key_ownership_proof(
2561 _set_id: fg_primitives::SetId,
2562 authority_id: fg_primitives::AuthorityId,
2563 ) -> Option<fg_primitives::OpaqueKeyOwnershipProof> {
2564 use codec::Encode;
2565
2566 Historical::prove((fg_primitives::KEY_TYPE, authority_id))
2567 .map(|p| p.encode())
2568 .map(fg_primitives::OpaqueKeyOwnershipProof::new)
2569 }
2570 }
2571
2572 impl sp_consensus_babe::BabeApi<Block> for Runtime {
2573 fn configuration() -> sp_consensus_babe::BabeConfiguration {
2574 let epoch_config = Babe::epoch_config().unwrap_or(BABE_GENESIS_EPOCH_CONFIG);
2575 sp_consensus_babe::BabeConfiguration {
2576 slot_duration: Babe::slot_duration(),
2577 epoch_length: EpochDuration::get(),
2578 c: epoch_config.c,
2579 authorities: Babe::authorities().to_vec(),
2580 randomness: Babe::randomness(),
2581 allowed_slots: epoch_config.allowed_slots,
2582 }
2583 }
2584
2585 fn current_epoch_start() -> sp_consensus_babe::Slot {
2586 Babe::current_epoch_start()
2587 }
2588
2589 fn current_epoch() -> sp_consensus_babe::Epoch {
2590 Babe::current_epoch()
2591 }
2592
2593 fn next_epoch() -> sp_consensus_babe::Epoch {
2594 Babe::next_epoch()
2595 }
2596
2597 fn generate_key_ownership_proof(
2598 _slot: sp_consensus_babe::Slot,
2599 authority_id: sp_consensus_babe::AuthorityId,
2600 ) -> Option<sp_consensus_babe::OpaqueKeyOwnershipProof> {
2601 use codec::Encode;
2602
2603 Historical::prove((sp_consensus_babe::KEY_TYPE, authority_id))
2604 .map(|p| p.encode())
2605 .map(sp_consensus_babe::OpaqueKeyOwnershipProof::new)
2606 }
2607
2608 fn submit_report_equivocation_unsigned_extrinsic(
2609 equivocation_proof: sp_consensus_babe::EquivocationProof<<Block as BlockT>::Header>,
2610 key_owner_proof: sp_consensus_babe::OpaqueKeyOwnershipProof,
2611 ) -> Option<()> {
2612 let key_owner_proof = key_owner_proof.decode()?;
2613
2614 Babe::submit_unsigned_equivocation_report(
2615 equivocation_proof,
2616 key_owner_proof,
2617 )
2618 }
2619 }
2620
2621 impl sp_authority_discovery::AuthorityDiscoveryApi<Block> for Runtime {
2622 fn authorities() -> Vec<AuthorityDiscoveryId> {
2623 parachains_runtime_api_impl::relevant_authority_ids::<Runtime>()
2624 }
2625 }
2626
2627 impl sp_session::SessionKeys<Block> for Runtime {
2628 fn generate_session_keys(seed: Option<Vec<u8>>) -> Vec<u8> {
2629 SessionKeys::generate(seed)
2630 }
2631
2632 fn decode_session_keys(
2633 encoded: Vec<u8>,
2634 ) -> Option<Vec<(Vec<u8>, sp_core::crypto::KeyTypeId)>> {
2635 SessionKeys::decode_into_raw_public_keys(&encoded)
2636 }
2637 }
2638
2639 impl frame_system_rpc_runtime_api::AccountNonceApi<Block, AccountId, Nonce> for Runtime {
2640 fn account_nonce(account: AccountId) -> Nonce {
2641 System::account_nonce(account)
2642 }
2643 }
2644
2645 impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi<
2646 Block,
2647 Balance,
2648 > for Runtime {
2649 fn query_info(uxt: <Block as BlockT>::Extrinsic, len: u32) -> RuntimeDispatchInfo<Balance> {
2650 TransactionPayment::query_info(uxt, len)
2651 }
2652 fn query_fee_details(uxt: <Block as BlockT>::Extrinsic, len: u32) -> FeeDetails<Balance> {
2653 TransactionPayment::query_fee_details(uxt, len)
2654 }
2655 fn query_weight_to_fee(weight: Weight) -> Balance {
2656 TransactionPayment::weight_to_fee(weight)
2657 }
2658 fn query_length_to_fee(length: u32) -> Balance {
2659 TransactionPayment::length_to_fee(length)
2660 }
2661 }
2662
2663 impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentCallApi<Block, Balance, RuntimeCall>
2664 for Runtime
2665 {
2666 fn query_call_info(call: RuntimeCall, len: u32) -> RuntimeDispatchInfo<Balance> {
2667 TransactionPayment::query_call_info(call, len)
2668 }
2669 fn query_call_fee_details(call: RuntimeCall, len: u32) -> FeeDetails<Balance> {
2670 TransactionPayment::query_call_fee_details(call, len)
2671 }
2672 fn query_weight_to_fee(weight: Weight) -> Balance {
2673 TransactionPayment::weight_to_fee(weight)
2674 }
2675 fn query_length_to_fee(length: u32) -> Balance {
2676 TransactionPayment::length_to_fee(length)
2677 }
2678 }
2679
2680 impl xcm_runtime_apis::fees::XcmPaymentApi<Block> for Runtime {
2681 fn query_acceptable_payment_assets(xcm_version: xcm::Version) -> Result<Vec<VersionedAssetId>, XcmPaymentApiError> {
2682 let acceptable_assets = vec![AssetId(xcm_config::TokenLocation::get())];
2683 XcmPallet::query_acceptable_payment_assets(xcm_version, acceptable_assets)
2684 }
2685
2686 fn query_weight_to_asset_fee(weight: Weight, asset: VersionedAssetId) -> Result<u128, XcmPaymentApiError> {
2687 use crate::xcm_config::XcmConfig;
2688
2689 type Trader = <XcmConfig as xcm_executor::Config>::Trader;
2690
2691 XcmPallet::query_weight_to_asset_fee::<Trader>(weight, asset)
2692 }
2693
2694 fn query_xcm_weight(message: VersionedXcm<()>) -> Result<Weight, XcmPaymentApiError> {
2695 XcmPallet::query_xcm_weight(message)
2696 }
2697
2698 fn query_delivery_fees(destination: VersionedLocation, message: VersionedXcm<()>) -> Result<VersionedAssets, XcmPaymentApiError> {
2699 XcmPallet::query_delivery_fees(destination, message)
2700 }
2701 }
2702
2703 impl xcm_runtime_apis::dry_run::DryRunApi<Block, RuntimeCall, RuntimeEvent, OriginCaller> for Runtime {
2704 fn dry_run_call(origin: OriginCaller, call: RuntimeCall, result_xcms_version: XcmVersion) -> Result<CallDryRunEffects<RuntimeEvent>, XcmDryRunApiError> {
2705 XcmPallet::dry_run_call::<Runtime, xcm_config::XcmRouter, OriginCaller, RuntimeCall>(origin, call, result_xcms_version)
2706 }
2707
2708 fn dry_run_xcm(origin_location: VersionedLocation, xcm: VersionedXcm<RuntimeCall>) -> Result<XcmDryRunEffects<RuntimeEvent>, XcmDryRunApiError> {
2709 XcmPallet::dry_run_xcm::<Runtime, xcm_config::XcmRouter, RuntimeCall, xcm_config::XcmConfig>(origin_location, xcm)
2710 }
2711 }
2712
2713 impl xcm_runtime_apis::conversions::LocationToAccountApi<Block, AccountId> for Runtime {
2714 fn convert_location(location: VersionedLocation) -> Result<
2715 AccountId,
2716 xcm_runtime_apis::conversions::Error
2717 > {
2718 xcm_runtime_apis::conversions::LocationToAccountHelper::<
2719 AccountId,
2720 xcm_config::LocationConverter,
2721 >::convert_location(location)
2722 }
2723 }
2724
2725 impl pallet_nomination_pools_runtime_api::NominationPoolsApi<
2726 Block,
2727 AccountId,
2728 Balance,
2729 > for Runtime {
2730 fn pending_rewards(member: AccountId) -> Balance {
2731 NominationPools::api_pending_rewards(member).unwrap_or_default()
2732 }
2733
2734 fn points_to_balance(pool_id: PoolId, points: Balance) -> Balance {
2735 NominationPools::api_points_to_balance(pool_id, points)
2736 }
2737
2738 fn balance_to_points(pool_id: PoolId, new_funds: Balance) -> Balance {
2739 NominationPools::api_balance_to_points(pool_id, new_funds)
2740 }
2741
2742 fn pool_pending_slash(pool_id: PoolId) -> Balance {
2743 NominationPools::api_pool_pending_slash(pool_id)
2744 }
2745
2746 fn member_pending_slash(member: AccountId) -> Balance {
2747 NominationPools::api_member_pending_slash(member)
2748 }
2749
2750 fn pool_needs_delegate_migration(pool_id: PoolId) -> bool {
2751 NominationPools::api_pool_needs_delegate_migration(pool_id)
2752 }
2753
2754 fn member_needs_delegate_migration(member: AccountId) -> bool {
2755 NominationPools::api_member_needs_delegate_migration(member)
2756 }
2757
2758 fn member_total_balance(member: AccountId) -> Balance {
2759 NominationPools::api_member_total_balance(member)
2760 }
2761
2762 fn pool_balance(pool_id: PoolId) -> Balance {
2763 NominationPools::api_pool_balance(pool_id)
2764 }
2765
2766 fn pool_accounts(pool_id: PoolId) -> (AccountId, AccountId) {
2767 NominationPools::api_pool_accounts(pool_id)
2768 }
2769 }
2770
2771 impl pallet_staking_runtime_api::StakingApi<Block, Balance, AccountId> for Runtime {
2772 fn nominations_quota(balance: Balance) -> u32 {
2773 Staking::api_nominations_quota(balance)
2774 }
2775
2776 fn eras_stakers_page_count(era: sp_staking::EraIndex, account: AccountId) -> sp_staking::Page {
2777 Staking::api_eras_stakers_page_count(era, account)
2778 }
2779
2780 fn pending_rewards(era: sp_staking::EraIndex, account: AccountId) -> bool {
2781 Staking::api_pending_rewards(era, account)
2782 }
2783 }
2784
2785 #[cfg(feature = "try-runtime")]
2786 impl frame_try_runtime::TryRuntime<Block> for Runtime {
2787 fn on_runtime_upgrade(checks: frame_try_runtime::UpgradeCheckSelect) -> (Weight, Weight) {
2788 log::info!("try-runtime::on_runtime_upgrade westend.");
2789 let weight = Executive::try_runtime_upgrade(checks).unwrap();
2790 (weight, BlockWeights::get().max_block)
2791 }
2792
2793 fn execute_block(
2794 block: Block,
2795 state_root_check: bool,
2796 signature_check: bool,
2797 select: frame_try_runtime::TryStateSelect,
2798 ) -> Weight {
2799 Executive::try_execute_block(block, state_root_check, signature_check, select).unwrap()
2802 }
2803 }
2804
2805 #[cfg(feature = "runtime-benchmarks")]
2806 impl frame_benchmarking::Benchmark<Block> for Runtime {
2807 fn benchmark_metadata(extra: bool) -> (
2808 Vec<frame_benchmarking::BenchmarkList>,
2809 Vec<frame_support::traits::StorageInfo>,
2810 ) {
2811 use frame_benchmarking::BenchmarkList;
2812 use frame_support::traits::StorageInfoTrait;
2813
2814 use pallet_session_benchmarking::Pallet as SessionBench;
2815 use pallet_offences_benchmarking::Pallet as OffencesBench;
2816 use pallet_election_provider_support_benchmarking::Pallet as ElectionProviderBench;
2817 use pallet_xcm::benchmarking::Pallet as PalletXcmExtrinsicsBenchmark;
2818 use frame_system_benchmarking::Pallet as SystemBench;
2819 use frame_system_benchmarking::extensions::Pallet as SystemExtensionsBench;
2820 use pallet_nomination_pools_benchmarking::Pallet as NominationPoolsBench;
2821
2822 type XcmBalances = pallet_xcm_benchmarks::fungible::Pallet::<Runtime>;
2823 type XcmGeneric = pallet_xcm_benchmarks::generic::Pallet::<Runtime>;
2824
2825 let mut list = Vec::<BenchmarkList>::new();
2826 list_benchmarks!(list, extra);
2827
2828 let storage_info = AllPalletsWithSystem::storage_info();
2829 return (list, storage_info)
2830 }
2831
2832 #[allow(non_local_definitions)]
2833 fn dispatch_benchmark(
2834 config: frame_benchmarking::BenchmarkConfig,
2835 ) -> Result<
2836 Vec<frame_benchmarking::BenchmarkBatch>,
2837 alloc::string::String,
2838 > {
2839 use frame_support::traits::WhitelistedStorageKeys;
2840 use frame_benchmarking::{BenchmarkBatch, BenchmarkError};
2841 use sp_storage::TrackedStorageKey;
2842 use pallet_session_benchmarking::Pallet as SessionBench;
2845 use pallet_offences_benchmarking::Pallet as OffencesBench;
2846 use pallet_election_provider_support_benchmarking::Pallet as ElectionProviderBench;
2847 use pallet_xcm::benchmarking::Pallet as PalletXcmExtrinsicsBenchmark;
2848 use frame_system_benchmarking::Pallet as SystemBench;
2849 use frame_system_benchmarking::extensions::Pallet as SystemExtensionsBench;
2850 use pallet_nomination_pools_benchmarking::Pallet as NominationPoolsBench;
2851
2852 impl pallet_session_benchmarking::Config for Runtime {}
2853 impl pallet_offences_benchmarking::Config for Runtime {}
2854 impl pallet_election_provider_support_benchmarking::Config for Runtime {}
2855
2856 use xcm_config::{AssetHub, TokenLocation};
2857
2858 use alloc::boxed::Box;
2859
2860 parameter_types! {
2861 pub ExistentialDepositAsset: Option<Asset> = Some((
2862 TokenLocation::get(),
2863 ExistentialDeposit::get()
2864 ).into());
2865 pub AssetHubParaId: ParaId = westend_runtime_constants::system_parachain::ASSET_HUB_ID.into();
2866 pub const RandomParaId: ParaId = ParaId::new(43211234);
2867 }
2868
2869 impl pallet_xcm::benchmarking::Config for Runtime {
2870 type DeliveryHelper = (
2871 polkadot_runtime_common::xcm_sender::ToParachainDeliveryHelper<
2872 xcm_config::XcmConfig,
2873 ExistentialDepositAsset,
2874 xcm_config::PriceForChildParachainDelivery,
2875 AssetHubParaId,
2876 Dmp,
2877 >,
2878 polkadot_runtime_common::xcm_sender::ToParachainDeliveryHelper<
2879 xcm_config::XcmConfig,
2880 ExistentialDepositAsset,
2881 xcm_config::PriceForChildParachainDelivery,
2882 RandomParaId,
2883 Dmp,
2884 >
2885 );
2886
2887 fn reachable_dest() -> Option<Location> {
2888 Some(crate::xcm_config::AssetHub::get())
2889 }
2890
2891 fn teleportable_asset_and_dest() -> Option<(Asset, Location)> {
2892 Some((
2894 Asset { fun: Fungible(ExistentialDeposit::get()), id: AssetId(Here.into()) },
2895 crate::xcm_config::AssetHub::get(),
2896 ))
2897 }
2898
2899 fn reserve_transferable_asset_and_dest() -> Option<(Asset, Location)> {
2900 None
2901 }
2902
2903 fn set_up_complex_asset_transfer(
2904 ) -> Option<(Assets, u32, Location, Box<dyn FnOnce()>)> {
2905 let native_location = Here.into();
2911 let dest = crate::xcm_config::AssetHub::get();
2912 pallet_xcm::benchmarking::helpers::native_teleport_as_asset_transfer::<Runtime>(
2913 native_location,
2914 dest
2915 )
2916 }
2917
2918 fn get_asset() -> Asset {
2919 Asset {
2920 id: AssetId(Location::here()),
2921 fun: Fungible(ExistentialDeposit::get()),
2922 }
2923 }
2924 }
2925 impl frame_system_benchmarking::Config for Runtime {}
2926 impl pallet_nomination_pools_benchmarking::Config for Runtime {}
2927 impl polkadot_runtime_parachains::disputes::slashing::benchmarking::Config for Runtime {}
2928
2929 use xcm::latest::{
2930 AssetId, Fungibility::*, InteriorLocation, Junction, Junctions::*,
2931 Asset, Assets, Location, NetworkId, Response,
2932 };
2933
2934 impl pallet_xcm_benchmarks::Config for Runtime {
2935 type XcmConfig = xcm_config::XcmConfig;
2936 type AccountIdConverter = xcm_config::LocationConverter;
2937 type DeliveryHelper = polkadot_runtime_common::xcm_sender::ToParachainDeliveryHelper<
2938 xcm_config::XcmConfig,
2939 ExistentialDepositAsset,
2940 xcm_config::PriceForChildParachainDelivery,
2941 AssetHubParaId,
2942 Dmp,
2943 >;
2944 fn valid_destination() -> Result<Location, BenchmarkError> {
2945 Ok(AssetHub::get())
2946 }
2947 fn worst_case_holding(_depositable_count: u32) -> Assets {
2948 vec![Asset{
2950 id: AssetId(TokenLocation::get()),
2951 fun: Fungible(1_000_000 * UNITS),
2952 }].into()
2953 }
2954 }
2955
2956 parameter_types! {
2957 pub TrustedTeleporter: Option<(Location, Asset)> = Some((
2958 AssetHub::get(),
2959 Asset { fun: Fungible(1 * UNITS), id: AssetId(TokenLocation::get()) },
2960 ));
2961 pub const TrustedReserve: Option<(Location, Asset)> = None;
2962 }
2963
2964 impl pallet_xcm_benchmarks::fungible::Config for Runtime {
2965 type TransactAsset = Balances;
2966
2967 type CheckedAccount = xcm_config::LocalCheckAccount;
2968 type TrustedTeleporter = TrustedTeleporter;
2969 type TrustedReserve = TrustedReserve;
2970
2971 fn get_asset() -> Asset {
2972 Asset {
2973 id: AssetId(TokenLocation::get()),
2974 fun: Fungible(1 * UNITS),
2975 }
2976 }
2977 }
2978
2979 impl pallet_xcm_benchmarks::generic::Config for Runtime {
2980 type TransactAsset = Balances;
2981 type RuntimeCall = RuntimeCall;
2982
2983 fn worst_case_response() -> (u64, Response) {
2984 (0u64, Response::Version(Default::default()))
2985 }
2986
2987 fn worst_case_asset_exchange() -> Result<(Assets, Assets), BenchmarkError> {
2988 Err(BenchmarkError::Skip)
2990 }
2991
2992 fn universal_alias() -> Result<(Location, Junction), BenchmarkError> {
2993 Err(BenchmarkError::Skip)
2995 }
2996
2997 fn transact_origin_and_runtime_call() -> Result<(Location, RuntimeCall), BenchmarkError> {
2998 Ok((AssetHub::get(), frame_system::Call::remark_with_event { remark: vec![] }.into()))
2999 }
3000
3001 fn subscribe_origin() -> Result<Location, BenchmarkError> {
3002 Ok(AssetHub::get())
3003 }
3004
3005 fn claimable_asset() -> Result<(Location, Location, Assets), BenchmarkError> {
3006 let origin = AssetHub::get();
3007 let assets: Assets = (AssetId(TokenLocation::get()), 1_000 * UNITS).into();
3008 let ticket = Location { parents: 0, interior: Here };
3009 Ok((origin, ticket, assets))
3010 }
3011
3012 fn worst_case_for_trader() -> Result<(Asset, WeightLimit), BenchmarkError> {
3013 Ok((Asset {
3014 id: AssetId(TokenLocation::get()),
3015 fun: Fungible(1_000_000 * UNITS),
3016 }, WeightLimit::Limited(Weight::from_parts(5000, 5000))))
3017 }
3018
3019 fn unlockable_asset() -> Result<(Location, Location, Asset), BenchmarkError> {
3020 Err(BenchmarkError::Skip)
3022 }
3023
3024 fn export_message_origin_and_destination(
3025 ) -> Result<(Location, NetworkId, InteriorLocation), BenchmarkError> {
3026 Err(BenchmarkError::Skip)
3028 }
3029
3030 fn alias_origin() -> Result<(Location, Location), BenchmarkError> {
3031 let origin = Location::new(0, [Parachain(1000)]);
3032 let target = Location::new(0, [Parachain(1000), AccountId32 { id: [128u8; 32], network: None }]);
3033 Ok((origin, target))
3034 }
3035 }
3036
3037 type XcmBalances = pallet_xcm_benchmarks::fungible::Pallet::<Runtime>;
3038 type XcmGeneric = pallet_xcm_benchmarks::generic::Pallet::<Runtime>;
3039
3040 let whitelist: Vec<TrackedStorageKey> = AllPalletsWithSystem::whitelisted_storage_keys();
3041
3042 let mut batches = Vec::<BenchmarkBatch>::new();
3043 let params = (&config, &whitelist);
3044
3045 add_benchmarks!(params, batches);
3046
3047 Ok(batches)
3048 }
3049 }
3050
3051 impl sp_genesis_builder::GenesisBuilder<Block> for Runtime {
3052 fn build_state(config: Vec<u8>) -> sp_genesis_builder::Result {
3053 build_state::<RuntimeGenesisConfig>(config)
3054 }
3055
3056 fn get_preset(id: &Option<sp_genesis_builder::PresetId>) -> Option<Vec<u8>> {
3057 get_preset::<RuntimeGenesisConfig>(id, &genesis_config_presets::get_preset)
3058 }
3059
3060 fn preset_names() -> Vec<sp_genesis_builder::PresetId> {
3061 genesis_config_presets::preset_names()
3062 }
3063 }
3064
3065 impl xcm_runtime_apis::trusted_query::TrustedQueryApi<Block> for Runtime {
3066 fn is_trusted_reserve(asset: VersionedAsset, location: VersionedLocation) -> Result<bool, xcm_runtime_apis::trusted_query::Error> {
3067 XcmPallet::is_trusted_reserve(asset, location)
3068 }
3069 fn is_trusted_teleporter(asset: VersionedAsset, location: VersionedLocation) -> Result<bool, xcm_runtime_apis::trusted_query::Error> {
3070 XcmPallet::is_trusted_teleporter(asset, location)
3071 }
3072 }
3073}