From 305e5044a40ac43a91354ac6179324866ad776e6 Mon Sep 17 00:00:00 2001
From: librelois <c@elo.tf>
Date: Sat, 15 Jan 2022 15:40:51 +0100
Subject: [PATCH] =?UTF-8?q?chore:=20more=20common=20code=20between=20gtest?=
 =?UTF-8?q?=20and=20g1=C2=A0runtimes?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 Cargo.lock                                    |  25 +++
 runtime/common-except-gdev/Cargo.toml         |  99 +++++++++
 runtime/common-except-gdev/src/apis.rs        |  83 +++++++
 runtime/common-except-gdev/src/lib.rs         |  20 ++
 .../common-except-gdev/src/pallets_config.rs  | 101 +++++++++
 runtime/common/Cargo.toml                     |   2 +-
 runtime/common/src/pallets_config.rs          |   4 +
 runtime/g1/Cargo.toml                         |   3 +
 runtime/g1/src/lib.rs                         | 203 +++--------------
 runtime/g1/src/parameters.rs                  |  54 ++++-
 runtime/gdev/Cargo.toml                       |   1 +
 runtime/gdev/src/lib.rs                       |  55 ++---
 runtime/gdev/src/parameters.rs                |  11 +
 runtime/gtest/Cargo.toml                      |   3 +
 runtime/gtest/src/lib.rs                      | 206 +++---------------
 runtime/gtest/src/parameters.rs               |  52 ++++-
 16 files changed, 510 insertions(+), 412 deletions(-)
 create mode 100644 runtime/common-except-gdev/Cargo.toml
 create mode 100644 runtime/common-except-gdev/src/apis.rs
 create mode 100644 runtime/common-except-gdev/src/lib.rs
 create mode 100644 runtime/common-except-gdev/src/pallets_config.rs

diff --git a/Cargo.lock b/Cargo.lock
index c5f7eb3da..bf0582be3 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -869,6 +869,29 @@ dependencies = [
  "sp-std",
 ]
 
+[[package]]
+name = "common-runtime-except-gdev"
+version = "0.8.0-dev"
+dependencies = [
+ "common-runtime",
+ "frame-support",
+ "frame-system",
+ "pallet-certification",
+ "pallet-identity",
+ "pallet-session",
+ "pallet-ud-accounts-storage",
+ "parity-scale-codec",
+ "scale-info",
+ "serde",
+ "smallvec",
+ "sp-arithmetic",
+ "sp-consensus-babe",
+ "sp-core",
+ "sp-runtime",
+ "sp-staking",
+ "sp-std",
+]
+
 [[package]]
 name = "concurrent-queue"
 version = "1.2.2"
@@ -2081,6 +2104,7 @@ name = "g1-runtime"
 version = "3.0.0"
 dependencies = [
  "common-runtime",
+ "common-runtime-except-gdev",
  "frame-benchmarking",
  "frame-executive",
  "frame-support",
@@ -2323,6 +2347,7 @@ name = "gtest-runtime"
 version = "3.0.0"
 dependencies = [
  "common-runtime",
+ "common-runtime-except-gdev",
  "frame-benchmarking",
  "frame-executive",
  "frame-support",
diff --git a/runtime/common-except-gdev/Cargo.toml b/runtime/common-except-gdev/Cargo.toml
new file mode 100644
index 000000000..e8ab258a2
--- /dev/null
+++ b/runtime/common-except-gdev/Cargo.toml
@@ -0,0 +1,99 @@
+[package]
+name = 'common-runtime-except-gdev'
+description = 'Common code shared between all runtimes except gdev'
+license = 'GPL-3.0-only'
+version = '0.8.0-dev'
+authors = ['Axiom-Team Developers <https://axiom-team.fr>']
+edition = '2018'
+
+[features]
+runtime-benchmarks = [
+    'frame-support/runtime-benchmarks',
+    'frame-system/runtime-benchmarks',
+    'pallet-certification/runtime-benchmarks',
+    'pallet-identity/runtime-benchmarks',
+    'pallet-ud-accounts-storage/runtime-benchmarks',
+    'common-runtime/runtime-benchmarks',
+    'sp-runtime/runtime-benchmarks',
+]
+std = [
+    'codec/std',
+    'frame-support/std',
+    'frame-system/std',
+    'pallet-certification/std',
+    'pallet-identity/std',
+    'pallet-ud-accounts-storage/std',
+    'common-runtime/std',
+    'serde',
+    'sp-arithmetic/std',
+    'sp-core/std',
+    'sp-runtime/std',
+    'sp-std/std'
+]
+
+[dependencies]
+common-runtime = { path = '../common', default-features = false }
+pallet-certification = { path = '../../pallets/certification', default-features = false }
+pallet-identity = { path = '../../pallets/identity', default-features = false }
+pallet-ud-accounts-storage = { path = '../../pallets/ud-accounts-storage', default-features = false }
+smallvec = "1.6.1"
+
+# substrate
+scale-info = { version = "1.0", default-features = false, features = ["derive"] }
+
+[dependencies.codec]
+default-features = false
+features = ['derive']
+package = 'parity-scale-codec'
+version = '2.3.1'
+
+[dependencies.frame-support]
+default-features = false
+git = 'https://github.com/librelois/substrate.git'
+branch = 'duniter-monthly-2022-01'
+
+[dependencies.frame-system]
+default-features = false
+git = 'https://github.com/librelois/substrate.git'
+branch = 'duniter-monthly-2022-01'
+
+[dependencies.pallet-session]
+default-features = false
+features = ["historical"]
+git = 'https://github.com/librelois/substrate.git'
+branch = 'duniter-monthly-2022-01'
+
+[dependencies.serde]
+version = "1.0.101"
+optional = true
+features = ["derive"]
+
+[dependencies.sp-arithmetic]
+default-features = false
+git = 'https://github.com/librelois/substrate.git'
+branch = 'duniter-monthly-2022-01'
+
+[dependencies.sp-consensus-babe]
+default-features = false
+git = 'https://github.com/librelois/substrate.git'
+branch = 'duniter-monthly-2022-01'
+
+[dependencies.sp-core]
+default-features = false
+git = 'https://github.com/librelois/substrate.git'
+branch = 'duniter-monthly-2022-01'
+
+[dependencies.sp-runtime]
+default-features = false
+git = 'https://github.com/librelois/substrate.git'
+branch = 'duniter-monthly-2022-01'
+
+[dependencies.sp-staking]
+default-features = false
+git = 'https://github.com/librelois/substrate.git'
+branch = 'duniter-monthly-2022-01'
+
+[dependencies.sp-std]
+default-features = false
+git = 'https://github.com/librelois/substrate.git'
+branch = 'duniter-monthly-2022-01'
diff --git a/runtime/common-except-gdev/src/apis.rs b/runtime/common-except-gdev/src/apis.rs
new file mode 100644
index 000000000..c49a39b4c
--- /dev/null
+++ b/runtime/common-except-gdev/src/apis.rs
@@ -0,0 +1,83 @@
+// Copyright 2021 Axiom-Team
+//
+// This file is part of Substrate-Libre-Currency.
+//
+// Substrate-Libre-Currency 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.
+//
+// Substrate-Libre-Currency 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 Substrate-Libre-Currency. If not, see <https://www.gnu.org/licenses/>.
+
+#[macro_export]
+macro_rules! runtime_apis {
+	{$($custom:tt)*} => {
+		common_runtime::runtime_apis! {
+			$($custom)*
+
+			impl sp_authority_discovery::AuthorityDiscoveryApi<Block> for Runtime {
+				fn authorities() -> Vec<sp_authority_discovery::AuthorityId> {
+					AuthorityDiscovery::authorities()
+				}
+			}
+
+			impl sp_consensus_babe::BabeApi<Block> for Runtime {
+				fn configuration() -> sp_consensus_babe::BabeGenesisConfiguration {
+					// The choice of `c` parameter (where `1 - c` represents the
+					// probability of a slot being empty), is done in accordance to the
+					// slot duration and expected target block time, for safely
+					// resisting network delays of maximum two seconds.
+					// <https://research.web3.foundation/en/latest/polkadot/BABE/Babe/#6-practical-results>
+					sp_consensus_babe::BabeGenesisConfiguration {
+						slot_duration: Babe::slot_duration(),
+						epoch_length: EpochDuration::get(),
+						c: BABE_GENESIS_EPOCH_CONFIG.c,
+						genesis_authorities: Babe::authorities().to_vec(),
+						randomness: Babe::randomness(),
+						allowed_slots: BABE_GENESIS_EPOCH_CONFIG.allowed_slots,
+					}
+				}
+
+				fn current_epoch_start() -> sp_consensus_babe::Slot {
+					Babe::current_epoch_start()
+				}
+
+				fn current_epoch() -> sp_consensus_babe::Epoch {
+					Babe::current_epoch()
+				}
+
+				fn next_epoch() -> sp_consensus_babe::Epoch {
+					Babe::next_epoch()
+				}
+
+				fn generate_key_ownership_proof(
+					_slot: sp_consensus_babe::Slot,
+					authority_id: sp_consensus_babe::AuthorityId,
+				) -> Option<sp_consensus_babe::OpaqueKeyOwnershipProof> {
+					use codec::Encode;
+
+					Historical::prove((sp_consensus_babe::KEY_TYPE, authority_id))
+						.map(|p| p.encode())
+						.map(sp_consensus_babe::OpaqueKeyOwnershipProof::new)
+				}
+
+				fn submit_report_equivocation_unsigned_extrinsic(
+					equivocation_proof: sp_consensus_babe::EquivocationProof<<Block as BlockT>::Header>,
+					key_owner_proof: sp_consensus_babe::OpaqueKeyOwnershipProof,
+				) -> Option<()> {
+					let key_owner_proof = key_owner_proof.decode()?;
+
+					Babe::submit_unsigned_equivocation_report(
+						equivocation_proof,
+						key_owner_proof,
+					)
+				}
+			}
+		}
+	};
+}
diff --git a/runtime/common-except-gdev/src/lib.rs b/runtime/common-except-gdev/src/lib.rs
new file mode 100644
index 000000000..1527b2c31
--- /dev/null
+++ b/runtime/common-except-gdev/src/lib.rs
@@ -0,0 +1,20 @@
+// Copyright 2021 Axiom-Team
+//
+// This file is part of Substrate-Libre-Currency.
+//
+// Substrate-Libre-Currency 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.
+//
+// Substrate-Libre-Currency 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 Substrate-Libre-Currency. If not, see <https://www.gnu.org/licenses/>.
+
+#![cfg_attr(not(feature = "std"), no_std)]
+
+pub mod apis;
+pub mod pallets_config;
diff --git a/runtime/common-except-gdev/src/pallets_config.rs b/runtime/common-except-gdev/src/pallets_config.rs
new file mode 100644
index 000000000..2e0696073
--- /dev/null
+++ b/runtime/common-except-gdev/src/pallets_config.rs
@@ -0,0 +1,101 @@
+// Copyright 2021 Axiom-Team
+//
+// This file is part of Substrate-Libre-Currency.
+//
+// Substrate-Libre-Currency 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.
+//
+// Substrate-Libre-Currency 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 Substrate-Libre-Currency. If not, see <https://www.gnu.org/licenses/>.
+
+#[macro_export]
+macro_rules! pallets_config {
+	{$($custom:tt)*} => {
+		common_runtime::pallets_config!{
+			$($custom)*
+
+			impl pallet_authority_discovery::Config for Runtime {
+				type MaxAuthorities = MaxAuthorities;
+			}
+			impl pallet_authorship::Config for Runtime {
+				type FindAuthor = pallet_session::FindAccountFromAuthorIndex<Self, Babe>;
+				type UncleGenerations = UncleGenerations;
+				type FilterUncle = ();
+				type EventHandler = ImOnline;
+			}
+			impl pallet_babe::Config for Runtime {
+				type EpochDuration = EpochDuration;
+				type ExpectedBlockTime = ExpectedBlockTime;
+
+				// session module is the trigger
+				type EpochChangeTrigger = pallet_babe::ExternalTrigger;
+
+				type DisabledValidators = Session;
+
+				type KeyOwnerProofSystem = Historical;
+
+				type KeyOwnerProof = <Self::KeyOwnerProofSystem 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 WeightInfo = ();
+
+				type MaxAuthorities = MaxAuthorities;
+			}
+
+			impl pallet_im_online::Config for Runtime {
+				type AuthorityId = ImOnlineId;
+				type Event = Event;
+				type ValidatorSet = Historical;
+				type NextSessionRotation = Babe;
+				type ReportUnresponsiveness = Offences;
+				type UnsignedPriority = ImOnlineUnsignedPriority;
+				type WeightInfo = ();
+				type MaxKeys = MaxKeys;
+				type MaxPeerInHeartbeats = MaxPeerInHeartbeats;
+				type MaxPeerDataEncodingSize = MaxPeerDataEncodingSize;
+			}
+			impl pallet_offences::Config for Runtime {
+				type Event = Event;
+				type IdentificationTuple = pallet_session::historical::IdentificationTuple<Self>;
+				type OnOffenceHandler = ();
+			}
+			impl pallet_session::Config for Runtime {
+				type Event = Event;
+				type ValidatorId = AccountId;
+				type ValidatorIdOf = sp_runtime::traits::ConvertInto;
+				type ShouldEndSession = Babe;
+				type NextSessionRotation = Babe;
+				type SessionManager = pallet_session::historical::NoteHistoricalRoot<Self, SessionManagerImpl>;
+				type SessionHandler = <opaque::SessionKeys as OpaqueKeys>::KeyTypeIdProviders;
+				type Keys = opaque::SessionKeys;
+				type WeightInfo = ();
+			}
+			impl pallet_session::historical::Config for Runtime {
+				type FullIdentification = ValidatorFullIdentification;
+				type FullIdentificationOf = FullIdentificationOfImpl;
+			}
+			impl pallet_timestamp::Config for Runtime {
+				type Moment = u64;
+				type OnTimestampSet = Babe;
+				type MinimumPeriod = MinimumPeriod;
+				type WeightInfo = ();
+			}
+		}
+	};
+}
diff --git a/runtime/common/Cargo.toml b/runtime/common/Cargo.toml
index f359a7cd6..998747927 100644
--- a/runtime/common/Cargo.toml
+++ b/runtime/common/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = 'common-runtime'
-description = 'Common code shared between runtimes'
+description = 'Common code shared between all runtimes'
 license = 'GPL-3.0-only'
 version = '0.8.0-dev'
 authors = ['Axiom-Team Developers <https://axiom-team.fr>']
diff --git a/runtime/common/src/pallets_config.rs b/runtime/common/src/pallets_config.rs
index 19c61e495..eb86e90d0 100644
--- a/runtime/common/src/pallets_config.rs
+++ b/runtime/common/src/pallets_config.rs
@@ -21,6 +21,10 @@ macro_rules! pallets_config {
 
 		// SYSTEM //
 
+		parameter_types! {
+			pub const Version: RuntimeVersion = VERSION;
+		}
+
         impl frame_system::Config for Runtime {
             /// The basic call filter to use in dispatchable.
             type BaseCallFilter = frame_support::traits::Everything;
diff --git a/runtime/g1/Cargo.toml b/runtime/g1/Cargo.toml
index bd7f9bcaa..8750b7412 100644
--- a/runtime/g1/Cargo.toml
+++ b/runtime/g1/Cargo.toml
@@ -47,9 +47,11 @@ std = [
     'pallet-transaction-payment-rpc-runtime-api/std',
     'pallet-transaction-payment/std',
     'common-runtime/std',
+    'common-runtime-except-gdev/std',
     'serde',
     'sp-api/std',
     'sp-arithmetic/std',
+	'sp-authority-discovery/std',
     'sp-block-builder/std',
     'sp-consensus-babe/std',
     'sp-core/std',
@@ -68,6 +70,7 @@ pallet-identity = { path = '../../pallets/identity', default-features = false }
 pallet-ud-accounts-storage = { path = '../../pallets/ud-accounts-storage', default-features = false }
 pallet-universal-dividend = { path = '../../pallets/universal-dividend', default-features = false }
 common-runtime = { path = "../common", default-features = false }
+common-runtime-except-gdev = { path = "../common-except-gdev", default-features = false }
 
 # substrate
 scale-info = { version = "1.0", default-features = false, features = ["derive"] }
diff --git a/runtime/g1/src/lib.rs b/runtime/g1/src/lib.rs
index 87ade7be1..5a1a9024c 100644
--- a/runtime/g1/src/lib.rs
+++ b/runtime/g1/src/lib.rs
@@ -59,7 +59,7 @@ use sp_core::OpaqueMetadata;
 use sp_runtime::traits::{AccountIdLookup, BlakeTwo256, Block as BlockT, NumberFor, OpaqueKeys};
 use sp_runtime::{
     create_runtime_str, generic, impl_opaque_keys,
-    transaction_validity::{TransactionPriority, TransactionSource, TransactionValidity},
+    transaction_validity::{TransactionSource, TransactionValidity},
     ApplyExtrinsicResult,
 };
 use sp_std::prelude::*;
@@ -118,101 +118,30 @@ pub fn native_version() -> NativeVersion {
     }
 }
 
-parameter_types! {
-    pub const Version: RuntimeVersion = VERSION;
-    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 = frame_system::limits::BlockWeights
-        ::with_sensible_defaults(2 * WEIGHT_PER_SECOND, NORMAL_DISPATCH_RATIO);
-    pub BlockLength: frame_system::limits::BlockLength = frame_system::limits::BlockLength
-        ::max_with_normal_ratio(5 * 1024 * 1024, NORMAL_DISPATCH_RATIO);
-    pub const SS58Prefix: u16 = 42;
-    pub const UncleGenerations: u32 = 0;
-}
-
-// Configure FRAME pallets to include in runtime.
-common_runtime::pallets_config! {
-    impl pallet_authority_discovery::Config for Runtime {
-        type MaxAuthorities = MaxAuthorities;
-    }
-    impl pallet_authorship::Config for Runtime {
-        type FindAuthor = pallet_session::FindAccountFromAuthorIndex<Self, Babe>;
-        type UncleGenerations = UncleGenerations;
-        type FilterUncle = ();
-        type EventHandler = ImOnline;
-    }
-    impl pallet_babe::Config for Runtime {
-        type EpochDuration = EpochDuration;
-        type ExpectedBlockTime = ExpectedBlockTime;
-
-        // session module is the trigger
-        type EpochChangeTrigger = pallet_babe::ExternalTrigger;
-
-        type DisabledValidators = Session;
-
-        type KeyOwnerProofSystem = Historical;
-
-        type KeyOwnerProof = <Self::KeyOwnerProofSystem 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 WeightInfo = ();
+/// Block type as expected by this runtime.
+pub type Block = sp_runtime::generic::Block<Header, UncheckedExtrinsic>;
+/// Unchecked extrinsic type as expected by this runtime.
+pub type UncheckedExtrinsic = generic::UncheckedExtrinsic<Address, Call, Signature, SignedExtra>;
+/// The SignedExtension to the basic transaction logic.
+pub type SignedExtra = (
+    frame_system::CheckSpecVersion<Runtime>,
+    frame_system::CheckTxVersion<Runtime>,
+    frame_system::CheckGenesis<Runtime>,
+    frame_system::CheckEra<Runtime>,
+    frame_system::CheckNonce<Runtime>,
+    frame_system::CheckWeight<Runtime>,
+    pallet_transaction_payment::ChargeTransactionPayment<Runtime>,
+);
+/// Executive: handles dispatch to the various modules.
+pub type Executive = frame_executive::Executive<
+    Runtime,
+    Block,
+    frame_system::ChainContext<Runtime>,
+    Runtime,
+    AllPalletsWithSystem,
+>;
 
-        type MaxAuthorities = MaxAuthorities;
-    }
-    parameter_types! {
-        pub const ImOnlineUnsignedPriority: TransactionPriority = TransactionPriority::max_value();
-        pub const MaxKeys: u32 = 10_000;
-        pub const MaxPeerInHeartbeats: u32 = 10_000;
-        pub const MaxPeerDataEncodingSize: u32 = 1_000;
-    }
-    impl pallet_im_online::Config for Runtime {
-        type AuthorityId = ImOnlineId;
-        type Event = Event;
-        type ValidatorSet = Historical;
-        type NextSessionRotation = Babe;
-        type ReportUnresponsiveness = Offences;
-        type UnsignedPriority = ImOnlineUnsignedPriority;
-        type WeightInfo = ();
-        type MaxKeys = MaxKeys;
-        type MaxPeerInHeartbeats = MaxPeerInHeartbeats;
-        type MaxPeerDataEncodingSize = MaxPeerDataEncodingSize;
-    }
-    impl pallet_offences::Config for Runtime {
-        type Event = Event;
-        type IdentificationTuple = pallet_session::historical::IdentificationTuple<Self>;
-        type OnOffenceHandler = ();
-    }
-    impl pallet_session::Config for Runtime {
-        type Event = Event;
-        type ValidatorId = AccountId;
-        type ValidatorIdOf = sp_runtime::traits::ConvertInto;
-        type ShouldEndSession = Babe;
-        type NextSessionRotation = Babe;
-        type SessionManager = pallet_session::historical::NoteHistoricalRoot<Self, SessionManagerImpl>;
-        type SessionHandler = <opaque::SessionKeys as OpaqueKeys>::KeyTypeIdProviders;
-        type Keys = opaque::SessionKeys;
-        type WeightInfo = ();
-    }
-    impl pallet_session::historical::Config for Runtime {
-        type FullIdentification = ValidatorFullIdentification;
-        type FullIdentificationOf = FullIdentificationOfImpl;
-    }
-    impl pallet_timestamp::Config for Runtime {
-        type Moment = u64;
-        type OnTimestampSet = Babe;
-        type MinimumPeriod = MinimumPeriod;
-        type WeightInfo = ();
-    }
+common_runtime_except_gdev::pallets_config! {
     impl pallet_sudo::Config for Runtime {
         type Event = Event;
         type Call = Call;
@@ -267,29 +196,6 @@ construct_runtime!(
     }
 );
 
-/// Block type as expected by this runtime.
-pub type Block = sp_runtime::generic::Block<Header, UncheckedExtrinsic>;
-/// Unchecked extrinsic type as expected by this runtime.
-pub type UncheckedExtrinsic = generic::UncheckedExtrinsic<Address, Call, Signature, SignedExtra>;
-/// The SignedExtension to the basic transaction logic.
-pub type SignedExtra = (
-    frame_system::CheckSpecVersion<Runtime>,
-    frame_system::CheckTxVersion<Runtime>,
-    frame_system::CheckGenesis<Runtime>,
-    frame_system::CheckEra<Runtime>,
-    frame_system::CheckNonce<Runtime>,
-    frame_system::CheckWeight<Runtime>,
-    pallet_transaction_payment::ChargeTransactionPayment<Runtime>,
-);
-/// Executive: handles dispatch to the various modules.
-pub type Executive = frame_executive::Executive<
-    Runtime,
-    Block,
-    frame_system::ChainContext<Runtime>,
-    Runtime,
-    AllPalletsWithSystem,
->;
-
 impl<C> frame_system::offchain::SendTransactionTypes<C> for Runtime
 where
     Call: From<C>,
@@ -308,63 +214,4 @@ where
 //     // Specific impls provided to the `runtime_apis!` macro.
 // }
 // ```
-common_runtime::runtime_apis! {
-    impl sp_authority_discovery::AuthorityDiscoveryApi<Block> for Runtime {
-        fn authorities() -> Vec<sp_authority_discovery::AuthorityId> {
-            AuthorityDiscovery::authorities()
-        }
-    }
-
-    impl sp_consensus_babe::BabeApi<Block> for Runtime {
-        fn configuration() -> sp_consensus_babe::BabeGenesisConfiguration {
-            // The choice of `c` parameter (where `1 - c` represents the
-            // probability of a slot being empty), is done in accordance to the
-            // slot duration and expected target block time, for safely
-            // resisting network delays of maximum two seconds.
-            // <https://research.web3.foundation/en/latest/polkadot/BABE/Babe/#6-practical-results>
-            sp_consensus_babe::BabeGenesisConfiguration {
-                slot_duration: Babe::slot_duration(),
-                epoch_length: EpochDuration::get(),
-                c: BABE_GENESIS_EPOCH_CONFIG.c,
-                genesis_authorities: Babe::authorities().to_vec(),
-                randomness: Babe::randomness(),
-                allowed_slots: BABE_GENESIS_EPOCH_CONFIG.allowed_slots,
-            }
-        }
-
-        fn current_epoch_start() -> sp_consensus_babe::Slot {
-            Babe::current_epoch_start()
-        }
-
-        fn current_epoch() -> sp_consensus_babe::Epoch {
-            Babe::current_epoch()
-        }
-
-        fn next_epoch() -> sp_consensus_babe::Epoch {
-            Babe::next_epoch()
-        }
-
-        fn generate_key_ownership_proof(
-            _slot: sp_consensus_babe::Slot,
-            authority_id: sp_consensus_babe::AuthorityId,
-        ) -> Option<sp_consensus_babe::OpaqueKeyOwnershipProof> {
-            use codec::Encode;
-
-            Historical::prove((sp_consensus_babe::KEY_TYPE, authority_id))
-                .map(|p| p.encode())
-                .map(sp_consensus_babe::OpaqueKeyOwnershipProof::new)
-        }
-
-        fn submit_report_equivocation_unsigned_extrinsic(
-            equivocation_proof: sp_consensus_babe::EquivocationProof<<Block as BlockT>::Header>,
-            key_owner_proof: sp_consensus_babe::OpaqueKeyOwnershipProof,
-        ) -> Option<()> {
-            let key_owner_proof = key_owner_proof.decode()?;
-
-            Babe::submit_unsigned_equivocation_report(
-                equivocation_proof,
-                key_owner_proof,
-            )
-        }
-    }
-}
+common_runtime_except_gdev::runtime_apis! {}
diff --git a/runtime/g1/src/parameters.rs b/runtime/g1/src/parameters.rs
index 6da85f34d..8019329e7 100644
--- a/runtime/g1/src/parameters.rs
+++ b/runtime/g1/src/parameters.rs
@@ -17,7 +17,24 @@
 use common_runtime::constants::*;
 use common_runtime::{Balance, BlockNumber};
 use frame_support::parameter_types;
+use frame_support::weights::constants::WEIGHT_PER_SECOND;
 use sp_arithmetic::Permill;
+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 = frame_system::limits::BlockWeights
+        ::with_sensible_defaults(2 * WEIGHT_PER_SECOND, NORMAL_DISPATCH_RATIO);
+    pub BlockLength: frame_system::limits::BlockLength = frame_system::limits::BlockLength
+        ::max_with_normal_ratio(5 * 1024 * 1024, NORMAL_DISPATCH_RATIO);
+    pub const SS58Prefix: u16 = 42;
+    pub const UncleGenerations: u32 = 0;
+}
+
+/*************/
+/* CONSENSUS */
+/*************/
 
 // Authority discovery
 parameter_types! {
@@ -37,6 +54,18 @@ parameter_types! {
     pub const ReportLongevity: u64 = 168 * EpochDuration::get();
 }
 
+// ImOnline
+parameter_types! {
+    pub const ImOnlineUnsignedPriority: TransactionPriority = TransactionPriority::max_value();
+    pub const MaxKeys: u32 = 10_000;
+    pub const MaxPeerInHeartbeats: u32 = 10_000;
+    pub const MaxPeerDataEncodingSize: u32 = 1_000;
+}
+
+/*********/
+/* MONEY */
+/*********/
+
 // Balances
 frame_support::parameter_types! {
     pub const ExistentialDeposit: Balance = 500;
@@ -48,6 +77,21 @@ frame_support::parameter_types! {
     pub const TransactionByteFee: Balance = 0;
 }
 
+// Universal dividend
+parameter_types! {
+    // 0.002_381_440 = 0.0488^2
+    pub const SquareMoneyGrowthRate: Permill = Permill::from_parts(2_381_440);
+    pub const UdCreationPeriod: BlockNumber = DAYS;
+    // TODO: this value will depend on the date of the migration
+    pub const UdFirstReeval: BlockNumber = 45 * DAYS;
+    pub const UdReevalPeriod: Balance = 182;
+    pub const UdReevalPeriodInBlocks: BlockNumber = 2_620_800; // 86400 * 182 / 6
+}
+
+/*******/
+/* WOT */
+/*******/
+
 // Identity
 pub const IDTY_CREATE_PERIOD: BlockNumber = 100;
 frame_support::parameter_types! {
@@ -68,16 +112,6 @@ parameter_types! {
     pub const ValidityPeriod: BlockNumber = 2 * YEARS;
 }
 
-// Universal dividend
-parameter_types! {
-    pub const SquareMoneyGrowthRate: Permill = Permill::from_parts(2_381_440); // 0.002_381_440 = 0.0488^2
-    pub const UdCreationPeriod: BlockNumber = DAYS;
-    // TODO: this value will depend on the date of the migration
-    pub const UdFirstReeval: BlockNumber = 45 * DAYS;
-    pub const UdReevalPeriod: Balance = 182;
-    pub const UdReevalPeriodInBlocks: BlockNumber = 2_620_800; // 86400 * 182 / 6
-}
-
 // Multisig
 parameter_types! {
     pub const DepositBase: Balance = 1000;
diff --git a/runtime/gdev/Cargo.toml b/runtime/gdev/Cargo.toml
index b2976ee1e..59bae5890 100644
--- a/runtime/gdev/Cargo.toml
+++ b/runtime/gdev/Cargo.toml
@@ -47,6 +47,7 @@ std = [
     'serde',
     'sp-api/std',
     'sp-arithmetic/std',
+	'sp-authority-discovery/std',
     'sp-block-builder/std',
     'sp-consensus-babe/std',
     'sp-core/std',
diff --git a/runtime/gdev/src/lib.rs b/runtime/gdev/src/lib.rs
index 0ad45d4aa..001fb85f1 100644
--- a/runtime/gdev/src/lib.rs
+++ b/runtime/gdev/src/lib.rs
@@ -112,16 +112,28 @@ pub fn native_version() -> NativeVersion {
     }
 }
 
-parameter_types! {
-    pub const Version: RuntimeVersion = VERSION;
-    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 = frame_system::limits::BlockWeights
-        ::with_sensible_defaults(2 * WEIGHT_PER_SECOND, NORMAL_DISPATCH_RATIO);
-    pub BlockLength: frame_system::limits::BlockLength = frame_system::limits::BlockLength
-        ::max_with_normal_ratio(5 * 1024 * 1024, NORMAL_DISPATCH_RATIO);
-    pub const SS58Prefix: u16 = 42;
-}
+/// Block type as expected by this runtime.
+pub type Block = sp_runtime::generic::Block<Header, UncheckedExtrinsic>;
+/// Unchecked extrinsic type as expected by this runtime.
+pub type UncheckedExtrinsic = generic::UncheckedExtrinsic<Address, Call, Signature, SignedExtra>;
+/// The SignedExtension to the basic transaction logic.
+pub type SignedExtra = (
+    frame_system::CheckSpecVersion<Runtime>,
+    frame_system::CheckTxVersion<Runtime>,
+    frame_system::CheckGenesis<Runtime>,
+    frame_system::CheckEra<Runtime>,
+    frame_system::CheckNonce<Runtime>,
+    frame_system::CheckWeight<Runtime>,
+    pallet_transaction_payment::ChargeTransactionPayment<Runtime>,
+);
+/// Executive: handles dispatch to the various modules.
+pub type Executive = frame_executive::Executive<
+    Runtime,
+    Block,
+    frame_system::ChainContext<Runtime>,
+    Runtime,
+    AllPalletsWithSystem,
+>;
 
 // Configure FRAME pallets to include in runtime.
 common_runtime::pallets_config! {
@@ -167,29 +179,6 @@ construct_runtime!(
     }
 );
 
-/// Block type as expected by this runtime.
-pub type Block = sp_runtime::generic::Block<Header, UncheckedExtrinsic>;
-/// Unchecked extrinsic type as expected by this runtime.
-pub type UncheckedExtrinsic = generic::UncheckedExtrinsic<Address, Call, Signature, SignedExtra>;
-/// The SignedExtension to the basic transaction logic.
-pub type SignedExtra = (
-    frame_system::CheckSpecVersion<Runtime>,
-    frame_system::CheckTxVersion<Runtime>,
-    frame_system::CheckGenesis<Runtime>,
-    frame_system::CheckEra<Runtime>,
-    frame_system::CheckNonce<Runtime>,
-    frame_system::CheckWeight<Runtime>,
-    pallet_transaction_payment::ChargeTransactionPayment<Runtime>,
-);
-/// Executive: handles dispatch to the various modules.
-pub type Executive = frame_executive::Executive<
-    Runtime,
-    Block,
-    frame_system::ChainContext<Runtime>,
-    Runtime,
-    AllPalletsWithSystem,
->;
-
 // All of our runtimes share most of their Runtime API implementations.
 // We use a macro to implement this common part and add runtime-specific additional implementations.
 // This macro expands to :
diff --git a/runtime/gdev/src/parameters.rs b/runtime/gdev/src/parameters.rs
index fd3b8fee5..6fd35e057 100644
--- a/runtime/gdev/src/parameters.rs
+++ b/runtime/gdev/src/parameters.rs
@@ -17,8 +17,19 @@
 use common_runtime::constants::*;
 use common_runtime::{Balance, BlockNumber};
 use frame_support::parameter_types;
+use frame_support::weights::constants::WEIGHT_PER_SECOND;
 use sp_arithmetic::Permill;
 
+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 = frame_system::limits::BlockWeights
+        ::with_sensible_defaults(2 * WEIGHT_PER_SECOND, NORMAL_DISPATCH_RATIO);
+    pub BlockLength: frame_system::limits::BlockLength = frame_system::limits::BlockLength
+        ::max_with_normal_ratio(5 * 1024 * 1024, NORMAL_DISPATCH_RATIO);
+    pub const SS58Prefix: u16 = 42;
+}
+
 // Balances
 frame_support::parameter_types! {
     pub const ExistentialDeposit: Balance = 500;
diff --git a/runtime/gtest/Cargo.toml b/runtime/gtest/Cargo.toml
index a45efe501..c102d90fa 100644
--- a/runtime/gtest/Cargo.toml
+++ b/runtime/gtest/Cargo.toml
@@ -47,9 +47,11 @@ std = [
     'pallet-transaction-payment-rpc-runtime-api/std',
     'pallet-transaction-payment/std',
     'common-runtime/std',
+    'common-runtime-except-gdev/std',
     'serde',
     'sp-api/std',
     'sp-arithmetic/std',
+	'sp-authority-discovery/std',
     'sp-block-builder/std',
     'sp-consensus-babe/std',
     'sp-core/std',
@@ -68,6 +70,7 @@ pallet-identity = { path = '../../pallets/identity', default-features = false }
 pallet-ud-accounts-storage = { path = '../../pallets/ud-accounts-storage', default-features = false }
 pallet-universal-dividend = { path = '../../pallets/universal-dividend', default-features = false }
 common-runtime = { path = "../common", default-features = false }
+common-runtime-except-gdev = { path = "../common-except-gdev", default-features = false }
 
 # substrate
 scale-info = { version = "1.0", default-features = false, features = ["derive"] }
diff --git a/runtime/gtest/src/lib.rs b/runtime/gtest/src/lib.rs
index 87a0429f6..d3b0d711e 100644
--- a/runtime/gtest/src/lib.rs
+++ b/runtime/gtest/src/lib.rs
@@ -56,10 +56,7 @@ use pallet_grandpa::fg_primitives;
 use pallet_grandpa::{AuthorityId as GrandpaId, AuthorityList as GrandpaAuthorityList};
 use sp_api::impl_runtime_apis;
 use sp_core::OpaqueMetadata;
-use sp_runtime::traits::{
-    AccountIdLookup, BlakeTwo256, Block as BlockT, ConvertInto, NumberFor, OpaqueKeys,
-};
-use sp_runtime::transaction_validity::TransactionPriority;
+use sp_runtime::traits::{AccountIdLookup, BlakeTwo256, Block as BlockT, NumberFor, OpaqueKeys};
 use sp_runtime::{
     create_runtime_str, generic, impl_opaque_keys,
     transaction_validity::{TransactionSource, TransactionValidity},
@@ -121,101 +118,30 @@ pub fn native_version() -> NativeVersion {
     }
 }
 
-parameter_types! {
-    pub const Version: RuntimeVersion = VERSION;
-    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 = frame_system::limits::BlockWeights
-        ::with_sensible_defaults(2 * WEIGHT_PER_SECOND, NORMAL_DISPATCH_RATIO);
-    pub BlockLength: frame_system::limits::BlockLength = frame_system::limits::BlockLength
-        ::max_with_normal_ratio(5 * 1024 * 1024, NORMAL_DISPATCH_RATIO);
-    pub const SS58Prefix: u16 = 42;
-    pub const UncleGenerations: u32 = 0;
-}
-
-// Configure FRAME pallets to include in runtime.
-common_runtime::pallets_config! {
-    impl pallet_authority_discovery::Config for Runtime {
-        type MaxAuthorities = MaxAuthorities;
-    }
-    impl pallet_authorship::Config for Runtime {
-        type FindAuthor = pallet_session::FindAccountFromAuthorIndex<Self, Babe>;
-        type UncleGenerations = UncleGenerations;
-        type FilterUncle = ();
-        type EventHandler = ImOnline;
-    }
-    impl pallet_babe::Config for Runtime {
-        type EpochDuration = EpochDuration;
-        type ExpectedBlockTime = ExpectedBlockTime;
-
-        // session module is the trigger
-        type EpochChangeTrigger = pallet_babe::ExternalTrigger;
-
-        type DisabledValidators = Session;
-
-        type KeyOwnerProofSystem = Historical;
-
-        type KeyOwnerProof = <Self::KeyOwnerProofSystem 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 WeightInfo = ();
+/// Block type as expected by this runtime.
+pub type Block = sp_runtime::generic::Block<Header, UncheckedExtrinsic>;
+/// Unchecked extrinsic type as expected by this runtime.
+pub type UncheckedExtrinsic = generic::UncheckedExtrinsic<Address, Call, Signature, SignedExtra>;
+/// The SignedExtension to the basic transaction logic.
+pub type SignedExtra = (
+    frame_system::CheckSpecVersion<Runtime>,
+    frame_system::CheckTxVersion<Runtime>,
+    frame_system::CheckGenesis<Runtime>,
+    frame_system::CheckEra<Runtime>,
+    frame_system::CheckNonce<Runtime>,
+    frame_system::CheckWeight<Runtime>,
+    pallet_transaction_payment::ChargeTransactionPayment<Runtime>,
+);
+/// Executive: handles dispatch to the various modules.
+pub type Executive = frame_executive::Executive<
+    Runtime,
+    Block,
+    frame_system::ChainContext<Runtime>,
+    Runtime,
+    AllPalletsWithSystem,
+>;
 
-        type MaxAuthorities = MaxAuthorities;
-    }
-    parameter_types! {
-        pub const ImOnlineUnsignedPriority: TransactionPriority = TransactionPriority::max_value();
-        pub const MaxKeys: u32 = 10_000;
-        pub const MaxPeerInHeartbeats: u32 = 10_000;
-        pub const MaxPeerDataEncodingSize: u32 = 1_000;
-    }
-    impl pallet_im_online::Config for Runtime {
-        type AuthorityId = ImOnlineId;
-        type Event = Event;
-        type ValidatorSet = Historical;
-        type NextSessionRotation = Babe;
-        type ReportUnresponsiveness = Offences;
-        type UnsignedPriority = ImOnlineUnsignedPriority;
-        type WeightInfo = ();
-        type MaxKeys = MaxKeys;
-        type MaxPeerInHeartbeats = MaxPeerInHeartbeats;
-        type MaxPeerDataEncodingSize = MaxPeerDataEncodingSize;
-    }
-    impl pallet_offences::Config for Runtime {
-        type Event = Event;
-        type IdentificationTuple = pallet_session::historical::IdentificationTuple<Self>;
-        type OnOffenceHandler = ();
-    }
-    impl pallet_session::Config for Runtime {
-        type Event = Event;
-        type ValidatorId = AccountId;
-        type ValidatorIdOf = ConvertInto;
-        type ShouldEndSession = Babe;
-        type NextSessionRotation = Babe;
-        type SessionManager = pallet_session::historical::NoteHistoricalRoot<Self, SessionManagerImpl>;
-        type SessionHandler = <opaque::SessionKeys as OpaqueKeys>::KeyTypeIdProviders;
-        type Keys = opaque::SessionKeys;
-        type WeightInfo = ();
-    }
-    impl pallet_session::historical::Config for Runtime {
-        type FullIdentification = ValidatorFullIdentification;
-        type FullIdentificationOf = FullIdentificationOfImpl;
-    }
-    impl pallet_timestamp::Config for Runtime {
-        type Moment = u64;
-        type OnTimestampSet = Babe;
-        type MinimumPeriod = MinimumPeriod;
-        type WeightInfo = ();
-    }
+common_runtime_except_gdev::pallets_config! {
     impl pallet_sudo::Config for Runtime {
         type Event = Event;
         type Call = Call;
@@ -270,29 +196,6 @@ construct_runtime!(
     }
 );
 
-/// Block type as expected by this runtime.
-pub type Block = sp_runtime::generic::Block<Header, UncheckedExtrinsic>;
-/// Unchecked extrinsic type as expected by this runtime.
-pub type UncheckedExtrinsic = generic::UncheckedExtrinsic<Address, Call, Signature, SignedExtra>;
-/// The SignedExtension to the basic transaction logic.
-pub type SignedExtra = (
-    frame_system::CheckSpecVersion<Runtime>,
-    frame_system::CheckTxVersion<Runtime>,
-    frame_system::CheckGenesis<Runtime>,
-    frame_system::CheckEra<Runtime>,
-    frame_system::CheckNonce<Runtime>,
-    frame_system::CheckWeight<Runtime>,
-    pallet_transaction_payment::ChargeTransactionPayment<Runtime>,
-);
-/// Executive: handles dispatch to the various modules.
-pub type Executive = frame_executive::Executive<
-    Runtime,
-    Block,
-    frame_system::ChainContext<Runtime>,
-    Runtime,
-    AllPalletsWithSystem,
->;
-
 impl<C> frame_system::offchain::SendTransactionTypes<C> for Runtime
 where
     Call: From<C>,
@@ -311,63 +214,4 @@ where
 //     // Specific impls provided to the `runtime_apis!` macro.
 // }
 // ```
-common_runtime::runtime_apis! {
-    impl sp_authority_discovery::AuthorityDiscoveryApi<Block> for Runtime {
-        fn authorities() -> Vec<sp_authority_discovery::AuthorityId> {
-            AuthorityDiscovery::authorities()
-        }
-    }
-
-    impl sp_consensus_babe::BabeApi<Block> for Runtime {
-        fn configuration() -> sp_consensus_babe::BabeGenesisConfiguration {
-            // The choice of `c` parameter (where `1 - c` represents the
-            // probability of a slot being empty), is done in accordance to the
-            // slot duration and expected target block time, for safely
-            // resisting network delays of maximum two seconds.
-            // <https://research.web3.foundation/en/latest/polkadot/BABE/Babe/#6-practical-results>
-            sp_consensus_babe::BabeGenesisConfiguration {
-                slot_duration: Babe::slot_duration(),
-                epoch_length: EpochDuration::get(),
-                c: BABE_GENESIS_EPOCH_CONFIG.c,
-                genesis_authorities: Babe::authorities().to_vec(),
-                randomness: Babe::randomness(),
-                allowed_slots: BABE_GENESIS_EPOCH_CONFIG.allowed_slots,
-            }
-        }
-
-        fn current_epoch_start() -> sp_consensus_babe::Slot {
-            Babe::current_epoch_start()
-        }
-
-        fn current_epoch() -> sp_consensus_babe::Epoch {
-            Babe::current_epoch()
-        }
-
-        fn next_epoch() -> sp_consensus_babe::Epoch {
-            Babe::next_epoch()
-        }
-
-        fn generate_key_ownership_proof(
-            _slot: sp_consensus_babe::Slot,
-            authority_id: sp_consensus_babe::AuthorityId,
-        ) -> Option<sp_consensus_babe::OpaqueKeyOwnershipProof> {
-            use codec::Encode;
-
-            Historical::prove((sp_consensus_babe::KEY_TYPE, authority_id))
-                .map(|p| p.encode())
-                .map(sp_consensus_babe::OpaqueKeyOwnershipProof::new)
-        }
-
-        fn submit_report_equivocation_unsigned_extrinsic(
-            equivocation_proof: sp_consensus_babe::EquivocationProof<<Block as BlockT>::Header>,
-            key_owner_proof: sp_consensus_babe::OpaqueKeyOwnershipProof,
-        ) -> Option<()> {
-            let key_owner_proof = key_owner_proof.decode()?;
-
-            Babe::submit_unsigned_equivocation_report(
-                equivocation_proof,
-                key_owner_proof,
-            )
-        }
-    }
-}
+common_runtime_except_gdev::runtime_apis! {}
diff --git a/runtime/gtest/src/parameters.rs b/runtime/gtest/src/parameters.rs
index b10456344..10abeb8ee 100644
--- a/runtime/gtest/src/parameters.rs
+++ b/runtime/gtest/src/parameters.rs
@@ -17,7 +17,24 @@
 use common_runtime::constants::*;
 use common_runtime::{Balance, BlockNumber};
 use frame_support::parameter_types;
+use frame_support::weights::constants::WEIGHT_PER_SECOND;
 use sp_arithmetic::Permill;
+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 = frame_system::limits::BlockWeights
+        ::with_sensible_defaults(2 * WEIGHT_PER_SECOND, NORMAL_DISPATCH_RATIO);
+    pub BlockLength: frame_system::limits::BlockLength = frame_system::limits::BlockLength
+        ::max_with_normal_ratio(5 * 1024 * 1024, NORMAL_DISPATCH_RATIO);
+    pub const SS58Prefix: u16 = 42;
+    pub const UncleGenerations: u32 = 0;
+}
+
+/*************/
+/* CONSENSUS */
+/*************/
 
 // Authority discovery
 parameter_types! {
@@ -37,6 +54,18 @@ parameter_types! {
     pub const ReportLongevity: u64 = 168 * EpochDuration::get();
 }
 
+// ImOnline
+parameter_types! {
+    pub const ImOnlineUnsignedPriority: TransactionPriority = TransactionPriority::max_value();
+    pub const MaxKeys: u32 = 10_000;
+    pub const MaxPeerInHeartbeats: u32 = 10_000;
+    pub const MaxPeerDataEncodingSize: u32 = 1_000;
+}
+
+/*********/
+/* MONEY */
+/*********/
+
 // Balances
 frame_support::parameter_types! {
     pub const ExistentialDeposit: Balance = 500;
@@ -48,6 +77,20 @@ frame_support::parameter_types! {
     pub const TransactionByteFee: Balance = 0;
 }
 
+// Universal dividend
+parameter_types! {
+    // 0.002_381_440 = 0.0488^2
+    pub const SquareMoneyGrowthRate: Permill = Permill::from_parts(2_381_440);
+    pub const UdCreationPeriod: BlockNumber = DAYS;
+    pub const UdFirstReeval: BlockNumber = 2 * DAYS;
+    pub const UdReevalPeriod: Balance = 7;
+    pub const UdReevalPeriodInBlocks: BlockNumber = 100800; // 86400 *7 / 6
+}
+
+/*******/
+/* WOT */
+/*******/
+
 // Identity
 pub const IDTY_CREATE_PERIOD: BlockNumber = 100;
 frame_support::parameter_types! {
@@ -68,15 +111,6 @@ parameter_types! {
     pub const ValidityPeriod: BlockNumber = 146 * DAYS;
 }
 
-// Universal dividend
-parameter_types! {
-    pub const SquareMoneyGrowthRate: Permill = Permill::from_parts(2_381_440); // 0.002_381_440 = 0.0488^2
-    pub const UdCreationPeriod: BlockNumber = DAYS;
-    pub const UdFirstReeval: BlockNumber = 2 * DAYS;
-    pub const UdReevalPeriod: Balance = 7;
-    pub const UdReevalPeriodInBlocks: BlockNumber = 100800; // 86400 *7 / 6
-}
-
 // Multisig
 parameter_types! {
     pub const DepositBase: Balance = 1000;
-- 
GitLab