Newer
Older
pub const MaxFellows: u32 = AllianceMaxMembers::get();
pub const MaxAllies: u32 = 100;
pub const AllyDeposit: Balance = 10 * DOLLARS;
pub const RetirementPeriod: BlockNumber = ALLIANCE_MOTION_DURATION_IN_BLOCKS + (1 * DAYS);
}
impl pallet_alliance::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type Proposal = RuntimeCall;
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
type AdminOrigin = EitherOfDiverse<
EnsureRoot<AccountId>,
pallet_collective::EnsureProportionMoreThan<AccountId, AllianceCollective, 2, 3>,
>;
type MembershipManager = EitherOfDiverse<
EnsureRoot<AccountId>,
pallet_collective::EnsureProportionMoreThan<AccountId, AllianceCollective, 2, 3>,
>;
type AnnouncementOrigin = EitherOfDiverse<
EnsureRoot<AccountId>,
pallet_collective::EnsureProportionMoreThan<AccountId, AllianceCollective, 2, 3>,
>;
type Currency = Balances;
type Slashed = Treasury;
type InitializeMembers = AllianceMotion;
type MembershipChanged = AllianceMotion;
#[cfg(not(feature = "runtime-benchmarks"))]
type IdentityVerifier = AllianceIdentityVerifier;
#[cfg(feature = "runtime-benchmarks")]
type IdentityVerifier = ();
type ProposalProvider = AllianceProposalProvider;
type MaxProposals = AllianceMaxProposals;
type MaxFellows = MaxFellows;
type MaxAllies = MaxAllies;
type MaxUnscrupulousItems = ConstU32<100>;
type MaxWebsiteUrlLength = ConstU32<255>;
type MaxAnnouncementsCount = ConstU32<100>;
type MaxMembersCount = AllianceMaxMembers;
type AllyDeposit = AllyDeposit;
type WeightInfo = pallet_alliance::weights::SubstrateWeight<Runtime>;
type RetirementPeriod = RetirementPeriod;
impl frame_benchmarking_pallet_pov::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
}
parameter_types! {
pub StatementCost: Balance = 1 * DOLLARS;
pub StatementByteCost: Balance = 100 * MILLICENTS;
pub const MinAllowedStatements: u32 = 4;
pub const MaxAllowedStatements: u32 = 10;
pub const MinAllowedBytes: u32 = 1024;
pub const MaxAllowedBytes: u32 = 4096;
}
impl pallet_statement::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type Currency = Balances;
type StatementCost = StatementCost;
type ByteCost = StatementByteCost;
type MinAllowedStatements = MinAllowedStatements;
type MaxAllowedStatements = MaxAllowedStatements;
type MinAllowedBytes = MinAllowedBytes;
type MaxAllowedBytes = MaxAllowedBytes;
}
parameter_types! {
pub MbmServiceWeight: Weight = Perbill::from_percent(80) * RuntimeBlockWeights::get().max_block;
}
impl pallet_migrations::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
#[cfg(not(feature = "runtime-benchmarks"))]
type Migrations = ();
// Benchmarks need mocked migrations to guarantee that they succeed.
#[cfg(feature = "runtime-benchmarks")]
type Migrations = pallet_migrations::mock_helpers::MockedMigrations;
type CursorMaxLen = ConstU32<65_536>;
type IdentifierMaxLen = ConstU32<256>;
type MigrationStatusHandler = ();
type FailedMigrationHandler = frame_support::migrations::FreezeChainOnFailedMigration;
type MaxServiceWeight = MbmServiceWeight;
type WeightInfo = pallet_migrations::weights::SubstrateWeight<Runtime>;
}
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
parameter_types! {
pub const BrokerPalletId: PalletId = PalletId(*b"py/broke");
}
pub struct IntoAuthor;
impl OnUnbalanced<Credit<AccountId, Balances>> for IntoAuthor {
fn on_nonzero_unbalanced(credit: Credit<AccountId, Balances>) {
if let Some(author) = Authorship::author() {
let _ = <Balances as Balanced<_>>::resolve(&author, credit);
}
}
}
parameter_types! {
pub storage CoretimeRevenue: Option<(BlockNumber, Balance)> = None;
}
pub struct CoretimeProvider;
impl CoretimeInterface for CoretimeProvider {
type AccountId = AccountId;
type Balance = Balance;
type RelayChainBlockNumberProvider = System;
fn request_core_count(_count: CoreIndex) {}
fn request_revenue_info_at(_when: u32) {}
fn credit_account(_who: Self::AccountId, _amount: Self::Balance) {}
fn assign_core(
_core: CoreIndex,
_assignment: Vec<(CoreAssignment, PartsOf57600)>,
fn check_notify_revenue_info() -> Option<(u32, Self::Balance)> {
let revenue = CoretimeRevenue::get();
CoretimeRevenue::set(&None);
revenue
}
#[cfg(feature = "runtime-benchmarks")]
fn ensure_notify_revenue_info(when: u32, revenue: Self::Balance) {
CoretimeRevenue::set(&Some((when, revenue)));
}
}
impl pallet_broker::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type Currency = Balances;
type OnRevenue = IntoAuthor;
type TimeslicePeriod = ConstU32<2>;
type MaxLeasedCores = ConstU32<5>;
type MaxReservedCores = ConstU32<5>;
type Coretime = CoretimeProvider;
type ConvertBalance = traits::Identity;
type WeightInfo = ();
type PalletId = BrokerPalletId;
type AdminOrigin = EnsureRoot<AccountId>;
type PriceAdapter = pallet_broker::Linear;
}
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
parameter_types! {
pub const MixnetNumCoverToCurrentBlocks: BlockNumber = 3;
pub const MixnetNumRequestsToCurrentBlocks: BlockNumber = 3;
pub const MixnetNumCoverToPrevBlocks: BlockNumber = 3;
pub const MixnetNumRegisterStartSlackBlocks: BlockNumber = 3;
pub const MixnetNumRegisterEndSlackBlocks: BlockNumber = 3;
pub const MixnetRegistrationPriority: TransactionPriority = ImOnlineUnsignedPriority::get() - 1;
}
impl pallet_mixnet::Config for Runtime {
type MaxAuthorities = MaxAuthorities;
type MaxExternalAddressSize = ConstU32<128>;
type MaxExternalAddressesPerMixnode = ConstU32<16>;
type NextSessionRotation = Babe;
type NumCoverToCurrentBlocks = MixnetNumCoverToCurrentBlocks;
type NumRequestsToCurrentBlocks = MixnetNumRequestsToCurrentBlocks;
type NumCoverToPrevBlocks = MixnetNumCoverToPrevBlocks;
type NumRegisterStartSlackBlocks = MixnetNumRegisterStartSlackBlocks;
type NumRegisterEndSlackBlocks = MixnetNumRegisterEndSlackBlocks;
type RegistrationPriority = MixnetRegistrationPriority;
type MinMixnodes = ConstU32<7>; // Low to allow small testing networks
}
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
/// Dynamic parameters that can be changed at runtime through the
/// `pallet_parameters::set_parameter`.
#[dynamic_params(RuntimeParameters, pallet_parameters::Parameters::<Runtime>)]
pub mod dynamic_params {
use super::*;
#[dynamic_pallet_params]
#[codec(index = 0)]
pub mod storage {
/// Configures the base deposit of storing some data.
#[codec(index = 0)]
pub static BaseDeposit: Balance = 1 * DOLLARS;
/// Configures the per-byte deposit of storing some data.
#[codec(index = 1)]
pub static ByteDeposit: Balance = 1 * CENTS;
}
#[dynamic_pallet_params]
#[codec(index = 1)]
pub mod contracts {
#[codec(index = 0)]
pub static DepositPerItem: Balance = deposit(1, 0);
#[codec(index = 1)]
pub static DepositPerByte: Balance = deposit(0, 1);
#[codec(index = 2)]
pub static DefaultDepositLimit: Balance = deposit(1024, 1024 * 1024);
}
}
#[cfg(feature = "runtime-benchmarks")]
impl Default for RuntimeParameters {
fn default() -> Self {
RuntimeParameters::Storage(dynamic_params::storage::Parameters::BaseDeposit(
dynamic_params::storage::BaseDeposit,
Some(1 * DOLLARS),
))
}
}
pub struct DynamicParametersManagerOrigin;
impl EnsureOriginWithArg<RuntimeOrigin, RuntimeParametersKey> for DynamicParametersManagerOrigin {
type Success = ();
fn try_origin(
origin: RuntimeOrigin,
key: &RuntimeParametersKey,
) -> Result<Self::Success, RuntimeOrigin> {
match key {
RuntimeParametersKey::Storage(_) => {
frame_system::ensure_root(origin.clone()).map_err(|_| origin)?;
return Ok(())
},
![Oliver Tale-Yazdi Oliver Tale-Yazdi's avatar](/uploads/-/system/user/avatar/533/avatar.png?width=36)
Oliver Tale-Yazdi
committed
RuntimeParametersKey::Contracts(_) => {
frame_system::ensure_root(origin.clone()).map_err(|_| origin)?;
return Ok(())
},
}
}
#[cfg(feature = "runtime-benchmarks")]
fn try_successful_origin(_key: &RuntimeParametersKey) -> Result<RuntimeOrigin, ()> {
Ok(RuntimeOrigin::root())
}
}
impl pallet_parameters::Config for Runtime {
type RuntimeParameters = RuntimeParameters;
type RuntimeEvent = RuntimeEvent;
type AdminOrigin = DynamicParametersManagerOrigin;
type WeightInfo = ();
}
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
#[frame_support::runtime]
mod runtime {
#[runtime::runtime]
#[runtime::derive(
RuntimeCall,
RuntimeEvent,
RuntimeError,
RuntimeOrigin,
RuntimeFreezeReason,
RuntimeHoldReason,
RuntimeSlashReason,
RuntimeLockId,
RuntimeTask
)]
pub struct Runtime;
#[runtime::pallet_index(0)]
pub type System = frame_system;
#[runtime::pallet_index(1)]
pub type Utility = pallet_utility;
#[runtime::pallet_index(2)]
pub type Babe = pallet_babe;
#[runtime::pallet_index(3)]
pub type Timestamp = pallet_timestamp;
// Authorship must be before session in order to note author in the correct session and era
// for im-online and staking.
#[runtime::pallet_index(4)]
pub type Authorship = pallet_authorship;
#[runtime::pallet_index(5)]
pub type Indices = pallet_indices;
#[runtime::pallet_index(6)]
pub type Balances = pallet_balances;
#[runtime::pallet_index(7)]
pub type TransactionPayment = pallet_transaction_payment;
#[runtime::pallet_index(8)]
pub type AssetTxPayment = pallet_asset_tx_payment;
#[runtime::pallet_index(9)]
pub type AssetConversionTxPayment = pallet_asset_conversion_tx_payment;
#[runtime::pallet_index(10)]
pub type ElectionProviderMultiPhase = pallet_election_provider_multi_phase;
#[runtime::pallet_index(11)]
pub type Staking = pallet_staking;
#[runtime::pallet_index(12)]
pub type Session = pallet_session;
#[runtime::pallet_index(13)]
pub type Democracy = pallet_democracy;
#[runtime::pallet_index(14)]
pub type Council = pallet_collective<Instance1>;
#[runtime::pallet_index(15)]
pub type TechnicalCommittee = pallet_collective<Instance2>;
#[runtime::pallet_index(16)]
pub type Elections = pallet_elections_phragmen;
#[runtime::pallet_index(17)]
pub type TechnicalMembership = pallet_membership<Instance1>;
#[runtime::pallet_index(18)]
pub type Grandpa = pallet_grandpa;
#[runtime::pallet_index(19)]
pub type Treasury = pallet_treasury;
#[runtime::pallet_index(20)]
pub type AssetRate = pallet_asset_rate;
#[runtime::pallet_index(21)]
pub type Contracts = pallet_contracts;
#[runtime::pallet_index(22)]
pub type Sudo = pallet_sudo;
#[runtime::pallet_index(23)]
pub type ImOnline = pallet_im_online;
#[runtime::pallet_index(24)]
pub type AuthorityDiscovery = pallet_authority_discovery;
#[runtime::pallet_index(25)]
pub type Offences = pallet_offences;
#[runtime::pallet_index(26)]
pub type Historical = pallet_session_historical;
#[runtime::pallet_index(27)]
pub type RandomnessCollectiveFlip = pallet_insecure_randomness_collective_flip;
#[runtime::pallet_index(28)]
pub type Identity = pallet_identity;
#[runtime::pallet_index(29)]
pub type Society = pallet_society;
#[runtime::pallet_index(30)]
pub type Recovery = pallet_recovery;
#[runtime::pallet_index(31)]
pub type Vesting = pallet_vesting;
#[runtime::pallet_index(32)]
pub type Scheduler = pallet_scheduler;
#[runtime::pallet_index(33)]
pub type Glutton = pallet_glutton;
#[runtime::pallet_index(34)]
pub type Preimage = pallet_preimage;
#[runtime::pallet_index(35)]
pub type Proxy = pallet_proxy;
#[runtime::pallet_index(36)]
pub type Multisig = pallet_multisig;
#[runtime::pallet_index(37)]
pub type Bounties = pallet_bounties;
#[runtime::pallet_index(38)]
pub type Tips = pallet_tips;
#[runtime::pallet_index(39)]
pub type Assets = pallet_assets<Instance1>;
#[runtime::pallet_index(40)]
pub type PoolAssets = pallet_assets<Instance2>;
#[runtime::pallet_index(41)]
pub type Beefy = pallet_beefy;
// MMR leaf construction must be after session in order to have a leaf's next_auth_set
// refer to block<N>. See issue polkadot-fellows/runtimes#160 for details.
#[runtime::pallet_index(42)]
pub type Mmr = pallet_mmr;
#[runtime::pallet_index(43)]
pub type MmrLeaf = pallet_beefy_mmr;
#[runtime::pallet_index(44)]
pub type Lottery = pallet_lottery;
#[runtime::pallet_index(45)]
pub type Nis = pallet_nis;
#[runtime::pallet_index(46)]
pub type Uniques = pallet_uniques;
#[runtime::pallet_index(47)]
pub type Nfts = pallet_nfts;
#[runtime::pallet_index(48)]
pub type NftFractionalization = pallet_nft_fractionalization;
#[runtime::pallet_index(49)]
pub type Salary = pallet_salary;
#[runtime::pallet_index(50)]
pub type CoreFellowship = pallet_core_fellowship;
#[runtime::pallet_index(51)]
pub type TransactionStorage = pallet_transaction_storage;
#[runtime::pallet_index(52)]
pub type VoterList = pallet_bags_list<Instance1>;
#[runtime::pallet_index(53)]
pub type StateTrieMigration = pallet_state_trie_migration;
#[runtime::pallet_index(54)]
pub type ChildBounties = pallet_child_bounties;
#[runtime::pallet_index(55)]
pub type Referenda = pallet_referenda;
#[runtime::pallet_index(56)]
pub type Remark = pallet_remark;
#[runtime::pallet_index(57)]
pub type RootTesting = pallet_root_testing;
#[runtime::pallet_index(58)]
pub type ConvictionVoting = pallet_conviction_voting;
#[runtime::pallet_index(59)]
pub type Whitelist = pallet_whitelist;
#[runtime::pallet_index(60)]
pub type AllianceMotion = pallet_collective<Instance3>;
#[runtime::pallet_index(61)]
pub type Alliance = pallet_alliance;
#[runtime::pallet_index(62)]
pub type NominationPools = pallet_nomination_pools;
#[runtime::pallet_index(63)]
pub type RankedPolls = pallet_referenda<Instance2>;
#[runtime::pallet_index(64)]
pub type RankedCollective = pallet_ranked_collective;
#[runtime::pallet_index(65)]
pub type AssetConversion = pallet_asset_conversion;
#[runtime::pallet_index(66)]
pub type FastUnstake = pallet_fast_unstake;
#[runtime::pallet_index(67)]
pub type MessageQueue = pallet_message_queue;
#[runtime::pallet_index(68)]
pub type Pov = frame_benchmarking_pallet_pov;
#[runtime::pallet_index(69)]
pub type TxPause = pallet_tx_pause;
#[runtime::pallet_index(70)]
pub type SafeMode = pallet_safe_mode;
#[runtime::pallet_index(71)]
pub type Statement = pallet_statement;
#[runtime::pallet_index(72)]
pub type MultiBlockMigrations = pallet_migrations;
#[runtime::pallet_index(73)]
pub type Broker = pallet_broker;
#[runtime::pallet_index(74)]
pub type TasksExample = pallet_example_tasks;
#[runtime::pallet_index(75)]
pub type Mixnet = pallet_mixnet;
#[runtime::pallet_index(76)]
pub type Parameters = pallet_parameters;
#[runtime::pallet_index(77)]
pub type SkipFeelessPayment = pallet_skip_feeless_payment;
#[runtime::pallet_index(78)]
pub type PalletExampleMbms = pallet_example_mbm;
Muharem Ismailov
committed
#[runtime::pallet_index(79)]
pub type AssetConversionMigration = pallet_asset_conversion_ops;
/// The address format for describing accounts.
pub type Address = sp_runtime::MultiAddress<AccountId, AccountIndex>;
pub type Header = generic::Header<BlockNumber, BlakeTwo256>;
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.
///
/// When you change this, you **MUST** modify [`sign`] in `bin/node/testing/src/keyring.rs`!
///
/// [`sign`]: <../../testing/src/keyring.rs.html>
pub type SignedExtra = (
frame_system::CheckNonZeroSender<Runtime>,
frame_system::CheckSpecVersion<Runtime>,
frame_system::CheckTxVersion<Runtime>,
frame_system::CheckGenesis<Runtime>,
frame_system::CheckEra<Runtime>,
frame_system::CheckNonce<Runtime>,
frame_system::CheckWeight<Runtime>,
pallet_skip_feeless_payment::SkipCheckIfFeeless<
Runtime,
pallet_asset_conversion_tx_payment::ChargeAssetTxPayment<Runtime>,
>,
/// Unchecked extrinsic type as expected by this runtime.
generic::UncheckedExtrinsic<Address, RuntimeCall, Signature, SignedExtra>;
/// The payload being signed in transactions.
pub type SignedPayload = generic::SignedPayload<RuntimeCall, SignedExtra>;
/// Extrinsic type that has already been checked.
pub type CheckedExtrinsic = generic::CheckedExtrinsic<AccountId, RuntimeCall, SignedExtra>;
/// Executive: handles dispatch to the various modules.
pub type Executive = frame_executive::Executive<
Runtime,
Block,
frame_system::ChainContext<Runtime>,
Runtime,
// We don't have a limit in the Relay Chain.
const IDENTITY_MIGRATION_KEY_LIMIT: u64 = u64::MAX;
// All migrations executed on runtime upgrade as a nested tuple of types implementing
// `OnRuntimeUpgrade`. Note: These are examples and do not need to be run directly
// after the genesis block.
type Migrations = (
pallet_nomination_pools::migration::versioned::V6ToV7<Runtime>,
pallet_alliance::migration::Migration<Runtime>,
Alexander Theißen
committed
pallet_contracts::Migration<Runtime>,
pallet_identity::migration::versioned::V0ToV1<Runtime, IDENTITY_MIGRATION_KEY_LIMIT>,
type EventRecord = frame_system::EventRecord<
<Runtime as frame_system::Config>::RuntimeEvent,
<Runtime as frame_system::Config>::Hash,
>;
parameter_types! {
pub const BeefySetIdSessionEntries: u32 = BondingDuration::get() * SessionsPerEra::get();
}
impl pallet_beefy::Config for Runtime {
type BeefyId = BeefyId;
type MaxAuthorities = MaxAuthorities;
type MaxNominators = ConstU32<0>;
type MaxSetIdSessionEntries = BeefySetIdSessionEntries;
type OnNewValidatorSet = MmrLeaf;
type WeightInfo = ();
type KeyOwnerProof = <Historical as KeyOwnerProofSystem<(KeyTypeId, BeefyId)>>::Proof;
type EquivocationReportSystem =
pallet_beefy::EquivocationReportSystem<Self, Offences, Historical, ReportLongevity>;
}
/// MMR helper types.
mod mmr {
use super::Runtime;
pub use pallet_mmr::primitives::*;
pub type Leaf = <<Runtime as pallet_mmr::Config>::LeafData as LeafDataProvider>::LeafData;
pub type Hash = <Hashing as sp_runtime::traits::Hash>::Output;
pub type Hashing = <Runtime as pallet_mmr::Config>::Hashing;
}
#[cfg(feature = "runtime-benchmarks")]
mod benches {
frame_benchmarking::define_benchmarks!(
[frame_benchmarking, BaselineBench::<Runtime>]
[frame_benchmarking_pallet_pov, Pov]
[pallet_alliance, Alliance]
[pallet_assets, Assets]
[pallet_babe, Babe]
[pallet_bags_list, VoterList]
[pallet_balances, Balances]
[pallet_bounties, Bounties]
[pallet_broker, Broker]
[pallet_child_bounties, ChildBounties]
[pallet_collective, Council]
[pallet_conviction_voting, ConvictionVoting]
[pallet_contracts, Contracts]
[pallet_core_fellowship, CoreFellowship]
[tasks_example, TasksExample]
[pallet_democracy, Democracy]
[pallet_election_provider_multi_phase, ElectionProviderMultiPhase]
Gonçalo Pestana
committed
[pallet_election_provider_support_benchmarking, EPSBench::<Runtime>]
[pallet_elections_phragmen, Elections]
[pallet_grandpa, Grandpa]
[pallet_identity, Identity]
[pallet_im_online, ImOnline]
[pallet_indices, Indices]
[pallet_lottery, Lottery]
[pallet_membership, TechnicalMembership]
[pallet_message_queue, MessageQueue]
[pallet_migrations, MultiBlockMigrations]
[pallet_mmr, Mmr]
[pallet_multisig, Multisig]
[pallet_nomination_pools, NominationPoolsBench::<Runtime>]
[pallet_offences, OffencesBench::<Runtime>]
[pallet_preimage, Preimage]
[pallet_proxy, Proxy]
[pallet_ranked_collective, RankedCollective]
[pallet_referenda, Referenda]
[pallet_scheduler, Scheduler]
[pallet_session, SessionBench::<Runtime>]
[pallet_staking, Staking]
[pallet_state_trie_migration, StateTrieMigration]
[frame_system, SystemBench::<Runtime>]
[pallet_timestamp, Timestamp]
[pallet_tips, Tips]
[pallet_transaction_storage, TransactionStorage]
[pallet_treasury, Treasury]
[pallet_asset_rate, AssetRate]
[pallet_uniques, Uniques]
[pallet_nft_fractionalization, NftFractionalization]
[pallet_utility, Utility]
[pallet_vesting, Vesting]
[pallet_tx_pause, TxPause]
[pallet_safe_mode, SafeMode]
Muharem Ismailov
committed
[pallet_asset_conversion_ops, AssetConversionMigration]
);
}
impl_runtime_apis! {
fn version() -> RuntimeVersion {
VERSION
}
fn execute_block(block: Block) {
Executive::execute_block(block);
fn initialize_block(header: &<Block as BlockT>::Header) -> sp_runtime::ExtrinsicInclusionMode {
Executive::initialize_block(header)
impl sp_api::Metadata<Block> for Runtime {
fn metadata() -> OpaqueMetadata {
OpaqueMetadata::new(Runtime::metadata().into())
fn metadata_at_version(version: u32) -> Option<OpaqueMetadata> {
Runtime::metadata_at_version(version)
}
fn metadata_versions() -> sp_std::vec::Vec<u32> {
Runtime::metadata_versions()
}
impl sp_block_builder::BlockBuilder<Block> for Runtime {
![Sergey Pepyakin Sergey Pepyakin's avatar](/assets/no_avatar-849f9c04a3a0d0cea2424ae97b27447dc64a7dbfae83c036c45b403392f0e8ba.png)
Sergey Pepyakin
committed
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: InherentData) -> Vec<<Block as BlockT>::Extrinsic> {
data.create_extrinsics()
fn check_inherents(block: Block, data: InherentData) -> CheckInherentsResult {
data.check_extrinsics(&block)
impl sp_transaction_pool::runtime_api::TaggedTransactionQueue<Block> for Runtime {
fn validate_transaction(
source: TransactionSource,
tx: <Block as BlockT>::Extrinsic,
block_hash: <Block as BlockT>::Hash,
) -> TransactionValidity {
Executive::validate_transaction(source, tx, block_hash)
impl sp_statement_store::runtime_api::ValidateStatement<Block> for Runtime {
fn validate_statement(
source: sp_statement_store::runtime_api::StatementSource,
statement: sp_statement_store::Statement,
) -> Result<sp_statement_store::runtime_api::ValidStatement, sp_statement_store::runtime_api::InvalidStatement> {
Statement::validate_statement(source, statement)
}
}
impl sp_offchain::OffchainWorkerApi<Block> for Runtime {
Tomasz Drwięga
committed
fn offchain_worker(header: &<Block as BlockT>::Header) {
Executive::offchain_worker(header)
impl sp_consensus_grandpa::GrandpaApi<Block> for Runtime {
fn grandpa_authorities() -> sp_consensus_grandpa::AuthorityList {
Grandpa::grandpa_authorities()
}
fn current_set_id() -> sp_consensus_grandpa::SetId {
fn submit_report_equivocation_unsigned_extrinsic(
equivocation_proof: sp_consensus_grandpa::EquivocationProof<
<Block as BlockT>::Hash,
NumberFor<Block>,
>,
key_owner_proof: sp_consensus_grandpa::OpaqueKeyOwnershipProof,
) -> Option<()> {
let key_owner_proof = key_owner_proof.decode()?;
Grandpa::submit_unsigned_equivocation_report(
equivocation_proof,
key_owner_proof,
)
}
fn generate_key_ownership_proof(
_set_id: sp_consensus_grandpa::SetId,
) -> Option<sp_consensus_grandpa::OpaqueKeyOwnershipProof> {
Historical::prove((sp_consensus_grandpa::KEY_TYPE, authority_id))
.map(sp_consensus_grandpa::OpaqueKeyOwnershipProof::new)
}
impl pallet_nomination_pools_runtime_api::NominationPoolsApi<Block, AccountId, Balance> for Runtime {
fn pending_rewards(who: AccountId) -> Balance {
NominationPools::api_pending_rewards(who).unwrap_or_default()
}
fn points_to_balance(pool_id: pallet_nomination_pools::PoolId, points: Balance) -> Balance {
NominationPools::api_points_to_balance(pool_id, points)
}
fn balance_to_points(pool_id: pallet_nomination_pools::PoolId, new_funds: Balance) -> Balance {
NominationPools::api_balance_to_points(pool_id, new_funds)
}
}
impl pallet_staking_runtime_api::StakingApi<Block, Balance, AccountId> for Runtime {
fn nominations_quota(balance: Balance) -> u32 {
Staking::api_nominations_quota(balance)
fn eras_stakers_page_count(era: sp_staking::EraIndex, account: AccountId) -> sp_staking::Page {
Staking::api_eras_stakers_page_count(era, account)
}
impl sp_consensus_babe::BabeApi<Block> for Runtime {
fn configuration() -> sp_consensus_babe::BabeConfiguration {
let epoch_config = Babe::epoch_config().unwrap_or(BABE_GENESIS_EPOCH_CONFIG);
sp_consensus_babe::BabeConfiguration {
slot_duration: Babe::slot_duration(),
epoch_length: EpochDuration::get(),
c: epoch_config.c,
authorities: Babe::authorities().to_vec(),
allowed_slots: epoch_config.allowed_slots,
fn current_epoch_start() -> sp_consensus_babe::Slot {
fn current_epoch() -> sp_consensus_babe::Epoch {
Babe::current_epoch()
}
fn next_epoch() -> sp_consensus_babe::Epoch {
Babe::next_epoch()
}
authority_id: sp_consensus_babe::AuthorityId,
) -> Option<sp_consensus_babe::OpaqueKeyOwnershipProof> {
use codec::Encode;
Historical::prove((sp_consensus_babe::KEY_TYPE, authority_id))
.map(|p| p.encode())
.map(sp_consensus_babe::OpaqueKeyOwnershipProof::new)
}
fn submit_report_equivocation_unsigned_extrinsic(
equivocation_proof: sp_consensus_babe::EquivocationProof<<Block as BlockT>::Header>,
key_owner_proof: sp_consensus_babe::OpaqueKeyOwnershipProof,
) -> Option<()> {
let key_owner_proof = key_owner_proof.decode()?;
Babe::submit_unsigned_equivocation_report(
equivocation_proof,
key_owner_proof,
)
}
impl sp_authority_discovery::AuthorityDiscoveryApi<Block> for Runtime {
fn authorities() -> Vec<AuthorityDiscoveryId> {
AuthorityDiscovery::authorities()
}
}
impl frame_system_rpc_runtime_api::AccountNonceApi<Block, AccountId, Nonce> for Runtime {
fn account_nonce(account: AccountId) -> Nonce {
System::account_nonce(account)
}
}
impl assets_api::AssetsApi<
Block,
AccountId,
Balance,
u32,
> for Runtime
{
fn account_balances(account: AccountId) -> Vec<(u32, Balance)> {
Assets::account_balances(account)
}
}
impl pallet_contracts::ContractsApi<Block, AccountId, Balance, BlockNumber, Hash, EventRecord> for Runtime
fn call(
origin: AccountId,
dest: AccountId,
value: Balance,
gas_limit: Option<Weight>,
storage_deposit_limit: Option<Balance>,
input_data: Vec<u8>,
) -> pallet_contracts::ContractExecResult<Balance, EventRecord> {
let gas_limit = gas_limit.unwrap_or(RuntimeBlockWeights::get().max_block);
Contracts::bare_call(
origin,
dest,
value,
gas_limit,
storage_deposit_limit,
input_data,
pallet_contracts::DebugInfo::UnsafeDebug,
pallet_contracts::CollectEvents::UnsafeCollect,
pallet_contracts::Determinism::Enforced,
fn instantiate(
origin: AccountId,
gas_limit: Option<Weight>,
storage_deposit_limit: Option<Balance>,
code: pallet_contracts::Code<Hash>,
data: Vec<u8>,
salt: Vec<u8>,
) -> pallet_contracts::ContractInstantiateResult<AccountId, Balance, EventRecord>
let gas_limit = gas_limit.unwrap_or(RuntimeBlockWeights::get().max_block);
Contracts::bare_instantiate(
origin,
value,
gas_limit,
storage_deposit_limit,
code,
data,
salt,
pallet_contracts::DebugInfo::UnsafeDebug,
pallet_contracts::CollectEvents::UnsafeCollect,
}
fn upload_code(
origin: AccountId,
code: Vec<u8>,
storage_deposit_limit: Option<Balance>,
determinism: pallet_contracts::Determinism,
) -> pallet_contracts::CodeUploadResult<Hash, Balance>
{
Contracts::bare_upload_code(
origin,
code,
storage_deposit_limit,
determinism,
)
}
fn get_storage(
address: AccountId,
key: Vec<u8>,
) -> pallet_contracts::GetStorageResult {
Contracts::get_storage(
address,
key
)
impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi<
Block,
Balance,
> for Runtime {
fn query_info(uxt: <Block as BlockT>::Extrinsic, len: u32) -> RuntimeDispatchInfo<Balance> {
TransactionPayment::query_info(uxt, len)
}
fn query_fee_details(uxt: <Block as BlockT>::Extrinsic, len: u32) -> FeeDetails<Balance> {
TransactionPayment::query_fee_details(uxt, len)
}
Stephen Shelton
committed
fn query_weight_to_fee(weight: Weight) -> Balance {
TransactionPayment::weight_to_fee(weight)
}
fn query_length_to_fee(length: u32) -> Balance {
TransactionPayment::length_to_fee(length)
}
impl pallet_asset_conversion::AssetConversionApi<
Block,
Balance,
NativeOrWithId<u32>
fn quote_price_exact_tokens_for_tokens(asset1: NativeOrWithId<u32>, asset2: NativeOrWithId<u32>, amount: Balance, include_fee: bool) -> Option<Balance> {
AssetConversion::quote_price_exact_tokens_for_tokens(asset1, asset2, amount, include_fee)
}
fn quote_price_tokens_for_exact_tokens(asset1: NativeOrWithId<u32>, asset2: NativeOrWithId<u32>, amount: Balance, include_fee: bool) -> Option<Balance> {
AssetConversion::quote_price_tokens_for_exact_tokens(asset1, asset2, amount, include_fee)
}
fn get_reserves(asset1: NativeOrWithId<u32>, asset2: NativeOrWithId<u32>) -> Option<(Balance, Balance)> {
AssetConversion::get_reserves(asset1, asset2).ok()
impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentCallApi<Block, Balance, RuntimeCall>
Muharem Ismailov
committed
for Runtime
{
fn query_call_info(call: RuntimeCall, len: u32) -> RuntimeDispatchInfo<Balance> {
Muharem Ismailov
committed
TransactionPayment::query_call_info(call, len)
}
fn query_call_fee_details(call: RuntimeCall, len: u32) -> FeeDetails<Balance> {
Muharem Ismailov
committed
TransactionPayment::query_call_fee_details(call, len)
}
Stephen Shelton
committed
fn query_weight_to_fee(weight: Weight) -> Balance {
TransactionPayment::weight_to_fee(weight)
}
fn query_length_to_fee(length: u32) -> Balance {
TransactionPayment::length_to_fee(length)
}
Muharem Ismailov
committed
}
impl pallet_nfts_runtime_api::NftsApi<Block, AccountId, u32, u32> for Runtime {
fn owner(collection: u32, item: u32) -> Option<AccountId> {
<Nfts as Inspect<AccountId>>::owner(&collection, &item)