1#![cfg_attr(not(feature = "std"), no_std)]
18#![recursion_limit = "256"]
19
20#[cfg(feature = "std")]
22include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs"));
23
24extern crate alloc;
25
26mod genesis_config_presets;
27mod xcm_config;
28
29use crate::xcm_config::{RelayLocation, XcmOriginToTransactDispatchOrigin};
30
31pub use pezkuwi_sdk::{teyrchain_info, *};
32use pezpallet_xcm::{EnsureXcm, IsVoiceOfBody};
33
34use pezcumulus_primitives_core::ParaId;
35use pezkuwi_runtime_common::{prod_or_fast, xcm_sender::NoPriceForMessageDelivery};
36use teyrchains_common::message_queue::{NarrowOriginToSibling, ParaIdToSibling};
37
38use alloc::{borrow::Cow, vec, vec::Vec};
39use pezcumulus_pezpallet_teyrchain_system::RelayNumberMonotonicallyIncreases;
40use pezframe_support::weights::{constants, FixedFee, RuntimeDbWeight};
41use pezsp_api::impl_runtime_apis;
42use pezsp_core::OpaqueMetadata;
43use pezsp_runtime::{
44 generic, impl_opaque_keys,
45 traits::{AccountIdLookup, BlakeTwo256, Block as BlockT, Hash as HashT},
46 transaction_validity::{TransactionSource, TransactionValidity},
47 ApplyExtrinsicResult, MultiSignature, MultiSigner,
48};
49#[cfg(feature = "std")]
50use pezsp_version::NativeVersion;
51use pezsp_version::RuntimeVersion;
52
53pub use pezframe_support::{
55 construct_runtime, derive_impl,
56 dispatch::DispatchClass,
57 genesis_builder_helper::{build_state, get_preset},
58 parameter_types,
59 traits::{
60 AsEnsureOriginWithArg, ConstBool, ConstU32, ConstU64, ConstU8, Contains, EitherOfDiverse,
61 Everything, HandleMessage, IsInVec, Nothing, QueueFootprint, Randomness, TransformOrigin,
62 },
63 weights::{
64 constants::{BlockExecutionWeight, WEIGHT_REF_TIME_PER_SECOND},
65 ConstantMultiplier, IdentityFee, Weight, WeightToFeeCoefficient, WeightToFeeCoefficients,
66 WeightToFeePolynomial,
67 },
68 BoundedSlice, PalletId, StorageValue,
69};
70use pezframe_system::{
71 limits::{BlockLength, BlockWeights},
72 EnsureRoot,
73};
74pub use pezpallet_balances::Call as BalancesCall;
75pub use pezpallet_timestamp::Call as TimestampCall;
76pub use pezsp_consensus_aura::sr25519::AuthorityId as AuraId;
77#[cfg(any(feature = "std", test))]
78pub use pezsp_runtime::BuildStorage;
79pub use pezsp_runtime::{Perbill, Permill};
80
81use pezcumulus_primitives_core::AggregateMessageOrigin; use xcm::latest::prelude::BodyId;
83use teyrchains_common::{AccountId, Signature};
84
85pub type SessionHandlers = ();
86
87impl_opaque_keys! {
88 pub struct SessionKeys {
89 pub aura: Aura,
90 }
91}
92
93#[pezsp_version::runtime_version]
95pub const VERSION: RuntimeVersion = RuntimeVersion {
96 spec_name: Cow::Borrowed("yet-another-teyrchain"),
97 impl_name: Cow::Borrowed("yet-another-teyrchain"),
98 authoring_version: 1,
99 spec_version: 1_003_000,
100 impl_version: 0,
101 apis: RUNTIME_API_VERSIONS,
102 transaction_version: 6,
103 system_version: 1,
104};
105
106pub const MILLISECS_PER_BLOCK: u64 = 2000;
107
108pub const SLOT_DURATION: u64 = 3 * MILLISECS_PER_BLOCK;
109
110pub const EPOCH_DURATION_IN_BLOCKS: u32 = 10 * MINUTES;
111
112pub const MINUTES: BlockNumber = 60_000 / (MILLISECS_PER_BLOCK as BlockNumber);
114pub const HOURS: BlockNumber = MINUTES * 60;
115pub const DAYS: BlockNumber = HOURS * 24;
116
117pub const YAP: Balance = 1_000_000_000_000;
118pub const NANOYAP: Balance = 1_000;
119
120#[cfg(feature = "std")]
122pub fn native_version() -> NativeVersion {
123 NativeVersion { runtime_version: VERSION, can_author_with: Default::default() }
124}
125
126const AVERAGE_ON_INITIALIZE_RATIO: Perbill = Perbill::from_percent(10);
129const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(95);
132const MAXIMUM_BLOCK_WEIGHT: Weight = Weight::from_parts(
134 WEIGHT_REF_TIME_PER_SECOND.saturating_mul(2),
135 pezcumulus_primitives_core::relay_chain::MAX_POV_SIZE as u64,
136);
137
138const UNINCLUDED_SEGMENT_CAPACITY: u32 = 10;
141
142const RELAY_PARENT_OFFSET: u32 = 1;
144
145const BLOCK_PROCESSING_VELOCITY: u32 = 3;
148const RELAY_CHAIN_SLOT_DURATION_MILLIS: u32 = 6000;
150
151parameter_types! {
152 pub const BlockHashCount: BlockNumber = 250;
153 pub const Version: RuntimeVersion = VERSION;
154 pub RuntimeBlockLength: BlockLength =
155 BlockLength::max_with_normal_ratio(5 * 1024 * 1024, NORMAL_DISPATCH_RATIO);
156 pub RuntimeBlockWeights: BlockWeights = BlockWeights::builder()
157 .base_block(BlockExecutionWeight::get())
158 .for_class(DispatchClass::all(), |weights| {
159 weights.base_extrinsic = <pezpallet_verify_signature::weights::BizinikiwiWeight::<Runtime> as pezpallet_verify_signature::WeightInfo>::verify_signature();
160 })
161 .for_class(DispatchClass::Normal, |weights| {
162 weights.max_total = Some(NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT);
163 })
164 .for_class(DispatchClass::Operational, |weights| {
165 weights.max_total = Some(MAXIMUM_BLOCK_WEIGHT);
166 weights.reserved = Some(
169 MAXIMUM_BLOCK_WEIGHT - NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT
170 );
171 })
172 .avg_block_initialization(AVERAGE_ON_INITIALIZE_RATIO)
173 .build_or_panic();
174 pub const SS58Prefix: u8 = 42;
175 pub const InMemoryDbWeight: RuntimeDbWeight = RuntimeDbWeight {
178 read: 9_000 * constants::WEIGHT_REF_TIME_PER_NANOS,
179 write: 28_000 * constants::WEIGHT_REF_TIME_PER_NANOS,
180 };
181}
182
183#[derive_impl(pezframe_system::config_preludes::TestDefaultConfig)]
184impl pezframe_system::Config for Runtime {
185 type AccountId = AccountId;
187 type RuntimeCall = RuntimeCall;
189 type Lookup = AccountIdLookup<AccountId, ()>;
191 type Nonce = Nonce;
193 type Hash = Hash;
195 type Hashing = BlakeTwo256;
197 type Block = Block;
199 type RuntimeEvent = RuntimeEvent;
201 type RuntimeOrigin = RuntimeOrigin;
203 type BlockHashCount = BlockHashCount;
205 type Version = Version;
207 type PalletInfo = PalletInfo;
209 type AccountData = pezpallet_balances::AccountData<Balance>;
210 type OnNewAccount = ();
211 type OnKilledAccount = ();
212 type DbWeight = InMemoryDbWeight;
213 type BaseCallFilter = pezframe_support::traits::Everything;
214 type SystemWeightInfo = pezframe_system::weights::BizinikiwiWeight<Self>;
215 type ExtensionsWeightInfo = pezframe_system::BizinikiwiExtensionsWeight<Self>;
216 type BlockWeights = RuntimeBlockWeights;
217 type BlockLength = RuntimeBlockLength;
218 type SS58Prefix = SS58Prefix;
219 type OnSetCode = pezcumulus_pezpallet_teyrchain_system::TeyrchainSetCode<Self>;
220 type MaxConsumers = pezframe_support::traits::ConstU32<16>;
221 type SingleBlockMigrations = RemoveCollectiveFlip;
222}
223
224impl pezcumulus_pezpallet_weight_reclaim::Config for Runtime {
225 type WeightInfo = ();
226}
227
228impl pezpallet_timestamp::Config for Runtime {
229 type Moment = u64;
231 type OnTimestampSet = Aura;
232 type MinimumPeriod = ConstU64<0>;
233 type WeightInfo = pezpallet_timestamp::weights::BizinikiwiWeight<Self>;
234}
235
236parameter_types! {
237 pub const Period: u32 = prod_or_fast!(10 * MINUTES, 10);
238 pub const Offset: u32 = 0;
239}
240
241impl pezpallet_session::Config for Runtime {
242 type RuntimeEvent = RuntimeEvent;
243 type ValidatorId = <Self as pezframe_system::Config>::AccountId;
244 type ValidatorIdOf = pezpallet_collator_selection::IdentityCollator;
245 type ShouldEndSession = pezpallet_session::PeriodicSessions<Period, Offset>;
246 type NextSessionRotation = pezpallet_session::PeriodicSessions<Period, Offset>;
247 type SessionManager = CollatorSelection;
248 type SessionHandler = <SessionKeys as pezsp_runtime::traits::OpaqueKeys>::KeyTypeIdProviders;
250 type Keys = SessionKeys;
251 type DisablingStrategy = ();
252 type WeightInfo = ();
253 type Currency = Balances;
254 type KeyDeposit = ();
255}
256
257parameter_types! {
258 pub const PotId: PalletId = PalletId(*b"PotStake");
259 pub const SessionLength: BlockNumber = prod_or_fast!(10 * MINUTES, 10);
260 pub const StakingAdminBodyId: BodyId = BodyId::Defense;
262}
263
264pub type CollatorSelectionUpdateOrigin = EitherOfDiverse<
266 EnsureRoot<AccountId>,
267 EnsureXcm<IsVoiceOfBody<RelayLocation, StakingAdminBodyId>>,
268>;
269
270impl pezpallet_collator_selection::Config for Runtime {
271 type RuntimeEvent = RuntimeEvent;
272 type Currency = Balances;
273 type UpdateOrigin = CollatorSelectionUpdateOrigin;
274 type PotId = PotId;
275 type MaxCandidates = ConstU32<100>;
276 type MinEligibleCollators = ConstU32<4>;
277 type MaxInvulnerables = ConstU32<20>;
278 type KickThreshold = Period;
280 type ValidatorId = <Self as pezframe_system::Config>::AccountId;
281 type ValidatorIdOf = pezpallet_collator_selection::IdentityCollator;
282 type ValidatorRegistration = Session;
283 type WeightInfo = ();
284}
285
286parameter_types! {
287 pub const ExistentialDeposit: u128 = NANOYAP;
288 pub const TransactionByteFee: u128 = NANOYAP;
289}
290
291impl pezpallet_balances::Config for Runtime {
292 type Balance = Balance;
294 type DustRemoval = ();
295 type RuntimeEvent = RuntimeEvent;
297 type ExistentialDeposit = ExistentialDeposit;
298 type AccountStore = System;
299 type WeightInfo = pezpallet_balances::weights::BizinikiwiWeight<Self>;
300 type MaxLocks = ConstU32<50>;
301 type MaxReserves = ConstU32<50>;
302 type ReserveIdentifier = [u8; 8];
303 type RuntimeHoldReason = RuntimeHoldReason;
304 type RuntimeFreezeReason = RuntimeFreezeReason;
305 type FreezeIdentifier = ();
306 type MaxFreezes = ConstU32<0>;
307 type DoneSlashHandler = ();
308}
309
310impl pezpallet_transaction_payment::Config for Runtime {
311 type RuntimeEvent = RuntimeEvent;
312 type OnChargeTransaction = pezpallet_transaction_payment::FungibleAdapter<Balances, ()>;
313 type WeightToFee = FixedFee<1, <Self as pezpallet_balances::Config>::Balance>;
314 type LengthToFee = ConstantMultiplier<Balance, TransactionByteFee>;
315 type FeeMultiplierUpdate = ();
316 type OperationalFeeMultiplier = ConstU8<5>;
317 type WeightInfo = pezpallet_transaction_payment::weights::BizinikiwiWeight<Self>;
318}
319
320impl pezpallet_sudo::Config for Runtime {
321 type RuntimeCall = RuntimeCall;
322 type RuntimeEvent = RuntimeEvent;
323 type WeightInfo = pezpallet_sudo::weights::BizinikiwiWeight<Runtime>;
324}
325
326parameter_types! {
327 pub const ReservedXcmpWeight: Weight = MAXIMUM_BLOCK_WEIGHT.saturating_div(4);
328 pub const ReservedDmpWeight: Weight = MAXIMUM_BLOCK_WEIGHT.saturating_div(4);
329 pub const RelayOrigin: AggregateMessageOrigin = AggregateMessageOrigin::Parent;
330}
331
332type ConsensusHook = pezcumulus_pezpallet_aura_ext::FixedVelocityConsensusHook<
333 Runtime,
334 RELAY_CHAIN_SLOT_DURATION_MILLIS,
335 BLOCK_PROCESSING_VELOCITY,
336 UNINCLUDED_SEGMENT_CAPACITY,
337>;
338
339pub struct DmpSink;
340impl HandleMessage for DmpSink {
341 type MaxMessageLen = ConstU32<16>;
342
343 fn handle_message(_msg: BoundedSlice<u8, Self::MaxMessageLen>) {}
344
345 fn handle_messages<'a>(_: impl Iterator<Item = BoundedSlice<'a, u8, Self::MaxMessageLen>>) {
346 unimplemented!()
347 }
348
349 fn sweep_queue() {
350 unimplemented!()
351 }
352}
353
354impl pezcumulus_pezpallet_teyrchain_system::Config for Runtime {
355 type WeightInfo = pezcumulus_pezpallet_teyrchain_system::weights::BizinikiwiWeight<Self>;
356 type RuntimeEvent = RuntimeEvent;
357 type OnSystemEvent = ();
358 type SelfParaId = teyrchain_info::Pezpallet<Runtime>;
359 type OutboundXcmpMessageSource = XcmpQueue;
360 type DmpQueue = pezframe_support::traits::EnqueueWithOrigin<MessageQueue, RelayOrigin>;
361 type ReservedDmpWeight = ReservedDmpWeight;
362 type XcmpMessageHandler = XcmpQueue;
363 type ReservedXcmpWeight = ReservedXcmpWeight;
364 type CheckAssociatedRelayNumber = RelayNumberMonotonicallyIncreases;
365 type ConsensusHook = ConsensusHook;
366 type RelayParentOffset = ConstU32<RELAY_PARENT_OFFSET>;
367}
368
369impl pezpallet_message_queue::Config for Runtime {
370 type RuntimeEvent = RuntimeEvent;
371 type WeightInfo = ();
372 type MessageProcessor = xcm_builder::ProcessXcmMessage<
373 AggregateMessageOrigin,
374 xcm_executor::XcmExecutor<xcm_config::XcmConfig>,
375 RuntimeCall,
376 >;
377 type Size = u32;
378 type QueueChangeHandler = NarrowOriginToSibling<XcmpQueue>;
380 type QueuePausedQuery = NarrowOriginToSibling<XcmpQueue>;
381 type HeapSize = pezsp_core::ConstU32<{ 103 * 1024 }>;
382 type MaxStale = pezsp_core::ConstU32<8>;
383 type ServiceWeight = MessageQueueServiceWeight;
384 type IdleMaxServiceWeight = ();
385}
386parameter_types! {
387 pub MessageQueueServiceWeight: Weight = Perbill::from_percent(35) * RuntimeBlockWeights::get().max_block;
388}
389
390impl pezpallet_authorship::Config for Runtime {
391 type FindAuthor = ();
392 type EventHandler = ();
393}
394
395pub struct WeightToFee;
396impl WeightToFeePolynomial for WeightToFee {
397 type Balance = Balance;
398 fn polynomial() -> WeightToFeeCoefficients<Self::Balance> {
399 let p = YAP / 10;
402 let q = 100
403 * Balance::from(
404 pezframe_support::weights::constants::ExtrinsicBaseWeight::get().ref_time(),
405 );
406 vec![WeightToFeeCoefficient {
407 degree: 1,
408 negative: false,
409 coeff_frac: Perbill::from_rational(p % q, q),
410 coeff_integer: p / q,
411 }]
412 .into()
413 }
414}
415
416impl pezcumulus_pezpallet_xcmp_queue::Config for Runtime {
417 type RuntimeEvent = RuntimeEvent;
418 type ChannelInfo = TeyrchainSystem;
419 type VersionWrapper = ();
420 type XcmpQueue = TransformOrigin<MessageQueue, AggregateMessageOrigin, ParaId, ParaIdToSibling>;
422 type MaxInboundSuspended = pezsp_core::ConstU32<1_000>;
423 type MaxActiveOutboundChannels = ConstU32<128>;
424 type MaxPageSize = ConstU32<{ 1 << 16 }>;
425 type ControllerOrigin = EnsureRoot<AccountId>;
426 type ControllerOriginConverter = XcmOriginToTransactDispatchOrigin;
427 type WeightInfo = ();
428 type PriceForSiblingDelivery = NoPriceForMessageDelivery<ParaId>;
429}
430
431impl teyrchain_info::Config for Runtime {}
432
433impl pezcumulus_pezpallet_aura_ext::Config for Runtime {}
434
435impl pezpallet_aura::Config for Runtime {
436 type AuthorityId = AuraId;
437 type DisabledValidators = ();
438 type MaxAuthorities = ConstU32<100_000>;
439 type AllowMultipleBlocksPerSlot = ConstBool<true>;
440 type SlotDuration = ConstU64<SLOT_DURATION>;
441}
442
443impl pezpallet_utility::Config for Runtime {
444 type RuntimeEvent = RuntimeEvent;
445 type RuntimeCall = RuntimeCall;
446 type PalletsOrigin = OriginCaller;
447 type WeightInfo = ();
448}
449
450#[cfg(feature = "runtime-benchmarks")]
451pub struct VerifySignatureBenchmarkHelper;
452#[cfg(feature = "runtime-benchmarks")]
453impl pezpallet_verify_signature::BenchmarkHelper<MultiSignature, AccountId>
454 for VerifySignatureBenchmarkHelper
455{
456 fn create_signature(_entropy: &[u8], msg: &[u8]) -> (MultiSignature, AccountId) {
457 use pezsp_io::crypto::{sr25519_generate, sr25519_sign};
458 use pezsp_runtime::traits::IdentifyAccount;
459 let public = sr25519_generate(0.into(), None);
460 let who_account: AccountId = MultiSigner::Sr25519(public).into_account().into();
461 let signature = MultiSignature::Sr25519(sr25519_sign(0.into(), &public, msg).unwrap());
462 (signature, who_account)
463 }
464}
465
466impl pezpallet_verify_signature::Config for Runtime {
467 type Signature = MultiSignature;
468 type AccountIdentifier = MultiSigner;
469 type WeightInfo = pezpallet_verify_signature::weights::BizinikiwiWeight<Runtime>;
470 #[cfg(feature = "runtime-benchmarks")]
471 type BenchmarkHelper = VerifySignatureBenchmarkHelper;
472}
473
474#[pezframe_support::runtime]
475mod runtime {
476 #[runtime::runtime]
477 #[runtime::derive(
478 RuntimeCall,
479 RuntimeEvent,
480 RuntimeError,
481 RuntimeOrigin,
482 RuntimeFreezeReason,
483 RuntimeHoldReason,
484 RuntimeSlashReason,
485 RuntimeLockId,
486 RuntimeTask,
487 RuntimeViewFunction
488 )]
489 pub struct Runtime;
490
491 #[runtime::pezpallet_index(0)]
492 pub type System = pezframe_system;
493 #[runtime::pezpallet_index(1)]
494 pub type Timestamp = pezpallet_timestamp;
495 #[runtime::pezpallet_index(2)]
496 pub type Sudo = pezpallet_sudo;
497 #[runtime::pezpallet_index(3)]
498 pub type TransactionPayment = pezpallet_transaction_payment;
499 #[runtime::pezpallet_index(4)]
500 pub type WeightReclaim = pezcumulus_pezpallet_weight_reclaim;
501
502 #[runtime::pezpallet_index(20)]
503 pub type TeyrchainSystem = pezcumulus_pezpallet_teyrchain_system;
504 #[runtime::pezpallet_index(21)]
505 pub type TeyrchainInfo = teyrchain_info;
506
507 #[runtime::pezpallet_index(25)]
508 pub type Authorship = pezpallet_authorship;
509 #[runtime::pezpallet_index(26)]
510 pub type CollatorSelection = pezpallet_collator_selection;
511 #[runtime::pezpallet_index(27)]
512 pub type Session = pezpallet_session;
513
514 #[runtime::pezpallet_index(30)]
515 pub type Balances = pezpallet_balances;
516
517 #[runtime::pezpallet_index(31)]
518 pub type Aura = pezpallet_aura;
519 #[runtime::pezpallet_index(32)]
520 pub type AuraExt = pezcumulus_pezpallet_aura_ext;
521
522 #[runtime::pezpallet_index(40)]
523 pub type Utility = pezpallet_utility;
524 #[runtime::pezpallet_index(41)]
525 pub type VerifySignature = pezpallet_verify_signature;
526
527 #[runtime::pezpallet_index(51)]
528 pub type XcmpQueue = pezcumulus_pezpallet_xcmp_queue;
529 #[runtime::pezpallet_index(52)]
530 pub type PezkuwiXcm = pezpallet_xcm;
531 #[runtime::pezpallet_index(53)]
532 pub type CumulusXcm = pezcumulus_pezpallet_xcm;
533 #[runtime::pezpallet_index(54)]
534 pub type MessageQueue = pezpallet_message_queue;
535}
536
537pub type Balance = u128;
539pub type Nonce = u32;
541pub type Hash = <BlakeTwo256 as HashT>::Output;
543pub type BlockNumber = u32;
545pub type Address = pezsp_runtime::MultiAddress<AccountId, ()>;
547pub type Header = generic::Header<BlockNumber, BlakeTwo256>;
549pub type Block = generic::Block<Header, UncheckedExtrinsic>;
551pub type SignedBlock = generic::SignedBlock<Block>;
553pub type BlockId = generic::BlockId<Block>;
555pub type TxExtension = pezcumulus_pezpallet_weight_reclaim::StorageWeightReclaim<
557 Runtime,
558 (
559 pezframe_system::CheckNonZeroSender<Runtime>,
562 pezframe_system::CheckSpecVersion<Runtime>,
563 pezframe_system::CheckTxVersion<Runtime>,
564 pezframe_system::CheckGenesis<Runtime>,
565 pezframe_system::CheckEra<Runtime>,
566 pezframe_system::CheckNonce<Runtime>,
567 pezframe_system::CheckWeight<Runtime>,
568 pezpallet_transaction_payment::ChargeTransactionPayment<Runtime>,
569 ),
570>;
571pub type UncheckedExtrinsic =
573 generic::UncheckedExtrinsic<Address, RuntimeCall, Signature, TxExtension>;
574pub type Executive = pezframe_executive::Executive<
576 Runtime,
577 Block,
578 pezframe_system::ChainContext<Runtime>,
579 Runtime,
580 AllPalletsWithSystem,
581>;
582
583pub struct RemoveCollectiveFlip;
584impl pezframe_support::traits::OnRuntimeUpgrade for RemoveCollectiveFlip {
585 fn on_runtime_upgrade() -> Weight {
586 use pezframe_support::storage::migration;
587 #[allow(deprecated)]
590 migration::remove_storage_prefix(b"RandomnessCollectiveFlip", b"RandomMaterial", b"");
591 <Runtime as pezframe_system::Config>::DbWeight::get().writes(1)
592 }
593}
594
595impl_runtime_apis! {
596 impl pezsp_api::Core<Block> for Runtime {
597 fn version() -> RuntimeVersion {
598 VERSION
599 }
600
601 fn execute_block(block: <Block as BlockT>::LazyBlock) {
602 Executive::execute_block(block);
603 }
604
605 fn initialize_block(header: &<Block as BlockT>::Header) -> pezsp_runtime::ExtrinsicInclusionMode {
606 Executive::initialize_block(header)
607 }
608 }
609
610 impl pezsp_api::Metadata<Block> for Runtime {
611 fn metadata() -> OpaqueMetadata {
612 OpaqueMetadata::new(Runtime::metadata().into())
613 }
614
615 fn metadata_at_version(version: u32) -> Option<OpaqueMetadata> {
616 Runtime::metadata_at_version(version)
617 }
618
619 fn metadata_versions() -> alloc::vec::Vec<u32> {
620 Runtime::metadata_versions()
621 }
622 }
623
624 impl pezsp_block_builder::BlockBuilder<Block> for Runtime {
625 fn apply_extrinsic(
626 extrinsic: <Block as BlockT>::Extrinsic,
627 ) -> ApplyExtrinsicResult {
628 Executive::apply_extrinsic(extrinsic)
629 }
630
631 fn finalize_block() -> <Block as BlockT>::Header {
632 Executive::finalize_block()
633 }
634
635 fn inherent_extrinsics(data: pezsp_inherents::InherentData) -> Vec<<Block as BlockT>::Extrinsic> {
636 data.create_extrinsics()
637 }
638
639 fn check_inherents(block: <Block as BlockT>::LazyBlock, data: pezsp_inherents::InherentData) -> pezsp_inherents::CheckInherentsResult {
640 data.check_extrinsics(&block)
641 }
642 }
643
644 impl pezsp_transaction_pool::runtime_api::TaggedTransactionQueue<Block> for Runtime {
645 fn validate_transaction(
646 source: TransactionSource,
647 tx: <Block as BlockT>::Extrinsic,
648 block_hash: <Block as BlockT>::Hash,
649 ) -> TransactionValidity {
650 Executive::validate_transaction(source, tx, block_hash)
651 }
652 }
653
654 impl pezsp_offchain::OffchainWorkerApi<Block> for Runtime {
655 fn offchain_worker(header: &<Block as BlockT>::Header) {
656 Executive::offchain_worker(header)
657 }
658 }
659
660 impl pezsp_session::SessionKeys<Block> for Runtime {
661 fn decode_session_keys(
662 encoded: Vec<u8>,
663 ) -> Option<Vec<(Vec<u8>, pezsp_core::crypto::KeyTypeId)>> {
664 SessionKeys::decode_into_raw_public_keys(&encoded)
665 }
666
667 fn generate_session_keys(seed: Option<Vec<u8>>) -> Vec<u8> {
668 SessionKeys::generate(seed)
669 }
670 }
671
672 impl pezsp_consensus_aura::AuraApi<Block, AuraId> for Runtime {
673 fn slot_duration() -> pezsp_consensus_aura::SlotDuration {
674 pezsp_consensus_aura::SlotDuration::from_millis(Aura::slot_duration())
675 }
676
677 fn authorities() -> Vec<AuraId> {
678 pezpallet_aura::Authorities::<Runtime>::get().into_inner()
679 }
680 }
681
682 impl pezframe_system_rpc_runtime_api::AccountNonceApi<Block, AccountId, Nonce> for Runtime {
683 fn account_nonce(account: AccountId) -> Nonce {
684 System::account_nonce(account)
685 }
686 }
687
688 impl pezpallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi<Block, Balance> for Runtime {
689 fn query_info(
690 uxt: <Block as BlockT>::Extrinsic,
691 len: u32,
692 ) -> pezpallet_transaction_payment_rpc_runtime_api::RuntimeDispatchInfo<Balance> {
693 TransactionPayment::query_info(uxt, len)
694 }
695 fn query_fee_details(
696 uxt: <Block as BlockT>::Extrinsic,
697 len: u32,
698 ) -> pezpallet_transaction_payment::FeeDetails<Balance> {
699 TransactionPayment::query_fee_details(uxt, len)
700 }
701 fn query_weight_to_fee(weight: Weight) -> Balance {
702 TransactionPayment::weight_to_fee(weight)
703 }
704 fn query_length_to_fee(length: u32) -> Balance {
705 TransactionPayment::length_to_fee(length)
706 }
707 }
708
709 impl pezpallet_transaction_payment_rpc_runtime_api::TransactionPaymentCallApi<Block, Balance, RuntimeCall>
710 for Runtime
711 {
712 fn query_call_info(
713 call: RuntimeCall,
714 len: u32,
715 ) -> pezpallet_transaction_payment::RuntimeDispatchInfo<Balance> {
716 TransactionPayment::query_call_info(call, len)
717 }
718 fn query_call_fee_details(
719 call: RuntimeCall,
720 len: u32,
721 ) -> pezpallet_transaction_payment::FeeDetails<Balance> {
722 TransactionPayment::query_call_fee_details(call, len)
723 }
724 fn query_weight_to_fee(weight: Weight) -> Balance {
725 TransactionPayment::weight_to_fee(weight)
726 }
727 fn query_length_to_fee(length: u32) -> Balance {
728 TransactionPayment::length_to_fee(length)
729 }
730 }
731
732 impl pezcumulus_primitives_core::CollectCollationInfo<Block> for Runtime {
733 fn collect_collation_info(header: &<Block as BlockT>::Header) -> pezcumulus_primitives_core::CollationInfo {
734 TeyrchainSystem::collect_collation_info(header)
735 }
736 }
737
738 impl pezsp_genesis_builder::GenesisBuilder<Block> for Runtime {
739 fn build_state(config: Vec<u8>) -> pezsp_genesis_builder::Result {
740 build_state::<RuntimeGenesisConfig>(config)
741 }
742
743 fn get_preset(id: &Option<pezsp_genesis_builder::PresetId>) -> Option<Vec<u8>> {
744 get_preset::<RuntimeGenesisConfig>(id, &genesis_config_presets::get_preset)
745 }
746
747 fn preset_names() -> Vec<pezsp_genesis_builder::PresetId> {
748 genesis_config_presets::preset_names()
749 }
750 }
751
752 impl pezcumulus_primitives_core::RelayParentOffsetApi<Block> for Runtime {
753 fn relay_parent_offset() -> u32 {
754 RELAY_PARENT_OFFSET
755 }
756 }
757
758 impl pezcumulus_primitives_aura::AuraUnincludedSegmentApi<Block> for Runtime {
759 fn can_build_upon(
760 included_hash: <Block as BlockT>::Hash,
761 slot: pezcumulus_primitives_aura::Slot,
762 ) -> bool {
763 ConsensusHook::can_build_upon(included_hash, slot)
764 }
765 }
766
767 impl pezcumulus_primitives_core::GetTeyrchainInfo<Block> for Runtime {
768 fn teyrchain_id() -> ParaId {
769 TeyrchainInfo::teyrchain_id()
770 }
771 }
772}
773
774pezcumulus_pezpallet_teyrchain_system::register_validate_block! {
775 Runtime = Runtime,
776 BlockExecutor = pezcumulus_pezpallet_aura_ext::BlockExecutor::<Runtime, Executive>,
777}