mirror of
https://github.com/pezkuwichain/pez-solochain-template.git
synced 2026-04-22 04:28:01 +00:00
172 lines
6.6 KiB
Rust
172 lines
6.6 KiB
Rust
// This is free and unencumbered software released into the public domain.
|
|
//
|
|
// Anyone is free to copy, modify, publish, use, compile, sell, or
|
|
// distribute this software, either in source code form or as a compiled
|
|
// binary, for any purpose, commercial or non-commercial, and by any
|
|
// means.
|
|
//
|
|
// In jurisdictions that recognize copyright laws, the author or authors
|
|
// of this software dedicate any and all copyright interest in the
|
|
// software to the public domain. We make this dedication for the benefit
|
|
// of the public at large and to the detriment of our heirs and
|
|
// successors. We intend this dedication to be an overt act of
|
|
// relinquishment in perpetuity of all present and future rights to this
|
|
// software under copyright law.
|
|
//
|
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
// IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
|
// OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
|
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
// OTHER DEALINGS IN THE SOFTWARE.
|
|
//
|
|
// For more information, please refer to <http://unlicense.org>
|
|
|
|
// Bizinikiwi and Pezkuwi dependencies
|
|
use pezframe_support::{
|
|
derive_impl, parameter_types,
|
|
traits::{ConstBool, ConstU128, ConstU32, ConstU64, ConstU8, VariantCountOf},
|
|
weights::{
|
|
constants::{RocksDbWeight, WEIGHT_REF_TIME_PER_SECOND},
|
|
IdentityFee, Weight,
|
|
},
|
|
};
|
|
use pezframe_system::limits::{BlockLength, BlockWeights};
|
|
use pezpallet_transaction_payment::{ConstFeeMultiplier, FungibleAdapter, Multiplier};
|
|
use pezsp_consensus_aura::sr25519::AuthorityId as AuraId;
|
|
use pezsp_runtime::{traits::One, Perbill};
|
|
use pezsp_version::RuntimeVersion;
|
|
|
|
// Local module imports
|
|
use super::{
|
|
AccountId, Aura, Balance, Balances, Block, BlockNumber, Hash, Nonce, PalletInfo, Runtime,
|
|
RuntimeCall, RuntimeEvent, RuntimeFreezeReason, RuntimeHoldReason, RuntimeOrigin, RuntimeTask,
|
|
System, EXISTENTIAL_DEPOSIT, SLOT_DURATION, VERSION,
|
|
};
|
|
|
|
const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75);
|
|
|
|
parameter_types! {
|
|
pub const BlockHashCount: BlockNumber = 2400;
|
|
pub const Version: RuntimeVersion = VERSION;
|
|
|
|
/// We allow for 2 seconds of compute with a 6 second average block time.
|
|
pub RuntimeBlockWeights: BlockWeights = BlockWeights::with_sensible_defaults(
|
|
Weight::from_parts(2u64 * WEIGHT_REF_TIME_PER_SECOND, u64::MAX),
|
|
NORMAL_DISPATCH_RATIO,
|
|
);
|
|
pub RuntimeBlockLength: BlockLength = BlockLength::max_with_normal_ratio(5 * 1024 * 1024, NORMAL_DISPATCH_RATIO);
|
|
pub const SS58Prefix: u8 = 42;
|
|
}
|
|
|
|
/// All migrations of the runtime, aside from the ones declared in the pallets.
|
|
///
|
|
/// This can be a tuple of types, each implementing `OnRuntimeUpgrade`.
|
|
#[allow(unused_parens)]
|
|
type SingleBlockMigrations = ();
|
|
|
|
/// The default types are being injected by [`derive_impl`](`pezframe_support::derive_impl`) from
|
|
/// [`SoloChainDefaultConfig`](`struct@pezframe_system::config_preludes::SolochainDefaultConfig`),
|
|
/// but overridden as needed.
|
|
#[derive_impl(pezframe_system::config_preludes::SolochainDefaultConfig)]
|
|
impl pezframe_system::Config for Runtime {
|
|
/// The block type for the runtime.
|
|
type Block = Block;
|
|
/// Block & extrinsics weights: base values and limits.
|
|
type BlockWeights = RuntimeBlockWeights;
|
|
/// The maximum length of a block (in bytes).
|
|
type BlockLength = RuntimeBlockLength;
|
|
/// The identifier used to distinguish between accounts.
|
|
type AccountId = AccountId;
|
|
/// The type for storing how many extrinsics an account has signed.
|
|
type Nonce = Nonce;
|
|
/// The type for hashing blocks and tries.
|
|
type Hash = Hash;
|
|
/// Maximum number of block number to block hash mappings to keep (oldest pruned first).
|
|
type BlockHashCount = BlockHashCount;
|
|
/// The weight of database operations that the runtime can invoke.
|
|
type DbWeight = RocksDbWeight;
|
|
/// Version of the runtime.
|
|
type Version = Version;
|
|
/// The data to be stored in an account.
|
|
type AccountData = pezpallet_balances::AccountData<Balance>;
|
|
/// This is used as an identifier of the chain. 42 is the generic bizinikiwi prefix.
|
|
type SS58Prefix = SS58Prefix;
|
|
type MaxConsumers = pezframe_support::traits::ConstU32<16>;
|
|
type SingleBlockMigrations = SingleBlockMigrations;
|
|
}
|
|
|
|
impl pezpallet_aura::Config for Runtime {
|
|
type AuthorityId = AuraId;
|
|
type DisabledValidators = ();
|
|
type MaxAuthorities = ConstU32<32>;
|
|
type AllowMultipleBlocksPerSlot = ConstBool<false>;
|
|
type SlotDuration = pezpallet_aura::MinimumPeriodTimesTwo<Runtime>;
|
|
}
|
|
|
|
impl pezpallet_grandpa::Config for Runtime {
|
|
type RuntimeEvent = RuntimeEvent;
|
|
|
|
type WeightInfo = ();
|
|
type MaxAuthorities = ConstU32<32>;
|
|
type MaxNominators = ConstU32<0>;
|
|
type MaxSetIdSessionEntries = ConstU64<0>;
|
|
|
|
type KeyOwnerProof = pezsp_core::Void;
|
|
type EquivocationReportSystem = ();
|
|
}
|
|
|
|
impl pezpallet_timestamp::Config for Runtime {
|
|
/// A timestamp: milliseconds since the unix epoch.
|
|
type Moment = u64;
|
|
type OnTimestampSet = Aura;
|
|
type MinimumPeriod = ConstU64<{ SLOT_DURATION / 2 }>;
|
|
type WeightInfo = ();
|
|
}
|
|
|
|
impl pezpallet_balances::Config for Runtime {
|
|
type MaxLocks = ConstU32<50>;
|
|
type MaxReserves = ();
|
|
type ReserveIdentifier = [u8; 8];
|
|
/// The type for recording an account's balance.
|
|
type Balance = Balance;
|
|
/// The ubiquitous event type.
|
|
type RuntimeEvent = RuntimeEvent;
|
|
type DustRemoval = ();
|
|
type ExistentialDeposit = ConstU128<EXISTENTIAL_DEPOSIT>;
|
|
type AccountStore = System;
|
|
type WeightInfo = pezpallet_balances::weights::BizinikiwiWeight<Runtime>;
|
|
type FreezeIdentifier = RuntimeFreezeReason;
|
|
type MaxFreezes = VariantCountOf<RuntimeFreezeReason>;
|
|
type RuntimeHoldReason = RuntimeHoldReason;
|
|
type RuntimeFreezeReason = RuntimeFreezeReason;
|
|
type DoneSlashHandler = ();
|
|
}
|
|
|
|
parameter_types! {
|
|
pub FeeMultiplier: Multiplier = Multiplier::one();
|
|
}
|
|
|
|
impl pezpallet_transaction_payment::Config for Runtime {
|
|
type RuntimeEvent = RuntimeEvent;
|
|
type OnChargeTransaction = FungibleAdapter<Balances, ()>;
|
|
type OperationalFeeMultiplier = ConstU8<5>;
|
|
type WeightToFee = IdentityFee<Balance>;
|
|
type LengthToFee = IdentityFee<Balance>;
|
|
type FeeMultiplierUpdate = ConstFeeMultiplier<FeeMultiplier>;
|
|
type WeightInfo = pezpallet_transaction_payment::weights::BizinikiwiWeight<Runtime>;
|
|
}
|
|
|
|
impl pezpallet_sudo::Config for Runtime {
|
|
type RuntimeEvent = RuntimeEvent;
|
|
type RuntimeCall = RuntimeCall;
|
|
type WeightInfo = pezpallet_sudo::weights::BizinikiwiWeight<Runtime>;
|
|
}
|
|
|
|
/// Configure the pezpallet-template in pallets/template.
|
|
impl pezpallet_template::Config for Runtime {
|
|
type RuntimeEvent = RuntimeEvent;
|
|
type WeightInfo = pezpallet_template::weights::BizinikiwiWeight<Runtime>;
|
|
}
|