From 5be26f766c1fa31bcedf4a08d3dbb66a4e44ab9d Mon Sep 17 00:00:00 2001
From: bgallois <benjamin@gallois.cc>
Date: Tue, 30 May 2023 20:53:54 +0200
Subject: [PATCH] wip fix runtime errors

---
 runtime/common/src/pallets_config.rs          |  38 ++--
 runtime/common/src/weights/block_weights.rs   |   8 +-
 .../common/src/weights/extrinsic_weights.rs   |   8 +-
 runtime/common/src/weights/pallet_babe.rs     |  15 +-
 runtime/common/src/weights/pallet_balances.rs | 178 +++++++++++-------
 runtime/common/src/weights/pallet_grandpa.rs  |  22 ++-
 .../common/src/weights/paritydb_weights.rs    |  12 +-
 runtime/g1/src/lib.rs                         |   4 +-
 runtime/g1/src/parameters.rs                  |   4 +-
 runtime/gdev/src/lib.rs                       |   6 +-
 runtime/gdev/src/parameters.rs                |   4 +-
 runtime/gtest/src/lib.rs                      |   4 +-
 runtime/gtest/src/parameters.rs               |   4 +-
 13 files changed, 177 insertions(+), 130 deletions(-)

diff --git a/runtime/common/src/pallets_config.rs b/runtime/common/src/pallets_config.rs
index f289dfac1..2d5fbf61e 100644
--- a/runtime/common/src/pallets_config.rs
+++ b/runtime/common/src/pallets_config.rs
@@ -119,20 +119,13 @@ macro_rules! pallets_config {
 
             type DisabledValidators = Session;
 
-            type KeyOwnerProofSystem = Historical;
-
-            type KeyOwnerProof = <Self::KeyOwnerProofSystem as KeyOwnerProofSystem<(
+            type KeyOwnerProof = <Historical as KeyOwnerProofSystem<(
                 KeyTypeId,
                 pallet_babe::AuthorityId,
             )>>::Proof;
 
-            type KeyOwnerIdentification = <Self::KeyOwnerProofSystem as KeyOwnerProofSystem<(
-                KeyTypeId,
-                pallet_babe::AuthorityId,
-            )>>::IdentificationTuple;
-
-            type HandleEquivocation =
-                pallet_babe::EquivocationHandler<Self::KeyOwnerIdentification, Offences, ReportLongevity>;
+            type EquivocationReportSystem =
+                pallet_babe::EquivocationReportSystem<Self, Offences, Historical, ReportLongevity>;
 
             type WeightInfo = common_runtime::weights::pallet_babe::WeightInfo<Runtime>;
 
@@ -154,9 +147,13 @@ macro_rules! pallets_config {
             type ReserveIdentifier = [u8; 8];
             /// The type for recording an account's balance.
             type Balance = Balance;
-            type DustRemoval = Treasury;
+            type DustRemoval = (); // TODO Treasury;
             type ExistentialDeposit = ExistentialDeposit;
             type AccountStore = Account;
+			type HoldIdentifier = ();
+			type FreezeIdentifier = ();
+			type MaxHolds = frame_support::pallet_prelude::ConstU32<0>;
+			type MaxFreezes = frame_support::pallet_prelude::ConstU32<0>;
             /// The ubiquitous event type.
             type RuntimeEvent = RuntimeEvent;
             type WeightInfo = common_runtime::weights::pallet_balances::WeightInfo<Runtime>;
@@ -213,8 +210,6 @@ macro_rules! pallets_config {
         }
         impl pallet_authorship::Config for Runtime {
             type FindAuthor = pallet_session::FindAccountFromAuthorIndex<Self, Babe>;
-            type UncleGenerations = UncleGenerations;
-            type FilterUncle = ();
             type EventHandler = ImOnline;
         }
         impl pallet_im_online::Config for Runtime {
@@ -255,25 +250,16 @@ macro_rules! pallets_config {
         impl pallet_grandpa::Config for Runtime {
             type RuntimeEvent = RuntimeEvent;
 
-            type KeyOwnerProofSystem = Historical;
-
             type KeyOwnerProof =
-                <Self::KeyOwnerProofSystem as KeyOwnerProofSystem<(KeyTypeId, GrandpaId)>>::Proof;
-
-            type KeyOwnerIdentification = <Self::KeyOwnerProofSystem as KeyOwnerProofSystem<(
-                KeyTypeId,
-                GrandpaId,
-            )>>::IdentificationTuple;
+                <Historical as KeyOwnerProofSystem<(KeyTypeId, GrandpaId)>>::Proof;
 
-        type HandleEquivocation = pallet_grandpa::EquivocationHandler<
-                Self::KeyOwnerIdentification,
-                Offences,
-                ReportLongevity,
-            >;
+            type EquivocationReportSystem =
+            		pallet_babe::EquivocationReportSystem<Self, Offences, Historical, ReportLongevity>;
 
             type WeightInfo = common_runtime::weights::pallet_grandpa::WeightInfo<Runtime>;
 
             type MaxAuthorities = MaxAuthorities;
+			type MaxSetIdSessionEntries = BondingDuration::get() * SessionsPerEra::get();
         }
 
         // ONCHAIN GOVERNANCE //
diff --git a/runtime/common/src/weights/block_weights.rs b/runtime/common/src/weights/block_weights.rs
index b94d3347b..6f28d260f 100644
--- a/runtime/common/src/weights/block_weights.rs
+++ b/runtime/common/src/weights/block_weights.rs
@@ -19,7 +19,7 @@
 //   --warmup=10
 
 use sp_core::parameter_types;
-use sp_weights::{constants::WEIGHT_PER_NANOS, Weight};
+use sp_weights::{constants::WEIGHT_REF_TIME_PER_NANOS, Weight};
 
 parameter_types! {
 	/// Time to execute an empty block.
@@ -35,7 +35,7 @@ parameter_types! {
 	///   99th: 738_574
 	///   95th: 729_596
 	///   75th: 709_823
-	pub const BlockExecutionWeight: Weight = WEIGHT_PER_NANOS.saturating_mul(709_232);
+	pub const BlockExecutionWeight: Weight =  Weight::from_parts(WEIGHT_REF_TIME_PER_NANOS, 0).saturating_mul(709_232);
 }
 
 #[cfg(test)]
@@ -51,12 +51,12 @@ mod test_weights {
 
 		// At least 100 µs.
 		assert!(
-			w.ref_time() >= 100u64 * constants::WEIGHT_PER_MICROS.ref_time(),
+			w.ref_time() >= 100u64 * constants::WEIGHT_REF_TIME_PER_MICROS,
 			"Weight should be at least 100 µs."
 		);
 		// At most 50 ms.
 		assert!(
-			w.ref_time() <= 50u64 * constants::WEIGHT_PER_MILLIS.ref_time(),
+			w.ref_time() <= 50u64 * constants::WEIGHT_REF_TIME_PER_MILLIS,
 			"Weight should be at most 50 ms."
 		);
 	}
diff --git a/runtime/common/src/weights/extrinsic_weights.rs b/runtime/common/src/weights/extrinsic_weights.rs
index de39f7a43..71d5cecc9 100644
--- a/runtime/common/src/weights/extrinsic_weights.rs
+++ b/runtime/common/src/weights/extrinsic_weights.rs
@@ -19,7 +19,7 @@
 //   --warmup=10
 
 use sp_core::parameter_types;
-use sp_weights::{constants::WEIGHT_PER_NANOS, Weight};
+use sp_weights::{constants::WEIGHT_REF_TIME_PER_NANOS, Weight};
 
 parameter_types! {
 	/// Time to execute a NO-OP extrinsic, for example `System::remark`.
@@ -35,7 +35,7 @@ parameter_types! {
 	///   99th: 205_581
 	///   95th: 205_130
 	///   75th: 204_772
-	pub const ExtrinsicBaseWeight: Weight = WEIGHT_PER_NANOS.saturating_mul(204_580);
+	pub const ExtrinsicBaseWeight: Weight =  Weight::from_parts(WEIGHT_REF_TIME_PER_NANOS, 0).saturating_mul(204_580);
 }
 
 #[cfg(test)]
@@ -51,12 +51,12 @@ mod test_weights {
 
 		// At least 10 µs.
 		assert!(
-			w.ref_time() >= 10u64 * constants::WEIGHT_PER_MICROS.ref_time(),
+			w.ref_time() >= 10u64 * constants::WEIGHT_REF_TIME_PER_MICROS,
 			"Weight should be at least 10 µs."
 		);
 		// At most 1 ms.
 		assert!(
-			w.ref_time() <= constants::WEIGHT_PER_MILLIS.ref_time(),
+			w.ref_time() <= constants::WEIGHT_REF_TIME_PER_MILLIS,
 			"Weight should be at most 1 ms."
 		);
 	}
diff --git a/runtime/common/src/weights/pallet_babe.rs b/runtime/common/src/weights/pallet_babe.rs
index 2ba18b260..90b7bbe50 100644
--- a/runtime/common/src/weights/pallet_babe.rs
+++ b/runtime/common/src/weights/pallet_babe.rs
@@ -20,7 +20,7 @@
 use frame_support::{
     traits::Get,
     weights::{
-        constants::{WEIGHT_PER_MICROS, WEIGHT_PER_NANOS},
+        constants::{WEIGHT_REF_TIME_PER_MICROS, WEIGHT_REF_TIME_PER_NANOS},
         Weight,
     },
 };
@@ -36,16 +36,17 @@ impl<T: frame_system::Config> pallet_babe::WeightInfo for WeightInfo<T> {
     fn report_equivocation(validator_count: u32) -> Weight {
         // we take the validator set count from the membership proof to
         // calculate the weight but we set a floor of 100 validators.
-        let validator_count = validator_count.max(100) as u64;
+		Weight::from_ref_time(86_280_000 as u64)
+        /*let validator_count = validator_count.max(100) as u64;
 
         // checking membership proof
-        (WEIGHT_PER_MICROS * 35)
-            .saturating_add((WEIGHT_PER_NANOS * 175).saturating_mul(validator_count))
+        (WEIGHT_REF_TIME_PER_MICROS * 35)
+            .saturating_add((WEIGHT_REF_TIME_PER_NANOS * 175).saturating_mul(validator_count))
             .saturating_add(T::DbWeight::get().reads(5))
             // check equivocation proof
-            .saturating_add(WEIGHT_PER_MICROS * 110)
+            .saturating_add(WEIGHT_REF_TIME_PER_MICROS * 110)
             // report offence
-            .saturating_add(WEIGHT_PER_MICROS * 110)
-            .saturating_add(T::DbWeight::get().writes(3))
+            .saturating_add(WEIGHT_REF_TIME_PER_MICROS * 110)
+            .saturating_add(T::DbWeight::get().writes(3))*/
     }
 }
diff --git a/runtime/common/src/weights/pallet_balances.rs b/runtime/common/src/weights/pallet_balances.rs
index 3f904a743..d6c1fc031 100644
--- a/runtime/common/src/weights/pallet_balances.rs
+++ b/runtime/common/src/weights/pallet_balances.rs
@@ -1,102 +1,150 @@
-// Copyright 2021-2022 Axiom-Team
-//
-// This file is part of Duniter-v2S.
-//
-// Duniter-v2S is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Affero General Public License as published by
-// the Free Software Foundation, version 3 of the License.
-//
-// Duniter-v2S is distributed in the hope that it will be useful,
+// Copyright (C) Parity Technologies (UK) Ltd.
+// This file is part of Polkadot.
+
+// Polkadot is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// Polkadot is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Affero General Public License for more details.
-//
-// You should have received a copy of the GNU Affero General Public License
-// along with Duniter-v2S. If not, see <https://www.gnu.org/licenses/>.
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Polkadot.  If not, see <http://www.gnu.org/licenses/>.
 
 //! Autogenerated weights for `pallet_balances`
 //!
 //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
-//! DATE: 2023-04-27, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
-//! HOSTNAME: `benjamin-xps139380`, CPU: `Intel(R) Core(TM) i7-8565U CPU @ 1.80GHz`
-//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024
+//! DATE: 2023-04-28, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
+//! WORST CASE MAP SIZE: `1000000`
+//! HOSTNAME: `bm5`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz`
+//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("polkadot-dev"), DB CACHE: 1024
 
 // Executed Command:
-// target/release/duniter
+// ./target/production/polkadot
 // benchmark
 // pallet
-// --chain=dev
+// --chain=polkadot-dev
 // --steps=50
 // --repeat=20
-// --pallet=*
+// --pallet=pallet_balances
 // --extrinsic=*
 // --execution=wasm
 // --wasm-execution=compiled
-// --heap-pages=4096
 // --header=./file_header.txt
-// --output=./runtime/common/src/weights/
+// --output=./runtime/polkadot/src/weights/
 
 #![cfg_attr(rustfmt, rustfmt_skip)]
 #![allow(unused_parens)]
 #![allow(unused_imports)]
+#![allow(missing_docs)]
 
 use frame_support::{traits::Get, weights::Weight};
-use sp_std::marker::PhantomData;
+use core::marker::PhantomData;
 
 /// Weight functions for `pallet_balances`.
 pub struct WeightInfo<T>(PhantomData<T>);
 impl<T: frame_system::Config> pallet_balances::WeightInfo for WeightInfo<T> {
-	// Storage: System Account (r:1 w:1)
-	// Storage: Account PendingNewAccounts (r:0 w:1)
-	fn transfer() -> Weight {
-		// Minimum execution time: 184_939 nanoseconds.
-		Weight::from_ref_time(188_127_000 as u64)
-			.saturating_add(T::DbWeight::get().reads(1 as u64))
-			.saturating_add(T::DbWeight::get().writes(2 as u64))
+	/// Storage: System Account (r:1 w:1)
+	/// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen)
+	fn transfer_allow_death() -> Weight {
+		// Proof Size summary in bytes:
+		//  Measured:  `0`
+		//  Estimated: `3593`
+		// Minimum execution time: 52_657_000 picoseconds.
+		Weight::from_parts(53_097_000, 0)
+			.saturating_add(Weight::from_parts(0, 3593))
+			.saturating_add(T::DbWeight::get().reads(1))
+			.saturating_add(T::DbWeight::get().writes(1))
 	}
-	// Storage: System Account (r:1 w:1)
-	// Storage: Account PendingNewAccounts (r:0 w:1)
+	/// Storage: System Account (r:1 w:1)
+	/// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen)
 	fn transfer_keep_alive() -> Weight {
-		// Minimum execution time: 125_034 nanoseconds.
-		Weight::from_ref_time(126_793_000 as u64)
-			.saturating_add(T::DbWeight::get().reads(1 as u64))
-			.saturating_add(T::DbWeight::get().writes(2 as u64))
+		// Proof Size summary in bytes:
+		//  Measured:  `0`
+		//  Estimated: `3593`
+		// Minimum execution time: 40_218_000 picoseconds.
+		Weight::from_parts(40_535_000, 0)
+			.saturating_add(Weight::from_parts(0, 3593))
+			.saturating_add(T::DbWeight::get().reads(1))
+			.saturating_add(T::DbWeight::get().writes(1))
 	}
-	// Storage: System Account (r:1 w:1)
-	fn set_balance_creating() -> Weight {
-		// Minimum execution time: 86_856 nanoseconds.
-		Weight::from_ref_time(90_900_000 as u64)
-			.saturating_add(T::DbWeight::get().reads(1 as u64))
-			.saturating_add(T::DbWeight::get().writes(1 as u64))
+	/// Storage: System Account (r:1 w:1)
+	/// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen)
+	fn force_set_balance_creating() -> Weight {
+		// Proof Size summary in bytes:
+		//  Measured:  `174`
+		//  Estimated: `3593`
+		// Minimum execution time: 17_287_000 picoseconds.
+		Weight::from_parts(17_564_000, 0)
+			.saturating_add(Weight::from_parts(0, 3593))
+			.saturating_add(T::DbWeight::get().reads(1))
+			.saturating_add(T::DbWeight::get().writes(1))
 	}
-	// Storage: System Account (r:1 w:1)
-	fn set_balance_killing() -> Weight {
-		// Minimum execution time: 99_577 nanoseconds.
-		Weight::from_ref_time(129_088_000 as u64)
-			.saturating_add(T::DbWeight::get().reads(1 as u64))
-			.saturating_add(T::DbWeight::get().writes(1 as u64))
+	/// Storage: System Account (r:1 w:1)
+	/// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen)
+	fn force_set_balance_killing() -> Weight {
+		// Proof Size summary in bytes:
+		//  Measured:  `174`
+		//  Estimated: `3593`
+		// Minimum execution time: 23_677_000 picoseconds.
+		Weight::from_parts(24_111_000, 0)
+			.saturating_add(Weight::from_parts(0, 3593))
+			.saturating_add(T::DbWeight::get().reads(1))
+			.saturating_add(T::DbWeight::get().writes(1))
 	}
-	// Storage: System Account (r:2 w:2)
-	// Storage: Account PendingNewAccounts (r:0 w:1)
+	/// Storage: System Account (r:2 w:2)
+	/// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen)
 	fn force_transfer() -> Weight {
-		// Minimum execution time: 185_595 nanoseconds.
-		Weight::from_ref_time(273_715_000 as u64)
-			.saturating_add(T::DbWeight::get().reads(2 as u64))
-			.saturating_add(T::DbWeight::get().writes(3 as u64))
+		// Proof Size summary in bytes:
+		//  Measured:  `103`
+		//  Estimated: `6196`
+		// Minimum execution time: 54_904_000 picoseconds.
+		Weight::from_parts(55_547_000, 0)
+			.saturating_add(Weight::from_parts(0, 6196))
+			.saturating_add(T::DbWeight::get().reads(2))
+			.saturating_add(T::DbWeight::get().writes(2))
 	}
-	// Storage: System Account (r:1 w:1)
-	// Storage: Account PendingNewAccounts (r:0 w:1)
+	/// Storage: System Account (r:1 w:1)
+	/// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen)
 	fn transfer_all() -> Weight {
-		// Minimum execution time: 143_575 nanoseconds.
-		Weight::from_ref_time(148_080_000 as u64)
-			.saturating_add(T::DbWeight::get().reads(1 as u64))
-			.saturating_add(T::DbWeight::get().writes(2 as u64))
+		// Proof Size summary in bytes:
+		//  Measured:  `0`
+		//  Estimated: `3593`
+		// Minimum execution time: 48_881_000 picoseconds.
+		Weight::from_parts(49_565_000, 0)
+			.saturating_add(Weight::from_parts(0, 3593))
+			.saturating_add(T::DbWeight::get().reads(1))
+			.saturating_add(T::DbWeight::get().writes(1))
 	}
-	// Storage: System Account (r:1 w:1)
+	/// Storage: System Account (r:1 w:1)
+	/// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen)
 	fn force_unreserve() -> Weight {
-		// Minimum execution time: 78_235 nanoseconds.
-		Weight::from_ref_time(111_974_000 as u64)
-			.saturating_add(T::DbWeight::get().reads(1 as u64))
-			.saturating_add(T::DbWeight::get().writes(1 as u64))
+		// Proof Size summary in bytes:
+		//  Measured:  `174`
+		//  Estimated: `3593`
+		// Minimum execution time: 19_744_000 picoseconds.
+		Weight::from_parts(20_140_000, 0)
+			.saturating_add(Weight::from_parts(0, 3593))
+			.saturating_add(T::DbWeight::get().reads(1))
+			.saturating_add(T::DbWeight::get().writes(1))
+	}
+	/// Storage: System Account (r:999 w:999)
+	/// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen)
+	/// The range of component `u` is `[1, 1000]`.
+	fn upgrade_accounts(u: u32, ) -> Weight {
+		// Proof Size summary in bytes:
+		//  Measured:  `0 + u * (135 ±0)`
+		//  Estimated: `990 + u * (2603 ±0)`
+		// Minimum execution time: 18_555_000 picoseconds.
+		Weight::from_parts(18_756_000, 0)
+			.saturating_add(Weight::from_parts(0, 990))
+			// Standard Error: 9_416
+			.saturating_add(Weight::from_parts(13_991_029, 0).saturating_mul(u.into()))
+			.saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(u.into())))
+			.saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(u.into())))
+			.saturating_add(Weight::from_parts(0, 2603).saturating_mul(u.into()))
 	}
 }
diff --git a/runtime/common/src/weights/pallet_grandpa.rs b/runtime/common/src/weights/pallet_grandpa.rs
index 06039084a..354256220 100644
--- a/runtime/common/src/weights/pallet_grandpa.rs
+++ b/runtime/common/src/weights/pallet_grandpa.rs
@@ -20,7 +20,7 @@
 use frame_support::{
     traits::Get,
     weights::{
-        constants::{WEIGHT_PER_MICROS, WEIGHT_PER_NANOS},
+        constants::{WEIGHT_REF_TIME_PER_MICROS, WEIGHT_REF_TIME_PER_NANOS},
         Weight,
     },
 };
@@ -30,24 +30,30 @@ use sp_std::marker::PhantomData;
 pub struct WeightInfo<T>(PhantomData<T>);
 impl<T: frame_system::Config> pallet_grandpa::WeightInfo for WeightInfo<T> {
     fn report_equivocation(validator_count: u32) -> Weight {
+		Weight::from_ref_time(86_280_000 as u64)
         // we take the validator set count from the membership proof to
         // calculate the weight but we set a floor of 100 validators.
-        let validator_count = validator_count.max(100) as u64;
+        /*let validator_count = validator_count.max(100) as u64;
 
         // checking membership proof
-        (WEIGHT_PER_MICROS * 35)
-            .saturating_add((WEIGHT_PER_NANOS * 175).saturating_mul(validator_count))
+        (Weight::from_ref_time(WEIGHT_REF_TIME_PER_MICROS * 35))
+            .saturating_add(
+                (Weight::from_ref_time(WEIGHT_REF_TIME_PER_NANOS * 175))
+                    .saturating_mul(Weight::from_ref_time(validator_count)),
+            )
             .saturating_add(T::DbWeight::get().reads(5))
             // check equivocation proof
-            .saturating_add(WEIGHT_PER_MICROS * 95)
+            .saturating_add(Weight::from_ref_time(WEIGHT_REF_TIME_PER_MICROS * 95))
             // report offence
-            .saturating_add(WEIGHT_PER_MICROS * 110)
+            .saturating_add(Weight::from_ref_time(WEIGHT_REF_TIME_PER_MICROS * 110))
             .saturating_add(T::DbWeight::get().writes(3))
             // fetching set id -> session index mappings
-            .saturating_add(T::DbWeight::get().reads(2))
+            .saturating_add(T::DbWeight::get().reads(2))*/
     }
 
     fn note_stalled() -> Weight {
-        (WEIGHT_PER_MICROS * 3).saturating_add(T::DbWeight::get().writes(1))
+		Weight::from_ref_time(86_280_000 as u64)
+        /*(Weight::from_ref_time(WEIGHT_REF_TIME_PER_MICROS * 3))
+            .saturating_add(T::DbWeight::get().writes(1))*/
     }
 }
diff --git a/runtime/common/src/weights/paritydb_weights.rs b/runtime/common/src/weights/paritydb_weights.rs
index d57bf2027..0787d9d0e 100644
--- a/runtime/common/src/weights/paritydb_weights.rs
+++ b/runtime/common/src/weights/paritydb_weights.rs
@@ -59,7 +59,7 @@ pub mod constants {
             ///   99th: 151_424
             ///   95th: 143_017
             ///   75th: 133_498
-            read: 250_000 * constants::WEIGHT_PER_NANOS.ref_time(),
+            read: 250_000 * constants::WEIGHT_REF_TIME_PER_NANOS,
 
             /// Time to write one storage item.
             /// Calculated by multiplying the *Average* of all values with `2` and adding `0`.
@@ -74,7 +74,7 @@ pub mod constants {
             ///   99th: 611_825
             ///   95th: 512_789
             ///   75th: 457_938
-            write: 840_000 * constants::WEIGHT_PER_NANOS.ref_time(),
+            write: 840_000 * constants::WEIGHT_REF_TIME_PER_NANOS,
         };
     }
 
@@ -90,20 +90,20 @@ pub mod constants {
         fn bound() {
             // At least 1 µs.
             assert!(
-                W::get().reads(1).ref_time() >= constants::WEIGHT_PER_MICROS.ref_time(),
+                W::get().reads(1).ref_time() >= constants::WEIGHT_REF_TIME_PER_MICROS,
                 "Read weight should be at least 1 µs."
             );
             assert!(
-                W::get().writes(1).ref_time() >= constants::WEIGHT_PER_MICROS.ref_time(),
+                W::get().writes(1).ref_time() >= constants::WEIGHT_REF_TIME_PER_MICROS,
                 "Write weight should be at least 1 µs."
             );
             // At most 1 ms.
             assert!(
-                W::get().reads(1).ref_time() <= constants::WEIGHT_PER_MILLIS.ref_time(),
+                W::get().reads(1).ref_time() <= constants::WEIGHT_REF_TIME_PER_MILLIS,
                 "Read weight should be at most 1 ms."
             );
             assert!(
-                W::get().writes(1).ref_time() <= constants::WEIGHT_PER_MILLIS.ref_time(),
+                W::get().writes(1).ref_time() <= constants::WEIGHT_REF_TIME_PER_MILLIS,
                 "Write weight should be at most 1 ms."
             );
         }
diff --git a/runtime/g1/src/lib.rs b/runtime/g1/src/lib.rs
index fdb472726..3d34f0ef0 100644
--- a/runtime/g1/src/lib.rs
+++ b/runtime/g1/src/lib.rs
@@ -64,7 +64,9 @@ pub use frame_support::{
     construct_runtime, parameter_types,
     traits::{EqualPrivilegeOnly, KeyOwnerProofSystem, Randomness},
     weights::{
-        constants::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight, WEIGHT_PER_SECOND},
+        constants::{
+            BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight, WEIGHT_REF_TIME_PER_SECOND,
+        },
         Weight, WeightToFeeCoefficient, WeightToFeeCoefficients, WeightToFeePolynomial,
     },
     StorageValue,
diff --git a/runtime/g1/src/parameters.rs b/runtime/g1/src/parameters.rs
index 354f52a43..c0c276a11 100644
--- a/runtime/g1/src/parameters.rs
+++ b/runtime/g1/src/parameters.rs
@@ -18,14 +18,14 @@ use crate::*;
 use common_runtime::constants::*;
 use common_runtime::{Balance, BlockNumber};
 use frame_support::parameter_types;
-use frame_support::weights::constants::WEIGHT_PER_SECOND;
+use frame_support::weights::constants::WEIGHT_REF_TIME_PER_SECOND;
 use sp_arithmetic::Perbill;
 use sp_runtime::transaction_validity::TransactionPriority;
 
 parameter_types! {
     pub const BlockHashCount: BlockNumber = 2400;
     /// We allow for 2 seconds of compute with a 6 second average block time.
-    pub BlockWeights: frame_system::limits::BlockWeights = block_weights((WEIGHT_PER_SECOND * 2)
+    pub BlockWeights: frame_system::limits::BlockWeights = block_weights((WEIGHT_REF_TIME_PER_SECOND * 2)
         .set_proof_size(5 * 1024 * 1024), NORMAL_DISPATCH_RATIO);
     pub BlockLength: frame_system::limits::BlockLength = frame_system::limits::BlockLength
         ::max_with_normal_ratio(5 * 1024 * 1024, NORMAL_DISPATCH_RATIO);
diff --git a/runtime/gdev/src/lib.rs b/runtime/gdev/src/lib.rs
index 770191a20..2ba88a277 100644
--- a/runtime/gdev/src/lib.rs
+++ b/runtime/gdev/src/lib.rs
@@ -71,7 +71,9 @@ pub use frame_support::{
     construct_runtime, parameter_types,
     traits::{EqualPrivilegeOnly, KeyOwnerProofSystem, Randomness},
     weights::{
-        constants::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight, WEIGHT_PER_SECOND},
+        constants::{
+            BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight, WEIGHT_REF_TIME_PER_SECOND,
+        },
         Weight, WeightToFeeCoefficient, WeightToFeeCoefficients, WeightToFeePolynomial,
     },
     StorageValue,
@@ -314,7 +316,7 @@ construct_runtime!(
 
         // Consensus support
         AuthorityMembers: pallet_authority_members::{Pallet, Call, Storage, Config<T>, Event<T>} = 10,
-        Authorship: pallet_authorship::{Pallet, Call, Storage} = 11,
+        Authorship: pallet_authorship::{Pallet, Storage} = 11,
         Offences: pallet_offences::{Pallet, Storage, Event} = 12,
         Historical: session_historical::{Pallet} = 13,
         Session: pallet_session::{Pallet, Call, Storage, Event, Config<T>} = 14,
diff --git a/runtime/gdev/src/parameters.rs b/runtime/gdev/src/parameters.rs
index f43402dc3..3308725d0 100644
--- a/runtime/gdev/src/parameters.rs
+++ b/runtime/gdev/src/parameters.rs
@@ -19,14 +19,14 @@ use common_runtime::constants::*;
 use common_runtime::{Balance, BlockNumber};
 use frame_support::parameter_types;
 use frame_support::traits::EitherOfDiverse;
-use frame_support::weights::constants::WEIGHT_PER_SECOND;
+use frame_support::weights::constants::WEIGHT_REF_TIME_PER_SECOND;
 use sp_arithmetic::Perbill;
 use sp_runtime::transaction_validity::TransactionPriority;
 
 parameter_types! {
     pub const BlockHashCount: BlockNumber = 2400;
     /// We allow for 2 seconds of compute with a 6 second average block time.
-    pub BlockWeights: frame_system::limits::BlockWeights = block_weights((WEIGHT_PER_SECOND * 2)
+    pub BlockWeights: frame_system::limits::BlockWeights = block_weights((WEIGHT_REF_TIME_PER_SECOND * 2)
         .set_proof_size(5 * 1024 * 1024), NORMAL_DISPATCH_RATIO);
     pub BlockLength: frame_system::limits::BlockLength = frame_system::limits::BlockLength
         ::max_with_normal_ratio(5 * 1024 * 1024, NORMAL_DISPATCH_RATIO);
diff --git a/runtime/gtest/src/lib.rs b/runtime/gtest/src/lib.rs
index 29ec85aae..ea65433a5 100644
--- a/runtime/gtest/src/lib.rs
+++ b/runtime/gtest/src/lib.rs
@@ -68,7 +68,9 @@ pub use frame_support::{
     construct_runtime, parameter_types,
     traits::{EqualPrivilegeOnly, KeyOwnerProofSystem, Randomness},
     weights::{
-        constants::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight, WEIGHT_PER_SECOND},
+        constants::{
+            BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight, WEIGHT_REF_TIME_PER_SECOND,
+        },
         Weight, WeightToFeeCoefficient, WeightToFeeCoefficients, WeightToFeePolynomial,
     },
     StorageValue,
diff --git a/runtime/gtest/src/parameters.rs b/runtime/gtest/src/parameters.rs
index 86b66d53a..f747cea13 100644
--- a/runtime/gtest/src/parameters.rs
+++ b/runtime/gtest/src/parameters.rs
@@ -18,14 +18,14 @@ use crate::*;
 use common_runtime::constants::*;
 use common_runtime::{Balance, BlockNumber};
 use frame_support::parameter_types;
-use frame_support::weights::constants::WEIGHT_PER_SECOND;
+use frame_support::weights::constants::WEIGHT_REF_TIME_PER_SECOND;
 use sp_arithmetic::Perbill;
 use sp_runtime::transaction_validity::TransactionPriority;
 
 parameter_types! {
     pub const BlockHashCount: BlockNumber = 2400;
     /// We allow for 2 seconds of compute with a 6 second average block time.
-    pub BlockWeights: frame_system::limits::BlockWeights = block_weights((WEIGHT_PER_SECOND * 2)
+    pub BlockWeights: frame_system::limits::BlockWeights = block_weights((WEIGHT_REF_TIME_PER_SECOND * 2)
         .set_proof_size(5 * 1024 * 1024), NORMAL_DISPATCH_RATIO);
     pub BlockLength: frame_system::limits::BlockLength = frame_system::limits::BlockLength
         ::max_with_normal_ratio(5 * 1024 * 1024, NORMAL_DISPATCH_RATIO);
-- 
GitLab