Refactor project structure: replace template pallet with pezpallets

- Remove template pallet (pallets/template/)
- Add new pezpallets module
- Update Cargo.toml and Cargo.lock with new dependencies
- Update node and runtime configurations
- Update README documentation
This commit is contained in:
2025-12-25 05:33:37 +03:00
parent c6f71c73f6
commit 01258776ab
22 changed files with 11256 additions and 10091 deletions
+7 -7
View File
@@ -1,6 +1,6 @@
[package]
name = "minimal-template-node"
description = "A minimal Substrate-based Substrate node, ready for hacking."
name = "pez-minimal-template-node"
description = "A minimal bizinikiwi-based bizinikiwi node, ready for hacking."
version = "0.1.0"
license = "Unlicense"
authors.workspace = true
@@ -19,15 +19,15 @@ docify = { workspace = true }
futures = { features = ["thread-pool"], workspace = true }
futures-timer = { workspace = true }
jsonrpsee = { features = ["server"], workspace = true }
minimal-template-runtime.workspace = true
polkadot-sdk = { workspace = true, features = ["experimental", "node"] }
pez-minimal-template-runtime = { workspace = true }
pezkuwi-sdk = { workspace = true, features = ["experimental", "node"] }
[build-dependencies]
polkadot-sdk = { workspace = true, features = ["substrate-build-script-utils"] }
pezkuwi-sdk = { workspace = true, features = ["bizinikiwi-build-script-utils"] }
[features]
default = ["std"]
std = [
"minimal-template-runtime/std",
"polkadot-sdk/std",
"pez-minimal-template-runtime/std",
"pezkuwi-sdk/std",
]
+2 -2
View File
@@ -1,6 +1,6 @@
// This file is part of Substrate.
// This file is part of Bizinikiwi.
// Copyright (C) Parity Technologies (UK) Ltd.
// Copyright (C) Parity Technologies (UK) Ltd. and Kurdistan Blockchain Technologies Institute
// SPDX-License-Identifier: Apache-2.0
// Licensed under the Apache License, Version 2.0 (the "License");
+9 -9
View File
@@ -1,6 +1,6 @@
// This file is part of Substrate.
// This file is part of pezkuwi-sdk.
// Copyright (C) Parity Technologies (UK) Ltd.
// Copyright (C) Pezkuwi Foundation. and Kurdistan Blockchain Technologies Institute (KBTI) 2024.
// SPDX-License-Identifier: Apache-2.0
// Licensed under the Apache License, Version 2.0 (the "License");
@@ -15,19 +15,19 @@
// See the License for the specific language governing permissions and
// limitations under the License.
use minimal_template_runtime::WASM_BINARY;
use polkadot_sdk::{
sc_service::{ChainType, Properties},
use pez_minimal_template_runtime::WASM_BINARY;
use pezkuwi_sdk::{
pezsc_service::{ChainType, Properties},
*,
};
/// This is a specialization of the general Substrate ChainSpec type.
pub type ChainSpec = sc_service::GenericChainSpec;
/// This is a specialization of the general bizinikiwi ChainSpec type.
pub type ChainSpec = pezsc_service::GenericChainSpec;
fn props() -> Properties {
let mut properties = Properties::new();
properties.insert("tokenDecimals".to_string(), 0.into());
properties.insert("tokenSymbol".to_string(), "MINI".into());
properties.insert("tokenSymbol".to_string(), "PEZ".into());
properties
}
@@ -36,7 +36,7 @@ pub fn development_chain_spec() -> Result<ChainSpec, String> {
.with_name("Development")
.with_id("dev")
.with_chain_type(ChainType::Development)
.with_genesis_config_preset_name(sp_genesis_builder::DEV_RUNTIME_PRESET)
.with_genesis_config_preset_name(pezsp_genesis_builder::DEV_RUNTIME_PRESET)
.with_properties(props())
.build())
}
+12 -13
View File
@@ -1,8 +1,7 @@
// This file is part of Substrate.
// This file is part of pezkuwi-sdk.
// Copyright (C) Parity Technologies (UK) Ltd.
// Copyright (C) Pezkuwi Foundation. and Kurdistan Blockchain Technologies Institute (KBTI) 2024.
// SPDX-License-Identifier: Apache-2.0
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
@@ -15,7 +14,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
use polkadot_sdk::{sc_cli::RunCmd, *};
use pezkuwi_sdk::{pezsc_cli::RunCmd, *};
#[derive(Debug, Clone)]
pub enum Consensus {
@@ -56,29 +55,29 @@ pub struct Cli {
pub enum Subcommand {
/// Key management cli utilities
#[command(subcommand)]
Key(sc_cli::KeySubcommand),
Key(pezsc_cli::KeySubcommand),
/// Build a chain specification.
BuildSpec(sc_cli::BuildSpecCmd),
BuildSpec(pezsc_cli::BuildSpecCmd),
/// Validate blocks.
CheckBlock(sc_cli::CheckBlockCmd),
CheckBlock(pezsc_cli::CheckBlockCmd),
/// Export blocks.
ExportBlocks(sc_cli::ExportBlocksCmd),
ExportBlocks(pezsc_cli::ExportBlocksCmd),
/// Export the state of a given block into a chain spec.
ExportState(sc_cli::ExportStateCmd),
ExportState(pezsc_cli::ExportStateCmd),
/// Import blocks.
ImportBlocks(sc_cli::ImportBlocksCmd),
ImportBlocks(pezsc_cli::ImportBlocksCmd),
/// Remove the whole chain.
PurgeChain(sc_cli::PurgeChainCmd),
PurgeChain(pezsc_cli::PurgeChainCmd),
/// Revert the chain to a previous state.
Revert(sc_cli::RevertCmd),
Revert(pezsc_cli::RevertCmd),
/// Db meta columns information.
ChainInfo(sc_cli::ChainInfoCmd),
ChainInfo(pezsc_cli::ChainInfoCmd),
}
+15 -15
View File
@@ -1,6 +1,6 @@
// This file is part of Substrate.
// This file is part of pezkuwi-sdk.
// Copyright (C) Parity Technologies (UK) Ltd.
// Copyright (C) Pezkuwi Foundation. and Kurdistan Blockchain Technologies Institute (KBTI) 2024.
// SPDX-License-Identifier: Apache-2.0
// Licensed under the Apache License, Version 2.0 (the "License");
@@ -20,15 +20,15 @@ use crate::{
cli::{Cli, Subcommand},
service,
};
use polkadot_sdk::{sc_cli::SubstrateCli, sc_service::PartialComponents, *};
use pezkuwi_sdk::{pezsc_cli::BizinikiwiCli, pezsc_service::PartialComponents, *};
impl SubstrateCli for Cli {
impl BizinikiwiCli for Cli {
fn impl_name() -> String {
"Substrate Node".into()
"Bizinikiwi Node".into()
}
fn impl_version() -> String {
env!("SUBSTRATE_CLI_IMPL_VERSION").into()
env!("BIZINIKIWI_CLI_IMPL_VERSION").into()
}
fn description() -> String {
@@ -47,7 +47,7 @@ impl SubstrateCli for Cli {
2017
}
fn load_spec(&self, id: &str) -> Result<Box<dyn sc_service::ChainSpec>, String> {
fn load_spec(&self, id: &str) -> Result<Box<dyn pezsc_service::ChainSpec>, String> {
Ok(match id {
"dev" => Box::new(chain_spec::development_chain_spec()?),
path =>
@@ -57,7 +57,7 @@ impl SubstrateCli for Cli {
}
/// Parse and run command line arguments
pub fn run() -> sc_cli::Result<()> {
pub fn run() -> pezsc_cli::Result<()> {
let cli = Cli::from_args();
match &cli.subcommand {
@@ -111,20 +111,20 @@ pub fn run() -> sc_cli::Result<()> {
Some(Subcommand::ChainInfo(cmd)) => {
let runner = cli.create_runner(cmd)?;
runner.sync_run(|config| {
cmd.run::<minimal_template_runtime::interface::OpaqueBlock>(&config)
cmd.run::<pez_minimal_template_runtime::interface::OpaqueBlock>(&config)
})
},
None => {
let runner = cli.create_runner(&cli.run)?;
runner.run_node_until_exit(|config| async move {
match config.network.network_backend.unwrap_or_default() {
sc_network::config::NetworkBackendType::Libp2p =>
service::new_full::<sc_network::NetworkWorker<_, _>>(config, cli.consensus)
.map_err(sc_cli::Error::Service),
sc_network::config::NetworkBackendType::Litep2p => service::new_full::<
sc_network::Litep2pNetworkBackend,
pezsc_network::config::NetworkBackendType::Libp2p =>
service::new_full::<pezsc_network::NetworkWorker<_, _>>(config, cli.consensus)
.map_err(pezsc_cli::Error::Service),
pezsc_network::config::NetworkBackendType::Litep2p => service::new_full::<
pezsc_network::Litep2pNetworkBackend,
>(config, cli.consensus)
.map_err(sc_cli::Error::Service),
.map_err(pezsc_cli::Error::Service),
}
})
},
+2 -2
View File
@@ -1,6 +1,6 @@
// This file is part of Polkadot Sdk.
// This file is part of Pezkuwi Sdk.
// Copyright (C) Parity Technologies (UK) Ltd.
// Copyright (C) Pezkuwi Foundation. and Kurdistan Blockchain Technologies Institute (KBTI) 2024.
// SPDX-License-Identifier: Apache-2.0
// Licensed under the Apache License, Version 2.0 (the "License");
+4 -4
View File
@@ -1,6 +1,6 @@
// This file is part of Substrate.
// This file is part of pezkuwi-sdk.
// Copyright (C) Parity Technologies (UK) Ltd.
// Copyright (C) Pezkuwi Foundation. and Kurdistan Blockchain Technologies Institute (KBTI) 2024.
// SPDX-License-Identifier: Apache-2.0
// Licensed under the Apache License, Version 2.0 (the "License");
@@ -15,7 +15,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
//! Substrate Node Template CLI library.
//! Bizinikiwi Node Template CLI library.
#![warn(missing_docs)]
mod chain_spec;
@@ -24,6 +24,6 @@ mod command;
mod rpc;
mod service;
fn main() -> polkadot_sdk::sc_cli::Result<()> {
fn main() -> pezkuwi_sdk::pezsc_cli::Result<()> {
command::run()
}
+12 -12
View File
@@ -1,6 +1,6 @@
// This file is part of Substrate.
// This file is part of pezkuwi-sdk.
// Copyright (C) Parity Technologies (UK) Ltd.
// Copyright (C) Pezkuwi Foundation. and Kurdistan Blockchain Technologies Institute (KBTI) 2024.
// SPDX-License-Identifier: Apache-2.0
// Licensed under the Apache License, Version 2.0 (the "License");
@@ -16,17 +16,17 @@
// limitations under the License.
//! A collection of node-specific RPC methods.
//! Substrate provides the `sc-rpc` crate, which defines the core RPC layer
//! used by Substrate nodes. This file extends those RPC definitions with
//! bizinikiwi provides the `pezsc-rpc` crate, which defines the core RPC layer
//! used by bizinikiwi nodes. This file extends those RPC definitions with
//! capabilities that are specific to this project's runtime configuration.
#![warn(missing_docs)]
use jsonrpsee::RpcModule;
use minimal_template_runtime::interface::{AccountId, Nonce, OpaqueBlock};
use polkadot_sdk::{
sc_transaction_pool_api::TransactionPool,
sp_blockchain::{Error as BlockChainError, HeaderBackend, HeaderMetadata},
use pez_minimal_template_runtime::interface::{AccountId, Nonce, OpaqueBlock};
use pezkuwi_sdk::{
pezsc_transaction_pool_api::TransactionPool,
pezsp_blockchain::{Error as BlockChainError, HeaderBackend, HeaderMetadata},
*,
};
use std::sync::Arc;
@@ -48,15 +48,15 @@ where
C: Send
+ Sync
+ 'static
+ sp_api::ProvideRuntimeApi<OpaqueBlock>
+ pezsp_api::ProvideRuntimeApi<OpaqueBlock>
+ HeaderBackend<OpaqueBlock>
+ HeaderMetadata<OpaqueBlock, Error = BlockChainError>
+ 'static,
C::Api: sp_block_builder::BlockBuilder<OpaqueBlock>,
C::Api: substrate_frame_rpc_system::AccountNonceApi<OpaqueBlock, AccountId, Nonce>,
C::Api: pezsp_block_builder::BlockBuilder<OpaqueBlock>,
C::Api: pezframe_rpc_system::AccountNonceApi<OpaqueBlock, AccountId, Nonce>,
P: TransactionPool + 'static,
{
use polkadot_sdk::substrate_frame_rpc_system::{System, SystemApiServer};
use pezkuwi_sdk::pezframe_rpc_system::{System, SystemApiServer};
let mut module = RpcModule::new(());
let FullDeps { client, pool } = deps;
+38 -38
View File
@@ -1,6 +1,6 @@
// This file is part of Substrate.
// This file is part of pezkuwi-sdk.
// Copyright (C) Parity Technologies (UK) Ltd.
// Copyright (C) Pezkuwi Foundation. and Kurdistan Blockchain Technologies Institute (KBTI) 2024.
// SPDX-License-Identifier: Apache-2.0
// Licensed under the Apache License, Version 2.0 (the "License");
@@ -17,34 +17,34 @@
use crate::cli::Consensus;
use futures::FutureExt;
use minimal_template_runtime::{interface::OpaqueBlock as Block, RuntimeApi};
use polkadot_sdk::{
sc_client_api::backend::Backend,
sc_executor::WasmExecutor,
sc_service::{error::Error as ServiceError, Configuration, TaskManager},
sc_telemetry::{Telemetry, TelemetryWorker},
sc_transaction_pool_api::OffchainTransactionPoolFactory,
sp_runtime::traits::Block as BlockT,
use pez_minimal_template_runtime::{interface::OpaqueBlock as Block, RuntimeApi};
use pezkuwi_sdk::{
pezsc_client_api::backend::Backend,
pezsc_executor::WasmExecutor,
pezsc_service::{error::Error as ServiceError, Configuration, TaskManager},
pezsc_telemetry::{Telemetry, TelemetryWorker},
pezsc_transaction_pool_api::OffchainTransactionPoolFactory,
pezsp_runtime::traits::Block as BlockT,
*,
};
use std::sync::Arc;
type HostFunctions = sp_io::SubstrateHostFunctions;
type HostFunctions = pezsp_io::BizinikiwiHostFunctions;
#[docify::export]
pub(crate) type FullClient =
sc_service::TFullClient<Block, RuntimeApi, WasmExecutor<HostFunctions>>;
pezsc_service::TFullClient<Block, RuntimeApi, WasmExecutor<HostFunctions>>;
type FullBackend = sc_service::TFullBackend<Block>;
type FullSelectChain = sc_consensus::LongestChain<FullBackend, Block>;
type FullBackend = pezsc_service::TFullBackend<Block>;
type FullSelectChain = pezsc_consensus::LongestChain<FullBackend, Block>;
/// Assembly of PartialComponents (enough to run chain ops subcommands)
pub type Service = sc_service::PartialComponents<
pub type Service = pezsc_service::PartialComponents<
FullClient,
FullBackend,
FullSelectChain,
sc_consensus::DefaultImportQueue<Block>,
sc_transaction_pool::TransactionPoolHandle<Block, FullClient>,
pezsc_consensus::DefaultImportQueue<Block>,
pezsc_transaction_pool::TransactionPoolHandle<Block, FullClient>,
Option<Telemetry>,
>;
@@ -53,17 +53,17 @@ pub fn new_partial(config: &Configuration) -> Result<Service, ServiceError> {
.telemetry_endpoints
.clone()
.filter(|x| !x.is_empty())
.map(|endpoints| -> Result<_, sc_telemetry::Error> {
.map(|endpoints| -> Result<_, pezsc_telemetry::Error> {
let worker = TelemetryWorker::new(16)?;
let telemetry = worker.handle().new_telemetry(endpoints);
Ok((worker, telemetry))
})
.transpose()?;
let executor = sc_service::new_wasm_executor(&config.executor);
let executor = pezsc_service::new_wasm_executor(&config.executor);
let (client, backend, keystore_container, task_manager) =
sc_service::new_full_parts::<Block, RuntimeApi, _>(
pezsc_service::new_full_parts::<Block, RuntimeApi, _>(
config,
telemetry.as_ref().map(|(_, telemetry)| telemetry.handle()),
executor,
@@ -75,10 +75,10 @@ pub fn new_partial(config: &Configuration) -> Result<Service, ServiceError> {
telemetry
});
let select_chain = sc_consensus::LongestChain::new(backend.clone());
let select_chain = pezsc_consensus::LongestChain::new(backend.clone());
let transaction_pool = Arc::from(
sc_transaction_pool::Builder::new(
pezsc_transaction_pool::Builder::new(
task_manager.spawn_essential_handle(),
client.clone(),
config.role.is_authority().into(),
@@ -88,13 +88,13 @@ pub fn new_partial(config: &Configuration) -> Result<Service, ServiceError> {
.build(),
);
let import_queue = sc_consensus_manual_seal::import_queue(
let import_queue = pezsc_consensus_manual_seal::import_queue(
Box::new(client.clone()),
&task_manager.spawn_essential_handle(),
config.prometheus_registry(),
);
Ok(sc_service::PartialComponents {
Ok(pezsc_service::PartialComponents {
client,
backend,
task_manager,
@@ -107,11 +107,11 @@ pub fn new_partial(config: &Configuration) -> Result<Service, ServiceError> {
}
/// Builds a new service for a full client.
pub fn new_full<Network: sc_network::NetworkBackend<Block, <Block as BlockT>::Hash>>(
pub fn new_full<Network: pezsc_network::NetworkBackend<Block, <Block as BlockT>::Hash>>(
config: Configuration,
consensus: Consensus,
) -> Result<TaskManager, ServiceError> {
let sc_service::PartialComponents {
let pezsc_service::PartialComponents {
client,
backend,
mut task_manager,
@@ -122,7 +122,7 @@ pub fn new_full<Network: sc_network::NetworkBackend<Block, <Block as BlockT>::Ha
other: mut telemetry,
} = new_partial(&config)?;
let net_config = sc_network::config::FullNetworkConfiguration::<
let net_config = pezsc_network::config::FullNetworkConfiguration::<
Block,
<Block as BlockT>::Hash,
Network,
@@ -135,7 +135,7 @@ pub fn new_full<Network: sc_network::NetworkBackend<Block, <Block as BlockT>::Ha
);
let (network, system_rpc_tx, tx_handler_controller, sync_service) =
sc_service::build_network(sc_service::BuildNetworkParams {
pezsc_service::build_network(pezsc_service::BuildNetworkParams {
config: &config,
net_config,
client: client.clone(),
@@ -150,7 +150,7 @@ pub fn new_full<Network: sc_network::NetworkBackend<Block, <Block as BlockT>::Ha
if config.offchain_worker.enabled {
let offchain_workers =
sc_offchain::OffchainWorkers::new(sc_offchain::OffchainWorkerOptions {
pezsc_offchain::OffchainWorkers::new(pezsc_offchain::OffchainWorkerOptions {
runtime_api_provider: client.clone(),
is_validator: config.role.is_authority(),
keystore: Some(keystore_container.keystore()),
@@ -181,7 +181,7 @@ pub fn new_full<Network: sc_network::NetworkBackend<Block, <Block as BlockT>::Ha
let prometheus_registry = config.prometheus_registry().cloned();
let _rpc_handlers = sc_service::spawn_tasks(sc_service::SpawnTasksParams {
let _rpc_handlers = pezsc_service::spawn_tasks(pezsc_service::SpawnTasksParams {
network,
client: client.clone(),
keystore: keystore_container.keystore(),
@@ -196,7 +196,7 @@ pub fn new_full<Network: sc_network::NetworkBackend<Block, <Block as BlockT>::Ha
telemetry: telemetry.as_mut(),
})?;
let proposer = sc_basic_authorship::ProposerFactory::new(
let proposer = pezsc_basic_authorship::ProposerFactory::new(
task_manager.spawn_handle(),
client.clone(),
transaction_pool.clone(),
@@ -206,7 +206,7 @@ pub fn new_full<Network: sc_network::NetworkBackend<Block, <Block as BlockT>::Ha
match consensus {
Consensus::InstantSeal => {
let params = sc_consensus_manual_seal::InstantSealParams {
let params = pezsc_consensus_manual_seal::InstantSealParams {
block_import: client.clone(),
env: proposer,
client,
@@ -214,11 +214,11 @@ pub fn new_full<Network: sc_network::NetworkBackend<Block, <Block as BlockT>::Ha
select_chain,
consensus_data_provider: None,
create_inherent_data_providers: move |_, ()| async move {
Ok(sp_timestamp::InherentDataProvider::from_system_time())
Ok(pezsp_timestamp::InherentDataProvider::from_system_time())
},
};
let authorship_future = sc_consensus_manual_seal::run_instant_seal(params);
let authorship_future = pezsc_consensus_manual_seal::run_instant_seal(params);
task_manager.spawn_essential_handle().spawn_blocking(
"instant-seal",
@@ -231,7 +231,7 @@ pub fn new_full<Network: sc_network::NetworkBackend<Block, <Block as BlockT>::Ha
task_manager.spawn_handle().spawn("block_authoring", None, async move {
loop {
futures_timer::Delay::new(std::time::Duration::from_millis(block_time)).await;
sink.try_send(sc_consensus_manual_seal::EngineCommand::SealNewBlock {
sink.try_send(pezsc_consensus_manual_seal::EngineCommand::SealNewBlock {
create_empty: true,
finalize: true,
parent_hash: None,
@@ -241,7 +241,7 @@ pub fn new_full<Network: sc_network::NetworkBackend<Block, <Block as BlockT>::Ha
}
});
let params = sc_consensus_manual_seal::ManualSealParams {
let params = pezsc_consensus_manual_seal::ManualSealParams {
block_import: client.clone(),
env: proposer,
client,
@@ -250,10 +250,10 @@ pub fn new_full<Network: sc_network::NetworkBackend<Block, <Block as BlockT>::Ha
commands_stream: Box::pin(commands_stream),
consensus_data_provider: None,
create_inherent_data_providers: move |_, ()| async move {
Ok(sp_timestamp::InherentDataProvider::from_system_time())
Ok(pezsp_timestamp::InherentDataProvider::from_system_time())
},
};
let authorship_future = sc_consensus_manual_seal::run_manual_seal(params);
let authorship_future = pezsc_consensus_manual_seal::run_manual_seal(params);
task_manager.spawn_essential_handle().spawn_blocking(
"manual-seal",