lib.rs 37.3 KB
Newer Older
Fedor Sakharov's avatar
Fedor Sakharov committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// Copyright 2020 Parity Technologies (UK) Ltd.
// This file is part of Polkadot.

// Polkadot is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.

// Polkadot is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with Polkadot.  If not, see <http://www.gnu.org/licenses/>.

17
//! The Rococo runtime for v1 parachains.
Fedor Sakharov's avatar
Fedor Sakharov committed
18
19
20

#![cfg_attr(not(feature = "std"), no_std)]
// `construct_runtime!` does a lot of recursion and requires us to increase the limit to 256.
21
#![recursion_limit = "256"]
Fedor Sakharov's avatar
Fedor Sakharov committed
22

Albrecht's avatar
Albrecht committed
23
use pallet_transaction_payment::CurrencyAdapter;
Fedor Sakharov's avatar
Fedor Sakharov committed
24
use sp_std::prelude::*;
Sergey Pepyakin's avatar
Sergey Pepyakin committed
25
use sp_std::collections::btree_map::BTreeMap;
26
use parity_scale_codec::{Encode, Decode};
Fedor Sakharov's avatar
Fedor Sakharov committed
27
28
use primitives::v1::{
	AccountId, AccountIndex, Balance, BlockNumber, Hash, Nonce, Signature, Moment,
29
	GroupRotationInfo, CoreState, Id, ValidationCode, CandidateEvent,
Fedor Sakharov's avatar
Fedor Sakharov committed
30
	ValidatorId, ValidatorIndex, CommittedCandidateReceipt, OccupiedCoreAssumption,
31
32
	PersistedValidationData, InboundDownwardMessage, InboundHrmpMessage,
	SessionInfo as SessionInfoData,
Fedor Sakharov's avatar
Fedor Sakharov committed
33
34
};
use runtime_common::{
35
	mmr as mmr_common,
36
	SlowAdjustingFeeUpdate, impls::ToAuthor, BlockHashCount, BlockWeights, BlockLength, RocksDbWeight,
Fedor Sakharov's avatar
Fedor Sakharov committed
37
38
39
40
41
};
use runtime_parachains::{
	self,
	runtime_api_impl::v1 as runtime_api_impl,
};
Shawn Tabrizi's avatar
Shawn Tabrizi committed
42
43
use frame_support::{
	construct_runtime, parameter_types,
44
	traits::{Filter, KeyOwnerProofSystem, Randomness, All, IsInVec},
Shawn Tabrizi's avatar
Shawn Tabrizi committed
45
46
47
	weights::Weight,
	PalletId
};
Fedor Sakharov's avatar
Fedor Sakharov committed
48
49
use sp_runtime::{
	create_runtime_str, generic, impl_opaque_keys,
Shawn Tabrizi's avatar
Shawn Tabrizi committed
50
	ApplyExtrinsicResult, KeyTypeId, Perbill,
Fedor Sakharov's avatar
Fedor Sakharov committed
51
52
	transaction_validity::{TransactionValidity, TransactionSource, TransactionPriority},
	traits::{
53
		self, Keccak256, BlakeTwo256, Block as BlockT, OpaqueKeys, AccountIdLookup,
Fedor Sakharov's avatar
Fedor Sakharov committed
54
55
56
		Extrinsic as ExtrinsicT, SaturatedConversion, Verify,
	},
};
57
use pallet_im_online::sr25519::AuthorityId as ImOnlineId;
Fedor Sakharov's avatar
Fedor Sakharov committed
58
use authority_discovery_primitives::AuthorityId as AuthorityDiscoveryId;
59
60
#[cfg(any(feature = "std", test))]
use sp_version::NativeVersion;
61
use sp_version::RuntimeVersion;
62
use pallet_transaction_payment::{FeeDetails, RuntimeDispatchInfo};
63
use pallet_grandpa::{AuthorityId as GrandpaId, fg_primitives};
64
use sp_core::{OpaqueMetadata, RuntimeDebug};
Fedor Sakharov's avatar
Fedor Sakharov committed
65
use sp_staking::SessionIndex;
66
use pallet_session::historical as session_historical;
67
68
use beefy_primitives::ecdsa::AuthorityId as BeefyId;
use pallet_mmr_primitives as mmr;
69
70
use frame_system::EnsureRoot;
use runtime_common::{paras_sudo_wrapper, paras_registrar, xcm_sender, auctions, crowdloan, slots};
Fedor Sakharov's avatar
Fedor Sakharov committed
71

72
use runtime_parachains::origin as parachains_origin;
Fedor Sakharov's avatar
Fedor Sakharov committed
73
use runtime_parachains::configuration as parachains_configuration;
74
use runtime_parachains::shared as parachains_shared;
Fedor Sakharov's avatar
Fedor Sakharov committed
75
use runtime_parachains::inclusion as parachains_inclusion;
76
use runtime_parachains::paras_inherent as parachains_paras_inherent;
Fedor Sakharov's avatar
Fedor Sakharov committed
77
use runtime_parachains::initializer as parachains_initializer;
78
use runtime_parachains::session_info as parachains_session_info;
Fedor Sakharov's avatar
Fedor Sakharov committed
79
use runtime_parachains::paras as parachains_paras;
80
81
82
use runtime_parachains::dmp as parachains_dmp;
use runtime_parachains::ump as parachains_ump;
use runtime_parachains::hrmp as parachains_hrmp;
Fedor Sakharov's avatar
Fedor Sakharov committed
83
84
use runtime_parachains::scheduler as parachains_scheduler;

85
pub use pallet_balances::Call as BalancesCall;
Fedor Sakharov's avatar
Fedor Sakharov committed
86

Shawn Tabrizi's avatar
Shawn Tabrizi committed
87
use polkadot_parachain::primitives::Id as ParaId;
88
89

use xcm::v0::{MultiLocation, NetworkId, BodyId};
Gavin Wood's avatar
Gavin Wood committed
90
use xcm_executor::XcmExecutor;
91
92
93
94
use xcm_builder::{
	AccountId32Aliases, ChildParachainConvertsVia, SovereignSignedViaLocation,
	CurrencyAdapter as XcmCurrencyAdapter, ChildParachainAsNative, SignedAccountId32AsNative,
	ChildSystemParachainAsSuperuser, LocationInverter, IsConcrete, FixedWeightBounds,
95
	BackingToPlurality, SignedToAccountId32, UsingComponents,
96
97
};
use constants::{time::*, currency::*, fee::*, size::*};
98
use frame_support::traits::InstanceFilter;
Shawn Tabrizi's avatar
Shawn Tabrizi committed
99

Fedor Sakharov's avatar
Fedor Sakharov committed
100
101
/// Constant values used within the runtime.
pub mod constants;
102
mod validator_manager;
Fedor Sakharov's avatar
Fedor Sakharov committed
103
104
105
106
107

// Make the WASM binary available.
#[cfg(feature = "std")]
include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs"));

108
109
110
/// Runtime version (Rococo).
pub const VERSION: RuntimeVersion = RuntimeVersion {
	spec_name: create_runtime_str!("rococo"),
111
	impl_name: create_runtime_str!("parity-rococo-v1.5"),
112
	authoring_version: 0,
113
	spec_version: 232,
114
115
116
117
118
119
120
121
	impl_version: 0,
	#[cfg(not(feature = "disable-runtime-api"))]
	apis: RUNTIME_API_VERSIONS,
	#[cfg(feature = "disable-runtime-api")]
	apis: sp_version::create_apis_vec![[]],
	transaction_version: 0,
};

122
123
124
125
126
127
128
/// The BABE epoch configuration at genesis.
pub const BABE_GENESIS_EPOCH_CONFIG: babe_primitives::BabeEpochConfiguration =
	babe_primitives::BabeEpochConfiguration {
		c: PRIMARY_PROBABILITY,
		allowed_slots: babe_primitives::AllowedSlots::PrimaryAndSecondaryVRFSlots
	};

129
130
131
132
133
134
135
136
137
/// Native version.
#[cfg(any(feature = "std", test))]
pub fn native_version() -> NativeVersion {
	NativeVersion {
		runtime_version: VERSION,
		can_author_with: Default::default(),
	}
}

Fedor Sakharov's avatar
Fedor Sakharov committed
138
/// The address format for describing accounts.
139
pub type Address = sp_runtime::MultiAddress<AccountId, ()>;
Fedor Sakharov's avatar
Fedor Sakharov committed
140
141
142
143
144
145
146
147
148
149
/// Block header type as expected by this runtime.
pub type Header = generic::Header<BlockNumber, BlakeTwo256>;
/// Block type as expected by this runtime.
pub type Block = generic::Block<Header, UncheckedExtrinsic>;
/// A Block signed with a Justification
pub type SignedBlock = generic::SignedBlock<Block>;
/// BlockId type as expected by this runtime.
pub type BlockId = generic::BlockId<Block>;
/// The SignedExtension to the basic transaction logic.
pub type SignedExtra = (
150
151
152
153
154
155
156
	frame_system::CheckSpecVersion<Runtime>,
	frame_system::CheckTxVersion<Runtime>,
	frame_system::CheckGenesis<Runtime>,
	frame_system::CheckMortality<Runtime>,
	frame_system::CheckNonce<Runtime>,
	frame_system::CheckWeight<Runtime>,
	pallet_transaction_payment::ChargeTransactionPayment<Runtime>,
Fedor Sakharov's avatar
Fedor Sakharov committed
157
158
159
160
161
);

/// Unchecked extrinsic type as expected by this runtime.
pub type UncheckedExtrinsic = generic::UncheckedExtrinsic<Address, Call, Signature, SignedExtra>;
/// Executive: handles dispatch to the various modules.
162
163
164
165
166
167
pub type Executive = frame_executive::Executive<
	Runtime,
	Block,
	frame_system::ChainContext<Runtime>,
	Runtime,
	AllPallets,
168
	(),
169
>;
Fedor Sakharov's avatar
Fedor Sakharov committed
170
171
172
173
174
/// The payload being signed in transactions.
pub type SignedPayload = generic::SignedPayload<Call, SignedExtra>;

impl_opaque_keys! {
	pub struct SessionKeys {
175
		pub grandpa: Grandpa,
Fedor Sakharov's avatar
Fedor Sakharov committed
176
177
		pub babe: Babe,
		pub im_online: ImOnline,
178
179
		pub para_validator: Initializer,
		pub para_assignment: SessionInfo,
180
		pub authority_discovery: AuthorityDiscovery,
181
182
183
184
		pub beefy: Beefy,
	}
}

Fedor Sakharov's avatar
Fedor Sakharov committed
185
186
187
188
189
190
construct_runtime! {
	pub enum Runtime where
		Block = Block,
		NodeBlock = primitives::v1::Block,
		UncheckedExtrinsic = UncheckedExtrinsic
	{
191
		System: frame_system::{Pallet, Call, Storage, Config, Event<T>},
Fedor Sakharov's avatar
Fedor Sakharov committed
192
193

		// Must be before session.
194
		Babe: pallet_babe::{Pallet, Call, Storage, Config, ValidateUnsigned},
Fedor Sakharov's avatar
Fedor Sakharov committed
195

196
197
198
199
		Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent},
		Indices: pallet_indices::{Pallet, Call, Storage, Config<T>, Event<T>},
		Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>},
		TransactionPayment: pallet_transaction_payment::{Pallet, Storage},
Fedor Sakharov's avatar
Fedor Sakharov committed
200
201

		// Consensus support.
202
203
204
205
206
207
208
		Authorship: pallet_authorship::{Pallet, Call, Storage},
		Offences: pallet_offences::{Pallet, Call, Storage, Event},
		Historical: session_historical::{Pallet},
		Session: pallet_session::{Pallet, Call, Storage, Event, Config<T>},
		Grandpa: pallet_grandpa::{Pallet, Call, Storage, Config, Event, ValidateUnsigned},
		ImOnline: pallet_im_online::{Pallet, Call, Storage, Event<T>, ValidateUnsigned, Config<T>},
		AuthorityDiscovery: pallet_authority_discovery::{Pallet, Call, Config},
Fedor Sakharov's avatar
Fedor Sakharov committed
209
210

		// Parachains modules.
211
212
213
214
		ParachainsOrigin: parachains_origin::{Pallet, Origin},
		ParachainsConfiguration: parachains_configuration::{Pallet, Call, Storage, Config<T>},
		Shared: parachains_shared::{Pallet, Call, Storage},
		Inclusion: parachains_inclusion::{Pallet, Call, Storage, Event<T>},
215
		ParasInherent: parachains_paras_inherent::{Pallet, Call, Storage, Inherent},
216
		Scheduler: parachains_scheduler::{Pallet, Call, Storage},
217
		Paras: parachains_paras::{Pallet, Call, Storage, Event, Config<T>},
218
219
220
221
222
223
		Initializer: parachains_initializer::{Pallet, Call, Storage},
		Dmp: parachains_dmp::{Pallet, Call, Storage},
		Ump: parachains_ump::{Pallet, Call, Storage},
		Hrmp: parachains_hrmp::{Pallet, Call, Storage, Event},
		SessionInfo: parachains_session_info::{Pallet, Call, Storage},

224
		// Parachain Onboarding Pallets
225
		Registrar: paras_registrar::{Pallet, Call, Storage, Event<T>},
226
227
228
		Auctions: auctions::{Pallet, Call, Storage, Event<T>},
		Crowdloan: crowdloan::{Pallet, Call, Storage, Event<T>},
		Slots: slots::{Pallet, Call, Storage, Event<T>},
229
		ParasSudoWrapper: paras_sudo_wrapper::{Pallet, Call},
230
231

		// Sudo
232
		Sudo: pallet_sudo::{Pallet, Call, Storage, Event<T>, Config<T>},
233

234
235
236
237
238
		// Bridges support.
		Mmr: pallet_mmr::{Pallet, Call, Storage},
		Beefy: pallet_beefy::{Pallet, Config<T>, Storage},
		MmrLeaf: mmr_common::{Pallet, Storage},

239
240
		// Validator Manager pallet.
		ValidatorManager: validator_manager::{Pallet, Call, Storage, Event<T>},
241

242
243
244
245
		// A "council"
		Collective: pallet_collective::{Pallet, Call, Storage, Origin<T>, Event<T>, Config<T>} = 80,
		Membership: pallet_membership::{Pallet, Call, Storage, Event<T>, Config<T>} = 81,

246
247
		Utility: pallet_utility::{Pallet, Call, Event} = 90,
		Proxy: pallet_proxy::{Pallet, Call, Storage, Event<T>} = 91,
Gavin Wood's avatar
Gavin Wood committed
248
249
250

		// Pallet for sending XCM.
		XcmPallet: pallet_xcm::{Pallet, Call, Storage, Event<T>} = 99,
251
252
253
	}
}

254
255
256
257
258
259
pub struct BaseFilter;
impl Filter<Call> for BaseFilter {
	fn filter(_call: &Call) -> bool {
		true
	}
}
260

Fedor Sakharov's avatar
Fedor Sakharov committed
261
262
parameter_types! {
	pub const Version: RuntimeVersion = VERSION;
263
	pub const SS58Prefix: u8 = 42;
Fedor Sakharov's avatar
Fedor Sakharov committed
264
265
}

266
impl frame_system::Config for Runtime {
Fedor Sakharov's avatar
Fedor Sakharov committed
267
	type BaseCallFilter = BaseFilter;
268
269
270
	type BlockWeights = BlockWeights;
	type BlockLength = BlockLength;
	type DbWeight = RocksDbWeight;
Fedor Sakharov's avatar
Fedor Sakharov committed
271
272
273
274
275
276
277
	type Origin = Origin;
	type Call = Call;
	type Index = Nonce;
	type BlockNumber = BlockNumber;
	type Hash = Hash;
	type Hashing = BlakeTwo256;
	type AccountId = AccountId;
278
	type Lookup = AccountIdLookup<AccountId, ()>;
Fedor Sakharov's avatar
Fedor Sakharov committed
279
280
281
282
	type Header = generic::Header<BlockNumber, BlakeTwo256>;
	type Event = Event;
	type BlockHashCount = BlockHashCount;
	type Version = Version;
283
	type PalletInfo = PalletInfo;
284
	type AccountData = pallet_balances::AccountData<Balance>;
Fedor Sakharov's avatar
Fedor Sakharov committed
285
286
287
	type OnNewAccount = ();
	type OnKilledAccount = ();
	type SystemWeightInfo = ();
288
	type SS58Prefix = SS58Prefix;
289
	type OnSetCode = ();
Fedor Sakharov's avatar
Fedor Sakharov committed
290
291
292
293
294
295
296
297
298
299
}

parameter_types! {
	pub const ValidationUpgradeFrequency: BlockNumber = 2 * DAYS;
	pub const ValidationUpgradeDelay: BlockNumber = 8 * HOURS;
	pub const SlashPeriod: BlockNumber = 7 * DAYS;
}

/// Submits a transaction with the node's public and signature type. Adheres to the signed extension
/// format of the chain.
300
impl<LocalCall> frame_system::offchain::CreateSignedTransaction<LocalCall> for Runtime where
Fedor Sakharov's avatar
Fedor Sakharov committed
301
302
	Call: From<LocalCall>,
{
303
	fn create_transaction<C: frame_system::offchain::AppCrypto<Self::Public, Self::Signature>>(
Fedor Sakharov's avatar
Fedor Sakharov committed
304
305
306
		call: Call,
		public: <Signature as Verify>::Signer,
		account: AccountId,
307
		nonce: <Runtime as frame_system::Config>::Index,
Fedor Sakharov's avatar
Fedor Sakharov committed
308
	) -> Option<(Call, <UncheckedExtrinsic as ExtrinsicT>::SignaturePayload)> {
309
		use sp_runtime::traits::StaticLookup;
Fedor Sakharov's avatar
Fedor Sakharov committed
310
311
312
313
314
315
316
317
318
319
320
321
322
		// take the biggest period possible.
		let period = BlockHashCount::get()
			.checked_next_power_of_two()
			.map(|c| c / 2)
			.unwrap_or(2) as u64;

		let current_block = System::block_number()
			.saturated_into::<u64>()
			// The `System::block_number` is initialized with `n+1`,
			// so the actual block number is `n`.
			.saturating_sub(1);
		let tip = 0;
		let extra: SignedExtra = (
323
324
325
326
327
328
329
			frame_system::CheckSpecVersion::<Runtime>::new(),
			frame_system::CheckTxVersion::<Runtime>::new(),
			frame_system::CheckGenesis::<Runtime>::new(),
			frame_system::CheckMortality::<Runtime>::from(generic::Era::mortal(period, current_block)),
			frame_system::CheckNonce::<Runtime>::from(nonce),
			frame_system::CheckWeight::<Runtime>::new(),
			pallet_transaction_payment::ChargeTransactionPayment::<Runtime>::from(tip),
Fedor Sakharov's avatar
Fedor Sakharov committed
330
331
		);
		let raw_payload = SignedPayload::new(call, extra).map_err(|e| {
332
			log::warn!("Unable to create signed payload: {:?}", e);
Fedor Sakharov's avatar
Fedor Sakharov committed
333
334
335
336
337
		}).ok()?;
		let signature = raw_payload.using_encoded(|payload| {
			C::sign(payload, public)
		})?;
		let (call, extra, _) = raw_payload.deconstruct();
338
339
		let address = <Runtime as frame_system::Config>::Lookup::unlookup(account);
		Some((call, (address, signature, extra)))
Fedor Sakharov's avatar
Fedor Sakharov committed
340
341
342
	}
}

343
impl frame_system::offchain::SigningTypes for Runtime {
Fedor Sakharov's avatar
Fedor Sakharov committed
344
345
346
347
	type Public = <Signature as Verify>::Signer;
	type Signature = Signature;
}

348
349
350
351
/// Special `FullIdentificationOf` implementation that is returning for every input `Some(Default::default())`.
pub struct FullIdentificationOf;
impl sp_runtime::traits::Convert<AccountId, Option<()>> for FullIdentificationOf {
	fn convert(_: AccountId) -> Option<()> { Some(Default::default()) }
Fedor Sakharov's avatar
Fedor Sakharov committed
352
353
}

354
355
356
impl pallet_session::historical::Config for Runtime {
	type FullIdentification = ();
	type FullIdentificationOf = FullIdentificationOf;
Fedor Sakharov's avatar
Fedor Sakharov committed
357
358
359
}

parameter_types! {
360
	pub SessionDuration: BlockNumber = EpochDurationInBlocks::get() as _;
Fedor Sakharov's avatar
Fedor Sakharov committed
361
362
363
364
365
366
}

parameter_types! {
	pub const ImOnlineUnsignedPriority: TransactionPriority = TransactionPriority::max_value();
}

367
impl pallet_im_online::Config for Runtime {
Fedor Sakharov's avatar
Fedor Sakharov committed
368
369
	type AuthorityId = ImOnlineId;
	type Event = Event;
370
	type ValidatorSet = Historical;
371
	type NextSessionRotation = Babe;
Fedor Sakharov's avatar
Fedor Sakharov committed
372
	type ReportUnresponsiveness = Offences;
373
	type UnsignedPriority = ImOnlineUnsignedPriority;
Fedor Sakharov's avatar
Fedor Sakharov committed
374
375
376
377
378
	type WeightInfo = ();
}

parameter_types! {
	pub const ExistentialDeposit: Balance = 1 * CENTS;
379
	pub const MaxLocks: u32 = 50;
Fedor Sakharov's avatar
Fedor Sakharov committed
380
381
}

382
impl pallet_balances::Config for Runtime {
Fedor Sakharov's avatar
Fedor Sakharov committed
383
384
385
386
387
	type Balance = Balance;
	type DustRemoval = ();
	type Event = Event;
	type ExistentialDeposit = ExistentialDeposit;
	type AccountStore = System;
388
	type MaxLocks = MaxLocks;
Fedor Sakharov's avatar
Fedor Sakharov committed
389
390
391
	type WeightInfo = ();
}

392
impl<C> frame_system::offchain::SendTransactionTypes<C> for Runtime where
Fedor Sakharov's avatar
Fedor Sakharov committed
393
394
395
396
397
398
399
400
401
402
403
404
	Call: From<C>,
{
	type OverarchingCall = Call;
	type Extrinsic = UncheckedExtrinsic;
}

parameter_types! {
	pub const QueueSize: usize = 2;
	pub const MaxRetries: u32 = 3;
}

parameter_types! {
405
	pub OffencesWeightSoftLimit: Weight = Perbill::from_percent(60) * BlockWeights::get().max_block;
Fedor Sakharov's avatar
Fedor Sakharov committed
406
407
}

408
impl pallet_offences::Config for Runtime {
Fedor Sakharov's avatar
Fedor Sakharov committed
409
	type Event = Event;
410
	type IdentificationTuple = pallet_session::historical::IdentificationTuple<Self>;
411
	type OnOffenceHandler = ();
Fedor Sakharov's avatar
Fedor Sakharov committed
412
413
414
	type WeightSoftLimit = OffencesWeightSoftLimit;
}

415
impl pallet_authority_discovery::Config for Runtime {}
Fedor Sakharov's avatar
Fedor Sakharov committed
416
417
418
419

parameter_types! {
	pub const MinimumPeriod: u64 = SLOT_DURATION / 2;
}
420
impl pallet_timestamp::Config for Runtime {
Fedor Sakharov's avatar
Fedor Sakharov committed
421
422
423
424
425
426
427
428
429
430
	type Moment = u64;
	type OnTimestampSet = Babe;
	type MinimumPeriod = MinimumPeriod;
	type WeightInfo = ();
}

parameter_types! {
	pub const TransactionByteFee: Balance = 10 * MILLICENTS;
}

431
impl pallet_transaction_payment::Config for Runtime {
Albrecht's avatar
Albrecht committed
432
	type OnChargeTransaction = CurrencyAdapter<Balances, ToAuthor<Runtime>>;
Fedor Sakharov's avatar
Fedor Sakharov committed
433
434
435
436
437
438
439
440
441
	type TransactionByteFee = TransactionByteFee;
	type WeightToFee = WeightToFee;
	type FeeMultiplierUpdate = SlowAdjustingFeeUpdate<Self>;
}

parameter_types! {
	pub const DisabledValidatorsThreshold: Perbill = Perbill::from_percent(17);
}

442
443
444
445
446
447
/// Special `ValidatorIdOf` implementation that is just returning the input as result.
pub struct ValidatorIdOf;
impl sp_runtime::traits::Convert<AccountId, Option<AccountId>> for ValidatorIdOf {
	fn convert(a: AccountId) -> Option<AccountId> { Some(a) }
}

448
impl pallet_session::Config for Runtime {
Fedor Sakharov's avatar
Fedor Sakharov committed
449
450
	type Event = Event;
	type ValidatorId = AccountId;
451
	type ValidatorIdOf = ValidatorIdOf;
Fedor Sakharov's avatar
Fedor Sakharov committed
452
453
	type ShouldEndSession = Babe;
	type NextSessionRotation = Babe;
454
	type SessionManager = pallet_session::historical::NoteHistoricalRoot<Self, ValidatorManager>;
Fedor Sakharov's avatar
Fedor Sakharov committed
455
456
457
458
459
460
461
462
	type SessionHandler = <SessionKeys as OpaqueKeys>::KeyTypeIdProviders;
	type Keys = SessionKeys;
	type DisabledValidatorsThreshold = DisabledValidatorsThreshold;
	type WeightInfo = ();
}

parameter_types! {
	pub const ExpectedBlockTime: Moment = MILLISECS_PER_BLOCK;
463
	pub ReportLongevity: u64 = EpochDurationInBlocks::get() as u64 * 10;
Fedor Sakharov's avatar
Fedor Sakharov committed
464
465
}

466
impl pallet_babe::Config for Runtime {
467
	type EpochDuration = EpochDurationInBlocks;
Fedor Sakharov's avatar
Fedor Sakharov committed
468
469
470
	type ExpectedBlockTime = ExpectedBlockTime;

	// session module is the trigger
471
	type EpochChangeTrigger = pallet_babe::ExternalTrigger;
Fedor Sakharov's avatar
Fedor Sakharov committed
472
473
474
475
476

	type KeyOwnerProofSystem = Historical;

	type KeyOwnerProof = <Self::KeyOwnerProofSystem as KeyOwnerProofSystem<(
		KeyTypeId,
477
		pallet_babe::AuthorityId,
Fedor Sakharov's avatar
Fedor Sakharov committed
478
479
480
481
	)>>::Proof;

	type KeyOwnerIdentification = <Self::KeyOwnerProofSystem as KeyOwnerProofSystem<(
		KeyTypeId,
482
		pallet_babe::AuthorityId,
Fedor Sakharov's avatar
Fedor Sakharov committed
483
484
485
	)>>::IdentificationTuple;

	type HandleEquivocation =
486
		pallet_babe::EquivocationHandler<Self::KeyOwnerIdentification, Offences, ReportLongevity>;
487
488

	type WeightInfo = ();
Fedor Sakharov's avatar
Fedor Sakharov committed
489
490
491
492
493
494
}

parameter_types! {
	pub const IndexDeposit: Balance = 1 * DOLLARS;
}

495
impl pallet_indices::Config for Runtime {
Fedor Sakharov's avatar
Fedor Sakharov committed
496
497
498
499
500
501
502
503
504
505
506
	type AccountIndex = AccountIndex;
	type Currency = Balances;
	type Deposit = IndexDeposit;
	type Event = Event;
	type WeightInfo = ();
}

parameter_types! {
	pub const AttestationPeriod: BlockNumber = 50;
}

507
impl pallet_grandpa::Config for Runtime {
Fedor Sakharov's avatar
Fedor Sakharov committed
508
509
510
511
512
513
514
515
516
517
518
519
520
	type Event = Event;
	type Call = Call;

	type KeyOwnerProofSystem = Historical;

	type KeyOwnerProof =
		<Self::KeyOwnerProofSystem as KeyOwnerProofSystem<(KeyTypeId, GrandpaId)>>::Proof;

	type KeyOwnerIdentification = <Self::KeyOwnerProofSystem as KeyOwnerProofSystem<(
		KeyTypeId,
		GrandpaId,
	)>>::IdentificationTuple;

521
522
	type HandleEquivocation =
		pallet_grandpa::EquivocationHandler<Self::KeyOwnerIdentification, Offences, ReportLongevity>;
523
524

	type WeightInfo = ();
Fedor Sakharov's avatar
Fedor Sakharov committed
525
526
527
528
529
530
}

parameter_types! {
	pub const UncleGenerations: u32 = 0;
}

531
impl pallet_authorship::Config for Runtime {
532
	type FindAuthor = pallet_session::FindAccountFromAuthorIndex<Self, Babe>;
Fedor Sakharov's avatar
Fedor Sakharov committed
533
534
	type UncleGenerations = UncleGenerations;
	type FilterUncle = ();
535
	type EventHandler = ImOnline;
Fedor Sakharov's avatar
Fedor Sakharov committed
536
537
}

538
impl parachains_origin::Config for Runtime {}
539

540
impl parachains_configuration::Config for Runtime {}
Fedor Sakharov's avatar
Fedor Sakharov committed
541

542
543
impl parachains_shared::Config for Runtime {}

544
545
546
547
548
549
550
/// Special `RewardValidators` that does nothing ;)
pub struct RewardValidators;
impl runtime_parachains::inclusion::RewardValidators for RewardValidators {
	fn reward_backing(_: impl IntoIterator<Item=ValidatorIndex>) {}
	fn reward_bitfields(_: impl IntoIterator<Item=ValidatorIndex>) {}
}

551
impl parachains_inclusion::Config for Runtime {
Fedor Sakharov's avatar
Fedor Sakharov committed
552
	type Event = Event;
553
	type RewardValidators = RewardValidators;
Fedor Sakharov's avatar
Fedor Sakharov committed
554
555
}

556
impl parachains_paras::Config for Runtime {
557
	type Origin = Origin;
558
	type Event = Event;
559
}
Fedor Sakharov's avatar
Fedor Sakharov committed
560

Shawn Tabrizi's avatar
Shawn Tabrizi committed
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
parameter_types! {
	pub const RocLocation: MultiLocation = MultiLocation::Null;
	pub const RococoNetwork: NetworkId = NetworkId::Polkadot;
	pub const Ancestry: MultiLocation = MultiLocation::Null;
}

pub type LocationConverter = (
	ChildParachainConvertsVia<ParaId, AccountId>,
	AccountId32Aliases<RococoNetwork, AccountId>,
);

pub type LocalAssetTransactor =
	XcmCurrencyAdapter<
		// Use this currency:
		Balances,
		// Use this currency when it is a fungible asset matching the given location or name:
		IsConcrete<RocLocation>,
		// We can convert the MultiLocations with our converter above:
		LocationConverter,
		// Our chain's account ID type (we can't get away without mentioning it explicitly):
		AccountId,
	>;

type LocalOriginConverter = (
	SovereignSignedViaLocation<LocationConverter, Origin>,
	ChildParachainAsNative<parachains_origin::Origin, Origin>,
	SignedAccountId32AsNative<RococoNetwork, Origin>,
	ChildSystemParachainAsSuperuser<ParaId, Origin>,
);

Gavin Wood's avatar
Gavin Wood committed
591
592
593
594
595
parameter_types! {
	pub const BaseXcmWeight: Weight = 100_000;
	pub const RocFee: (MultiLocation, u128) = (RocLocation::get(), 1 * CENTS);
}

Gavin Wood's avatar
Gavin Wood committed
596
597
598
599
600
601
602
/// The XCM router. When we want to send an XCM message, we use this type. It amalgamates all of our
/// individual routers.
pub type XcmRouter = (
	// Only one router so far - use DMP to communicate with child parachains.
	xcm_sender::ChildParachainRouter<Runtime>,
);

603
604
use xcm::v0::{MultiAsset, MultiAsset::AllConcreteFungible, MultiLocation::{Null, X1}, Junction::Parachain};
parameter_types! {
Ricardo Rius's avatar
Ricardo Rius committed
605
	pub const RococoForTick: (MultiAsset, MultiLocation) =
606
		(AllConcreteFungible { id: Null }, X1(Parachain(100)));
Ricardo Rius's avatar
Ricardo Rius committed
607
	pub const RococoForTrick: (MultiAsset, MultiLocation) =
608
		(AllConcreteFungible { id: Null }, X1(Parachain(110)));
Ricardo Rius's avatar
Ricardo Rius committed
609
	pub const RococoForTrack: (MultiAsset, MultiLocation) =
610
		(AllConcreteFungible { id: Null }, X1(Parachain(120)));
Ricardo Rius's avatar
Ricardo Rius committed
611
	pub const RococoForStatemint: (MultiAsset, MultiLocation) =
612
		(AllConcreteFungible { id: Null }, X1(Parachain(1)));
613
614
615
616
617
}
pub type TrustedTeleporters = (
	xcm_builder::Case<RococoForTick>,
	xcm_builder::Case<RococoForTrick>,
	xcm_builder::Case<RococoForTrack>,
Ricardo Rius's avatar
Ricardo Rius committed
618
	xcm_builder::Case<RococoForStatemint>,
619
620
621
);

parameter_types! {
Ricardo Rius's avatar
Ricardo Rius committed
622
623
	pub AllowUnpaidFrom: Vec<MultiLocation> = 
		vec![
624
625
626
627
			X1(Parachain(100)),
			X1(Parachain(110)),
			X1(Parachain(120)),
			X1(Parachain(1))
Ricardo Rius's avatar
Ricardo Rius committed
628
		];
629
630
631
632
633
634
635
636
637
}

use xcm_builder::{TakeWeightCredit, AllowTopLevelPaidExecutionFrom, AllowUnpaidExecutionFrom};
pub type Barrier = (
	TakeWeightCredit,
	AllowTopLevelPaidExecutionFrom<All<MultiLocation>>,
	AllowUnpaidExecutionFrom<IsInVec<AllowUnpaidFrom>>,	// <- Trusted parachains get free execution
);

Shawn Tabrizi's avatar
Shawn Tabrizi committed
638
639
640
pub struct XcmConfig;
impl xcm_executor::Config for XcmConfig {
	type Call = Call;
Gavin Wood's avatar
Gavin Wood committed
641
	type XcmSender = XcmRouter;
Shawn Tabrizi's avatar
Shawn Tabrizi committed
642
643
644
	type AssetTransactor = LocalAssetTransactor;
	type OriginConverter = LocalOriginConverter;
	type IsReserve = ();
645
	type IsTeleporter = TrustedTeleporters;
Shawn Tabrizi's avatar
Shawn Tabrizi committed
646
	type LocationInverter = LocationInverter<Ancestry>;
647
	type Barrier = Barrier;
Gavin Wood's avatar
Gavin Wood committed
648
	type Weigher = FixedWeightBounds<BaseXcmWeight, Call>;
649
	type Trader = UsingComponents<WeightToFee, RocLocation, AccountId, Balances, ToAuthor<Runtime>>;
Gavin Wood's avatar
Gavin Wood committed
650
	type ResponseHandler = ();
Shawn Tabrizi's avatar
Shawn Tabrizi committed
651
652
}

653
654
655
656
parameter_types! {
	pub const CollectiveBodyId: BodyId = BodyId::Unit;
}

Gavin Wood's avatar
Gavin Wood committed
657
658
659
/// Type to convert an `Origin` type value into a `MultiLocation` value which represents an interior location
/// of this chain.
pub type LocalOriginToLocation = (
660
661
	// We allow an origin from the Collective pallet to be used in XCM as a corresponding Plurality of the
	// `Unit` body.
662
663
664
	BackingToPlurality<Origin, pallet_collective::Origin<Runtime>, CollectiveBodyId>,
	// And a usual Signed origin to be used in XCM as a corresponding AccountId32
	SignedToAccountId32<Origin, AccountId, RococoNetwork>,
Gavin Wood's avatar
Gavin Wood committed
665
666
667
668
669
670
671
672
673
674
675
);

impl pallet_xcm::Config for Runtime {
	type Event = Event;
	type SendXcmOrigin = xcm_builder::EnsureXcmOrigin<Origin, LocalOriginToLocation>;
	type XcmRouter = XcmRouter;
	// Right now nobody but root is allowed to dispatch local XCM messages.
	type ExecuteXcmOrigin = xcm_builder::EnsureXcmOrigin<Origin, ()>;
	type XcmExecutor = XcmExecutor<XcmConfig>;
}

676
impl parachains_session_info::Config for Runtime {}
677

Gavin Wood's avatar
Gavin Wood committed
678
679
680
681
parameter_types! {
	pub const FirstMessageFactorPercent: u64 = 100;
}

682
impl parachains_ump::Config for Runtime {
Gavin Wood's avatar
Gavin Wood committed
683
684
	type UmpSink = crate::parachains_ump::XcmSink<XcmExecutor<XcmConfig>, Call>;
	type FirstMessageFactorPercent = FirstMessageFactorPercent;
685
}
686

687
impl parachains_dmp::Config for Runtime {}
688

689
impl parachains_hrmp::Config for Runtime {
690
	type Event = Event;
691
	type Origin = Origin;
692
	type Currency = Balances;
693
694
}

695
impl parachains_paras_inherent::Config for Runtime {}
Fedor Sakharov's avatar
Fedor Sakharov committed
696

697
impl parachains_scheduler::Config for Runtime {}
Fedor Sakharov's avatar
Fedor Sakharov committed
698

699
impl parachains_initializer::Config for Runtime {
700
	type Randomness = pallet_babe::RandomnessFromOneEpochAgo<Runtime>;
701
	type ForceOrigin = EnsureRoot<AccountId>;
Fedor Sakharov's avatar
Fedor Sakharov committed
702
}
703

704
impl paras_sudo_wrapper::Config for Runtime {}
705

706
707
708
parameter_types! {
	pub const ParaDeposit: Balance = 5 * DOLLARS;
	pub const DataDepositPerByte: Balance = deposit(0, 1);
709
	pub const MaxCodeSize: u32 = MAX_CODE_SIZE;
710
711
712
	pub const MaxHeadSize: u32 = 20 * 1024; // 20 KB
}

713
impl paras_registrar::Config for Runtime {
714
	type Event = Event;
715
	type Origin = Origin;
716
	type Currency = Balances;
717
	type OnSwap = (Crowdloan, Slots);
718
719
720
721
722
	type ParaDeposit = ParaDeposit;
	type DataDepositPerByte = DataDepositPerByte;
	type MaxCodeSize = MaxCodeSize;
	type MaxHeadSize = MaxHeadSize;
	type WeightInfo = paras_registrar::TestWeightInfo;
723
}
724

725
726
727
728
/// An insecure randomness beacon that uses the parent block hash as random material.
///
/// THIS SHOULD ONLY BE USED FOR TESTING PURPOSES.
pub struct ParentHashRandomness;
729

730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
impl pallet_beefy::Config for Runtime {
	type AuthorityId = BeefyId;
}

impl pallet_mmr::Config for Runtime {
	const INDEXING_PREFIX: &'static [u8] = b"mmr";
	type Hashing = Keccak256;
	type Hash = <Keccak256 as traits::Hash>::Output;
	type OnNewRoot = mmr_common::DepositBeefyDigest<Runtime>;
	type WeightInfo = ();
	type LeafData = mmr_common::Pallet<Runtime>;
}

impl mmr_common::Config for Runtime {
	type BeefyAuthorityToMerkleLeaf = mmr_common::UncompressBeefyEcdsaKeys;
	type ParachainHeads = Paras;
}

748
impl Randomness<Hash, BlockNumber> for ParentHashRandomness {
749
	fn random(subject: &[u8]) -> (Hash, BlockNumber) {
750
751
752
753
		(
			(System::parent_hash(), subject).using_encoded(sp_io::hashing::blake2_256).into(),
			System::block_number(),
		)
754
755
756
	}
}

757
parameter_types! {
758
	pub const EndingPeriod: BlockNumber = 1 * HOURS;
759
760
761
	pub const SampleLength: BlockNumber = 1;
}

762
763
764
impl auctions::Config for Runtime {
	type Event = Event;
	type Leaser = Slots;
765
	type Registrar = Registrar;
766
	type EndingPeriod = EndingPeriod;
767
	type SampleLength = SampleLength;
768
	type Randomness = ParentHashRandomness;
769
770
771
	type InitiateOrigin = EnsureRoot<AccountId>;
	type WeightInfo = auctions::TestWeightInfo;
}
772

773
774
775
parameter_types! {
	pub const LeasePeriod: BlockNumber = 1 * DAYS;
}
776

777
778
779
780
781
782
783
impl slots::Config for Runtime {
	type Event = Event;
	type Currency = Balances;
	type Registrar = Registrar;
	type LeasePeriod = LeasePeriod;
	type WeightInfo = slots::TestWeightInfo;
}
784

785
parameter_types! {
Shawn Tabrizi's avatar
Shawn Tabrizi committed
786
	pub const CrowdloanId: PalletId = PalletId(*b"py/cfund");
787
788
789
790
	pub const SubmissionDeposit: Balance = 100 * DOLLARS;
	pub const MinContribution: Balance = 1 * DOLLARS;
	pub const RetirementPeriod: BlockNumber = 6 * HOURS;
	pub const RemoveKeysLimit: u32 = 500;
791
792
	// Allow 32 bytes for an additional memo to a crowdloan.
	pub const MaxMemoLength: u8 = 32;
793
}
794

795
796
impl crowdloan::Config for Runtime {
	type Event = Event;
Shawn Tabrizi's avatar
Shawn Tabrizi committed
797
	type PalletId = CrowdloanId;
798
799
800
801
802
	type SubmissionDeposit = SubmissionDeposit;
	type MinContribution = MinContribution;
	type RemoveKeysLimit = RemoveKeysLimit;
	type Registrar = Registrar;
	type Auctioneer = Auctions;
803
	type MaxMemoLength = MaxMemoLength;
804
	type WeightInfo = crowdloan::TestWeightInfo;
805
806
}

807
808
809
impl pallet_sudo::Config for Runtime {
	type Event = Event;
	type Call = Call;
810
811
}

812
impl validator_manager::Config for Runtime {
813
	type Event = Event;
814
	type PrivilegedOrigin = EnsureRoot<AccountId>;
815
816
}

817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
impl pallet_utility::Config for Runtime {
	type Event = Event;
	type Call = Call;
	type WeightInfo = ();
}

parameter_types! {
	// One storage item; key size 32, value size 8; .
	pub const ProxyDepositBase: Balance = 10;
	// Additional storage item size of 33 bytes.
	pub const ProxyDepositFactor: Balance = 10;
	pub const MaxProxies: u16 = 32;
	pub const AnnouncementDepositBase: Balance = 10;
	pub const AnnouncementDepositFactor: Balance = 10;
	pub const MaxPending: u16 = 32;
}

/// The type used to represent the kinds of proxying allowed.
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Encode, Decode, RuntimeDebug)]
pub enum ProxyType {
	Any,
	CancelProxy,
}
impl Default for ProxyType { fn default() -> Self { Self::Any } }
impl InstanceFilter<Call> for ProxyType {
	fn filter(&self, c: &Call) -> bool {
		match self {
			ProxyType::Any => true,
			ProxyType::CancelProxy => matches!(c,
				Call::Proxy(pallet_proxy::Call::reject_announcement(..))
			)
		}
	}
	fn is_superset(&self, o: &Self) -> bool {
		match (self, o) {
			(ProxyType::Any, _) => true,
			_ => false,
		}
	}
}

impl pallet_proxy::Config for Runtime {
	type Event = Event;
	type Call = Call;
	type Currency = Balances;
	type ProxyType = ProxyType;
	type ProxyDepositBase = ProxyDepositBase;
	type ProxyDepositFactor = ProxyDepositFactor;
	type MaxProxies = MaxProxies;
	type WeightInfo = ();
	type MaxPending = MaxPending;
	type CallHasher = BlakeTwo256;
	type AnnouncementDepositBase = AnnouncementDepositBase;
	type AnnouncementDepositFactor = AnnouncementDepositFactor;
}

873
874
875
876
877
878
879
880
881
882
883
884
885
parameter_types! {
	pub const MotionDuration: BlockNumber = 5;
	pub const MaxProposals: u32 = 100;
	pub const MaxMembers: u32 = 100;
}

impl pallet_collective::Config for Runtime {
	type Origin = Origin;
	type Proposal = Call;
	type Event = Event;
	type MotionDuration = MotionDuration;
	type MaxProposals = MaxProposals;
	type DefaultVote = pallet_collective::PrimeDefaultVote;
886
	type MaxMembers = MaxMembers;
887
888
889
890
891
892
893
894
895
896
897
898
	type WeightInfo = ();
}

impl pallet_membership::Config for Runtime {
	type Event = Event;
	type AddOrigin = EnsureRoot<AccountId>;
	type RemoveOrigin = EnsureRoot<AccountId>;
	type SwapOrigin = EnsureRoot<AccountId>;
	type ResetOrigin = EnsureRoot<AccountId>;
	type PrimeOrigin = EnsureRoot<AccountId>;
	type MembershipInitialized = Collective;
	type MembershipChanged = Collective;
899
900
	type MaxMembers = MaxMembers;
	type WeightInfo = ();
901
902
}

903
904
905
906
907
908
909
910
#[cfg(not(feature = "disable-runtime-api"))]
sp_api::impl_runtime_apis! {
	impl sp_api::Core<Block> for Runtime {
		fn version() -> RuntimeVersion {
			VERSION
		}

		fn execute_block(block: Block) {
911
			Executive::execute_block(block);
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
		}

		fn initialize_block(header: &<Block as BlockT>::Header) {
			Executive::initialize_block(header)
		}
	}

	impl sp_api::Metadata<Block> for Runtime {
		fn metadata() -> OpaqueMetadata {
			Runtime::metadata().into()
		}
	}

	impl block_builder_api::BlockBuilder<Block> for Runtime {
		fn apply_extrinsic(extrinsic: <Block as BlockT>::Extrinsic) -> ApplyExtrinsicResult {
			Executive::apply_extrinsic(extrinsic)
		}

		fn finalize_block() -> <Block as BlockT>::Header {
			Executive::finalize_block()
		}

		fn inherent_extrinsics(data: inherents::InherentData) -> Vec<<Block as BlockT>::Extrinsic> {
			data.create_extrinsics()
		}

		fn check_inherents(
			block: Block,
			data: inherents::InherentData,
		) -> inherents::CheckInherentsResult {
			data.check_extrinsics(&block)
		}

		fn random_seed() -> <Block as BlockT>::Hash {
946
			pallet_babe::RandomnessFromOneEpochAgo::<Runtime>::random_seed().0
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
		}
	}

	impl tx_pool_api::runtime_api::TaggedTransactionQueue<Block> for Runtime {
		fn validate_transaction(
			source: TransactionSource,
			tx: <Block as BlockT>::Extrinsic,
		) -> TransactionValidity {
			Executive::validate_transaction(source, tx)
		}
	}

	impl offchain_primitives::OffchainWorkerApi<Block> for Runtime {
		fn offchain_worker(header: &<Block as BlockT>::Header) {
			Executive::offchain_worker(header)
		}
	}

	impl primitives::v1::ParachainHost<Block, Hash, BlockNumber> for Runtime {
		fn validators() -> Vec<ValidatorId> {
			runtime_api_impl::validators::<Runtime>()
		}

		fn validator_groups() -> (Vec<Vec<ValidatorIndex>>, GroupRotationInfo<BlockNumber>) {
			runtime_api_impl::validator_groups::<Runtime>()
		}

974
		fn availability_cores() -> Vec<CoreState<Hash, BlockNumber>> {
975
976
977
978
			runtime_api_impl::availability_cores::<Runtime>()
		}

		fn persisted_validation_data(para_id: Id, assumption: OccupiedCoreAssumption)
979
			-> Option<PersistedValidationData<Hash, BlockNumber>> {
980
981
982
983
984
			runtime_api_impl::persisted_validation_data::<Runtime>(para_id, assumption)
		}

		fn check_validation_outputs(
			para_id: Id,
985
			outputs: primitives::v1::CandidateCommitments,
986
987
988
989
990
991
992
993
994
995
996
997
998
		) -> bool {
			runtime_api_impl::check_validation_outputs::<Runtime>(para_id, outputs)
		}

		fn session_index_for_child() -> SessionIndex {
			runtime_api_impl::session_index_for_child::<Runtime>()
		}

		fn validation_code(para_id: Id, assumption: OccupiedCoreAssumption)
			-> Option<ValidationCode> {
			runtime_api_impl::validation_code::<Runtime>(para_id, assumption)
		}

999
1000
		fn historical_validation_code(para_id: Id, context_height: BlockNumber)
			-> Option<ValidationCode>
For faster browsing, not all history is shown. View entire blame