diff --git a/Cargo.toml b/Cargo.toml index 4e10d67..58efc49 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,8 +1,8 @@ [workspace.package] license = "MIT-0" -authors = ["Parity Technologies "] -homepage = "https://paritytech.github.io/polkadot-sdk/" -repository = "https://github.com/paritytech/polkadot-sdk-solochain-template.git" +authors = ["PezkuwiChain "] +homepage = "https://pezkuwichain.github.io/pezkuwi-sdk/" +repository = "https://github.com/pezkuwichain/pez-solochain-template.git" edition = "2021" [workspace] @@ -13,65 +13,105 @@ members = [ ] resolver = "2" +[workspace.lints.rust] +suspicious_double_ref_op = { level = "allow", priority = 2 } + +[workspace.lints.clippy] +all = { level = "allow", priority = 0 } +correctness = { level = "warn", priority = 1 } +complexity = { level = "warn", priority = 1 } +if-same-then-else = { level = "allow", priority = 2 } +zero-prefixed-literal = { level = "allow", priority = 2 } +type_complexity = { level = "allow", priority = 2 } +nonminimal-bool = { level = "allow", priority = 2 } +borrowed-box = { level = "allow", priority = 2 } +too-many-arguments = { level = "allow", priority = 2 } +needless-lifetimes = { level = "allow", priority = 2 } +unnecessary_cast = { level = "allow", priority = 2 } +identity-op = { level = "allow", priority = 2 } +useless_conversion = { level = "allow", priority = 2 } +unit_arg = { level = "allow", priority = 2 } +option-map-unit-fn = { level = "allow", priority = 2 } +bind_instead_of_map = { level = "allow", priority = 2 } +erasing_op = { level = "allow", priority = 2 } +eq_op = { level = "allow", priority = 2 } +while_immutable_condition = { level = "allow", priority = 2 } +needless_option_as_deref = { level = "allow", priority = 2 } +derivable_impls = { level = "allow", priority = 2 } +stable_sort_primitive = { level = "allow", priority = 2 } +extra-unused-type-parameters = { level = "allow", priority = 2 } +default_constructed_unit_structs = { level = "allow", priority = 2 } +self-named-module-files = { level = "allow", priority = 2 } + [workspace.dependencies] -solochain-template-runtime = { path = "./runtime", default-features = false } -pallet-template = { path = "./pallets/template", default-features = false } -clap = { version = "4.5.13" } -frame-benchmarking-cli = { version = "47.0.0", default-features = false } -frame-metadata-hash-extension = { version = "0.8.0", default-features = false } -frame-system = { version = "40.1.0", default-features = false } -futures = { version = "0.3.31" } -jsonrpsee = { version = "0.24.3" } -pallet-transaction-payment = { version = "40.0.0", default-features = false } -pallet-transaction-payment-rpc = { version = "43.0.0", default-features = false } -sc-basic-authorship = { version = "0.49.0", default-features = false } -sc-cli = { version = "0.51.0", default-features = false } -sc-client-api = { version = "39.0.0", default-features = false } -sc-consensus = { version = "0.48.0", default-features = false } -sc-consensus-aura = { version = "0.49.0", default-features = false } -sc-consensus-grandpa = { version = "0.34.0", default-features = false } -sc-executor = { version = "0.42.0", default-features = false } -sc-network = { version = "0.49.1", default-features = false } -sc-offchain = { version = "44.0.0", default-features = false } -sc-service = { version = "0.50.0", default-features = false } -sc-telemetry = { version = "28.1.0", default-features = false } -sc-transaction-pool = { version = "39.0.0", default-features = false } -sc-transaction-pool-api = { version = "39.0.0", default-features = false } -sp-api = { version = "36.0.1", default-features = false } -sp-block-builder = { version = "36.0.0", default-features = false } -sp-blockchain = { version = "39.0.0", default-features = false } -sp-consensus-aura = { version = "0.42.0", default-features = false } -sp-core = { version = "36.1.0", default-features = false } -sp-genesis-builder = { version = "0.17.0", default-features = false } -sp-inherents = { version = "36.0.0", default-features = false } -sp-io = { version = "40.0.1", default-features = false } -sp-keyring = { version = "41.0.0", default-features = false } -sp-runtime = { version = "41.1.0", default-features = false } -sp-timestamp = { version = "36.0.0", default-features = false } -substrate-frame-rpc-system = { version = "43.0.0", default-features = false } -substrate-build-script-utils = { version = "11.0.0", default-features = false } -codec = { version = "3.7.4", default-features = false, package = "parity-scale-codec" } -frame-benchmarking = { version = "40.0.0", default-features = false } -frame-executive = { version = "40.0.0", default-features = false } -frame-support = { version = "40.1.0", default-features = false } -frame-system-benchmarking = { version = "40.0.0", default-features = false } -frame-system-rpc-runtime-api = { version = "36.0.0", default-features = false } -frame-try-runtime = { version = "0.46.0", default-features = false } -pallet-aura = { version = "39.0.0", default-features = false } -pallet-balances = { version = "41.1.0", default-features = false } -pallet-grandpa = { version = "40.0.0", default-features = false } -pallet-sudo = { version = "40.0.0", default-features = false } -pallet-timestamp = { version = "39.0.0", default-features = false } -pallet-transaction-payment-rpc-runtime-api = { version = "40.0.0", default-features = false } -scale-info = { version = "2.11.6", default-features = false } -serde_json = { version = "1.0.132", default-features = false } -sp-consensus-grandpa = { version = "23.1.0", default-features = false } -sp-offchain = { version = "36.0.0", default-features = false } -sp-session = { version = "38.1.0", default-features = false } -sp-storage = { version = "22.0.0", default-features = false } -sp-transaction-pool = { version = "36.0.0", default-features = false } -sp-version = { version = "39.0.0", default-features = false } -substrate-wasm-builder = { version = "26.0.1", default-features = false } +# Local crates +pez-solochain-template-runtime = { path = "./runtime", default-features = false } +pezpallet-template = { path = "./pallets/template", default-features = false } + +# External crates +clap = { version = "4.5" } +codec = { version = "3.7", default-features = false, package = "parity-scale-codec" } +futures = { version = "0.3" } +jsonrpsee = { version = "0.24" } +log = { version = "0.4", default-features = false } +scale-info = { version = "2.11", default-features = false } +serde_json = { version = "1.0", default-features = false } + +# Pezkuwi SDK dependencies (path to local pezkuwi-sdk - update to git/crates.io when published) +pezframe-benchmarking = { path = "../pezkuwi-sdk/bizinikiwi/pezframe/benchmarking", default-features = false } +pezframe-benchmarking-cli = { path = "../pezkuwi-sdk/bizinikiwi/utils/pezframe/benchmarking-cli", default-features = false } +pezframe-executive = { path = "../pezkuwi-sdk/bizinikiwi/pezframe/executive", default-features = false } +pezframe-metadata-hash-extension = { path = "../pezkuwi-sdk/bizinikiwi/pezframe/metadata-hash-extension", default-features = false } +pezframe-support = { path = "../pezkuwi-sdk/bizinikiwi/pezframe/support", default-features = false } +pezframe-system = { path = "../pezkuwi-sdk/bizinikiwi/pezframe/system", default-features = false } +pezframe-system-benchmarking = { path = "../pezkuwi-sdk/bizinikiwi/pezframe/system/benchmarking", default-features = false } +pezframe-system-rpc-runtime-api = { path = "../pezkuwi-sdk/bizinikiwi/pezframe/system/rpc/runtime-api", default-features = false } +pezframe-try-runtime = { path = "../pezkuwi-sdk/bizinikiwi/pezframe/try-runtime", default-features = false } + +pezpallet-aura = { path = "../pezkuwi-sdk/bizinikiwi/pezframe/pezpallet-aura", default-features = false } +pezpallet-balances = { path = "../pezkuwi-sdk/bizinikiwi/pezframe/pezpallet-balances", default-features = false } +pezpallet-grandpa = { path = "../pezkuwi-sdk/bizinikiwi/pezframe/pezpallet-grandpa", default-features = false } +pezpallet-sudo = { path = "../pezkuwi-sdk/bizinikiwi/pezframe/pezpallet-sudo", default-features = false } +pezpallet-timestamp = { path = "../pezkuwi-sdk/bizinikiwi/pezframe/pezpallet-timestamp", default-features = false } +pezpallet-transaction-payment = { path = "../pezkuwi-sdk/bizinikiwi/pezframe/pezpallet-transaction-payment", default-features = false } +pezpallet-transaction-payment-rpc = { path = "../pezkuwi-sdk/bizinikiwi/pezframe/pezpallet-transaction-payment/rpc", default-features = false } +pezpallet-transaction-payment-rpc-runtime-api = { path = "../pezkuwi-sdk/bizinikiwi/pezframe/pezpallet-transaction-payment/rpc/runtime-api", default-features = false } + +pezsc-basic-authorship = { path = "../pezkuwi-sdk/bizinikiwi/client/basic-authorship", default-features = false } +pezsc-cli = { path = "../pezkuwi-sdk/bizinikiwi/client/cli", default-features = false } +pezsc-client-api = { path = "../pezkuwi-sdk/bizinikiwi/client/api", default-features = false } +pezsc-consensus = { path = "../pezkuwi-sdk/bizinikiwi/client/consensus/common", default-features = false } +pezsc-consensus-aura = { path = "../pezkuwi-sdk/bizinikiwi/client/consensus/aura", default-features = false } +pezsc-consensus-grandpa = { path = "../pezkuwi-sdk/bizinikiwi/client/consensus/grandpa", default-features = false } +pezsc-executor = { path = "../pezkuwi-sdk/bizinikiwi/client/executor", default-features = false } +pezsc-network = { path = "../pezkuwi-sdk/bizinikiwi/client/network", default-features = false } +pezsc-offchain = { path = "../pezkuwi-sdk/bizinikiwi/client/offchain", default-features = false } +pezsc-service = { path = "../pezkuwi-sdk/bizinikiwi/client/service", default-features = false } +pezsc-telemetry = { path = "../pezkuwi-sdk/bizinikiwi/client/telemetry", default-features = false } +pezsc-transaction-pool = { path = "../pezkuwi-sdk/bizinikiwi/client/transaction-pool", default-features = false } +pezsc-transaction-pool-api = { path = "../pezkuwi-sdk/bizinikiwi/client/transaction-pool/api", default-features = false } + +pezsp-api = { path = "../pezkuwi-sdk/bizinikiwi/primitives/api", default-features = false } +pezsp-block-builder = { path = "../pezkuwi-sdk/bizinikiwi/primitives/block-builder", default-features = false } +pezsp-blockchain = { path = "../pezkuwi-sdk/bizinikiwi/primitives/blockchain", default-features = false } +pezsp-consensus-aura = { path = "../pezkuwi-sdk/bizinikiwi/primitives/consensus/aura", default-features = false } +pezsp-consensus-grandpa = { path = "../pezkuwi-sdk/bizinikiwi/primitives/consensus/grandpa", default-features = false } +pezsp-core = { path = "../pezkuwi-sdk/bizinikiwi/primitives/core", default-features = false } +pezsp-genesis-builder = { path = "../pezkuwi-sdk/bizinikiwi/primitives/genesis-builder", default-features = false } +pezsp-inherents = { path = "../pezkuwi-sdk/bizinikiwi/primitives/inherents", default-features = false } +pezsp-io = { path = "../pezkuwi-sdk/bizinikiwi/primitives/io", default-features = false } +pezsp-keyring = { path = "../pezkuwi-sdk/bizinikiwi/primitives/keyring", default-features = false } +pezsp-offchain = { path = "../pezkuwi-sdk/bizinikiwi/primitives/offchain", default-features = false } +pezsp-runtime = { path = "../pezkuwi-sdk/bizinikiwi/primitives/runtime", default-features = false } +pezsp-session = { path = "../pezkuwi-sdk/bizinikiwi/primitives/session", default-features = false } +pezsp-storage = { path = "../pezkuwi-sdk/bizinikiwi/primitives/storage", default-features = false } +pezsp-timestamp = { path = "../pezkuwi-sdk/bizinikiwi/primitives/timestamp", default-features = false } +pezsp-transaction-pool = { path = "../pezkuwi-sdk/bizinikiwi/primitives/transaction-pool", default-features = false } +pezsp-version = { path = "../pezkuwi-sdk/bizinikiwi/primitives/version", default-features = false } + +bizinikiwi-build-script-utils = { path = "../pezkuwi-sdk/bizinikiwi/utils/build-script-utils", default-features = false } +bizinikiwi-frame-rpc-system = { path = "../pezkuwi-sdk/bizinikiwi/utils/pezframe/rpc/system", default-features = false } +bizinikiwi-wasm-builder = { path = "../pezkuwi-sdk/bizinikiwi/utils/wasm-builder", default-features = false } [profile.release] opt-level = 3 @@ -81,4 +121,3 @@ panic = "unwind" codegen-units = 1 inherits = "release" lto = true - diff --git a/node/Cargo.toml b/node/Cargo.toml index 3428b24..ec4ef29 100644 --- a/node/Cargo.toml +++ b/node/Cargo.toml @@ -1,7 +1,7 @@ [package] -name = "solochain-template-node" -description = "A solochain node template built with Substrate, part of Polkadot Sdk." -version = "0.1.0" +name = "pez-solochain-template-node" +description = "A solochain node template built with Bizinikiwi, part of Pezkuwi Sdk." +version = "0.0.0" license = "Unlicense" authors.workspace = true homepage.workspace = true @@ -10,97 +10,103 @@ edition.workspace = true publish = false build = "build.rs" +documentation = "https://docs.rs/pez-solochain-template-node" [package.metadata.docs.rs] targets = ["x86_64-unknown-linux-gnu"] +[lints] +workspace = true + [dependencies] clap = { features = ["derive"], workspace = true } -frame-benchmarking-cli.default-features = true -frame-benchmarking-cli.workspace = true -frame-metadata-hash-extension.default-features = true -frame-metadata-hash-extension.workspace = true -frame-system.default-features = true -frame-system.workspace = true futures = { features = ["thread-pool"], workspace = true } jsonrpsee = { features = ["server"], workspace = true } -pallet-transaction-payment-rpc.default-features = true -pallet-transaction-payment-rpc.workspace = true -pallet-transaction-payment.default-features = true -pallet-transaction-payment.workspace = true -sc-basic-authorship.default-features = true -sc-basic-authorship.workspace = true -sc-cli.default-features = true -sc-cli.workspace = true -sc-client-api.default-features = true -sc-client-api.workspace = true -sc-consensus-aura.default-features = true -sc-consensus-aura.workspace = true -sc-consensus-grandpa.default-features = true -sc-consensus-grandpa.workspace = true -sc-consensus.default-features = true -sc-consensus.workspace = true -sc-executor.default-features = true -sc-executor.workspace = true -sc-network.default-features = true -sc-network.workspace = true -sc-offchain.default-features = true -sc-offchain.workspace = true -sc-service.default-features = true -sc-service.workspace = true -sc-telemetry.default-features = true -sc-telemetry.workspace = true -sc-transaction-pool-api.default-features = true -sc-transaction-pool-api.workspace = true -sc-transaction-pool.default-features = true -sc-transaction-pool.workspace = true -solochain-template-runtime.workspace = true -sp-api.default-features = true -sp-api.workspace = true -sp-block-builder.default-features = true -sp-block-builder.workspace = true -sp-blockchain.default-features = true -sp-blockchain.workspace = true -sp-consensus-aura.default-features = true -sp-consensus-aura.workspace = true -sp-core.default-features = true -sp-core.workspace = true -sp-genesis-builder.default-features = true -sp-genesis-builder.workspace = true -sp-inherents.default-features = true -sp-inherents.workspace = true -sp-io.default-features = true -sp-io.workspace = true -sp-keyring.default-features = true -sp-keyring.workspace = true -sp-runtime.default-features = true -sp-runtime.workspace = true -sp-timestamp.default-features = true -sp-timestamp.workspace = true -substrate-frame-rpc-system.default-features = true -substrate-frame-rpc-system.workspace = true + +# bizinikiwi client +pezsc-basic-authorship = { workspace = true, default-features = true } +pezsc-cli = { workspace = true, default-features = true } +pezsc-client-api = { workspace = true, default-features = true } +pezsc-consensus = { workspace = true, default-features = true } +pezsc-consensus-aura = { workspace = true, default-features = true } +pezsc-consensus-grandpa = { workspace = true, default-features = true } +pezsc-executor = { workspace = true, default-features = true } +pezsc-network = { workspace = true, default-features = true } +pezsc-offchain = { workspace = true, default-features = true } +pezsc-service = { workspace = true, default-features = true } +pezsc-telemetry = { workspace = true, default-features = true } +pezsc-transaction-pool = { workspace = true, default-features = true } +pezsc-transaction-pool-api = { workspace = true, default-features = true } +pezsp-consensus-aura = { workspace = true, default-features = true } +pezsp-core = { workspace = true, default-features = true } +pezsp-genesis-builder = { workspace = true, default-features = true } + +# bizinikiwi primitives +pezsp-api = { workspace = true, default-features = true } +pezsp-block-builder = { workspace = true, default-features = true } +pezsp-blockchain = { workspace = true, default-features = true } +pezsp-inherents = { workspace = true, default-features = true } +pezsp-io = { workspace = true, default-features = true } +pezsp-keyring = { workspace = true, default-features = true } +pezsp-runtime = { workspace = true, default-features = true } +pezsp-timestamp = { workspace = true, default-features = true } + +# frame and pallets +bizinikiwi-frame-rpc-system = { workspace = true, default-features = true } +pezframe-metadata-hash-extension = { workspace = true, default-features = true } +pezframe-system = { workspace = true, default-features = true } +pezpallet-transaction-payment = { workspace = true, default-features = true } +pezpallet-transaction-payment-rpc = { workspace = true, default-features = true } + +# These dependencies are used for runtime benchmarking +pezframe-benchmarking-cli = { workspace = true, default-features = true } + +# Local Dependencies +pez-solochain-template-runtime = { workspace = true } [build-dependencies] -substrate-build-script-utils.default-features = true -substrate-build-script-utils.workspace = true +bizinikiwi-build-script-utils = { workspace = true, default-features = true } [features] default = ["std"] -std = ["solochain-template-runtime/std"] +std = ["pez-solochain-template-runtime/std"] # Dependencies that are only required if runtime benchmarking should be build. runtime-benchmarks = [ - "frame-benchmarking-cli/runtime-benchmarks", - "frame-system/runtime-benchmarks", - "pallet-transaction-payment/runtime-benchmarks", - "sc-service/runtime-benchmarks", - "solochain-template-runtime/runtime-benchmarks", - "sp-runtime/runtime-benchmarks", + "bizinikiwi-frame-rpc-system/runtime-benchmarks", + "pez-solochain-template-runtime/runtime-benchmarks", + "pezframe-benchmarking-cli/runtime-benchmarks", + "pezframe-metadata-hash-extension/runtime-benchmarks", + "pezframe-system/runtime-benchmarks", + "pezpallet-transaction-payment-rpc/runtime-benchmarks", + "pezpallet-transaction-payment/runtime-benchmarks", + "pezsc-basic-authorship/runtime-benchmarks", + "pezsc-cli/runtime-benchmarks", + "pezsc-client-api/runtime-benchmarks", + "pezsc-consensus-aura/runtime-benchmarks", + "pezsc-consensus-grandpa/runtime-benchmarks", + "pezsc-consensus/runtime-benchmarks", + "pezsc-executor/runtime-benchmarks", + "pezsc-network/runtime-benchmarks", + "pezsc-offchain/runtime-benchmarks", + "pezsc-service/runtime-benchmarks", + "pezsc-transaction-pool-api/runtime-benchmarks", + "pezsc-transaction-pool/runtime-benchmarks", + "pezsp-api/runtime-benchmarks", + "pezsp-block-builder/runtime-benchmarks", + "pezsp-blockchain/runtime-benchmarks", + "pezsp-consensus-aura/runtime-benchmarks", + "pezsp-genesis-builder/runtime-benchmarks", + "pezsp-inherents/runtime-benchmarks", + "pezsp-io/runtime-benchmarks", + "pezsp-keyring/runtime-benchmarks", + "pezsp-runtime/runtime-benchmarks", + "pezsp-timestamp/runtime-benchmarks", ] # Enable features that allow the runtime to be tried and debugged. Name might be subject to change # in the near future. try-runtime = [ - "frame-system/try-runtime", - "pallet-transaction-payment/try-runtime", - "solochain-template-runtime/try-runtime", - "sp-runtime/try-runtime", + "pez-solochain-template-runtime/try-runtime", + "pezframe-system/try-runtime", + "pezpallet-transaction-payment/try-runtime", + "pezsp-runtime/try-runtime", ] diff --git a/node/build.rs b/node/build.rs index e3bfe31..bcf7ba3 100644 --- a/node/build.rs +++ b/node/build.rs @@ -1,4 +1,4 @@ -use substrate_build_script_utils::{generate_cargo_keys, rerun_if_git_head_changed}; +use bizinikiwi_build_script_utils::{generate_cargo_keys, rerun_if_git_head_changed}; fn main() { generate_cargo_keys(); diff --git a/node/src/benchmarking.rs b/node/src/benchmarking.rs index 467cad4..8d9c44c 100644 --- a/node/src/benchmarking.rs +++ b/node/src/benchmarking.rs @@ -4,14 +4,14 @@ use crate::service::FullClient; +use pez_solochain_template_runtime as runtime; +use pezsc_cli::Result; +use pezsc_client_api::BlockBackend; +use pezsp_core::{Encode, Pair}; +use pezsp_inherents::{InherentData, InherentDataProvider}; +use pezsp_keyring::Sr25519Keyring; +use pezsp_runtime::{OpaqueExtrinsic, SaturatedConversion}; use runtime::{AccountId, Balance, BalancesCall, SystemCall}; -use sc_cli::Result; -use sc_client_api::BlockBackend; -use solochain_template_runtime as runtime; -use sp_core::{Encode, Pair}; -use sp_inherents::{InherentData, InherentDataProvider}; -use sp_keyring::Sr25519Keyring; -use sp_runtime::{OpaqueExtrinsic, SaturatedConversion}; use std::{sync::Arc, time::Duration}; @@ -29,8 +29,8 @@ impl RemarkBuilder { } } -impl frame_benchmarking_cli::ExtrinsicBuilder for RemarkBuilder { - fn pallet(&self) -> &str { +impl pezframe_benchmarking_cli::ExtrinsicBuilder for RemarkBuilder { + fn pezpallet(&self) -> &str { "system" } @@ -68,8 +68,8 @@ impl TransferKeepAliveBuilder { } } -impl frame_benchmarking_cli::ExtrinsicBuilder for TransferKeepAliveBuilder { - fn pallet(&self) -> &str { +impl pezframe_benchmarking_cli::ExtrinsicBuilder for TransferKeepAliveBuilder { + fn pezpallet(&self) -> &str { "balances" } @@ -97,7 +97,7 @@ impl frame_benchmarking_cli::ExtrinsicBuilder for TransferKeepAliveBuilder { /// Note: Should only be used for benchmarking. pub fn create_benchmark_extrinsic( client: &FullClient, - sender: sp_core::sr25519::Pair, + sender: pezsp_core::sr25519::Pair, call: runtime::RuntimeCall, nonce: u32, ) -> runtime::UncheckedExtrinsic { @@ -110,25 +110,27 @@ pub fn create_benchmark_extrinsic( .map(|c| c / 2) .unwrap_or(2) as u64; let tx_ext: runtime::TxExtension = ( - frame_system::CheckNonZeroSender::::new(), - frame_system::CheckSpecVersion::::new(), - frame_system::CheckTxVersion::::new(), - frame_system::CheckGenesis::::new(), - frame_system::CheckEra::::from(sp_runtime::generic::Era::mortal( + pezframe_system::AuthorizeCall::::new(), + pezframe_system::CheckNonZeroSender::::new(), + pezframe_system::CheckSpecVersion::::new(), + pezframe_system::CheckTxVersion::::new(), + pezframe_system::CheckGenesis::::new(), + pezframe_system::CheckEra::::from(pezsp_runtime::generic::Era::mortal( period, best_block.saturated_into(), )), - frame_system::CheckNonce::::from(nonce), - frame_system::CheckWeight::::new(), - pallet_transaction_payment::ChargeTransactionPayment::::from(0), - frame_metadata_hash_extension::CheckMetadataHash::::new(false), - frame_system::WeightReclaim::::new(), + pezframe_system::CheckNonce::::from(nonce), + pezframe_system::CheckWeight::::new(), + pezpallet_transaction_payment::ChargeTransactionPayment::::from(0), + pezframe_metadata_hash_extension::CheckMetadataHash::::new(false), + pezframe_system::WeightReclaim::::new(), ); let raw_payload = runtime::SignedPayload::from_raw( call.clone(), tx_ext.clone(), ( + (), (), runtime::VERSION.spec_version, runtime::VERSION.transaction_version, @@ -145,7 +147,7 @@ pub fn create_benchmark_extrinsic( runtime::UncheckedExtrinsic::new_signed( call, - sp_runtime::AccountId32::from(sender.public()).into(), + pezsp_runtime::AccountId32::from(sender.public()).into(), runtime::Signature::Sr25519(signature), tx_ext, ) @@ -157,9 +159,9 @@ pub fn create_benchmark_extrinsic( pub fn inherent_benchmark_data() -> Result { let mut inherent_data = InherentData::new(); let d = Duration::from_millis(0); - let timestamp = sp_timestamp::InherentDataProvider::new(d.into()); + let timestamp = pezsp_timestamp::InherentDataProvider::new(d.into()); futures::executor::block_on(timestamp.provide_inherent_data(&mut inherent_data)) - .map_err(|e| format!("creating inherent data: {:?}", e))?; + .map_err(|e| format!("creating inherent data: {e:?}"))?; Ok(inherent_data) } diff --git a/node/src/chain_spec.rs b/node/src/chain_spec.rs index 086bf7a..de21524 100644 --- a/node/src/chain_spec.rs +++ b/node/src/chain_spec.rs @@ -1,8 +1,8 @@ -use sc_service::ChainType; -use solochain_template_runtime::WASM_BINARY; +use pez_solochain_template_runtime::WASM_BINARY; +use pezsc_service::ChainType; -/// Specialized `ChainSpec`. This is a specialization of the general Substrate ChainSpec type. -pub type ChainSpec = sc_service::GenericChainSpec; +/// Specialized `ChainSpec`. This is a specialization of the general Bizinikiwi ChainSpec type. +pub type ChainSpec = pezsc_service::GenericChainSpec; pub fn development_chain_spec() -> Result { Ok(ChainSpec::builder( @@ -12,7 +12,7 @@ pub fn development_chain_spec() -> Result { .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) .build()) } @@ -24,6 +24,6 @@ pub fn local_chain_spec() -> Result { .with_name("Local Testnet") .with_id("local_testnet") .with_chain_type(ChainType::Local) - .with_genesis_config_preset_name(sp_genesis_builder::LOCAL_TESTNET_RUNTIME_PRESET) + .with_genesis_config_preset_name(pezsp_genesis_builder::LOCAL_TESTNET_RUNTIME_PRESET) .build()) } diff --git a/node/src/cli.rs b/node/src/cli.rs index b2c53aa..149375a 100644 --- a/node/src/cli.rs +++ b/node/src/cli.rs @@ -1,12 +1,10 @@ -use sc_cli::RunCmd; - #[derive(Debug, clap::Parser)] pub struct Cli { #[command(subcommand)] pub subcommand: Option, #[clap(flatten)] - pub run: RunCmd, + pub run: pezsc_cli::RunCmd, } #[derive(Debug, clap::Subcommand)] @@ -14,33 +12,41 @@ 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), + /// DEPRECATED: `build-spec` command will be removed after 1/04/2026. Use `export-chain-spec` + /// command instead. + #[deprecated( + note = "build-spec command will be removed after 1/04/2026. Use export-chain-spec command instead" + )] + BuildSpec(pezsc_cli::BuildSpecCmd), + + /// Export the chain specification. + ExportChainSpec(pezsc_cli::ExportChainSpecCmd), /// 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), /// Sub-commands concerned with benchmarking. #[command(subcommand)] - Benchmark(frame_benchmarking_cli::BenchmarkCmd), + Benchmark(pezframe_benchmarking_cli::BenchmarkCmd), /// Db meta columns information. - ChainInfo(sc_cli::ChainInfoCmd), + ChainInfo(pezsc_cli::ChainInfoCmd), } diff --git a/node/src/command.rs b/node/src/command.rs index 54540db..72c9c91 100644 --- a/node/src/command.rs +++ b/node/src/command.rs @@ -4,19 +4,19 @@ use crate::{ cli::{Cli, Subcommand}, service, }; -use frame_benchmarking_cli::{BenchmarkCmd, ExtrinsicFactory, SUBSTRATE_REFERENCE_HARDWARE}; -use sc_cli::SubstrateCli; -use sc_service::PartialComponents; -use solochain_template_runtime::{Block, EXISTENTIAL_DEPOSIT}; -use sp_keyring::Sr25519Keyring; +use pez_solochain_template_runtime::{Block, EXISTENTIAL_DEPOSIT}; +use pezframe_benchmarking_cli::{BenchmarkCmd, ExtrinsicFactory, BIZINIKIWI_REFERENCE_HARDWARE}; +use pezsc_cli::BizinikiwiCli; +use pezsc_service::PartialComponents; +use pezsp_keyring::Sr25519Keyring; -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 { @@ -35,22 +35,24 @@ impl SubstrateCli for Cli { 2017 } - fn load_spec(&self, id: &str) -> Result, String> { + fn load_spec(&self, id: &str) -> Result, String> { Ok(match id { "dev" => Box::new(chain_spec::development_chain_spec()?), "" | "local" => Box::new(chain_spec::local_chain_spec()?), - path => - Box::new(chain_spec::ChainSpec::from_json_file(std::path::PathBuf::from(path))?), + path => { + Box::new(chain_spec::ChainSpec::from_json_file(std::path::PathBuf::from(path))?) + }, }) } } /// 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 { Some(Subcommand::Key(cmd)) => cmd.run(&cli), + #[allow(deprecated)] Some(Subcommand::BuildSpec(cmd)) => { let runner = cli.create_runner(cmd)?; runner.sync_run(|config| cmd.run(config.chain_spec, config.network)) @@ -63,6 +65,10 @@ pub fn run() -> sc_cli::Result<()> { Ok((cmd.run(client, import_queue), task_manager)) }) }, + Some(Subcommand::ExportChainSpec(cmd)) => { + let chain_spec = cli.load_spec(&cmd.chain)?; + cmd.run(chain_spec) + }, Some(Subcommand::ExportBlocks(cmd)) => { let runner = cli.create_runner(cmd)?; runner.async_run(|config| { @@ -95,7 +101,7 @@ pub fn run() -> sc_cli::Result<()> { let PartialComponents { client, task_manager, backend, .. } = service::new_partial(&config)?; let aux_revert = Box::new(|client, _, blocks| { - sc_consensus_grandpa::revert(client, blocks)?; + pezsc_consensus_grandpa::revert(client, blocks)?; Ok(()) }); Ok((cmd.run(client, backend, Some(aux_revert)), task_manager)) @@ -108,7 +114,7 @@ pub fn run() -> sc_cli::Result<()> { // This switch needs to be in the client, since the client decides // which sub-commands it wants to support. match cmd { - BenchmarkCmd::Pallet(cmd) => { + BenchmarkCmd::Pezpallet(cmd) => { if !cfg!(feature = "runtime-benchmarks") { return Err( "Runtime benchmarking wasn't enabled when building the node. \ @@ -117,7 +123,7 @@ pub fn run() -> sc_cli::Result<()> { ); } - cmd.run_with_spec::, ()>(Some( + cmd.run_with_spec::, ()>(Some( config.chain_spec, )) }, @@ -136,8 +142,9 @@ pub fn run() -> sc_cli::Result<()> { service::new_partial(&config)?; let db = backend.expose_db(); let storage = backend.expose_storage(); + let shared_cache = backend.expose_shared_trie_cache(); - cmd.run(config, client, db, storage) + cmd.run(config, client, db, storage, shared_cache) }, BenchmarkCmd::Overhead(cmd) => { let PartialComponents { client, .. } = service::new_partial(&config)?; @@ -166,8 +173,9 @@ pub fn run() -> sc_cli::Result<()> { cmd.run(client, inherent_benchmark_data()?, Vec::new(), &ext_factory) }, - BenchmarkCmd::Machine(cmd) => - cmd.run(&config, SUBSTRATE_REFERENCE_HARDWARE.clone()), + BenchmarkCmd::Machine(cmd) => { + cmd.run(&config, BIZINIKIWI_REFERENCE_HARDWARE.clone()) + }, } }) }, @@ -178,17 +186,17 @@ pub fn run() -> sc_cli::Result<()> { 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< - solochain_template_runtime::opaque::Block, - ::Hash, + match config.network.network_backend { + pezsc_network::config::NetworkBackendType::Libp2p => service::new_full::< + pezsc_network::NetworkWorker< + pez_solochain_template_runtime::opaque::Block, + ::Hash, >, >(config) - .map_err(sc_cli::Error::Service), - sc_network::config::NetworkBackendType::Litep2p => - service::new_full::(config) - .map_err(sc_cli::Error::Service), + .map_err(pezsc_cli::Error::Service), + pezsc_network::config::NetworkBackendType::Litep2p => + service::new_full::(config) + .map_err(pezsc_cli::Error::Service), } }) }, diff --git a/node/src/main.rs b/node/src/main.rs index 8918dd4..7d3479b 100644 --- a/node/src/main.rs +++ b/node/src/main.rs @@ -1,4 +1,4 @@ -//! Substrate Node Template CLI library. +//! Bizinikiwi Node Template CLI library. #![warn(missing_docs)] mod benchmarking; @@ -8,6 +8,6 @@ mod command; mod rpc; mod service; -fn main() -> sc_cli::Result<()> { +fn main() -> pezsc_cli::Result<()> { command::run() } diff --git a/node/src/rpc.rs b/node/src/rpc.rs index 1fc6eb0..7d3ec33 100644 --- a/node/src/rpc.rs +++ b/node/src/rpc.rs @@ -1,6 +1,6 @@ //! 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 `sc-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)] @@ -8,11 +8,11 @@ use std::sync::Arc; use jsonrpsee::RpcModule; -use sc_transaction_pool_api::TransactionPool; -use solochain_template_runtime::{opaque::Block, AccountId, Balance, Nonce}; -use sp_api::ProvideRuntimeApi; -use sp_block_builder::BlockBuilder; -use sp_blockchain::{Error as BlockChainError, HeaderBackend, HeaderMetadata}; +use pez_solochain_template_runtime::{opaque::Block, AccountId, Balance, Nonce}; +use pezsc_transaction_pool_api::TransactionPool; +use pezsp_api::ProvideRuntimeApi; +use pezsp_block_builder::BlockBuilder; +use pezsp_blockchain::{Error as BlockChainError, HeaderBackend, HeaderMetadata}; /// Full client dependencies. pub struct FullDeps { @@ -30,13 +30,13 @@ where C: ProvideRuntimeApi, C: HeaderBackend + HeaderMetadata + 'static, C: Send + Sync + 'static, - C::Api: substrate_frame_rpc_system::AccountNonceApi, - C::Api: pallet_transaction_payment_rpc::TransactionPaymentRuntimeApi, + C::Api: bizinikiwi_frame_rpc_system::AccountNonceApi, + C::Api: pezpallet_transaction_payment_rpc::TransactionPaymentRuntimeApi, C::Api: BlockBuilder, P: TransactionPool + 'static, { - use pallet_transaction_payment_rpc::{TransactionPayment, TransactionPaymentApiServer}; - use substrate_frame_rpc_system::{System, SystemApiServer}; + use bizinikiwi_frame_rpc_system::{System, SystemApiServer}; + use pezpallet_transaction_payment_rpc::{TransactionPayment, TransactionPaymentApiServer}; let mut module = RpcModule::new(()); let FullDeps { client, pool } = deps; diff --git a/node/src/service.rs b/node/src/service.rs index 79d97fb..3f3b618 100644 --- a/node/src/service.rs +++ b/node/src/service.rs @@ -1,37 +1,42 @@ -//! Service and ServiceFactory implementation. Specialized wrapper over substrate service. +//! Service and ServiceFactory implementation. Specialized wrapper over bizinikiwi service. use futures::FutureExt; -use sc_client_api::{Backend, BlockBackend}; -use sc_consensus_aura::{ImportQueueParams, SlotProportion, StartAuraParams}; -use sc_consensus_grandpa::SharedVoterState; -use sc_service::{error::Error as ServiceError, Configuration, TaskManager, WarpSyncConfig}; -use sc_telemetry::{Telemetry, TelemetryWorker}; -use sc_transaction_pool_api::OffchainTransactionPoolFactory; -use solochain_template_runtime::{self, apis::RuntimeApi, opaque::Block}; -use sp_consensus_aura::sr25519::AuthorityPair as AuraPair; +use pez_solochain_template_runtime::{self, apis::RuntimeApi, opaque::Block}; +use pezsc_client_api::{Backend, BlockBackend}; +use pezsc_consensus_aura::{ImportQueueParams, SlotProportion, StartAuraParams}; +use pezsc_consensus_grandpa::SharedVoterState; +use pezsc_service::{error::Error as ServiceError, Configuration, TaskManager, WarpSyncConfig}; +use pezsc_telemetry::{Telemetry, TelemetryWorker}; +use pezsc_transaction_pool_api::OffchainTransactionPoolFactory; +use pezsp_consensus_aura::sr25519::AuthorityPair as AuraPair; use std::{sync::Arc, time::Duration}; -pub(crate) type FullClient = sc_service::TFullClient< +pub(crate) type FullClient = pezsc_service::TFullClient< Block, RuntimeApi, - sc_executor::WasmExecutor, + pezsc_executor::WasmExecutor, >; -type FullBackend = sc_service::TFullBackend; -type FullSelectChain = sc_consensus::LongestChain; +type FullBackend = pezsc_service::TFullBackend; +type FullSelectChain = pezsc_consensus::LongestChain; /// The minimum period of blocks on which justifications will be /// imported and generated. const GRANDPA_JUSTIFICATION_PERIOD: u32 = 512; -pub type Service = sc_service::PartialComponents< +pub type Service = pezsc_service::PartialComponents< FullClient, FullBackend, FullSelectChain, - sc_consensus::DefaultImportQueue, - sc_transaction_pool::TransactionPoolHandle, + pezsc_consensus::DefaultImportQueue, + pezsc_transaction_pool::TransactionPoolHandle, ( - sc_consensus_grandpa::GrandpaBlockImport, - sc_consensus_grandpa::LinkHalf, + pezsc_consensus_grandpa::GrandpaBlockImport< + FullBackend, + Block, + FullClient, + FullSelectChain, + >, + pezsc_consensus_grandpa::LinkHalf, Option, ), >; @@ -41,16 +46,17 @@ pub fn new_partial(config: &Configuration) -> Result { .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::( + pezsc_service::new_full_parts::( config, telemetry.as_ref().map(|(_, telemetry)| telemetry.handle()), executor, @@ -62,10 +68,10 @@ pub fn new_partial(config: &Configuration) -> Result { 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(), @@ -75,7 +81,7 @@ pub fn new_partial(config: &Configuration) -> Result { .build(), ); - let (grandpa_block_import, grandpa_link) = sc_consensus_grandpa::block_import( + let (grandpa_block_import, grandpa_link) = pezsc_consensus_grandpa::block_import( client.clone(), GRANDPA_JUSTIFICATION_PERIOD, &client, @@ -85,21 +91,21 @@ pub fn new_partial(config: &Configuration) -> Result { let cidp_client = client.clone(); let import_queue = - sc_consensus_aura::import_queue::(ImportQueueParams { + pezsc_consensus_aura::import_queue::(ImportQueueParams { block_import: grandpa_block_import.clone(), justification_import: Some(Box::new(grandpa_block_import.clone())), client: client.clone(), create_inherent_data_providers: move |parent_hash, _| { let cidp_client = cidp_client.clone(); async move { - let slot_duration = sc_consensus_aura::standalone::slot_duration_at( + let slot_duration = pezsc_consensus_aura::standalone::slot_duration_at( &*cidp_client, parent_hash, )?; - let timestamp = sp_timestamp::InherentDataProvider::from_system_time(); + let timestamp = pezsp_timestamp::InherentDataProvider::from_system_time(); let slot = - sp_consensus_aura::inherents::InherentDataProvider::from_timestamp_and_slot_duration( + pezsp_consensus_aura::inherents::InherentDataProvider::from_timestamp_and_slot_duration( *timestamp, slot_duration, ); @@ -114,7 +120,7 @@ pub fn new_partial(config: &Configuration) -> Result { compatibility_mode: Default::default(), })?; - Ok(sc_service::PartialComponents { + Ok(pezsc_service::PartialComponents { client, backend, task_manager, @@ -128,11 +134,11 @@ pub fn new_partial(config: &Configuration) -> Result { /// Builds a new service for a full client. pub fn new_full< - N: sc_network::NetworkBackend::Hash>, + N: pezsc_network::NetworkBackend::Hash>, >( config: Configuration, ) -> Result { - let sc_service::PartialComponents { + let pezsc_service::PartialComponents { client, backend, mut task_manager, @@ -143,34 +149,34 @@ pub fn new_full< other: (block_import, grandpa_link, mut telemetry), } = new_partial(&config)?; - let mut net_config = sc_network::config::FullNetworkConfiguration::< + let mut net_config = pezsc_network::config::FullNetworkConfiguration::< Block, - ::Hash, + ::Hash, N, >::new(&config.network, config.prometheus_registry().cloned()); let metrics = N::register_notification_metrics(config.prometheus_registry()); let peer_store_handle = net_config.peer_store_handle(); - let grandpa_protocol_name = sc_consensus_grandpa::protocol_standard_name( + let grandpa_protocol_name = pezsc_consensus_grandpa::protocol_standard_name( &client.block_hash(0).ok().flatten().expect("Genesis block exists; qed"), &config.chain_spec, ); let (grandpa_protocol_config, grandpa_notification_service) = - sc_consensus_grandpa::grandpa_peers_set_config::<_, N>( + pezsc_consensus_grandpa::grandpa_peers_set_config::<_, N>( grandpa_protocol_name.clone(), metrics.clone(), peer_store_handle, ); net_config.add_notification_protocol(grandpa_protocol_config); - let warp_sync = Arc::new(sc_consensus_grandpa::warp_proof::NetworkProvider::new( + let warp_sync = Arc::new(pezsc_consensus_grandpa::warp_proof::NetworkProvider::new( backend.clone(), grandpa_link.shared_authority_set().clone(), Vec::default(), )); 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(), @@ -185,7 +191,7 @@ pub fn new_full< 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()), @@ -221,7 +227,7 @@ pub fn new_full< }) }; - let _rpc_handlers = sc_service::spawn_tasks(sc_service::SpawnTasksParams { + let _rpc_handlers = pezsc_service::spawn_tasks(pezsc_service::SpawnTasksParams { network: Arc::new(network.clone()), client: client.clone(), keystore: keystore_container.keystore(), @@ -234,10 +240,11 @@ pub fn new_full< sync_service: sync_service.clone(), config, telemetry: telemetry.as_mut(), + tracing_execute_block: None, })?; if role.is_authority() { - let proposer_factory = sc_basic_authorship::ProposerFactory::new( + let proposer_factory = pezsc_basic_authorship::ProposerFactory::new( task_manager.spawn_handle(), client.clone(), transaction_pool.clone(), @@ -245,9 +252,9 @@ pub fn new_full< telemetry.as_ref().map(|x| x.handle()), ); - let slot_duration = sc_consensus_aura::slot_duration(&*client)?; + let slot_duration = pezsc_consensus_aura::slot_duration(&*client)?; - let aura = sc_consensus_aura::start_aura::( + let aura = pezsc_consensus_aura::start_aura::( StartAuraParams { slot_duration, client, @@ -255,10 +262,10 @@ pub fn new_full< block_import, proposer_factory, create_inherent_data_providers: move |_, ()| async move { - let timestamp = sp_timestamp::InherentDataProvider::from_system_time(); + let timestamp = pezsp_timestamp::InherentDataProvider::from_system_time(); let slot = - sp_consensus_aura::inherents::InherentDataProvider::from_timestamp_and_slot_duration( + pezsp_consensus_aura::inherents::InherentDataProvider::from_timestamp_and_slot_duration( *timestamp, slot_duration, ); @@ -289,7 +296,7 @@ pub fn new_full< // need a keystore, regardless of which protocol we use below. let keystore = if role.is_authority() { Some(keystore_container.keystore()) } else { None }; - let grandpa_config = sc_consensus_grandpa::Config { + let grandpa_config = pezsc_consensus_grandpa::Config { // FIXME #1578 make this available through chainspec gossip_duration: Duration::from_millis(333), justification_generation_period: GRANDPA_JUSTIFICATION_PERIOD, @@ -307,13 +314,13 @@ pub fn new_full< // and vote data availability than the observer. The observer has not // been tested extensively yet and having most nodes in a network run it // could lead to finality stalls. - let grandpa_config = sc_consensus_grandpa::GrandpaParams { + let grandpa_config = pezsc_consensus_grandpa::GrandpaParams { config: grandpa_config, link: grandpa_link, network, sync: Arc::new(sync_service), notification_service: grandpa_notification_service, - voting_rule: sc_consensus_grandpa::VotingRulesBuilder::default().build(), + voting_rule: pezsc_consensus_grandpa::VotingRulesBuilder::default().build(), prometheus_registry, shared_voter_state: SharedVoterState::empty(), telemetry: telemetry.as_ref().map(|x| x.handle()), @@ -325,7 +332,7 @@ pub fn new_full< task_manager.spawn_essential_handle().spawn_blocking( "grandpa-voter", None, - sc_consensus_grandpa::run_grandpa_voter(grandpa_config)?, + pezsc_consensus_grandpa::run_grandpa_voter(grandpa_config)?, ); } diff --git a/pallets/template/Cargo.toml b/pallets/template/Cargo.toml index 78906cf..135d325 100644 --- a/pallets/template/Cargo.toml +++ b/pallets/template/Cargo.toml @@ -1,46 +1,56 @@ [package] -name = "pallet-template" -description = "FRAME pallet template for defining custom runtime logic." -version = "0.1.0" +name = "pezpallet-template" +description = "FRAME pezpallet template for defining custom runtime logic." +version = "0.0.0" license = "Unlicense" authors.workspace = true homepage.workspace = true repository.workspace = true edition.workspace = true publish = false +documentation = "https://docs.rs/pezpallet-template" [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-support.workspace = true -frame-system.workspace = true scale-info = { features = ["derive"], workspace = true } +# frame deps +pezframe-benchmarking = { optional = true, workspace = true } +pezframe-support = { workspace = true } +pezframe-system = { workspace = true } + [dev-dependencies] -sp-core = { default-features = true, workspace = true } -sp-io = { default-features = true, workspace = true } -sp-runtime = { default-features = true, workspace = true } +pezsp-core = { workspace = true, default-features = true } +pezsp-io = { workspace = true, default-features = true } +pezsp-runtime = { workspace = true, default-features = true } [features] default = ["std"] std = [ "codec/std", - "frame-benchmarking?/std", - "frame-support/std", - "frame-system/std", + "pezframe-benchmarking?/std", + "pezframe-support/std", + "pezframe-system/std", + "pezsp-core/std", + "pezsp-io/std", + "pezsp-runtime/std", "scale-info/std", ] runtime-benchmarks = [ - "frame-benchmarking/runtime-benchmarks", - "frame-support/runtime-benchmarks", - "frame-system/runtime-benchmarks", - "sp-runtime/runtime-benchmarks", + "pezframe-benchmarking/runtime-benchmarks", + "pezframe-support/runtime-benchmarks", + "pezframe-system/runtime-benchmarks", + "pezsp-io/runtime-benchmarks", + "pezsp-runtime/runtime-benchmarks", ] try-runtime = [ - "frame-support/try-runtime", - "frame-system/try-runtime", - "sp-runtime/try-runtime", + "pezframe-support/try-runtime", + "pezframe-system/try-runtime", + "pezsp-runtime/try-runtime", ] diff --git a/pallets/template/src/benchmarking.rs b/pallets/template/src/benchmarking.rs index 8af5d24..ecae03b 100644 --- a/pallets/template/src/benchmarking.rs +++ b/pallets/template/src/benchmarking.rs @@ -1,11 +1,11 @@ -//! Benchmarking setup for pallet-template +//! Benchmarking setup for pezpallet-template use super::*; #[allow(unused)] -use crate::Pallet as Template; -use frame_benchmarking::v2::*; -use frame_system::RawOrigin; +use crate::Pezpallet as Template; +use pezframe_benchmarking::v2::*; +use pezframe_system::RawOrigin; #[benchmarks] mod benchmarks { diff --git a/pallets/template/src/lib.rs b/pallets/template/src/lib.rs index 90dfe37..068f989 100644 --- a/pallets/template/src/lib.rs +++ b/pallets/template/src/lib.rs @@ -1,12 +1,13 @@ -//! # Template Pallet +//! # Template Pezpallet //! -//! A pallet with minimal functionality to help developers understand the essential components of -//! writing a FRAME pallet. It is typically used in beginner tutorials or in Substrate template -//! nodes as a starting point for creating a new pallet and **not meant to be used in production**. +//! A pezpallet with minimal functionality to help developers understand the essential components of +//! writing a FRAME pezpallet. It is typically used in beginner tutorials or in Bizinikiwi template +//! nodes as a starting point for creating a new pezpallet and **not meant to be used in +//! production**. //! //! ## Overview //! -//! This template pallet contains basic examples of: +//! This template pezpallet contains basic examples of: //! - declaring a storage item that stores a single `u32` value //! - declaring and using events //! - declaring and using errors @@ -14,97 +15,102 @@ //! upon success //! - another dispatchable function that causes a custom error to be thrown //! -//! Each pallet section is annotated with an attribute using the `#[pallet::...]` procedural macro. -//! This macro generates the necessary code for a pallet to be aggregated into a FRAME runtime. +//! Each pezpallet section is annotated with an attribute using the `#[pezpallet::...]` procedural +//! macro. This macro generates the necessary code for a pezpallet to be aggregated into a FRAME +//! runtime. //! -//! Learn more about FRAME macros [here](https://docs.substrate.io/reference/frame-macros/). +//! Learn more about FRAME macros [here](https://docs.pezkuwichain.io/reference/frame-macros/). //! -//! ### Pallet Sections +//! ### Pezpallet Sections //! -//! The pallet sections in this template are: +//! The pezpallet sections in this template are: //! -//! - A **configuration trait** that defines the types and parameters which the pallet depends on -//! (denoted by the `#[pallet::config]` attribute). See: [`Config`]. -//! - A **means to store pallet-specific data** (denoted by the `#[pallet::storage]` attribute). -//! See: [`storage_types`]. -//! - A **declaration of the events** this pallet emits (denoted by the `#[pallet::event]` +//! - A **configuration trait** that defines the types and parameters which the pezpallet depends on +//! (denoted by the `#[pezpallet::config]` attribute). See: [`Config`]. +//! - A **means to store pezpallet-specific data** (denoted by the `#[pezpallet::storage]` +//! attribute). See: [`storage_types`]. +//! - A **declaration of the events** this pezpallet emits (denoted by the `#[pezpallet::event]` //! attribute). See: [`Event`]. -//! - A **declaration of the errors** that this pallet can throw (denoted by the `#[pallet::error]` -//! attribute). See: [`Error`]. -//! - A **set of dispatchable functions** that define the pallet's functionality (denoted by the -//! `#[pallet::call]` attribute). See: [`dispatchables`]. +//! - A **declaration of the errors** that this pezpallet can throw (denoted by the +//! `#[pezpallet::error]` attribute). See: [`Error`]. +//! - A **set of dispatchable functions** that define the pezpallet's functionality (denoted by the +//! `#[pezpallet::call]` attribute). See: [`dispatchables`]. //! -//! Run `cargo doc --package pallet-template --open` to view this pallet's documentation. +//! Run `cargo doc --package pezpallet-template --open` to view this pezpallet's documentation. -// We make sure this pallet uses `no_std` for compiling to Wasm. +// We make sure this pezpallet uses `no_std` for compiling to Wasm. #![cfg_attr(not(feature = "std"), no_std)] -// Re-export pallet items so that they can be accessed from the crate namespace. -pub use pallet::*; +// Re-export pezpallet items so that they can be accessed from the crate namespace. +pub use pezpallet::*; // FRAME pallets require their own "mock runtimes" to be able to run unit tests. This module -// contains a mock runtime specific for testing this pallet's functionality. +// contains a mock runtime specific for testing this pezpallet's functionality. #[cfg(test)] mod mock; -// This module contains the unit tests for this pallet. -// Learn about pallet unit testing here: https://docs.substrate.io/test/unit-testing/ +// This module contains the unit tests for this pezpallet. +// Learn about pezpallet unit testing here: https://docs.pezkuwichain.io/test/unit-testing/ #[cfg(test)] mod tests; -// Every callable function or "dispatchable" a pallet exposes must have weight values that correctly -// estimate a dispatchable's execution time. The benchmarking module is used to calculate weights -// for each dispatchable and generates this pallet's weight.rs file. Learn more about benchmarking here: https://docs.substrate.io/test/benchmark/ +// Every callable function or "dispatchable" a pezpallet exposes must have weight values that +// correctly estimate a dispatchable's execution time. The benchmarking module is used to calculate +// weights for each dispatchable and generates this pezpallet's weight.rs file. Learn more about benchmarking here: https://docs.pezkuwichain.io/test/benchmark/ #[cfg(feature = "runtime-benchmarks")] mod benchmarking; pub mod weights; pub use weights::*; -// All pallet logic is defined in its own module and must be annotated by the `pallet` attribute. -#[frame_support::pallet] -pub mod pallet { +// All pezpallet logic is defined in its own module and must be annotated by the `pezpallet` +// attribute. +#[pezframe_support::pezpallet] +pub mod pezpallet { // Import various useful types required by all FRAME pallets. use super::*; - use frame_support::pallet_prelude::*; - use frame_system::pallet_prelude::*; + use pezframe_support::pezpallet_prelude::*; + use pezframe_system::pezpallet_prelude::*; - // The `Pallet` struct serves as a placeholder to implement traits, methods and dispatchables - // (`Call`s) in this pallet. - #[pallet::pallet] - pub struct Pallet(_); + // The `Pezpallet` struct serves as a placeholder to implement traits, methods and dispatchables + // (`Call`s) in this pezpallet. + #[pezpallet::pezpallet] + pub struct Pezpallet(_); - /// The pallet's configuration trait. + /// The pezpallet's configuration trait. /// - /// All our types and constants a pallet depends on must be declared here. - /// These types are defined generically and made concrete when the pallet is declared in the + /// All our types and constants a pezpallet depends on must be declared here. + /// These types are defined generically and made concrete when the pezpallet is declared in the /// `runtime/src/lib.rs` file of your chain. - #[pallet::config] - pub trait Config: frame_system::Config { + #[pezpallet::config] + pub trait Config: pezframe_system::Config { /// The overarching runtime event type. - type RuntimeEvent: From> + IsType<::RuntimeEvent>; - /// A type representing the weights required by the dispatchables of this pallet. + #[allow(deprecated)] + type RuntimeEvent: From> + + IsType<::RuntimeEvent>; + /// A type representing the weights required by the dispatchables of this pezpallet. type WeightInfo: WeightInfo; } - /// A storage item for this pallet. + /// A storage item for this pezpallet. /// /// In this template, we are declaring a storage item called `Something` that stores a single - /// `u32` value. Learn more about runtime storage here: - #[pallet::storage] + /// `u32` value. Learn more about runtime storage here: + #[pezpallet::storage] pub type Something = StorageValue<_, u32>; - /// Events that functions in this pallet can emit. + /// Events that functions in this pezpallet can emit. /// /// Events are a simple means of indicating to the outside world (such as dApps, chain explorers - /// or other users) that some notable update in the runtime has occurred. In a FRAME pallet, the - /// documentation for each event field and its parameters is added to a node's metadata so it - /// can be used by external interfaces or tools. + /// or other users) that some notable update in the runtime has occurred. In a FRAME pezpallet, + /// the documentation for each event field and its parameters is added to a node's metadata so + /// it can be used by external interfaces or tools. /// - /// The `generate_deposit` macro generates a function on `Pallet` called `deposit_event` which - /// will convert the event type of your pallet into `RuntimeEvent` (declared in the pallet's - /// [`Config`] trait) and deposit it using [`frame_system::Pallet::deposit_event`]. - #[pallet::event] - #[pallet::generate_deposit(pub(super) fn deposit_event)] + /// The `generate_deposit` macro generates a function on `Pezpallet` called `deposit_event` + /// which will convert the event type of your pezpallet into `RuntimeEvent` (declared in the + /// pezpallet's [`Config`] trait) and deposit it using + /// [`pezframe_system::Pezpallet::deposit_event`]. + #[pezpallet::event] + #[pezpallet::generate_deposit(pub(super) fn deposit_event)] pub enum Event { /// A user has successfully set a new value. SomethingStored { @@ -115,7 +121,7 @@ pub mod pallet { }, } - /// Errors that can be returned by this pallet. + /// Errors that can be returned by this pezpallet. /// /// Errors tell users that something went wrong so it's important that their naming is /// informative. Similar to events, error documentation is added to a node's metadata so it's @@ -123,7 +129,7 @@ pub mod pallet { /// /// This type of runtime error can be up to 4 bytes in size should you want to return additional /// information. - #[pallet::error] + #[pezpallet::error] pub enum Error { /// The value retrieved was `None` as no value was previously set. NoneValue, @@ -131,9 +137,9 @@ pub mod pallet { StorageOverflow, } - /// The pallet's dispatchable functions ([`Call`]s). + /// The pezpallet's dispatchable functions ([`Call`]s). /// - /// Dispatchable functions allows users to interact with the pallet and invoke state changes. + /// Dispatchable functions allows users to interact with the pezpallet and invoke state changes. /// These functions materialize as "extrinsics", which are often compared to transactions. /// They must always return a `DispatchResult` and be annotated with a weight and call index. /// @@ -143,15 +149,15 @@ pub mod pallet { /// will also change which will break backwards compatibility. /// /// The [`weight`] macro is used to assign a weight to each call. - #[pallet::call] - impl Pallet { + #[pezpallet::call] + impl Pezpallet { /// An example dispatchable that takes a single u32 value as a parameter, writes the value /// to storage and emits an event. /// /// It checks that the _origin_ for this call is _Signed_ and returns a dispatch - /// error if it isn't. Learn more about origins here: - #[pallet::call_index(0)] - #[pallet::weight(T::WeightInfo::do_something())] + /// error if it isn't. Learn more about origins here: + #[pezpallet::call_index(0)] + #[pezpallet::weight(T::WeightInfo::do_something())] pub fn do_something(origin: OriginFor, something: u32) -> DispatchResult { // Check that the extrinsic was signed and get the signer. let who = ensure_signed(origin)?; @@ -179,8 +185,8 @@ pub mod pallet { /// - If no value has been set ([`Error::NoneValue`]) /// - If incrementing the value in storage causes an arithmetic overflow /// ([`Error::StorageOverflow`]) - #[pallet::call_index(1)] - #[pallet::weight(T::WeightInfo::cause_error())] + #[pezpallet::call_index(1)] + #[pezpallet::weight(T::WeightInfo::cause_error())] pub fn cause_error(origin: OriginFor) -> DispatchResult { let _who = ensure_signed(origin)?; diff --git a/pallets/template/src/mock.rs b/pallets/template/src/mock.rs index 44085bc..dca5044 100644 --- a/pallets/template/src/mock.rs +++ b/pallets/template/src/mock.rs @@ -1,10 +1,10 @@ -use crate as pallet_template; -use frame_support::derive_impl; -use sp_runtime::BuildStorage; +use crate as pezpallet_template; +use pezframe_support::derive_impl; +use pezsp_runtime::BuildStorage; -type Block = frame_system::mocking::MockBlock; +type Block = pezframe_system::mocking::MockBlock; -#[frame_support::runtime] +#[pezframe_support::runtime] mod runtime { // The main runtime #[runtime::runtime] @@ -23,24 +23,27 @@ mod runtime { )] pub struct Test; - #[runtime::pallet_index(0)] - pub type System = frame_system::Pallet; + #[runtime::pezpallet_index(0)] + pub type System = pezframe_system::Pezpallet; - #[runtime::pallet_index(1)] - pub type Template = pallet_template::Pallet; + #[runtime::pezpallet_index(1)] + pub type Template = pezpallet_template::Pezpallet; } -#[derive_impl(frame_system::config_preludes::TestDefaultConfig)] -impl frame_system::Config for Test { +#[derive_impl(pezframe_system::config_preludes::TestDefaultConfig)] +impl pezframe_system::Config for Test { type Block = Block; } -impl pallet_template::Config for Test { +impl pezpallet_template::Config for Test { type RuntimeEvent = RuntimeEvent; type WeightInfo = (); } // Build genesis storage according to the mock runtime. -pub fn new_test_ext() -> sp_io::TestExternalities { - frame_system::GenesisConfig::::default().build_storage().unwrap().into() +pub fn new_test_ext() -> pezsp_io::TestExternalities { + pezframe_system::GenesisConfig::::default() + .build_storage() + .unwrap() + .into() } diff --git a/pallets/template/src/tests.rs b/pallets/template/src/tests.rs index d05433c..0ab6549 100644 --- a/pallets/template/src/tests.rs +++ b/pallets/template/src/tests.rs @@ -1,5 +1,5 @@ use crate::{mock::*, Error, Event, Something}; -use frame_support::{assert_noop, assert_ok}; +use pezframe_support::{assert_noop, assert_ok}; #[test] fn it_works_for_default_value() { @@ -8,7 +8,7 @@ fn it_works_for_default_value() { System::set_block_number(1); // Dispatch a signed extrinsic. assert_ok!(Template::do_something(RuntimeOrigin::signed(1), 42)); - // Read pallet storage and assert an expected result. + // Read pezpallet storage and assert an expected result. assert_eq!(Something::::get(), Some(42)); // Assert that the correct event was deposited System::assert_last_event(Event::SomethingStored { something: 42, who: 1 }.into()); diff --git a/pallets/template/src/weights.rs b/pallets/template/src/weights.rs index c2879fa..4b83f62 100644 --- a/pallets/template/src/weights.rs +++ b/pallets/template/src/weights.rs @@ -1,7 +1,7 @@ -//! Autogenerated weights for pallet_template +//! Autogenerated weights for pezpallet_template //! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! THIS FILE WAS AUTO-GENERATED USING THE BIZINIKIWI BENCHMARK CLI VERSION 4.0.0-dev //! DATE: 2023-04-06, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! HOSTNAME: `Alexs-MacBook-Pro-2.local`, CPU: `` @@ -10,11 +10,11 @@ // Executed Command: // ../../target/release/node-template // benchmark -// pallet +// pezpallet // --chain // dev -// --pallet -// pallet_template +// --pezpallet +// pezpallet_template // --extrinsic // * // --steps=50 @@ -29,18 +29,18 @@ #![allow(unused_parens)] #![allow(unused_imports)] -use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; +use pezframe_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; use core::marker::PhantomData; -/// Weight functions needed for pallet_template. +/// Weight functions needed for pezpallet_template. pub trait WeightInfo { fn do_something() -> Weight; fn cause_error() -> Weight; } -/// Weights for pallet_template using the Substrate node and recommended hardware. -pub struct SubstrateWeight(PhantomData); -impl WeightInfo for SubstrateWeight { +/// Weights for pezpallet_template using the Bizinikiwi node and recommended hardware. +pub struct BizinikiwiWeight(PhantomData); +impl WeightInfo for BizinikiwiWeight { /// Storage: Template Something (r:0 w:1) /// Proof: Template Something (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) fn do_something() -> Weight { diff --git a/runtime/Cargo.toml b/runtime/Cargo.toml index b10319c..51d5aa4 100644 --- a/runtime/Cargo.toml +++ b/runtime/Cargo.toml @@ -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"] diff --git a/runtime/build.rs b/runtime/build.rs index caac851..f74cde8 100644 --- a/runtime/build.rs +++ b/runtime/build.rs @@ -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 diff --git a/runtime/src/apis.rs b/runtime/src/apis.rs index 0288070..a20aa7a 100644 --- a/runtime/src/apis.rs +++ b/runtime/src/apis.rs @@ -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 for Runtime { + impl pezsp_api::Core for Runtime { fn version() -> RuntimeVersion { VERSION } - fn execute_block(block: Block) { + fn execute_block(block: ::LazyBlock) { Executive::execute_block(block); } - fn initialize_block(header: &::Header) -> sp_runtime::ExtrinsicInclusionMode { + fn initialize_block(header: &::Header) -> pezsp_runtime::ExtrinsicInclusionMode { Executive::initialize_block(header) } } - impl sp_api::Metadata for Runtime { + impl pezsp_api::Metadata 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 for Runtime { - fn execute_view_function(id: frame_support::view_functions::ViewFunctionId, input: Vec) -> Result, frame_support::view_functions::ViewFunctionDispatchError> { + impl pezframe_support::view_functions::runtime_api::RuntimeViewFunction for Runtime { + fn execute_view_function(id: pezframe_support::view_functions::ViewFunctionId, input: Vec) -> Result, pezframe_support::view_functions::ViewFunctionDispatchError> { Runtime::execute_view_function(id, input) } } - impl sp_block_builder::BlockBuilder for Runtime { + impl pezsp_block_builder::BlockBuilder for Runtime { fn apply_extrinsic(extrinsic: ::Extrinsic) -> ApplyExtrinsicResult { Executive::apply_extrinsic(extrinsic) } @@ -90,19 +90,19 @@ impl_runtime_apis! { Executive::finalize_block() } - fn inherent_extrinsics(data: sp_inherents::InherentData) -> Vec<::Extrinsic> { + fn inherent_extrinsics(data: pezsp_inherents::InherentData) -> Vec<::Extrinsic> { data.create_extrinsics() } fn check_inherents( - block: Block, - data: sp_inherents::InherentData, - ) -> sp_inherents::CheckInherentsResult { + block: ::LazyBlock, + data: pezsp_inherents::InherentData, + ) -> pezsp_inherents::CheckInherentsResult { data.check_extrinsics(&block) } } - impl sp_transaction_pool::runtime_api::TaggedTransactionQueue for Runtime { + impl pezsp_transaction_pool::runtime_api::TaggedTransactionQueue for Runtime { fn validate_transaction( source: TransactionSource, tx: ::Extrinsic, @@ -112,23 +112,23 @@ impl_runtime_apis! { } } - impl sp_offchain::OffchainWorkerApi for Runtime { + impl pezsp_offchain::OffchainWorkerApi for Runtime { fn offchain_worker(header: &::Header) { Executive::offchain_worker(header) } } - impl sp_consensus_aura::AuraApi for Runtime { - fn slot_duration() -> sp_consensus_aura::SlotDuration { - sp_consensus_aura::SlotDuration::from_millis(Aura::slot_duration()) + impl pezsp_consensus_aura::AuraApi for Runtime { + fn slot_duration() -> pezsp_consensus_aura::SlotDuration { + pezsp_consensus_aura::SlotDuration::from_millis(Aura::slot_duration()) } fn authorities() -> Vec { - pallet_aura::Authorities::::get().into_inner() + pezpallet_aura::Authorities::::get().into_inner() } } - impl sp_session::SessionKeys for Runtime { + impl pezsp_session::SessionKeys for Runtime { fn generate_session_keys(seed: Option>) -> Vec { SessionKeys::generate(seed) } @@ -140,29 +140,29 @@ impl_runtime_apis! { } } - impl sp_consensus_grandpa::GrandpaApi for Runtime { - fn grandpa_authorities() -> sp_consensus_grandpa::AuthorityList { + impl pezsp_consensus_grandpa::GrandpaApi 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< ::Hash, NumberFor, >, - _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 { + ) -> Option { // 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 for Runtime { + impl pezframe_system_rpc_runtime_api::AccountNonceApi for Runtime { fn account_nonce(account: AccountId) -> Nonce { System::account_nonce(account) } } - impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi for Runtime { + impl pezpallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi for Runtime { fn query_info( uxt: ::Extrinsic, len: u32, - ) -> pallet_transaction_payment_rpc_runtime_api::RuntimeDispatchInfo { + ) -> pezpallet_transaction_payment_rpc_runtime_api::RuntimeDispatchInfo { TransactionPayment::query_info(uxt, len) } fn query_fee_details( uxt: ::Extrinsic, len: u32, - ) -> pallet_transaction_payment::FeeDetails { + ) -> pezpallet_transaction_payment::FeeDetails { 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 + impl pezpallet_transaction_payment_rpc_runtime_api::TransactionPaymentCallApi for Runtime { fn query_call_info( call: RuntimeCall, len: u32, - ) -> pallet_transaction_payment::RuntimeDispatchInfo { + ) -> pezpallet_transaction_payment::RuntimeDispatchInfo { TransactionPayment::query_call_info(call, len) } fn query_call_fee_details( call: RuntimeCall, len: u32, - ) -> pallet_transaction_payment::FeeDetails { + ) -> pezpallet_transaction_payment::FeeDetails { 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 for Runtime { + impl pezframe_benchmarking::Benchmark for Runtime { fn benchmark_metadata(extra: bool) -> ( - Vec, - Vec, + Vec, + Vec, ) { - 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::::new(); @@ -243,19 +243,19 @@ impl_runtime_apis! { #[allow(non_local_definitions)] fn dispatch_benchmark( - config: frame_benchmarking::BenchmarkConfig - ) -> Result, 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, 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 = AllPalletsWithSystem::whitelisted_storage_keys(); let mut batches = Vec::::new(); @@ -267,8 +267,8 @@ impl_runtime_apis! { } #[cfg(feature = "try-runtime")] - impl frame_try_runtime::TryRuntime for Runtime { - fn on_runtime_upgrade(checks: frame_try_runtime::UpgradeCheckSelect) -> (Weight, Weight) { + impl pezframe_try_runtime::TryRuntime 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: ::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 for Runtime { - fn build_state(config: Vec) -> sp_genesis_builder::Result { + impl pezsp_genesis_builder::GenesisBuilder for Runtime { + fn build_state(config: Vec) -> pezsp_genesis_builder::Result { build_state::(config) } - fn get_preset(id: &Option) -> Option> { + fn get_preset(id: &Option) -> Option> { get_preset::(id, crate::genesis_config_presets::get_preset) } - fn preset_names() -> Vec { + fn preset_names() -> Vec { crate::genesis_config_presets::preset_names() } } diff --git a/runtime/src/benchmarks.rs b/runtime/src/benchmarks.rs index 59012e0..1eb6a7d 100644 --- a/runtime/src/benchmarks.rs +++ b/runtime/src/benchmarks.rs @@ -23,12 +23,12 @@ // // For more information, please refer to -frame_benchmarking::define_benchmarks!( - [frame_benchmarking, BaselineBench::] - [frame_system, SystemBench::] - [frame_system_extensions, SystemExtensionsBench::] - [pallet_balances, Balances] - [pallet_timestamp, Timestamp] - [pallet_sudo, Sudo] - [pallet_template, Template] +pezframe_benchmarking::define_benchmarks!( + [pezframe_benchmarking, BaselineBench::] + [pezframe_system, SystemBench::] + [pezframe_system_extensions, SystemExtensionsBench::] + [pezpallet_balances, Balances] + [pezpallet_timestamp, Timestamp] + [pezpallet_sudo, Sudo] + [pezpallet_template, Template] ); diff --git a/runtime/src/configs/mod.rs b/runtime/src/configs/mod.rs index e34b3cb..9ade966 100644 --- a/runtime/src/configs/mod.rs +++ b/runtime/src/configs/mod.rs @@ -23,8 +23,8 @@ // // For more information, please refer to -// 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; - /// This is used as an identifier of the chain. 42 is the generic substrate prefix. + type AccountData = pezpallet_balances::AccountData; + /// 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; - type SlotDuration = pallet_aura::MinimumPeriodTimesTwo; + type SlotDuration = pezpallet_aura::MinimumPeriodTimesTwo; } -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; type AccountStore = System; - type WeightInfo = pallet_balances::weights::SubstrateWeight; + type WeightInfo = pezpallet_balances::weights::BizinikiwiWeight; type FreezeIdentifier = RuntimeFreezeReason; type MaxFreezes = VariantCountOf; 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; type OperationalFeeMultiplier = ConstU8<5>; type WeightToFee = IdentityFee; type LengthToFee = IdentityFee; type FeeMultiplierUpdate = ConstFeeMultiplier; - type WeightInfo = pallet_transaction_payment::weights::SubstrateWeight; + type WeightInfo = pezpallet_transaction_payment::weights::BizinikiwiWeight; } -impl pallet_sudo::Config for Runtime { +impl pezpallet_sudo::Config for Runtime { type RuntimeEvent = RuntimeEvent; type RuntimeCall = RuntimeCall; - type WeightInfo = pallet_sudo::weights::SubstrateWeight; + type WeightInfo = pezpallet_sudo::weights::BizinikiwiWeight; } -/// 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; + type WeightInfo = pezpallet_template::weights::BizinikiwiWeight; } diff --git a/runtime/src/genesis_config_presets.rs b/runtime/src/genesis_config_presets.rs index 6af8dc9..34f804e 100644 --- a/runtime/src/genesis_config_presets.rs +++ b/runtime/src/genesis_config_presets.rs @@ -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::>(), }, - aura: pallet_aura::GenesisConfig { - authorities: initial_authorities.iter().map(|x| (x.0.clone())).collect::>(), + aura: pezpallet_aura::GenesisConfig { + authorities: initial_authorities.iter().map(|x| x.0.clone()).collect::>(), }, - grandpa: pallet_grandpa::GenesisConfig { + grandpa: pezpallet_grandpa::GenesisConfig { authorities: initial_authorities.iter().map(|x| (x.1.clone(), 1)).collect::>(), }, 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> { 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> { /// List of supported presets. pub fn preset_names() -> Vec { 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), ] } diff --git a/runtime/src/lib.rs b/runtime/src/lib.rs index f25b841..8917d93 100644 --- a/runtime/src/lib.rs +++ b/runtime/src/lib.rs @@ -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; @@ -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; /// The `TransactionExtension` to the basic transaction logic. pub type TxExtension = ( - frame_system::CheckNonZeroSender, - frame_system::CheckSpecVersion, - frame_system::CheckTxVersion, - frame_system::CheckGenesis, - frame_system::CheckEra, - frame_system::CheckNonce, - frame_system::CheckWeight, - pallet_transaction_payment::ChargeTransactionPayment, - frame_metadata_hash_extension::CheckMetadataHash, - frame_system::WeightReclaim, + pezframe_system::AuthorizeCall, + pezframe_system::CheckNonZeroSender, + pezframe_system::CheckSpecVersion, + pezframe_system::CheckTxVersion, + pezframe_system::CheckGenesis, + pezframe_system::CheckEra, + pezframe_system::CheckNonce, + pezframe_system::CheckWeight, + pezpallet_transaction_payment::ChargeTransactionPayment, + pezframe_metadata_hash_extension::CheckMetadataHash, + pezframe_system::WeightReclaim, ); /// 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; -/// 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, + pezframe_system::ChainContext, 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; }