From 30bb7bdae4eabd28789b17e4d8af2c0b9020636b Mon Sep 17 00:00:00 2001
From: alexd10s <alexfraga10@gmail.com>
Date: Thu, 6 Apr 2023 17:19:46 +0100
Subject: [PATCH] Update the frame-weight-template to use PhantomData from core
 (#13844)

* update weights template and recalculate weights from pallet template

* update template file in benchmarking-cli
---
 .maintain/frame-weight-template.hbs                  |  2 +-
 Cargo.lock                                           |  1 -
 bin/node-template/pallets/template/Cargo.toml        |  1 -
 bin/node-template/pallets/template/src/weights.rs    | 12 ++++++------
 utils/frame/benchmarking-cli/src/pallet/template.hbs |  2 +-
 5 files changed, 8 insertions(+), 10 deletions(-)

diff --git a/.maintain/frame-weight-template.hbs b/.maintain/frame-weight-template.hbs
index ba9ac0798844d..0df6bef5d3bee 100644
--- a/.maintain/frame-weight-template.hbs
+++ b/.maintain/frame-weight-template.hbs
@@ -17,7 +17,7 @@
 #![allow(unused_imports)]
 
 use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};
-use sp_std::marker::PhantomData;
+use core::marker::PhantomData;
 
 /// Weight functions needed for {{pallet}}.
 pub trait WeightInfo {
diff --git a/Cargo.lock b/Cargo.lock
index 525f40cedc8db..d4185103f8c96 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -6864,7 +6864,6 @@ dependencies = [
  "sp-core",
  "sp-io",
  "sp-runtime",
- "sp-std",
 ]
 
 [[package]]
diff --git a/bin/node-template/pallets/template/Cargo.toml b/bin/node-template/pallets/template/Cargo.toml
index 818dc0bbc8c3c..ddf7c6e52fb2f 100644
--- a/bin/node-template/pallets/template/Cargo.toml
+++ b/bin/node-template/pallets/template/Cargo.toml
@@ -20,7 +20,6 @@ scale-info = { version = "2.1.1", default-features = false, features = ["derive"
 frame-benchmarking = { version = "4.0.0-dev", default-features = false, optional = true, path = "../../../../frame/benchmarking" }
 frame-support = { version = "4.0.0-dev", default-features = false, path = "../../../../frame/support" }
 frame-system = { version = "4.0.0-dev", default-features = false, path = "../../../../frame/system" }
-sp-std = { version = "5.0.0", default-features = false, path = "../../../../primitives/std" }
 
 [dev-dependencies]
 sp-core = { version = "7.0.0", path = "../../../../primitives/core" }
diff --git a/bin/node-template/pallets/template/src/weights.rs b/bin/node-template/pallets/template/src/weights.rs
index 952aba49bb3d4..e8fbc09bad8e9 100644
--- a/bin/node-template/pallets/template/src/weights.rs
+++ b/bin/node-template/pallets/template/src/weights.rs
@@ -2,7 +2,7 @@
 //! Autogenerated weights for pallet_template
 //!
 //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
-//! DATE: 2023-04-05, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
+//! DATE: 2023-04-06, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
 //! WORST CASE MAP SIZE: `1000000`
 //! HOSTNAME: `Alexs-MacBook-Pro-2.local`, CPU: `<UNKNOWN>`
 //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024
@@ -31,7 +31,7 @@
 #![allow(unused_imports)]
 
 use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};
-use sp_std::marker::PhantomData;
+use core::marker::PhantomData;
 
 /// Weight functions needed for pallet_template.
 pub trait WeightInfo {
@@ -49,7 +49,7 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
 		//  Measured:  `0`
 		//  Estimated: `0`
 		// Minimum execution time: 8_000_000 picoseconds.
-		Weight::from_parts(8_000_000, 0)
+		Weight::from_parts(9_000_000, 0)
 			.saturating_add(T::DbWeight::get().writes(1_u64))
 	}
 	/// Storage: TemplateModule Something (r:1 w:1)
@@ -58,7 +58,7 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
 		// Proof Size summary in bytes:
 		//  Measured:  `32`
 		//  Estimated: `1489`
-		// Minimum execution time: 5_000_000 picoseconds.
+		// Minimum execution time: 6_000_000 picoseconds.
 		Weight::from_parts(6_000_000, 1489)
 			.saturating_add(T::DbWeight::get().reads(1_u64))
 			.saturating_add(T::DbWeight::get().writes(1_u64))
@@ -74,7 +74,7 @@ impl WeightInfo for () {
 		//  Measured:  `0`
 		//  Estimated: `0`
 		// Minimum execution time: 8_000_000 picoseconds.
-		Weight::from_parts(8_000_000, 0)
+		Weight::from_parts(9_000_000, 0)
 			.saturating_add(RocksDbWeight::get().writes(1_u64))
 	}
 	/// Storage: TemplateModule Something (r:1 w:1)
@@ -83,7 +83,7 @@ impl WeightInfo for () {
 		// Proof Size summary in bytes:
 		//  Measured:  `32`
 		//  Estimated: `1489`
-		// Minimum execution time: 5_000_000 picoseconds.
+		// Minimum execution time: 6_000_000 picoseconds.
 		Weight::from_parts(6_000_000, 1489)
 			.saturating_add(RocksDbWeight::get().reads(1_u64))
 			.saturating_add(RocksDbWeight::get().writes(1_u64))
diff --git a/utils/frame/benchmarking-cli/src/pallet/template.hbs b/utils/frame/benchmarking-cli/src/pallet/template.hbs
index 88d6b69a6c339..f852e773ce7d7 100644
--- a/utils/frame/benchmarking-cli/src/pallet/template.hbs
+++ b/utils/frame/benchmarking-cli/src/pallet/template.hbs
@@ -17,7 +17,7 @@
 #![allow(unused_imports)]
 
 use frame_support::{traits::Get, weights::Weight};
-use sp_std::marker::PhantomData;
+use core::marker::PhantomData;
 
 /// Weight functions for `{{pallet}}`.
 pub struct WeightInfo<T>(PhantomData<T>);