From 97984e44bbb70c1da3a10d75893cda3bc4fd9111 Mon Sep 17 00:00:00 2001 From: Oliver Tale-Yazdi Date: Mon, 8 May 2023 17:20:20 +0200 Subject: [PATCH] Prevent name clash with Substrate Pallet Template (#2536) * Remove cumulus template pallet Signed-off-by: Oliver Tale-Yazdi * Use substrate template pallet Signed-off-by: Oliver Tale-Yazdi * Update Cargo.lock Signed-off-by: Oliver Tale-Yazdi * Revert back to master Revert "Remove cumulus template pallet" This reverts commit a6d3566e52e9124c0e9823c12cacea557187c6b4. Revert "Use substrate template pallet" This reverts commit fbb8eea28dec5b75e13823762572d24bd9a4b88f. Revert "Update Cargo.lock" This reverts commit ee24cb81e5d91d6b8f7ef0c97d0f0fdbfe857c53. Signed-off-by: Oliver Tale-Yazdi * pallet-template -> pallet-parachain-template Signed-off-by: Oliver Tale-Yazdi * Update Cargo.lock Signed-off-by: Oliver Tale-Yazdi --------- Signed-off-by: Oliver Tale-Yazdi --- Cargo.lock | 32 +++++++++---------- .../pallets/template/Cargo.toml | 2 +- .../pallets/template/src/benchmarking.rs | 2 +- .../pallets/template/src/mock.rs | 5 ++- parachain-template/runtime/Cargo.toml | 8 ++--- parachain-template/runtime/src/lib.rs | 6 ++-- 6 files changed, 27 insertions(+), 28 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d46e0c7600..9358d81a03 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -7339,6 +7339,21 @@ dependencies = [ "sp-std", ] +[[package]] +name = "pallet-parachain-template" +version = "0.1.0" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "parity-scale-codec", + "scale-info", + "serde", + "sp-core", + "sp-io", + "sp-runtime", +] + [[package]] name = "pallet-preimage" version = "4.0.0-dev" @@ -7574,21 +7589,6 @@ dependencies = [ "sp-std", ] -[[package]] -name = "pallet-template" -version = "0.1.0" -dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", - "parity-scale-codec", - "scale-info", - "serde", - "sp-core", - "sp-io", - "sp-runtime", -] - [[package]] name = "pallet-timestamp" version = "4.0.0-dev" @@ -7879,9 +7879,9 @@ dependencies = [ "pallet-authorship", "pallet-balances", "pallet-collator-selection", + "pallet-parachain-template", "pallet-session", "pallet-sudo", - "pallet-template", "pallet-timestamp", "pallet-transaction-payment", "pallet-transaction-payment-rpc-runtime-api", diff --git a/parachain-template/pallets/template/Cargo.toml b/parachain-template/pallets/template/Cargo.toml index ca574f6c8d..f47d82c979 100644 --- a/parachain-template/pallets/template/Cargo.toml +++ b/parachain-template/pallets/template/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "pallet-template" +name = "pallet-parachain-template" authors = ["Anonymous"] description = "FRAME pallet template for defining custom runtime logic." version = "0.1.0" diff --git a/parachain-template/pallets/template/src/benchmarking.rs b/parachain-template/pallets/template/src/benchmarking.rs index fea9e65969..8bba2a0986 100644 --- a/parachain-template/pallets/template/src/benchmarking.rs +++ b/parachain-template/pallets/template/src/benchmarking.rs @@ -1,4 +1,4 @@ -//! Benchmarking setup for pallet-template +//! Benchmarking setup for pallet-parachain-template use super::*; diff --git a/parachain-template/pallets/template/src/mock.rs b/parachain-template/pallets/template/src/mock.rs index 4a7ebac0fa..099c0af8ac 100644 --- a/parachain-template/pallets/template/src/mock.rs +++ b/parachain-template/pallets/template/src/mock.rs @@ -1,4 +1,3 @@ -use crate as pallet_template; use frame_support::{parameter_types, traits::Everything}; use frame_system as system; use sp_core::H256; @@ -18,7 +17,7 @@ frame_support::construct_runtime!( UncheckedExtrinsic = UncheckedExtrinsic, { System: frame_system::{Pallet, Call, Config, Storage, Event}, - TemplateModule: pallet_template::{Pallet, Call, Storage, Event}, + TemplateModule: crate::{Pallet, Call, Storage, Event}, } ); @@ -54,7 +53,7 @@ impl system::Config for Test { type MaxConsumers = frame_support::traits::ConstU32<16>; } -impl pallet_template::Config for Test { +impl crate::Config for Test { type RuntimeEvent = RuntimeEvent; } diff --git a/parachain-template/runtime/Cargo.toml b/parachain-template/runtime/Cargo.toml index 81a4cf811a..fefaffb032 100644 --- a/parachain-template/runtime/Cargo.toml +++ b/parachain-template/runtime/Cargo.toml @@ -22,7 +22,7 @@ scale-info = { version = "2.6.0", default-features = false, features = ["derive" smallvec = "1.10.0" # Local -pallet-template = { path = "../pallets/template", default-features = false } +pallet-parachain-template = { path = "../pallets/template", default-features = false } # Substrate frame-benchmarking = { git = "https://github.com/paritytech/substrate", default-features = false, optional = true, branch = "master" } @@ -99,7 +99,7 @@ std = [ "pallet-collator-selection/std", "pallet-session/std", "pallet-sudo/std", - "pallet-template/std", + "pallet-parachain-template/std", "pallet-timestamp/std", "pallet-transaction-payment-rpc-runtime-api/std", "pallet-transaction-payment/std", @@ -132,7 +132,7 @@ runtime-benchmarks = [ "frame-system/runtime-benchmarks", "pallet-balances/runtime-benchmarks", "pallet-collator-selection/runtime-benchmarks", - "pallet-template/runtime-benchmarks", + "pallet-parachain-template/runtime-benchmarks", "pallet-timestamp/runtime-benchmarks", "pallet-xcm/runtime-benchmarks", "sp-runtime/runtime-benchmarks", @@ -156,7 +156,7 @@ try-runtime = [ "pallet-collator-selection/try-runtime", "pallet-session/try-runtime", "pallet-sudo/try-runtime", - "pallet-template/try-runtime", + "pallet-parachain-template/try-runtime", "pallet-timestamp/try-runtime", "pallet-transaction-payment/try-runtime", "pallet-xcm/try-runtime", diff --git a/parachain-template/runtime/src/lib.rs b/parachain-template/runtime/src/lib.rs index 3c24b39d64..7a847fc511 100644 --- a/parachain-template/runtime/src/lib.rs +++ b/parachain-template/runtime/src/lib.rs @@ -58,7 +58,7 @@ use xcm::latest::prelude::BodyId; use xcm_executor::XcmExecutor; /// Import the template pallet. -pub use pallet_template; +pub use pallet_parachain_template; /// Alias to 512-bit hash when used in the context of a transaction signature on the chain. pub type Signature = MultiSignature; @@ -457,7 +457,7 @@ impl pallet_collator_selection::Config for Runtime { } /// Configure the pallet template in pallets/template. -impl pallet_template::Config for Runtime { +impl pallet_parachain_template::Config for Runtime { type RuntimeEvent = RuntimeEvent; } @@ -492,7 +492,7 @@ construct_runtime!( DmpQueue: cumulus_pallet_dmp_queue = 33, // Template - TemplatePallet: pallet_template = 40, + TemplatePallet: pallet_parachain_template = 40, } );