difftreelog
opal runtime 9090 00
in: master
1 file changed
runtime/src/lib.rsdiffbeforeafterboth1//2// This file is subject to the terms and conditions defined in3// file 'LICENSE', which is part of this source code package.4//56//! The Substrate Node Template runtime. This can be compiled with `#[no_std]`, ready for Wasm.78#![cfg_attr(not(feature = "std"), no_std)]9// `construct_runtime!` does a lot of recursion and requires us to increase the limit to 256.10#![recursion_limit = "1024"]11#![allow(clippy::from_over_into, clippy::identity_op)]12#![allow(clippy::fn_to_numeric_cast_with_truncation)]13// Make the WASM binary available.14#[cfg(feature = "std")]15include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs"));1617use sp_api::impl_runtime_apis;18use sp_core::{crypto::KeyTypeId, OpaqueMetadata, H256, U256, H160};19// #[cfg(any(feature = "std", test))]20// pub use sp_runtime::BuildStorage;2122use sp_runtime::{23 Permill, Perbill, Percent, create_runtime_str, generic, impl_opaque_keys,24 traits::{25 AccountIdLookup, ConvertInto, BlakeTwo256, Block as BlockT, IdentifyAccount, Verify,26 AccountIdConversion,27 },28 transaction_validity::{TransactionSource, TransactionValidity},29 ApplyExtrinsicResult, MultiSignature,30};3132use sp_std::prelude::*;3334#[cfg(feature = "std")]35use sp_version::NativeVersion;36use sp_version::RuntimeVersion;37pub use pallet_transaction_payment::{38 Multiplier, TargetedFeeAdjustment, FeeDetails, RuntimeDispatchInfo,39};40// A few exports that help ease life for downstream crates.41pub use pallet_balances::Call as BalancesCall;42pub use pallet_evm::{EnsureAddressTruncated, HashedAddressMapping, Runner};43pub use frame_support::{44 construct_runtime, match_type,45 dispatch::DispatchResult,46 PalletId, parameter_types, StorageValue, ConsensusEngineId,47 traits::{48 Everything, Currency, ExistenceRequirement, Get, IsInVec, KeyOwnerProofSystem,49 LockIdentifier, OnUnbalanced, Randomness, FindAuthor,50 },51 weights::{52 constants::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight, WEIGHT_PER_SECOND},53 DispatchClass, DispatchInfo, GetDispatchInfo, IdentityFee, Pays, PostDispatchInfo, Weight,54 WeightToFeePolynomial, WeightToFeeCoefficient, WeightToFeeCoefficients,55 },56};57use nft_data_structs::*;58// use pallet_contracts::weights::WeightInfo;59// #[cfg(any(feature = "std", test))]60use frame_system::{61 self as system, EnsureRoot, EnsureSigned,62 limits::{BlockWeights, BlockLength},63};64use sp_arithmetic::{65 traits::{BaseArithmetic, Unsigned},66};67use smallvec::smallvec;68use codec::{Encode, Decode};69use pallet_evm::{Account as EVMAccount, FeeCalculator, OnMethodCall};70use fp_rpc::TransactionStatus;71use sp_core::crypto::Public;72use sp_runtime::{73 traits::{Dispatchable},74};7576// pub use pallet_timestamp::Call as TimestampCall;77pub use sp_consensus_aura::sr25519::AuthorityId as AuraId;7879// Polkadot imports80use pallet_xcm::XcmPassthrough;81use polkadot_parachain::primitives::Sibling;82use xcm::v0::{BodyId, Junction::*, MultiLocation, MultiLocation::*, NetworkId};83use xcm_builder::{84 AccountId32Aliases, AllowTopLevelPaidExecutionFrom, AllowUnpaidExecutionFrom, CurrencyAdapter,85 EnsureXcmOrigin, FixedWeightBounds, IsConcrete, LocationInverter, NativeAsset,86 ParentAsSuperuser, ParentIsDefault, RelayChainAsNative, SiblingParachainAsNative,87 SiblingParachainConvertsVia, SignedAccountId32AsNative, SignedToAccountId32,88 SovereignSignedViaLocation, TakeWeightCredit, UsingComponents,89};90use xcm_executor::{Config, XcmExecutor};9192// mod chain_extension;93// use crate::chain_extension::{NFTExtension, Imbalance};9495/// An index to a block.96pub type BlockNumber = u32;9798/// Alias to 512-bit hash when used in the context of a transaction signature on the chain.99pub type Signature = MultiSignature;100101/// Some way of identifying an account on the chain. We intentionally make it equivalent102/// to the public key of our transaction signing scheme.103pub type AccountId = <<Signature as Verify>::Signer as IdentifyAccount>::AccountId;104105/// The type for looking up accounts. We don't expect more than 4 billion of them, but you106/// never know...107pub type AccountIndex = u32;108109/// Balance of an account.110pub type Balance = u128;111112/// Index of a transaction in the chain.113pub type Index = u32;114115/// A hash of some data used by the chain.116pub type Hash = sp_core::H256;117118/// Digest item type.119pub type DigestItem = generic::DigestItem<Hash>;120121/// Opaque types. These are used by the CLI to instantiate machinery that don't need to know122/// the specifics of the runtime. They can then be made to be agnostic over specific formats123/// of data like extrinsics, allowing for them to continue syncing the network through upgrades124/// to even the core data structures.125pub mod opaque {126 use super::*;127128 pub use sp_runtime::OpaqueExtrinsic as UncheckedExtrinsic;129130 /// Opaque block type.131 pub type Block = generic::Block<Header, UncheckedExtrinsic>;132133 pub type SessionHandlers = ();134135 impl_opaque_keys! {136 pub struct SessionKeys {137 pub aura: Aura,138 }139 }140}141142/// This runtime version.143pub const VERSION: RuntimeVersion = RuntimeVersion {144 spec_name: create_runtime_str!("nft"),145 impl_name: create_runtime_str!("nft"),146 authoring_version: 1,147 spec_version: 3,148 impl_version: 1,149 apis: RUNTIME_API_VERSIONS,150 transaction_version: 1,151};152153pub const MILLISECS_PER_BLOCK: u64 = 12000;154155pub const SLOT_DURATION: u64 = MILLISECS_PER_BLOCK;156157// These time units are defined in number of blocks.158pub const MINUTES: BlockNumber = 60_000 / (MILLISECS_PER_BLOCK as BlockNumber);159pub const HOURS: BlockNumber = MINUTES * 60;160pub const DAYS: BlockNumber = HOURS * 24;161162parameter_types! {163 pub const DefaultSponsoringRateLimit: BlockNumber = 1 * DAYS;164}165166#[derive(codec::Encode, codec::Decode)]167pub enum XCMPMessage<XAccountId, XBalance> {168 /// Transfer tokens to the given account from the Parachain account.169 TransferToken(XAccountId, XBalance),170}171172/// The version information used to identify this runtime when compiled natively.173#[cfg(feature = "std")]174pub fn native_version() -> NativeVersion {175 NativeVersion {176 runtime_version: VERSION,177 can_author_with: Default::default(),178 }179}180181type NegativeImbalance = <Balances as Currency<AccountId>>::NegativeImbalance;182183pub struct DealWithFees;184impl OnUnbalanced<NegativeImbalance> for DealWithFees {185 fn on_unbalanceds<B>(mut fees_then_tips: impl Iterator<Item = NegativeImbalance>) {186 if let Some(fees) = fees_then_tips.next() {187 // for fees, 100% to treasury188 let mut split = fees.ration(100, 0);189 if let Some(tips) = fees_then_tips.next() {190 // for tips, if any, 100% to treasury191 tips.ration_merge_into(100, 0, &mut split);192 }193 Treasury::on_unbalanced(split.0);194 // Author::on_unbalanced(split.1);195 }196 }197}198199/// We assume that ~10% of the block weight is consumed by `on_initalize` handlers.200/// This is used to limit the maximal weight of a single extrinsic.201const AVERAGE_ON_INITIALIZE_RATIO: Perbill = Perbill::from_percent(10);202/// We allow `Normal` extrinsics to fill up the block up to 75%, the rest can be used203/// by Operational extrinsics.204const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75);205/// We allow for 2 seconds of compute with a 6 second average block time.206const MAXIMUM_BLOCK_WEIGHT: Weight = WEIGHT_PER_SECOND / 2;207208parameter_types! {209 pub const BlockHashCount: BlockNumber = 2400;210 pub RuntimeBlockLength: BlockLength =211 BlockLength::max_with_normal_ratio(5 * 1024 * 1024, NORMAL_DISPATCH_RATIO);212 pub const AvailableBlockRatio: Perbill = Perbill::from_percent(75);213 pub const MaximumBlockLength: u32 = 5 * 1024 * 1024;214 pub RuntimeBlockWeights: BlockWeights = BlockWeights::builder()215 .base_block(BlockExecutionWeight::get())216 .for_class(DispatchClass::all(), |weights| {217 weights.base_extrinsic = ExtrinsicBaseWeight::get();218 })219 .for_class(DispatchClass::Normal, |weights| {220 weights.max_total = Some(NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT);221 })222 .for_class(DispatchClass::Operational, |weights| {223 weights.max_total = Some(MAXIMUM_BLOCK_WEIGHT);224 // Operational transactions have some extra reserved space, so that they225 // are included even if block reached `MAXIMUM_BLOCK_WEIGHT`.226 weights.reserved = Some(227 MAXIMUM_BLOCK_WEIGHT - NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT228 );229 })230 .avg_block_initialization(AVERAGE_ON_INITIALIZE_RATIO)231 .build_or_panic();232 pub const Version: RuntimeVersion = VERSION;233 pub const SS58Prefix: u8 = 42;234}235236parameter_types! {237 pub const ChainId: u64 = 8888;238}239240impl pallet_evm::Config for Runtime {241 type BlockGasLimit = BlockGasLimit;242 type FeeCalculator = ();243 type GasWeightMapping = ();244 type BlockHashMapping = pallet_ethereum::EthereumBlockHashMapping<Self>;245 type CallOrigin = EnsureAddressTruncated;246 type WithdrawOrigin = EnsureAddressTruncated;247 type AddressMapping = HashedAddressMapping<Self::Hashing>;248 type Precompiles = ();249 type Currency = Balances;250 type Event = Event;251 type OnMethodCall = (252 pallet_evm_migration::OnMethodCall<Self>,253 pallet_nft::NftErcSupport<Self>,254 pallet_evm_contract_helpers::HelpersOnMethodCall<Self>,255 );256 type OnCreate = pallet_evm_contract_helpers::HelpersOnCreate<Self>;257 type ChainId = ChainId;258 type Runner = pallet_evm::runner::stack::Runner<Self>;259 type OnChargeTransaction = pallet_evm_transaction_payment::OnChargeTransaction<Self>;260 type TransactionValidityHack = pallet_evm_transaction_payment::TransactionValidityHack<Self>;261 type FindAuthor = EthereumFindAuthor<Aura>;262}263264impl pallet_evm_migration::Config for Runtime {265 type WeightInfo = pallet_evm_migration::weights::SubstrateWeight<Self>;266}267268pub struct EthereumFindAuthor<F>(core::marker::PhantomData<F>);269impl<F: FindAuthor<u32>> FindAuthor<H160> for EthereumFindAuthor<F> {270 fn find_author<'a, I>(digests: I) -> Option<H160>271 where272 I: 'a + IntoIterator<Item = (ConsensusEngineId, &'a [u8])>,273 {274 if let Some(author_index) = F::find_author(digests) {275 let authority_id = Aura::authorities()[author_index as usize].clone();276 return Some(H160::from_slice(&authority_id.to_raw_vec()[4..24]));277 }278 None279 }280}281282parameter_types! {283 pub BlockGasLimit: U256 = U256::from(u32::max_value());284}285286impl pallet_ethereum::Config for Runtime {287 type Event = Event;288 type StateRoot = pallet_ethereum::IntermediateStateRoot;289 type EvmSubmitLog = pallet_evm::Pallet<Self>;290}291292impl pallet_randomness_collective_flip::Config for Runtime {}293294impl system::Config for Runtime {295 /// The data to be stored in an account.296 type AccountData = pallet_balances::AccountData<Balance>;297 /// The identifier used to distinguish between accounts.298 type AccountId = AccountId;299 /// The basic call filter to use in dispatchable.300 type BaseCallFilter = Everything;301 /// Maximum number of block number to block hash mappings to keep (oldest pruned first).302 type BlockHashCount = BlockHashCount;303 /// The maximum length of a block (in bytes).304 type BlockLength = RuntimeBlockLength;305 /// The index type for blocks.306 type BlockNumber = BlockNumber;307 /// The weight of the overhead invoked on the block import process, independent of the extrinsics included in that block.308 type BlockWeights = RuntimeBlockWeights;309 /// The aggregated dispatch type that is available for extrinsics.310 type Call = Call;311 /// The weight of database operations that the runtime can invoke.312 type DbWeight = RocksDbWeight;313 /// The ubiquitous event type.314 type Event = Event;315 /// The type for hashing blocks and tries.316 type Hash = Hash;317 /// The hashing algorithm used.318 type Hashing = BlakeTwo256;319 /// The header type.320 type Header = generic::Header<BlockNumber, BlakeTwo256>;321 /// The index type for storing how many extrinsics an account has signed.322 type Index = Index;323 /// The lookup mechanism to get account ID from whatever is passed in dispatchers.324 type Lookup = AccountIdLookup<AccountId, ()>;325 /// What to do if an account is fully reaped from the system.326 type OnKilledAccount = ();327 /// What to do if a new account is created.328 type OnNewAccount = ();329 type OnSetCode = cumulus_pallet_parachain_system::ParachainSetCode<Self>;330 /// The ubiquitous origin type.331 type Origin = Origin;332 /// This type is being generated by `construct_runtime!`.333 type PalletInfo = PalletInfo;334 /// This is used as an identifier of the chain. 42 is the generic substrate prefix.335 type SS58Prefix = SS58Prefix;336 /// Weight information for the extrinsics of this pallet.337 type SystemWeightInfo = system::weights::SubstrateWeight<Self>;338 /// Version of the runtime.339 type Version = Version;340}341342parameter_types! {343 pub const MinimumPeriod: u64 = SLOT_DURATION / 2;344}345346impl pallet_timestamp::Config for Runtime {347 /// A timestamp: milliseconds since the unix epoch.348 type Moment = u64;349 type OnTimestampSet = ();350 type MinimumPeriod = MinimumPeriod;351 type WeightInfo = ();352}353354parameter_types! {355 // pub const ExistentialDeposit: u128 = 500;356 pub const ExistentialDeposit: u128 = 0;357 pub const MaxLocks: u32 = 50;358}359360impl pallet_balances::Config for Runtime {361 type MaxLocks = MaxLocks;362 type MaxReserves = ();363 type ReserveIdentifier = [u8; 8];364 /// The type for recording an account's balance.365 type Balance = Balance;366 /// The ubiquitous event type.367 type Event = Event;368 type DustRemoval = Treasury;369 type ExistentialDeposit = ExistentialDeposit;370 type AccountStore = System;371 type WeightInfo = pallet_balances::weights::SubstrateWeight<Self>;372}373374pub const MICROUNIQUE: Balance = 1_000_000_000;375pub const MILLIUNIQUE: Balance = 1_000 * MICROUNIQUE;376pub const CENTIUNIQUE: Balance = 10 * MILLIUNIQUE;377pub const UNIQUE: Balance = 100 * CENTIUNIQUE;378379pub const fn deposit(items: u32, bytes: u32) -> Balance {380 items as Balance * 15 * CENTIUNIQUE + (bytes as Balance) * 6 * CENTIUNIQUE381}382383/*384parameter_types! {385 pub TombstoneDeposit: Balance = deposit(386 1,387 sp_std::mem::size_of::<pallet_contracts::Pallet<Runtime>> as u32,388 );389 pub DepositPerContract: Balance = TombstoneDeposit::get();390 pub const DepositPerStorageByte: Balance = deposit(0, 1);391 pub const DepositPerStorageItem: Balance = deposit(1, 0);392 pub RentFraction: Perbill = Perbill::from_rational(1u32, 30 * DAYS);393 pub const SurchargeReward: Balance = 150 * MILLIUNIQUE;394 pub const SignedClaimHandicap: u32 = 2;395 pub const MaxDepth: u32 = 32;396 pub const MaxValueSize: u32 = 16 * 1024;397 pub const MaxCodeSize: u32 = 1024 * 1024 * 25; // 25 Mb398 // The lazy deletion runs inside on_initialize.399 pub DeletionWeightLimit: Weight = AVERAGE_ON_INITIALIZE_RATIO *400 RuntimeBlockWeights::get().max_block;401 // The weight needed for decoding the queue should be less or equal than a fifth402 // of the overall weight dedicated to the lazy deletion.403 pub DeletionQueueDepth: u32 = ((DeletionWeightLimit::get() / (404 <Runtime as pallet_contracts::Config>::WeightInfo::on_initialize_per_queue_item(1) -405 <Runtime as pallet_contracts::Config>::WeightInfo::on_initialize_per_queue_item(0)406 )) / 5) as u32;407 pub Schedule: pallet_contracts::Schedule<Runtime> = Default::default();408}409410impl pallet_contracts::Config for Runtime {411 type Time = Timestamp;412 type Randomness = RandomnessCollectiveFlip;413 type Currency = Balances;414 type Event = Event;415 type RentPayment = ();416 type SignedClaimHandicap = SignedClaimHandicap;417 type TombstoneDeposit = TombstoneDeposit;418 type DepositPerContract = DepositPerContract;419 type DepositPerStorageByte = DepositPerStorageByte;420 type DepositPerStorageItem = DepositPerStorageItem;421 type RentFraction = RentFraction;422 type SurchargeReward = SurchargeReward;423 type WeightPrice = pallet_transaction_payment::Pallet<Self>;424 type WeightInfo = pallet_contracts::weights::SubstrateWeight<Self>;425 type ChainExtension = NFTExtension;426 type DeletionQueueDepth = DeletionQueueDepth;427 type DeletionWeightLimit = DeletionWeightLimit;428 type Schedule = Schedule;429 type CallStack = [pallet_contracts::Frame<Self>; 31];430}431*/432433parameter_types! {434 pub const TransactionByteFee: Balance = 501 * MICROUNIQUE; // Targeting 0.1 Unique per NFT transfer435}436437/// Linear implementor of `WeightToFeePolynomial`438pub struct LinearFee<T>(sp_std::marker::PhantomData<T>);439440impl<T> WeightToFeePolynomial for LinearFee<T>441where442 T: BaseArithmetic + From<u32> + Copy + Unsigned,443{444 type Balance = T;445446 fn polynomial() -> WeightToFeeCoefficients<Self::Balance> {447 smallvec!(WeightToFeeCoefficient {448 coeff_integer: 146_700u32.into(), // Targeting 0.1 Unique per NFT transfer449 coeff_frac: Perbill::zero(),450 negative: false,451 degree: 1,452 })453 }454}455456impl pallet_transaction_payment::Config for Runtime {457 type OnChargeTransaction = pallet_transaction_payment::CurrencyAdapter<Balances, DealWithFees>;458 type TransactionByteFee = TransactionByteFee;459 type WeightToFee = LinearFee<Balance>;460 type FeeMultiplierUpdate = ();461}462463parameter_types! {464 pub const ProposalBond: Permill = Permill::from_percent(5);465 pub const ProposalBondMinimum: Balance = 1 * UNIQUE;466 pub const SpendPeriod: BlockNumber = 5 * MINUTES;467 pub const Burn: Permill = Permill::from_percent(0);468 pub const TipCountdown: BlockNumber = 1 * DAYS;469 pub const TipFindersFee: Percent = Percent::from_percent(20);470 pub const TipReportDepositBase: Balance = 1 * UNIQUE;471 pub const DataDepositPerByte: Balance = 1 * CENTIUNIQUE;472 pub const BountyDepositBase: Balance = 1 * UNIQUE;473 pub const BountyDepositPayoutDelay: BlockNumber = 1 * DAYS;474 pub const TreasuryModuleId: PalletId = PalletId(*b"py/trsry");475 pub const BountyUpdatePeriod: BlockNumber = 14 * DAYS;476 pub const MaximumReasonLength: u32 = 16384;477 pub const BountyCuratorDeposit: Permill = Permill::from_percent(50);478 pub const BountyValueMinimum: Balance = 5 * UNIQUE;479 pub const MaxApprovals: u32 = 100;480}481482impl pallet_treasury::Config for Runtime {483 type PalletId = TreasuryModuleId;484 type Currency = Balances;485 type ApproveOrigin = EnsureRoot<AccountId>;486 type RejectOrigin = EnsureRoot<AccountId>;487 type Event = Event;488 type OnSlash = ();489 type ProposalBond = ProposalBond;490 type ProposalBondMinimum = ProposalBondMinimum;491 type SpendPeriod = SpendPeriod;492 type Burn = Burn;493 type BurnDestination = ();494 type SpendFunds = ();495 type WeightInfo = pallet_treasury::weights::SubstrateWeight<Self>;496 type MaxApprovals = MaxApprovals;497}498499impl pallet_sudo::Config for Runtime {500 type Event = Event;501 type Call = Call;502}503504parameter_types! {505 pub const MinVestedTransfer: Balance = 10 * UNIQUE;506}507508impl pallet_vesting::Config for Runtime {509 type Event = Event;510 type Currency = Balances;511 type BlockNumberToBalance = ConvertInto;512 type MinVestedTransfer = MinVestedTransfer;513 type WeightInfo = ();514}515516parameter_types! {517 pub const ReservedDmpWeight: Weight = MAXIMUM_BLOCK_WEIGHT / 4;518 pub const ReservedXcmpWeight: Weight = MAXIMUM_BLOCK_WEIGHT / 4;519}520521impl cumulus_pallet_parachain_system::Config for Runtime {522 type Event = Event;523 type OnValidationData = ();524 type SelfParaId = parachain_info::Pallet<Self>;525 // type DownwardMessageHandlers = cumulus_primitives_utility::UnqueuedDmpAsParent<526 // MaxDownwardMessageWeight,527 // XcmExecutor<XcmConfig>,528 // Call,529 // >;530 type OutboundXcmpMessageSource = XcmpQueue;531 type DmpMessageHandler = DmpQueue;532 type ReservedDmpWeight = ReservedDmpWeight;533 type ReservedXcmpWeight = ReservedXcmpWeight;534 type XcmpMessageHandler = XcmpQueue;535}536537impl parachain_info::Config for Runtime {}538539impl cumulus_pallet_aura_ext::Config for Runtime {}540541parameter_types! {542 pub const RelayLocation: MultiLocation = X1(Parent);543 pub const RelayNetwork: NetworkId = NetworkId::Polkadot;544 pub RelayOrigin: Origin = cumulus_pallet_xcm::Origin::Relay.into();545 pub Ancestry: MultiLocation = X1(Parachain(ParachainInfo::parachain_id().into()));546}547548/// Type for specifying how a `MultiLocation` can be converted into an `AccountId`. This is used549/// when determining ownership of accounts for asset transacting and when attempting to use XCM550/// `Transact` in order to determine the dispatch Origin.551pub type LocationToAccountId = (552 // The parent (Relay-chain) origin converts to the default `AccountId`.553 ParentIsDefault<AccountId>,554 // Sibling parachain origins convert to AccountId via the `ParaId::into`.555 SiblingParachainConvertsVia<Sibling, AccountId>,556 // Straight up local `AccountId32` origins just alias directly to `AccountId`.557 AccountId32Aliases<RelayNetwork, AccountId>,558);559560/// Means for transacting assets on this chain.561pub type LocalAssetTransactor = CurrencyAdapter<562 // Use this currency:563 Balances,564 // Use this currency when it is a fungible asset matching the given location or name:565 IsConcrete<RelayLocation>,566 // Do a simple punn to convert an AccountId32 MultiLocation into a native chain account ID:567 LocationToAccountId,568 // Our chain's account ID type (we can't get away without mentioning it explicitly):569 AccountId,570 // We don't track any teleports.571 (),572>;573574/// This is the type we use to convert an (incoming) XCM origin into a local `Origin` instance,575/// ready for dispatching a transaction with Xcm's `Transact`. There is an `OriginKind` which can576/// biases the kind of local `Origin` it will become.577pub type XcmOriginToTransactDispatchOrigin = (578 // Sovereign account converter; this attempts to derive an `AccountId` from the origin location579 // using `LocationToAccountId` and then turn that into the usual `Signed` origin. Useful for580 // foreign chains who want to have a local sovereign account on this chain which they control.581 SovereignSignedViaLocation<LocationToAccountId, Origin>,582 // Native converter for Relay-chain (Parent) location; will converts to a `Relay` origin when583 // recognised.584 RelayChainAsNative<RelayOrigin, Origin>,585 // Native converter for sibling Parachains; will convert to a `SiblingPara` origin when586 // recognised.587 SiblingParachainAsNative<cumulus_pallet_xcm::Origin, Origin>,588 // Superuser converter for the Relay-chain (Parent) location. This will allow it to issue a589 // transaction from the Root origin.590 ParentAsSuperuser<Origin>,591 // Native signed account converter; this just converts an `AccountId32` origin into a normal592 // `Origin::Signed` origin of the same 32-byte value.593 SignedAccountId32AsNative<RelayNetwork, Origin>,594 // Xcm origins can be represented natively under the Xcm pallet's Xcm origin.595 XcmPassthrough<Origin>,596);597598parameter_types! {599 // One XCM operation is 1_000_000 weight - almost certainly a conservative estimate.600 pub UnitWeightCost: Weight = 1_000_000;601 // 1200 UNIQUEs buy 1 second of weight.602 pub const WeightPrice: (MultiLocation, u128) = (X1(Parent), 1_200 * UNIQUE);603}604605match_type! {606 pub type ParentOrParentsUnitPlurality: impl Contains<MultiLocation> = {607 X1(Parent) | X2(Parent, Plurality { id: BodyId::Unit, .. })608 };609}610611pub type Barrier = (612 TakeWeightCredit,613 AllowTopLevelPaidExecutionFrom<Everything>,614 AllowUnpaidExecutionFrom<ParentOrParentsUnitPlurality>,615 // ^^^ Parent & its unit plurality gets free execution616);617618pub struct XcmConfig;619impl Config for XcmConfig {620 type Call = Call;621 type XcmSender = XcmRouter;622 // How to withdraw and deposit an asset.623 type AssetTransactor = LocalAssetTransactor;624 type OriginConverter = XcmOriginToTransactDispatchOrigin;625 type IsReserve = NativeAsset;626 type IsTeleporter = (); // Teleportation is disabled627 type LocationInverter = LocationInverter<Ancestry>;628 type Barrier = Barrier;629 type Weigher = FixedWeightBounds<UnitWeightCost, Call>;630 type Trader = UsingComponents<IdentityFee<Balance>, RelayLocation, AccountId, Balances, ()>;631 type ResponseHandler = (); // Don't handle responses for now.632}633634// parameter_types! {635// pub const MaxDownwardMessageWeight: Weight = MAXIMUM_BLOCK_WEIGHT / 10;636// }637638/// No local origins on this chain are allowed to dispatch XCM sends/executions.639pub type LocalOriginToLocation = (SignedToAccountId32<Origin, AccountId, RelayNetwork>,);640641/// The means for routing XCM messages which are not for local execution into the right message642/// queues.643pub type XcmRouter = (644 // Two routers - use UMP to communicate with the relay chain:645 cumulus_primitives_utility::ParentAsUmp<ParachainSystem>,646 // ..and XCMP to communicate with the sibling chains.647 XcmpQueue,648);649650impl pallet_evm_coder_substrate::Config for Runtime {651 type EthereumTransactionSender = pallet_ethereum::Pallet<Self>;652}653654impl pallet_xcm::Config for Runtime {655 type Event = Event;656 type SendXcmOrigin = EnsureXcmOrigin<Origin, LocalOriginToLocation>;657 type XcmRouter = XcmRouter;658 type ExecuteXcmOrigin = EnsureXcmOrigin<Origin, LocalOriginToLocation>;659 type XcmExecuteFilter = Everything;660 type XcmExecutor = XcmExecutor<XcmConfig>;661 type XcmTeleportFilter = Everything;662 type XcmReserveTransferFilter = ();663 type Weigher = FixedWeightBounds<UnitWeightCost, Call>;664 type LocationInverter = LocationInverter<Ancestry>;665}666667impl cumulus_pallet_xcm::Config for Runtime {668 type Event = Event;669 type XcmExecutor = XcmExecutor<XcmConfig>;670}671672impl cumulus_pallet_xcmp_queue::Config for Runtime {673 type Event = Event;674 type XcmExecutor = XcmExecutor<XcmConfig>;675 type ChannelInfo = ParachainSystem;676}677678impl cumulus_pallet_dmp_queue::Config for Runtime {679 type Event = Event;680 type XcmExecutor = XcmExecutor<XcmConfig>;681 type ExecuteOverweightOrigin = frame_system::EnsureRoot<AccountId>;682}683684impl pallet_aura::Config for Runtime {685 type AuthorityId = AuraId;686 type DisabledValidators = ();687}688689parameter_types! {690 pub TreasuryAccountId: AccountId = TreasuryModuleId::get().into_account();691 pub const CollectionCreationPrice: Balance = 100 * UNIQUE;692}693694/// Used for the pallet nft in `./nft.rs`695impl pallet_nft::Config for Runtime {696 type Event = Event;697 type WeightInfo = pallet_nft::weights::SubstrateWeight<Self>;698699 type EvmBackwardsAddressMapping = pallet_nft::MapBackwardsAddressTruncated;700 type EvmAddressMapping = HashedAddressMapping<Self::Hashing>;701 type CrossAccountId = pallet_nft::BasicCrossAccountId<Self>;702703 type Currency = Balances;704 type CollectionCreationPrice = CollectionCreationPrice;705 type TreasuryAccountId = TreasuryAccountId;706}707708parameter_types! {709 pub const InflationBlockInterval: BlockNumber = 100; // every time per how many blocks inflation is applied710}711712/// Used for the pallet inflation713impl pallet_inflation::Config for Runtime {714 type Currency = Balances;715 type TreasuryAccountId = TreasuryAccountId;716 type InflationBlockInterval = InflationBlockInterval;717}718719parameter_types! {720 pub MaximumSchedulerWeight: Weight = Perbill::from_percent(50) *721 RuntimeBlockWeights::get().max_block;722 pub const MaxScheduledPerBlock: u32 = 50;723}724725pub struct Sponsoring;726impl SponsoringResolve<AccountId, Call> for Sponsoring {727 fn resolve(who: &AccountId, call: &Call) -> Option<AccountId>728 where729 Call: Dispatchable<Info = DispatchInfo>,730 AccountId: AsRef<[u8]>,731 {732 pallet_nft_transaction_payment::Module::<Runtime>::withdraw_type(who, call)733 }734}735736type SponsorshipHandler = (737 pallet_nft::NftSponsorshipHandler<Runtime>,738 //pallet_contract_helpers::ContractSponsorshipHandler<Runtime>,739);740741impl pallet_scheduler::Config for Runtime {742 type Event = Event;743 type Origin = Origin;744 type PalletsOrigin = OriginCaller;745 type Call = Call;746 type MaximumWeight = MaximumSchedulerWeight;747 type ScheduleOrigin = EnsureSigned<AccountId>;748 type MaxScheduledPerBlock = MaxScheduledPerBlock;749 type SponsorshipHandler = SponsorshipHandler;750 type WeightInfo = ();751}752753impl pallet_nft_transaction_payment::Config for Runtime {754 type SponsorshipHandler = SponsorshipHandler;755}756757impl pallet_evm_transaction_payment::Config for Runtime {758 type SponsorshipHandler = (759 pallet_nft::NftEthSponsorshipHandler<Self>,760 pallet_evm_contract_helpers::HelpersContractSponsoring<Self>,761 );762 type Currency = Balances;763}764765impl pallet_nft_charge_transaction::Config for Runtime {}766767// impl pallet_contract_helpers::Config for Runtime {768// type DefaultSponsoringRateLimit = DefaultSponsoringRateLimit;769// }770771parameter_types! {772 // 0x842899ECF380553E8a4de75bF534cdf6fBF64049773 pub const HelpersContractAddress: H160 = H160([774 0x84, 0x28, 0x99, 0xec, 0xf3, 0x80, 0x55, 0x3e, 0x8a, 0x4d, 0xe7, 0x5b, 0xf5, 0x34, 0xcd, 0xf6, 0xfb, 0xf6, 0x40, 0x49,775 ]);776}777778impl pallet_evm_contract_helpers::Config for Runtime {779 type ContractAddress = HelpersContractAddress;780 type DefaultSponsoringRateLimit = DefaultSponsoringRateLimit;781}782783construct_runtime!(784 pub enum Runtime where785 Block = Block,786 NodeBlock = opaque::Block,787 UncheckedExtrinsic = UncheckedExtrinsic788 {789 ParachainSystem: cumulus_pallet_parachain_system::{Pallet, Call, Storage, Inherent, Event<T>, ValidateUnsigned} = 20,790 ParachainInfo: parachain_info::{Pallet, Storage, Config} = 21,791792 Aura: pallet_aura::{Pallet, Config<T>} = 22,793 AuraExt: cumulus_pallet_aura_ext::{Pallet, Config} = 23,794795 Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>} = 30,796 RandomnessCollectiveFlip: pallet_randomness_collective_flip::{Pallet, Storage} = 31,797 Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent} = 32,798 TransactionPayment: pallet_transaction_payment::{Pallet, Storage} = 33,799 Treasury: pallet_treasury::{Pallet, Call, Storage, Config, Event<T>} = 34,800 Sudo: pallet_sudo::{Pallet, Call, Storage, Config<T>, Event<T>} = 35,801 System: system::{Pallet, Call, Storage, Config, Event<T>} = 36,802 Vesting: pallet_vesting::{Pallet, Call, Config<T>, Storage, Event<T>} = 37,803 // Contracts: pallet_contracts::{Pallet, Call, Storage, Event<T>} = 38,804805 // XCM helpers.806 XcmpQueue: cumulus_pallet_xcmp_queue::{Pallet, Call, Storage, Event<T>} = 50,807 PolkadotXcm: pallet_xcm::{Pallet, Call, Event<T>, Origin} = 51,808 CumulusXcm: cumulus_pallet_xcm::{Pallet, Call, Event<T>, Origin} = 52,809 DmpQueue: cumulus_pallet_dmp_queue::{Pallet, Call, Storage, Event<T>} = 53,810811 // Unique Pallets812 Inflation: pallet_inflation::{Pallet, Call, Storage} = 60,813 Nft: pallet_nft::{Pallet, Call, Config<T>, Storage, Event<T>} = 61,814 Scheduler: pallet_scheduler::{Pallet, Call, Storage, Event<T>} = 62,815 NftPayment: pallet_nft_transaction_payment::{Pallet, Call, Storage} = 63,816 Charging: pallet_nft_charge_transaction::{Pallet, Call, Storage } = 64,817 // ContractHelpers: pallet_contract_helpers::{Pallet, Call, Storage} = 65,818819 // Frontier820 EVM: pallet_evm::{Pallet, Config, Call, Storage, Event<T>} = 100,821 Ethereum: pallet_ethereum::{Pallet, Config, Call, Storage, Event, ValidateUnsigned} = 101,822823 EvmCoderSubstrate: pallet_evm_coder_substrate::{Pallet, Storage} = 150,824 EvmContractHelpers: pallet_evm_contract_helpers::{Pallet, Storage} = 151,825 EvmTransactionPayment: pallet_evm_transaction_payment::{Pallet} = 152,826 EvmMigration: pallet_evm_migration::{Pallet, Call, Storage} = 153,827 }828);829830pub struct TransactionConverter;831832impl fp_rpc::ConvertTransaction<UncheckedExtrinsic> for TransactionConverter {833 fn convert_transaction(&self, transaction: pallet_ethereum::Transaction) -> UncheckedExtrinsic {834 UncheckedExtrinsic::new_unsigned(835 pallet_ethereum::Call::<Runtime>::transact(transaction).into(),836 )837 }838}839840impl fp_rpc::ConvertTransaction<opaque::UncheckedExtrinsic> for TransactionConverter {841 fn convert_transaction(842 &self,843 transaction: pallet_ethereum::Transaction,844 ) -> opaque::UncheckedExtrinsic {845 let extrinsic = UncheckedExtrinsic::new_unsigned(846 pallet_ethereum::Call::<Runtime>::transact(transaction).into(),847 );848 let encoded = extrinsic.encode();849 opaque::UncheckedExtrinsic::decode(&mut &encoded[..])850 .expect("Encoded extrinsic is always valid")851 }852}853854/// The address format for describing accounts.855pub type Address = sp_runtime::MultiAddress<AccountId, ()>;856/// Block header type as expected by this runtime.857pub type Header = generic::Header<BlockNumber, BlakeTwo256>;858/// Block type as expected by this runtime.859pub type Block = generic::Block<Header, UncheckedExtrinsic>;860/// A Block signed with a Justification861pub type SignedBlock = generic::SignedBlock<Block>;862/// BlockId type as expected by this runtime.863pub type BlockId = generic::BlockId<Block>;864/// The SignedExtension to the basic transaction logic.865pub type SignedExtra = (866 system::CheckSpecVersion<Runtime>,867 // system::CheckTxVersion<Runtime>,868 system::CheckGenesis<Runtime>,869 system::CheckEra<Runtime>,870 system::CheckNonce<Runtime>,871 system::CheckWeight<Runtime>,872 pallet_nft_charge_transaction::ChargeTransactionPayment<Runtime>,873 //pallet_contract_helpers::ContractHelpersExtension<Runtime>,874);875/// Unchecked extrinsic type as expected by this runtime.876pub type UncheckedExtrinsic = generic::UncheckedExtrinsic<Address, Call, Signature, SignedExtra>;877/// Extrinsic type that has already been checked.878pub type CheckedExtrinsic = generic::CheckedExtrinsic<AccountId, Call, SignedExtra>;879/// Executive: handles dispatch to the various modules.880pub type Executive = frame_executive::Executive<881 Runtime,882 Block,883 frame_system::ChainContext<Runtime>,884 Runtime,885 AllPallets,886>;887888impl_opaque_keys! {889 pub struct SessionKeys {890 pub aura: Aura,891 }892}893894impl_runtime_apis! {895 impl pallet_nft::NftApi<Block>896 for Runtime897 {898 fn eth_contract_code(account: H160) -> Option<Vec<u8>> {899 <pallet_nft::NftErcSupport<Runtime>>::get_code(&account)900 }901 }902903 impl sp_api::Core<Block> for Runtime {904 fn version() -> RuntimeVersion {905 VERSION906 }907908 fn execute_block(block: Block) {909 Executive::execute_block(block)910 }911912 fn initialize_block(header: &<Block as BlockT>::Header) {913 Executive::initialize_block(header)914 }915 }916917 impl sp_api::Metadata<Block> for Runtime {918 fn metadata() -> OpaqueMetadata {919 Runtime::metadata().into()920 }921 }922923 impl sp_block_builder::BlockBuilder<Block> for Runtime {924 fn apply_extrinsic(extrinsic: <Block as BlockT>::Extrinsic) -> ApplyExtrinsicResult {925 Executive::apply_extrinsic(extrinsic)926 }927928 fn finalize_block() -> <Block as BlockT>::Header {929 Executive::finalize_block()930 }931932 fn inherent_extrinsics(data: sp_inherents::InherentData) -> Vec<<Block as BlockT>::Extrinsic> {933 data.create_extrinsics()934 }935936 fn check_inherents(937 block: Block,938 data: sp_inherents::InherentData,939 ) -> sp_inherents::CheckInherentsResult {940 data.check_extrinsics(&block)941 }942943 // fn random_seed() -> <Block as BlockT>::Hash {944 // RandomnessCollectiveFlip::random_seed().0945 // }946 }947948 impl sp_transaction_pool::runtime_api::TaggedTransactionQueue<Block> for Runtime {949 fn validate_transaction(950 source: TransactionSource,951 tx: <Block as BlockT>::Extrinsic,952 hash: <Block as BlockT>::Hash,953 ) -> TransactionValidity {954 Executive::validate_transaction(source, tx, hash)955 }956 }957958 impl sp_offchain::OffchainWorkerApi<Block> for Runtime {959 fn offchain_worker(header: &<Block as BlockT>::Header) {960 Executive::offchain_worker(header)961 }962 }963964 impl fp_rpc::EthereumRuntimeRPCApi<Block> for Runtime {965 fn chain_id() -> u64 {966 <Runtime as pallet_evm::Config>::ChainId::get()967 }968969 fn account_basic(address: H160) -> EVMAccount {970 EVM::account_basic(&address)971 }972973 fn gas_price() -> U256 {974 <Runtime as pallet_evm::Config>::FeeCalculator::min_gas_price()975 }976977 fn account_code_at(address: H160) -> Vec<u8> {978 EVM::account_codes(address)979 }980981 fn author() -> H160 {982 <pallet_evm::Pallet<Runtime>>::find_author()983 }984985 fn storage_at(address: H160, index: U256) -> H256 {986 let mut tmp = [0u8; 32];987 index.to_big_endian(&mut tmp);988 EVM::account_storages(address, H256::from_slice(&tmp[..]))989 }990991 fn call(992 from: H160,993 to: H160,994 data: Vec<u8>,995 value: U256,996 gas_limit: U256,997 gas_price: Option<U256>,998 nonce: Option<U256>,999 estimate: bool,1000 ) -> Result<pallet_evm::CallInfo, sp_runtime::DispatchError> {1001 let config = if estimate {1002 let mut config = <Runtime as pallet_evm::Config>::config().clone();1003 config.estimate = true;1004 Some(config)1005 } else {1006 None1007 };10081009 <Runtime as pallet_evm::Config>::Runner::call(1010 from,1011 to,1012 data,1013 value,1014 gas_limit.low_u64(),1015 gas_price,1016 nonce,1017 config.as_ref().unwrap_or_else(|| <Runtime as pallet_evm::Config>::config()),1018 ).map_err(|err| err.into())1019 }10201021 fn create(1022 from: H160,1023 data: Vec<u8>,1024 value: U256,1025 gas_limit: U256,1026 gas_price: Option<U256>,1027 nonce: Option<U256>,1028 estimate: bool,1029 ) -> Result<pallet_evm::CreateInfo, sp_runtime::DispatchError> {1030 let config = if estimate {1031 let mut config = <Runtime as pallet_evm::Config>::config().clone();1032 config.estimate = true;1033 Some(config)1034 } else {1035 None1036 };10371038 <Runtime as pallet_evm::Config>::Runner::create(1039 from,1040 data,1041 value,1042 gas_limit.low_u64(),1043 gas_price,1044 nonce,1045 config.as_ref().unwrap_or_else(|| <Runtime as pallet_evm::Config>::config()),1046 ).map_err(|err| err.into())1047 }10481049 fn current_transaction_statuses() -> Option<Vec<TransactionStatus>> {1050 Ethereum::current_transaction_statuses()1051 }10521053 fn current_block() -> Option<pallet_ethereum::Block> {1054 Ethereum::current_block()1055 }10561057 fn current_receipts() -> Option<Vec<pallet_ethereum::Receipt>> {1058 Ethereum::current_receipts()1059 }10601061 fn current_all() -> (1062 Option<pallet_ethereum::Block>,1063 Option<Vec<pallet_ethereum::Receipt>>,1064 Option<Vec<TransactionStatus>>1065 ) {1066 (1067 Ethereum::current_block(),1068 Ethereum::current_receipts(),1069 Ethereum::current_transaction_statuses()1070 )1071 }10721073 fn extrinsic_filter(xts: Vec<<Block as sp_api::BlockT>::Extrinsic>) -> Vec<pallet_ethereum::Transaction> {1074 xts.into_iter().filter_map(|xt| match xt.function {1075 Call::Ethereum(pallet_ethereum::Call::transact(t)) => Some(t),1076 _ => None1077 }).collect()1078 }1079 }10801081 impl sp_session::SessionKeys<Block> for Runtime {1082 fn decode_session_keys(1083 encoded: Vec<u8>,1084 ) -> Option<Vec<(Vec<u8>, KeyTypeId)>> {1085 SessionKeys::decode_into_raw_public_keys(&encoded)1086 }10871088 fn generate_session_keys(seed: Option<Vec<u8>>) -> Vec<u8> {1089 SessionKeys::generate(seed)1090 }1091 }10921093 impl sp_consensus_aura::AuraApi<Block, AuraId> for Runtime {1094 fn slot_duration() -> sp_consensus_aura::SlotDuration {1095 sp_consensus_aura::SlotDuration::from_millis(Aura::slot_duration())1096 }10971098 fn authorities() -> Vec<AuraId> {1099 Aura::authorities()1100 }1101 }11021103 impl cumulus_primitives_core::CollectCollationInfo<Block> for Runtime {1104 fn collect_collation_info() -> cumulus_primitives_core::CollationInfo {1105 ParachainSystem::collect_collation_info()1106 }1107 }11081109 impl frame_system_rpc_runtime_api::AccountNonceApi<Block, AccountId, Index> for Runtime {1110 fn account_nonce(account: AccountId) -> Index {1111 System::account_nonce(account)1112 }1113 }11141115 impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi<Block, Balance> for Runtime {1116 fn query_info(uxt: <Block as BlockT>::Extrinsic, len: u32) -> RuntimeDispatchInfo<Balance> {1117 TransactionPayment::query_info(uxt, len)1118 }1119 fn query_fee_details(uxt: <Block as BlockT>::Extrinsic, len: u32) -> FeeDetails<Balance> {1120 TransactionPayment::query_fee_details(uxt, len)1121 }1122 }11231124 /*1125 impl pallet_contracts_rpc_runtime_api::ContractsApi<Block, AccountId, Balance, BlockNumber, Hash>1126 for Runtime1127 {1128 fn call(1129 origin: AccountId,1130 dest: AccountId,1131 value: Balance,1132 gas_limit: u64,1133 input_data: Vec<u8>,1134 ) -> pallet_contracts_primitives::ContractExecResult {1135 Contracts::bare_call(origin, dest, value, gas_limit, input_data, false)1136 }11371138 fn instantiate(1139 origin: AccountId,1140 endowment: Balance,1141 gas_limit: u64,1142 code: pallet_contracts_primitives::Code<Hash>,1143 data: Vec<u8>,1144 salt: Vec<u8>,1145 ) -> pallet_contracts_primitives::ContractInstantiateResult<AccountId, BlockNumber>1146 {1147 Contracts::bare_instantiate(origin, endowment, gas_limit, code, data, salt, true, false)1148 }11491150 fn get_storage(1151 address: AccountId,1152 key: [u8; 32],1153 ) -> pallet_contracts_primitives::GetStorageResult {1154 Contracts::get_storage(address, key)1155 }11561157 fn rent_projection(1158 address: AccountId,1159 ) -> pallet_contracts_primitives::RentProjectionResult<BlockNumber> {1160 Contracts::rent_projection(address)1161 }1162 }1163 */11641165 #[cfg(feature = "runtime-benchmarks")]1166 impl frame_benchmarking::Benchmark<Block> for Runtime {1167 fn dispatch_benchmark(1168 config: frame_benchmarking::BenchmarkConfig1169 ) -> Result<Vec<frame_benchmarking::BenchmarkBatch>, sp_runtime::RuntimeString> {1170 use frame_benchmarking::{Benchmarking, BenchmarkBatch, add_benchmark, TrackedStorageKey};11711172 let whitelist: Vec<TrackedStorageKey> = vec![1173 // Alice account1174 hex_literal::hex!("d43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d").to_vec().into(),1175 // // Total Issuance1176 // hex_literal::hex!("c2261276cc9d1f8598ea4b6a74b15c2f57c875e4cff74148e4628f264b974c80").to_vec().into(),1177 // // Execution Phase1178 // hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef7ff553b5a9862a516939d82b3d3d8661a").to_vec().into(),1179 // // Event Count1180 // hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef70a98fdbe9ce6c55837576c60c7af3850").to_vec().into(),1181 // // System Events1182 // hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef780d41e5e16056765bc8461851072c9d7").to_vec().into(),1183 ];11841185 let mut batches = Vec::<BenchmarkBatch>::new();1186 let params = (&config, &whitelist);11871188 add_benchmark!(params, batches, pallet_evm_migration, EvmMigration);1189 add_benchmark!(params, batches, pallet_nft, Nft);1190 add_benchmark!(params, batches, pallet_inflation, Inflation);11911192 if batches.is_empty() { return Err("Benchmark not found for this pallet.".into()) }1193 Ok(batches)1194 }1195 }1196}11971198struct CheckInherents;11991200impl cumulus_pallet_parachain_system::CheckInherents<Block> for CheckInherents {1201 fn check_inherents(1202 block: &Block,1203 relay_state_proof: &cumulus_pallet_parachain_system::RelayChainStateProof,1204 ) -> sp_inherents::CheckInherentsResult {1205 let relay_chain_slot = relay_state_proof1206 .read_slot()1207 .expect("Could not read the relay chain slot from the proof");12081209 let inherent_data =1210 cumulus_primitives_timestamp::InherentDataProvider::from_relay_chain_slot_and_duration(1211 relay_chain_slot,1212 sp_std::time::Duration::from_secs(6),1213 )1214 .create_inherent_data()1215 .expect("Could not create the timestamp inherent data");12161217 inherent_data.check_extrinsics(block)1218 }1219}12201221cumulus_pallet_parachain_system::register_validate_block!(1222 Runtime = Runtime,1223 BlockExecutor = cumulus_pallet_aura_ext::BlockExecutor::<Runtime, Executive>,1224 CheckInherents = CheckInherents,1225);