Apply local rebrand updates (compatible with pezkuwi-sdk)

This commit is contained in:
2026-01-11 19:33:32 +03:00
parent 2610f22b83
commit 1a81a0f2f7
23 changed files with 779 additions and 657 deletions
+127 -93
View File
@@ -1,121 +1,155 @@
[package]
name = "solochain-template-runtime"
description = "A solochain runtime template built with Substrate, part of Polkadot Sdk."
version = "0.1.0"
name = "pez-solochain-template-runtime"
description = "A solochain runtime template built with Bizinikiwi, part of Pezkuwi Sdk."
version = "0.0.0"
license = "Unlicense"
authors.workspace = true
homepage.workspace = true
repository.workspace = true
edition.workspace = true
publish = false
documentation = "https://docs.rs/pez-solochain-template-runtime"
[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]
[lints]
workspace = true
[dependencies]
codec = { features = ["derive"], workspace = true }
frame-benchmarking = { optional = true, workspace = true }
frame-executive.workspace = true
frame-metadata-hash-extension.workspace = true
frame-support = { features = ["experimental"], workspace = true }
frame-system-benchmarking = { optional = true, workspace = true }
frame-system-rpc-runtime-api.workspace = true
frame-system.workspace = true
frame-try-runtime = { optional = true, workspace = true }
pallet-aura.workspace = true
pallet-balances.workspace = true
pallet-grandpa.workspace = true
pallet-sudo.workspace = true
pallet-template.workspace = true
pallet-timestamp.workspace = true
pallet-transaction-payment-rpc-runtime-api.workspace = true
pallet-transaction-payment.workspace = true
scale-info = { features = ["derive", "serde"], workspace = true }
serde_json = { workspace = true, default-features = false, features = ["alloc"] }
sp-api.workspace = true
sp-block-builder.workspace = true
sp-consensus-aura = { features = ["serde"], workspace = true }
sp-consensus-grandpa = { features = ["serde"], workspace = true }
sp-core = { features = ["serde"], workspace = true }
sp-genesis-builder.workspace = true
sp-inherents.workspace = true
sp-keyring.workspace = true
sp-offchain.workspace = true
sp-runtime = { features = ["serde"], workspace = true }
sp-session.workspace = true
sp-storage.workspace = true
sp-transaction-pool.workspace = true
sp-version = { features = ["serde"], workspace = true }
serde_json = { workspace = true, default-features = false, features = [
"alloc",
] }
# frame
pezframe-executive = { workspace = true }
pezframe-metadata-hash-extension = { workspace = true }
pezframe-support = { features = ["experimental"], workspace = true }
pezframe-system = { workspace = true }
pezframe-try-runtime = { optional = true, workspace = true }
# frame pallets
pezpallet-aura = { workspace = true }
pezpallet-balances = { workspace = true }
pezpallet-grandpa = { workspace = true }
pezpallet-sudo = { workspace = true }
pezpallet-timestamp = { workspace = true }
pezpallet-transaction-payment = { workspace = true }
# primitives
pezsp-api = { workspace = true }
pezsp-block-builder = { workspace = true }
pezsp-consensus-aura = { features = ["serde"], workspace = true }
pezsp-consensus-grandpa = { features = ["serde"], workspace = true }
pezsp-core = { features = ["serde"], workspace = true }
pezsp-genesis-builder = { workspace = true }
pezsp-inherents = { workspace = true }
pezsp-keyring = { workspace = true }
pezsp-offchain = { workspace = true }
pezsp-runtime = { features = ["serde"], workspace = true }
pezsp-session = { workspace = true }
pezsp-storage = { workspace = true }
pezsp-transaction-pool = { workspace = true }
pezsp-version = { features = ["serde"], workspace = true }
# RPC related
pezframe-system-rpc-runtime-api = { workspace = true }
pezpallet-transaction-payment-rpc-runtime-api = { workspace = true }
# Used for runtime benchmarking
pezframe-benchmarking = { optional = true, workspace = true }
pezframe-system-benchmarking = { optional = true, workspace = true }
# The pezpallet in this template.
pezpallet-template = { workspace = true }
[build-dependencies]
substrate-wasm-builder = { optional = true, workspace = true, default-features = true }
bizinikiwi-wasm-builder = { optional = true, workspace = true, default-features = true }
[features]
default = ["std"]
std = [
"bizinikiwi-wasm-builder",
"codec/std",
"frame-benchmarking?/std",
"frame-executive/std",
"frame-metadata-hash-extension/std",
"frame-support/std",
"frame-system-benchmarking?/std",
"frame-system-rpc-runtime-api/std",
"frame-system/std",
"frame-try-runtime?/std",
"pallet-aura/std",
"pallet-balances/std",
"pallet-grandpa/std",
"pallet-sudo/std",
"pallet-template/std",
"pallet-timestamp/std",
"pallet-transaction-payment-rpc-runtime-api/std",
"pallet-transaction-payment/std",
"pezframe-benchmarking?/std",
"pezframe-executive/std",
"pezframe-metadata-hash-extension/std",
"pezframe-support/std",
"pezframe-system-benchmarking?/std",
"pezframe-system-rpc-runtime-api/std",
"pezframe-system/std",
"pezframe-try-runtime?/std",
"pezpallet-aura/std",
"pezpallet-balances/std",
"pezpallet-grandpa/std",
"pezpallet-sudo/std",
"pezpallet-template/std",
"pezpallet-timestamp/std",
"pezpallet-transaction-payment-rpc-runtime-api/std",
"pezpallet-transaction-payment/std",
"pezsp-api/std",
"pezsp-block-builder/std",
"pezsp-consensus-aura/std",
"pezsp-consensus-grandpa/std",
"pezsp-core/std",
"pezsp-genesis-builder/std",
"pezsp-inherents/std",
"pezsp-keyring/std",
"pezsp-offchain/std",
"pezsp-runtime/std",
"pezsp-session/std",
"pezsp-storage/std",
"pezsp-transaction-pool/std",
"pezsp-version/std",
"scale-info/std",
"serde_json/std",
"sp-api/std",
"sp-block-builder/std",
"sp-consensus-aura/std",
"sp-consensus-grandpa/std",
"sp-core/std",
"sp-genesis-builder/std",
"sp-inherents/std",
"sp-keyring/std",
"sp-offchain/std",
"sp-runtime/std",
"sp-session/std",
"sp-storage/std",
"sp-transaction-pool/std",
"sp-version/std",
"substrate-wasm-builder",
]
runtime-benchmarks = [
"frame-benchmarking/runtime-benchmarks",
"frame-support/runtime-benchmarks",
"frame-system-benchmarking/runtime-benchmarks",
"frame-system/runtime-benchmarks",
"pallet-balances/runtime-benchmarks",
"pallet-grandpa/runtime-benchmarks",
"pallet-sudo/runtime-benchmarks",
"pallet-template/runtime-benchmarks",
"pallet-timestamp/runtime-benchmarks",
"pallet-transaction-payment/runtime-benchmarks",
"sp-runtime/runtime-benchmarks",
"bizinikiwi-wasm-builder?/runtime-benchmarks",
"pezframe-benchmarking/runtime-benchmarks",
"pezframe-executive/runtime-benchmarks",
"pezframe-metadata-hash-extension/runtime-benchmarks",
"pezframe-support/runtime-benchmarks",
"pezframe-system-benchmarking/runtime-benchmarks",
"pezframe-system-rpc-runtime-api/runtime-benchmarks",
"pezframe-system/runtime-benchmarks",
"pezframe-try-runtime?/runtime-benchmarks",
"pezpallet-aura/runtime-benchmarks",
"pezpallet-balances/runtime-benchmarks",
"pezpallet-grandpa/runtime-benchmarks",
"pezpallet-sudo/runtime-benchmarks",
"pezpallet-template/runtime-benchmarks",
"pezpallet-timestamp/runtime-benchmarks",
"pezpallet-transaction-payment-rpc-runtime-api/runtime-benchmarks",
"pezpallet-transaction-payment/runtime-benchmarks",
"pezsp-api/runtime-benchmarks",
"pezsp-block-builder/runtime-benchmarks",
"pezsp-consensus-aura/runtime-benchmarks",
"pezsp-consensus-grandpa/runtime-benchmarks",
"pezsp-genesis-builder/runtime-benchmarks",
"pezsp-inherents/runtime-benchmarks",
"pezsp-keyring/runtime-benchmarks",
"pezsp-offchain/runtime-benchmarks",
"pezsp-runtime/runtime-benchmarks",
"pezsp-session/runtime-benchmarks",
"pezsp-transaction-pool/runtime-benchmarks",
"pezsp-version/runtime-benchmarks",
]
try-runtime = [
"frame-executive/try-runtime",
"frame-support/try-runtime",
"frame-system/try-runtime",
"frame-try-runtime/try-runtime",
"pallet-aura/try-runtime",
"pallet-balances/try-runtime",
"pallet-grandpa/try-runtime",
"pallet-sudo/try-runtime",
"pallet-template/try-runtime",
"pallet-timestamp/try-runtime",
"pallet-transaction-payment/try-runtime",
"sp-runtime/try-runtime",
"pezframe-executive/try-runtime",
"pezframe-support/try-runtime",
"pezframe-system/try-runtime",
"pezframe-try-runtime/try-runtime",
"pezpallet-aura/try-runtime",
"pezpallet-balances/try-runtime",
"pezpallet-grandpa/try-runtime",
"pezpallet-sudo/try-runtime",
"pezpallet-template/try-runtime",
"pezpallet-timestamp/try-runtime",
"pezpallet-transaction-payment/try-runtime",
"pezsp-runtime/try-runtime",
]
# Enable the metadata hash generation.
@@ -125,8 +159,8 @@ try-runtime = [
# generate the metadata hash and then a second time with the
# `RUNTIME_METADATA_HASH` environment variable set for the `CheckMetadataHash`
# extension.
metadata-hash = ["substrate-wasm-builder/metadata-hash"]
metadata-hash = ["bizinikiwi-wasm-builder/metadata-hash"]
# A convenience feature for enabling things when doing a build
# for an on-chain release.
on-chain-release-build = ["metadata-hash", "sp-api/disable-logging"]
on-chain-release-build = ["metadata-hash", "pezsp-api/disable-logging"]
+2 -2
View File
@@ -1,13 +1,13 @@
#[cfg(all(feature = "std", feature = "metadata-hash"))]
fn main() {
substrate_wasm_builder::WasmBuilder::init_with_defaults()
bizinikiwi_wasm_builder::WasmBuilder::init_with_defaults()
.enable_metadata_hash("UNIT", 12)
.build();
}
#[cfg(all(feature = "std", not(feature = "metadata-hash")))]
fn main() {
substrate_wasm_builder::WasmBuilder::build_using_defaults();
bizinikiwi_wasm_builder::WasmBuilder::build_using_defaults();
}
/// The wasm builder is deactivated when compiling
+64 -64
View File
@@ -25,20 +25,20 @@
// External crates imports
use alloc::vec::Vec;
use frame_support::{
use pezframe_support::{
genesis_builder_helper::{build_state, get_preset},
weights::Weight,
};
use pallet_grandpa::AuthorityId as GrandpaId;
use sp_api::impl_runtime_apis;
use sp_consensus_aura::sr25519::AuthorityId as AuraId;
use sp_core::{crypto::KeyTypeId, OpaqueMetadata};
use sp_runtime::{
use pezpallet_grandpa::AuthorityId as GrandpaId;
use pezsp_api::impl_runtime_apis;
use pezsp_consensus_aura::sr25519::AuthorityId as AuraId;
use pezsp_core::{crypto::KeyTypeId, OpaqueMetadata};
use pezsp_runtime::{
traits::{Block as BlockT, NumberFor},
transaction_validity::{TransactionSource, TransactionValidity},
ApplyExtrinsicResult,
};
use sp_version::RuntimeVersion;
use pezsp_version::RuntimeVersion;
// Local module imports
use super::{
@@ -47,21 +47,21 @@ use super::{
};
impl_runtime_apis! {
impl sp_api::Core<Block> for Runtime {
impl pezsp_api::Core<Block> for Runtime {
fn version() -> RuntimeVersion {
VERSION
}
fn execute_block(block: Block) {
fn execute_block(block: <Block as BlockT>::LazyBlock) {
Executive::execute_block(block);
}
fn initialize_block(header: &<Block as BlockT>::Header) -> sp_runtime::ExtrinsicInclusionMode {
fn initialize_block(header: &<Block as BlockT>::Header) -> pezsp_runtime::ExtrinsicInclusionMode {
Executive::initialize_block(header)
}
}
impl sp_api::Metadata<Block> for Runtime {
impl pezsp_api::Metadata<Block> for Runtime {
fn metadata() -> OpaqueMetadata {
OpaqueMetadata::new(Runtime::metadata().into())
}
@@ -75,13 +75,13 @@ impl_runtime_apis! {
}
}
impl frame_support::view_functions::runtime_api::RuntimeViewFunction<Block> for Runtime {
fn execute_view_function(id: frame_support::view_functions::ViewFunctionId, input: Vec<u8>) -> Result<Vec<u8>, frame_support::view_functions::ViewFunctionDispatchError> {
impl pezframe_support::view_functions::runtime_api::RuntimeViewFunction<Block> for Runtime {
fn execute_view_function(id: pezframe_support::view_functions::ViewFunctionId, input: Vec<u8>) -> Result<Vec<u8>, pezframe_support::view_functions::ViewFunctionDispatchError> {
Runtime::execute_view_function(id, input)
}
}
impl sp_block_builder::BlockBuilder<Block> for Runtime {
impl pezsp_block_builder::BlockBuilder<Block> for Runtime {
fn apply_extrinsic(extrinsic: <Block as BlockT>::Extrinsic) -> ApplyExtrinsicResult {
Executive::apply_extrinsic(extrinsic)
}
@@ -90,19 +90,19 @@ impl_runtime_apis! {
Executive::finalize_block()
}
fn inherent_extrinsics(data: sp_inherents::InherentData) -> Vec<<Block as BlockT>::Extrinsic> {
fn inherent_extrinsics(data: pezsp_inherents::InherentData) -> Vec<<Block as BlockT>::Extrinsic> {
data.create_extrinsics()
}
fn check_inherents(
block: Block,
data: sp_inherents::InherentData,
) -> sp_inherents::CheckInherentsResult {
block: <Block as BlockT>::LazyBlock,
data: pezsp_inherents::InherentData,
) -> pezsp_inherents::CheckInherentsResult {
data.check_extrinsics(&block)
}
}
impl sp_transaction_pool::runtime_api::TaggedTransactionQueue<Block> for Runtime {
impl pezsp_transaction_pool::runtime_api::TaggedTransactionQueue<Block> for Runtime {
fn validate_transaction(
source: TransactionSource,
tx: <Block as BlockT>::Extrinsic,
@@ -112,23 +112,23 @@ impl_runtime_apis! {
}
}
impl sp_offchain::OffchainWorkerApi<Block> for Runtime {
impl pezsp_offchain::OffchainWorkerApi<Block> for Runtime {
fn offchain_worker(header: &<Block as BlockT>::Header) {
Executive::offchain_worker(header)
}
}
impl sp_consensus_aura::AuraApi<Block, AuraId> for Runtime {
fn slot_duration() -> sp_consensus_aura::SlotDuration {
sp_consensus_aura::SlotDuration::from_millis(Aura::slot_duration())
impl pezsp_consensus_aura::AuraApi<Block, AuraId> for Runtime {
fn slot_duration() -> pezsp_consensus_aura::SlotDuration {
pezsp_consensus_aura::SlotDuration::from_millis(Aura::slot_duration())
}
fn authorities() -> Vec<AuraId> {
pallet_aura::Authorities::<Runtime>::get().into_inner()
pezpallet_aura::Authorities::<Runtime>::get().into_inner()
}
}
impl sp_session::SessionKeys<Block> for Runtime {
impl pezsp_session::SessionKeys<Block> for Runtime {
fn generate_session_keys(seed: Option<Vec<u8>>) -> Vec<u8> {
SessionKeys::generate(seed)
}
@@ -140,29 +140,29 @@ impl_runtime_apis! {
}
}
impl sp_consensus_grandpa::GrandpaApi<Block> for Runtime {
fn grandpa_authorities() -> sp_consensus_grandpa::AuthorityList {
impl pezsp_consensus_grandpa::GrandpaApi<Block> for Runtime {
fn grandpa_authorities() -> pezsp_consensus_grandpa::AuthorityList {
Grandpa::grandpa_authorities()
}
fn current_set_id() -> sp_consensus_grandpa::SetId {
fn current_set_id() -> pezsp_consensus_grandpa::SetId {
Grandpa::current_set_id()
}
fn submit_report_equivocation_unsigned_extrinsic(
_equivocation_proof: sp_consensus_grandpa::EquivocationProof<
_equivocation_proof: pezsp_consensus_grandpa::EquivocationProof<
<Block as BlockT>::Hash,
NumberFor<Block>,
>,
_key_owner_proof: sp_consensus_grandpa::OpaqueKeyOwnershipProof,
_key_owner_proof: pezsp_consensus_grandpa::OpaqueKeyOwnershipProof,
) -> Option<()> {
None
}
fn generate_key_ownership_proof(
_set_id: sp_consensus_grandpa::SetId,
_set_id: pezsp_consensus_grandpa::SetId,
_authority_id: GrandpaId,
) -> Option<sp_consensus_grandpa::OpaqueKeyOwnershipProof> {
) -> Option<pezsp_consensus_grandpa::OpaqueKeyOwnershipProof> {
// NOTE: this is the only implementation possible since we've
// defined our key owner proof type as a bottom type (i.e. a type
// with no values).
@@ -170,23 +170,23 @@ impl_runtime_apis! {
}
}
impl frame_system_rpc_runtime_api::AccountNonceApi<Block, AccountId, Nonce> for Runtime {
impl pezframe_system_rpc_runtime_api::AccountNonceApi<Block, AccountId, Nonce> for Runtime {
fn account_nonce(account: AccountId) -> Nonce {
System::account_nonce(account)
}
}
impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi<Block, Balance> for Runtime {
impl pezpallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi<Block, Balance> for Runtime {
fn query_info(
uxt: <Block as BlockT>::Extrinsic,
len: u32,
) -> pallet_transaction_payment_rpc_runtime_api::RuntimeDispatchInfo<Balance> {
) -> pezpallet_transaction_payment_rpc_runtime_api::RuntimeDispatchInfo<Balance> {
TransactionPayment::query_info(uxt, len)
}
fn query_fee_details(
uxt: <Block as BlockT>::Extrinsic,
len: u32,
) -> pallet_transaction_payment::FeeDetails<Balance> {
) -> pezpallet_transaction_payment::FeeDetails<Balance> {
TransactionPayment::query_fee_details(uxt, len)
}
fn query_weight_to_fee(weight: Weight) -> Balance {
@@ -197,19 +197,19 @@ impl_runtime_apis! {
}
}
impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentCallApi<Block, Balance, RuntimeCall>
impl pezpallet_transaction_payment_rpc_runtime_api::TransactionPaymentCallApi<Block, Balance, RuntimeCall>
for Runtime
{
fn query_call_info(
call: RuntimeCall,
len: u32,
) -> pallet_transaction_payment::RuntimeDispatchInfo<Balance> {
) -> pezpallet_transaction_payment::RuntimeDispatchInfo<Balance> {
TransactionPayment::query_call_info(call, len)
}
fn query_call_fee_details(
call: RuntimeCall,
len: u32,
) -> pallet_transaction_payment::FeeDetails<Balance> {
) -> pezpallet_transaction_payment::FeeDetails<Balance> {
TransactionPayment::query_call_fee_details(call, len)
}
fn query_weight_to_fee(weight: Weight) -> Balance {
@@ -221,16 +221,16 @@ impl_runtime_apis! {
}
#[cfg(feature = "runtime-benchmarks")]
impl frame_benchmarking::Benchmark<Block> for Runtime {
impl pezframe_benchmarking::Benchmark<Block> for Runtime {
fn benchmark_metadata(extra: bool) -> (
Vec<frame_benchmarking::BenchmarkList>,
Vec<frame_support::traits::StorageInfo>,
Vec<pezframe_benchmarking::BenchmarkList>,
Vec<pezframe_support::traits::StorageInfo>,
) {
use frame_benchmarking::{baseline, BenchmarkList};
use frame_support::traits::StorageInfoTrait;
use frame_system_benchmarking::Pallet as SystemBench;
use frame_system_benchmarking::extensions::Pallet as SystemExtensionsBench;
use baseline::Pallet as BaselineBench;
use pezframe_benchmarking::{baseline, BenchmarkList};
use pezframe_support::traits::StorageInfoTrait;
use pezframe_system_benchmarking::Pezpallet as SystemBench;
use pezframe_system_benchmarking::extensions::Pezpallet as SystemExtensionsBench;
use baseline::Pezpallet as BaselineBench;
use super::*;
let mut list = Vec::<BenchmarkList>::new();
@@ -243,19 +243,19 @@ impl_runtime_apis! {
#[allow(non_local_definitions)]
fn dispatch_benchmark(
config: frame_benchmarking::BenchmarkConfig
) -> Result<Vec<frame_benchmarking::BenchmarkBatch>, alloc::string::String> {
use frame_benchmarking::{baseline, BenchmarkBatch};
use sp_storage::TrackedStorageKey;
use frame_system_benchmarking::Pallet as SystemBench;
use frame_system_benchmarking::extensions::Pallet as SystemExtensionsBench;
use baseline::Pallet as BaselineBench;
config: pezframe_benchmarking::BenchmarkConfig
) -> Result<Vec<pezframe_benchmarking::BenchmarkBatch>, alloc::string::String> {
use pezframe_benchmarking::{baseline, BenchmarkBatch};
use pezsp_storage::TrackedStorageKey;
use pezframe_system_benchmarking::Pezpallet as SystemBench;
use pezframe_system_benchmarking::extensions::Pezpallet as SystemExtensionsBench;
use baseline::Pezpallet as BaselineBench;
use super::*;
impl frame_system_benchmarking::Config for Runtime {}
impl pezframe_system_benchmarking::Config for Runtime {}
impl baseline::Config for Runtime {}
use frame_support::traits::WhitelistedStorageKeys;
use pezframe_support::traits::WhitelistedStorageKeys;
let whitelist: Vec<TrackedStorageKey> = AllPalletsWithSystem::whitelisted_storage_keys();
let mut batches = Vec::<BenchmarkBatch>::new();
@@ -267,8 +267,8 @@ impl_runtime_apis! {
}
#[cfg(feature = "try-runtime")]
impl frame_try_runtime::TryRuntime<Block> for Runtime {
fn on_runtime_upgrade(checks: frame_try_runtime::UpgradeCheckSelect) -> (Weight, Weight) {
impl pezframe_try_runtime::TryRuntime<Block> for Runtime {
fn on_runtime_upgrade(checks: pezframe_try_runtime::UpgradeCheckSelect) -> (Weight, Weight) {
// NOTE: intentional unwrap: we don't want to propagate the error backwards, and want to
// have a backtrace here. If any of the pre/post migration checks fail, we shall stop
// right here and right now.
@@ -277,10 +277,10 @@ impl_runtime_apis! {
}
fn execute_block(
block: Block,
block: <Block as BlockT>::LazyBlock,
state_root_check: bool,
signature_check: bool,
select: frame_try_runtime::TryStateSelect
select: pezframe_try_runtime::TryStateSelect
) -> Weight {
// NOTE: intentional unwrap: we don't want to propagate the error backwards, and want to
// have a backtrace here.
@@ -288,16 +288,16 @@ impl_runtime_apis! {
}
}
impl sp_genesis_builder::GenesisBuilder<Block> for Runtime {
fn build_state(config: Vec<u8>) -> sp_genesis_builder::Result {
impl pezsp_genesis_builder::GenesisBuilder<Block> for Runtime {
fn build_state(config: Vec<u8>) -> pezsp_genesis_builder::Result {
build_state::<RuntimeGenesisConfig>(config)
}
fn get_preset(id: &Option<sp_genesis_builder::PresetId>) -> Option<Vec<u8>> {
fn get_preset(id: &Option<pezsp_genesis_builder::PresetId>) -> Option<Vec<u8>> {
get_preset::<RuntimeGenesisConfig>(id, crate::genesis_config_presets::get_preset)
}
fn preset_names() -> Vec<sp_genesis_builder::PresetId> {
fn preset_names() -> Vec<pezsp_genesis_builder::PresetId> {
crate::genesis_config_presets::preset_names()
}
}
+8 -8
View File
@@ -23,12 +23,12 @@
//
// For more information, please refer to <http://unlicense.org>
frame_benchmarking::define_benchmarks!(
[frame_benchmarking, BaselineBench::<Runtime>]
[frame_system, SystemBench::<Runtime>]
[frame_system_extensions, SystemExtensionsBench::<Runtime>]
[pallet_balances, Balances]
[pallet_timestamp, Timestamp]
[pallet_sudo, Sudo]
[pallet_template, Template]
pezframe_benchmarking::define_benchmarks!(
[pezframe_benchmarking, BaselineBench::<Runtime>]
[pezframe_system, SystemBench::<Runtime>]
[pezframe_system_extensions, SystemExtensionsBench::<Runtime>]
[pezpallet_balances, Balances]
[pezpallet_timestamp, Timestamp]
[pezpallet_sudo, Sudo]
[pezpallet_template, Template]
);
+35 -28
View File
@@ -23,8 +23,8 @@
//
// For more information, please refer to <http://unlicense.org>
// Substrate and Polkadot dependencies
use frame_support::{
// Bizinikiwi and Pezkuwi dependencies
use pezframe_support::{
derive_impl, parameter_types,
traits::{ConstBool, ConstU128, ConstU32, ConstU64, ConstU8, VariantCountOf},
weights::{
@@ -32,11 +32,11 @@ use frame_support::{
IdentityFee, Weight,
},
};
use frame_system::limits::{BlockLength, BlockWeights};
use pallet_transaction_payment::{ConstFeeMultiplier, FungibleAdapter, Multiplier};
use sp_consensus_aura::sr25519::AuthorityId as AuraId;
use sp_runtime::{traits::One, Perbill};
use sp_version::RuntimeVersion;
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::{
@@ -60,11 +60,17 @@ parameter_types! {
pub const SS58Prefix: u8 = 42;
}
/// The default types are being injected by [`derive_impl`](`frame_support::derive_impl`) from
/// [`SoloChainDefaultConfig`](`struct@frame_system::config_preludes::SolochainDefaultConfig`),
/// 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(frame_system::config_preludes::SolochainDefaultConfig)]
impl frame_system::Config for Runtime {
#[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.
@@ -84,21 +90,22 @@ impl frame_system::Config for Runtime {
/// Version of the runtime.
type Version = Version;
/// The data to be stored in an account.
type AccountData = pallet_balances::AccountData<Balance>;
/// This is used as an identifier of the chain. 42 is the generic substrate prefix.
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 = frame_support::traits::ConstU32<16>;
type MaxConsumers = pezframe_support::traits::ConstU32<16>;
type SingleBlockMigrations = SingleBlockMigrations;
}
impl pallet_aura::Config for Runtime {
impl pezpallet_aura::Config for Runtime {
type AuthorityId = AuraId;
type DisabledValidators = ();
type MaxAuthorities = ConstU32<32>;
type AllowMultipleBlocksPerSlot = ConstBool<false>;
type SlotDuration = pallet_aura::MinimumPeriodTimesTwo<Runtime>;
type SlotDuration = pezpallet_aura::MinimumPeriodTimesTwo<Runtime>;
}
impl pallet_grandpa::Config for Runtime {
impl pezpallet_grandpa::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type WeightInfo = ();
@@ -106,11 +113,11 @@ impl pallet_grandpa::Config for Runtime {
type MaxNominators = ConstU32<0>;
type MaxSetIdSessionEntries = ConstU64<0>;
type KeyOwnerProof = sp_core::Void;
type KeyOwnerProof = pezsp_core::Void;
type EquivocationReportSystem = ();
}
impl pallet_timestamp::Config for Runtime {
impl pezpallet_timestamp::Config for Runtime {
/// A timestamp: milliseconds since the unix epoch.
type Moment = u64;
type OnTimestampSet = Aura;
@@ -118,7 +125,7 @@ impl pallet_timestamp::Config for Runtime {
type WeightInfo = ();
}
impl pallet_balances::Config for Runtime {
impl pezpallet_balances::Config for Runtime {
type MaxLocks = ConstU32<50>;
type MaxReserves = ();
type ReserveIdentifier = [u8; 8];
@@ -129,7 +136,7 @@ impl pallet_balances::Config for Runtime {
type DustRemoval = ();
type ExistentialDeposit = ConstU128<EXISTENTIAL_DEPOSIT>;
type AccountStore = System;
type WeightInfo = pallet_balances::weights::SubstrateWeight<Runtime>;
type WeightInfo = pezpallet_balances::weights::BizinikiwiWeight<Runtime>;
type FreezeIdentifier = RuntimeFreezeReason;
type MaxFreezes = VariantCountOf<RuntimeFreezeReason>;
type RuntimeHoldReason = RuntimeHoldReason;
@@ -141,24 +148,24 @@ parameter_types! {
pub FeeMultiplier: Multiplier = Multiplier::one();
}
impl pallet_transaction_payment::Config for Runtime {
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 = pallet_transaction_payment::weights::SubstrateWeight<Runtime>;
type WeightInfo = pezpallet_transaction_payment::weights::BizinikiwiWeight<Runtime>;
}
impl pallet_sudo::Config for Runtime {
impl pezpallet_sudo::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type RuntimeCall = RuntimeCall;
type WeightInfo = pallet_sudo::weights::SubstrateWeight<Runtime>;
type WeightInfo = pezpallet_sudo::weights::BizinikiwiWeight<Runtime>;
}
/// Configure the pallet-template in pallets/template.
impl pallet_template::Config for Runtime {
/// Configure the pezpallet-template in pallets/template.
impl pezpallet_template::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type WeightInfo = pallet_template::weights::SubstrateWeight<Runtime>;
type WeightInfo = pezpallet_template::weights::BizinikiwiWeight<Runtime>;
}
+20 -20
View File
@@ -1,4 +1,4 @@
// This file is part of Substrate.
// This file is part of Bizinikiwi.
// Copyright (C) Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0
@@ -17,12 +17,12 @@
use crate::{AccountId, BalancesConfig, RuntimeGenesisConfig, SudoConfig};
use alloc::{vec, vec::Vec};
use frame_support::build_struct_json_patch;
use pezframe_support::build_struct_json_patch;
use pezsp_consensus_aura::sr25519::AuthorityId as AuraId;
use pezsp_consensus_grandpa::AuthorityId as GrandpaId;
use pezsp_genesis_builder::{self, PresetId};
use pezsp_keyring::Sr25519Keyring;
use serde_json::Value;
use sp_consensus_aura::sr25519::AuthorityId as AuraId;
use sp_consensus_grandpa::AuthorityId as GrandpaId;
use sp_genesis_builder::{self, PresetId};
use sp_keyring::Sr25519Keyring;
// Returns the genesis config presets populated with given parameters.
fn testnet_genesis(
@@ -38,10 +38,10 @@ fn testnet_genesis(
.map(|k| (k, 1u128 << 60))
.collect::<Vec<_>>(),
},
aura: pallet_aura::GenesisConfig {
authorities: initial_authorities.iter().map(|x| (x.0.clone())).collect::<Vec<_>>(),
aura: pezpallet_aura::GenesisConfig {
authorities: initial_authorities.iter().map(|x| x.0.clone()).collect::<Vec<_>>(),
},
grandpa: pallet_grandpa::GenesisConfig {
grandpa: pezpallet_grandpa::GenesisConfig {
authorities: initial_authorities.iter().map(|x| (x.1.clone(), 1)).collect::<Vec<_>>(),
},
sudo: SudoConfig { key: Some(root) },
@@ -52,8 +52,8 @@ fn testnet_genesis(
pub fn development_config_genesis() -> Value {
testnet_genesis(
vec![(
sp_keyring::Sr25519Keyring::Alice.public().into(),
sp_keyring::Ed25519Keyring::Alice.public().into(),
pezsp_keyring::Sr25519Keyring::Alice.public().into(),
pezsp_keyring::Ed25519Keyring::Alice.public().into(),
)],
vec![
Sr25519Keyring::Alice.to_account_id(),
@@ -61,7 +61,7 @@ pub fn development_config_genesis() -> Value {
Sr25519Keyring::AliceStash.to_account_id(),
Sr25519Keyring::BobStash.to_account_id(),
],
sp_keyring::Sr25519Keyring::Alice.to_account_id(),
pezsp_keyring::Sr25519Keyring::Alice.to_account_id(),
)
}
@@ -70,12 +70,12 @@ pub fn local_config_genesis() -> Value {
testnet_genesis(
vec![
(
sp_keyring::Sr25519Keyring::Alice.public().into(),
sp_keyring::Ed25519Keyring::Alice.public().into(),
pezsp_keyring::Sr25519Keyring::Alice.public().into(),
pezsp_keyring::Ed25519Keyring::Alice.public().into(),
),
(
sp_keyring::Sr25519Keyring::Bob.public().into(),
sp_keyring::Ed25519Keyring::Bob.public().into(),
pezsp_keyring::Sr25519Keyring::Bob.public().into(),
pezsp_keyring::Ed25519Keyring::Bob.public().into(),
),
],
Sr25519Keyring::iter()
@@ -89,8 +89,8 @@ pub fn local_config_genesis() -> Value {
/// Provides the JSON representation of predefined genesis config for given `id`.
pub fn get_preset(id: &PresetId) -> Option<Vec<u8>> {
let patch = match id.as_ref() {
sp_genesis_builder::DEV_RUNTIME_PRESET => development_config_genesis(),
sp_genesis_builder::LOCAL_TESTNET_RUNTIME_PRESET => local_config_genesis(),
pezsp_genesis_builder::DEV_RUNTIME_PRESET => development_config_genesis(),
pezsp_genesis_builder::LOCAL_TESTNET_RUNTIME_PRESET => local_config_genesis(),
_ => return None,
};
Some(
@@ -103,7 +103,7 @@ pub fn get_preset(id: &PresetId) -> Option<Vec<u8>> {
/// List of supported presets.
pub fn preset_names() -> Vec<PresetId> {
vec![
PresetId::from(sp_genesis_builder::DEV_RUNTIME_PRESET),
PresetId::from(sp_genesis_builder::LOCAL_TESTNET_RUNTIME_PRESET),
PresetId::from(pezsp_genesis_builder::DEV_RUNTIME_PRESET),
PresetId::from(pezsp_genesis_builder::LOCAL_TESTNET_RUNTIME_PRESET),
]
}
+47 -53
View File
@@ -10,20 +10,20 @@ pub mod configs;
extern crate alloc;
use alloc::vec::Vec;
use sp_runtime::{
use pezsp_runtime::{
generic, impl_opaque_keys,
traits::{BlakeTwo256, IdentifyAccount, Verify},
MultiAddress, MultiSignature,
};
#[cfg(feature = "std")]
use sp_version::NativeVersion;
use sp_version::RuntimeVersion;
use pezsp_version::NativeVersion;
use pezsp_version::RuntimeVersion;
pub use frame_system::Call as SystemCall;
pub use pallet_balances::Call as BalancesCall;
pub use pallet_timestamp::Call as TimestampCall;
pub use pezframe_system::Call as SystemCall;
pub use pezpallet_balances::Call as BalancesCall;
pub use pezpallet_timestamp::Call as TimestampCall;
#[cfg(any(feature = "std", test))]
pub use sp_runtime::BuildStorage;
pub use pezsp_runtime::BuildStorage;
pub mod genesis_config_presets;
@@ -33,12 +33,12 @@ pub mod genesis_config_presets;
/// to even the core data structures.
pub mod opaque {
use super::*;
use sp_runtime::{
use pezsp_runtime::{
generic,
traits::{BlakeTwo256, Hash as HashT},
};
pub use sp_runtime::OpaqueExtrinsic as UncheckedExtrinsic;
pub use pezsp_runtime::OpaqueExtrinsic as UncheckedExtrinsic;
/// Opaque block header type.
pub type Header = generic::Header<BlockNumber, BlakeTwo256>;
@@ -58,16 +58,16 @@ impl_opaque_keys! {
}
// To learn more about runtime versioning, see:
// https://docs.substrate.io/main-docs/build/upgrade#runtime-versioning
#[sp_version::runtime_version]
// https://docs.pezkuwichain.io/main-docs/build/upgrade#runtime-versioning
#[pezsp_version::runtime_version]
pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_name: alloc::borrow::Cow::Borrowed("solochain-template-runtime"),
impl_name: alloc::borrow::Cow::Borrowed("solochain-template-runtime"),
spec_name: alloc::borrow::Cow::Borrowed("pez-solochain-template-runtime"),
impl_name: alloc::borrow::Cow::Borrowed("pez-solochain-template-runtime"),
authoring_version: 1,
// The version of the runtime specification. A full node will not attempt to use its native
// runtime in substitute for the on-chain Wasm runtime unless all of `spec_name`,
// `spec_version`, and `authoring_version` are the same between Wasm and native.
// This value is set to 100 to notify Polkadot-JS App (https://polkadot.js.org/apps) to use
// This value is set to 100 to notify Pezkuwi-JS App (https://pezkuwichain.io) to use
// the compatible custom types.
spec_version: 100,
impl_version: 1,
@@ -79,7 +79,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
mod block_times {
/// This determines the average expected block time that we are targeting. Blocks will be
/// produced at a minimum duration defined by `SLOT_DURATION`. `SLOT_DURATION` is picked up by
/// `pallet_timestamp` which is in turn picked up by `pallet_aura` to implement `fn
/// `pezpallet_timestamp` which is in turn picked up by `pezpallet_aura` to implement `fn
/// slot_duration()`.
///
/// Change this to adjust the block time.
@@ -126,7 +126,7 @@ pub type Balance = u128;
pub type Nonce = u32;
/// A hash of some data used by the chain.
pub type Hash = sp_core::H256;
pub type Hash = pezsp_core::H256;
/// An index to a block.
pub type BlockNumber = u32;
@@ -148,16 +148,17 @@ pub type BlockId = generic::BlockId<Block>;
/// The `TransactionExtension` to the basic transaction logic.
pub type TxExtension = (
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_transaction_payment::ChargeTransactionPayment<Runtime>,
frame_metadata_hash_extension::CheckMetadataHash<Runtime>,
frame_system::WeightReclaim<Runtime>,
pezframe_system::AuthorizeCall<Runtime>,
pezframe_system::CheckNonZeroSender<Runtime>,
pezframe_system::CheckSpecVersion<Runtime>,
pezframe_system::CheckTxVersion<Runtime>,
pezframe_system::CheckGenesis<Runtime>,
pezframe_system::CheckEra<Runtime>,
pezframe_system::CheckNonce<Runtime>,
pezframe_system::CheckWeight<Runtime>,
pezpallet_transaction_payment::ChargeTransactionPayment<Runtime>,
pezframe_metadata_hash_extension::CheckMetadataHash<Runtime>,
pezframe_system::WeightReclaim<Runtime>,
);
/// Unchecked extrinsic type as expected by this runtime.
@@ -167,24 +168,17 @@ pub type UncheckedExtrinsic =
/// The payload being signed in transactions.
pub type SignedPayload = generic::SignedPayload<RuntimeCall, TxExtension>;
/// 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 Migrations = ();
/// Executive: handles dispatch to the various modules.
pub type Executive = frame_executive::Executive<
pub type Executive = pezframe_executive::Executive<
Runtime,
Block,
frame_system::ChainContext<Runtime>,
pezframe_system::ChainContext<Runtime>,
Runtime,
AllPalletsWithSystem,
Migrations,
>;
// Create the runtime by composing the FRAME pallets that were previously configured.
#[frame_support::runtime]
#[pezframe_support::runtime]
mod runtime {
#[runtime::runtime]
#[runtime::derive(
@@ -201,28 +195,28 @@ mod runtime {
)]
pub struct Runtime;
#[runtime::pallet_index(0)]
pub type System = frame_system;
#[runtime::pezpallet_index(0)]
pub type System = pezframe_system;
#[runtime::pallet_index(1)]
pub type Timestamp = pallet_timestamp;
#[runtime::pezpallet_index(1)]
pub type Timestamp = pezpallet_timestamp;
#[runtime::pallet_index(2)]
pub type Aura = pallet_aura;
#[runtime::pezpallet_index(2)]
pub type Aura = pezpallet_aura;
#[runtime::pallet_index(3)]
pub type Grandpa = pallet_grandpa;
#[runtime::pezpallet_index(3)]
pub type Grandpa = pezpallet_grandpa;
#[runtime::pallet_index(4)]
pub type Balances = pallet_balances;
#[runtime::pezpallet_index(4)]
pub type Balances = pezpallet_balances;
#[runtime::pallet_index(5)]
pub type TransactionPayment = pallet_transaction_payment;
#[runtime::pezpallet_index(5)]
pub type TransactionPayment = pezpallet_transaction_payment;
#[runtime::pallet_index(6)]
pub type Sudo = pallet_sudo;
#[runtime::pezpallet_index(6)]
pub type Sudo = pezpallet_sudo;
// Include the custom logic from the pallet-template in the runtime.
#[runtime::pallet_index(7)]
pub type Template = pallet_template;
// Include the custom logic from the pezpallet-template in the runtime.
#[runtime::pezpallet_index(7)]
pub type Template = pezpallet_template;
}