From cd90016a5d1a13a7d99b194ae465500dbb7bad3a Mon Sep 17 00:00:00 2001
From: bgallois <benjamin@gallois.cc>
Date: Thu, 18 Jan 2024 17:58:55 +0100
Subject: [PATCH] fix all pallets tests

---
 Cargo.lock                             |  3 ++
 pallets/authority-members/Cargo.toml   |  4 +++
 pallets/authority-members/src/mock.rs  | 35 +++++++++--------------
 pallets/certification/src/mock.rs      | 21 +++++---------
 pallets/distance/src/mock.rs           | 39 ++++++++++++--------------
 pallets/duniter-account/Cargo.toml     |  3 +-
 pallets/duniter-wot/Cargo.toml         |  4 +++
 pallets/duniter-wot/src/mock.rs        | 33 ++++++++++------------
 pallets/identity/Cargo.toml            |  1 +
 pallets/identity/src/mock.rs           | 27 ++++++++----------
 pallets/membership/src/mock.rs         | 20 +++++--------
 pallets/offences/src/mock.rs           | 23 ++++++---------
 pallets/oneshot-account/Cargo.toml     |  1 +
 pallets/oneshot-account/src/mock.rs    | 27 ++++++++----------
 pallets/quota/src/mock.rs              | 27 ++++++++----------
 pallets/smith-members/src/mock.rs      | 20 +++++--------
 pallets/universal-dividend/src/mock.rs | 24 +++++++---------
 17 files changed, 137 insertions(+), 175 deletions(-)

diff --git a/Cargo.lock b/Cargo.lock
index df99173ba..aab224f96 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -6234,6 +6234,7 @@ dependencies = [
  "sp-membership",
  "sp-runtime 24.0.0",
  "sp-staking",
+ "sp-state-machine 0.28.0",
  "sp-std 8.0.0 (git+https://github.com/bgallois/duniter-polkadot-sdk?branch=duniter-v1.6.0)",
 ]
 
@@ -6418,6 +6419,7 @@ dependencies = [
  "sp-io 23.0.0",
  "sp-membership",
  "sp-runtime 24.0.0",
+ "sp-state-machine 0.28.0",
  "sp-std 8.0.0 (git+https://github.com/bgallois/duniter-polkadot-sdk?branch=duniter-v1.6.0)",
 ]
 
@@ -6459,6 +6461,7 @@ dependencies = [
  "sp-io 23.0.0",
  "sp-keystore 0.27.0",
  "sp-runtime 24.0.0",
+ "sp-state-machine 0.28.0",
  "sp-std 8.0.0 (git+https://github.com/bgallois/duniter-polkadot-sdk?branch=duniter-v1.6.0)",
 ]
 
diff --git a/pallets/authority-members/Cargo.toml b/pallets/authority-members/Cargo.toml
index cd3731cec..981bc00d6 100644
--- a/pallets/authority-members/Cargo.toml
+++ b/pallets/authority-members/Cargo.toml
@@ -109,3 +109,7 @@ version = '1.0.119'
 [dev-dependencies.sp-io]
 git = 'https://github.com/bgallois/duniter-polkadot-sdk'
 branch = 'duniter-v1.6.0'
+
+[dev-dependencies.sp-state-machine]
+git = 'https://github.com/bgallois/duniter-polkadot-sdk'
+branch = 'duniter-v1.6.0'
diff --git a/pallets/authority-members/src/mock.rs b/pallets/authority-members/src/mock.rs
index 4c818534a..01498945a 100644
--- a/pallets/authority-members/src/mock.rs
+++ b/pallets/authority-members/src/mock.rs
@@ -16,28 +16,24 @@
 
 use super::*;
 use crate::{self as pallet_authority_members};
-use frame_support::{
-    pallet_prelude::*,
-    parameter_types,
-    traits::{Everything, GenesisBuild},
-    BasicExternalities,
-};
+use frame_support::{pallet_prelude::*, parameter_types, traits::Everything};
 use frame_system as system;
 use pallet_offences::traits::OnOffenceHandler;
 use pallet_offences::SlashStrategy;
 use pallet_session::ShouldEndSession;
 use sp_core::{crypto::key_types::DUMMY, H256};
+use sp_runtime::BuildStorage;
 use sp_runtime::{
     impl_opaque_keys,
-    testing::{Header, UintAuthorityId},
+    testing::UintAuthorityId,
     traits::{BlakeTwo256, ConvertInto, IdentityLookup, IsMember, OpaqueKeys},
     KeyTypeId,
 };
 use sp_staking::offence::OffenceDetails;
+use sp_state_machine::BasicExternalities;
 
 type AccountId = u64;
 type Block = frame_system::mocking::MockBlock<Test>;
-type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>;
 
 impl_opaque_keys! {
     pub struct MockSessionKeys {
@@ -53,14 +49,11 @@ impl From<UintAuthorityId> for MockSessionKeys {
 
 // Configure a mock runtime to test the pallet.
 frame_support::construct_runtime!(
-    pub enum Test where
-        Block = Block,
-        NodeBlock = Block,
-        UncheckedExtrinsic = UncheckedExtrinsic,
+    pub enum Test
     {
-        System: frame_system::{Pallet, Call, Config, Storage, Event<T>},
-        Session: pallet_session::{Pallet, Call, Storage, Config<T>, Event},
-        AuthorityMembers: pallet_authority_members::{Pallet, Call, Storage, Config<T>, Event<T>},
+        System: frame_system,
+        Session: pallet_session,
+        AuthorityMembers: pallet_authority_members,
     }
 );
 
@@ -73,16 +66,14 @@ impl system::Config for Test {
     type BaseCallFilter = Everything;
     type BlockWeights = ();
     type BlockLength = ();
+    type Block = Block;
     type DbWeight = ();
     type RuntimeOrigin = RuntimeOrigin;
     type RuntimeCall = RuntimeCall;
-    type Index = u64;
-    type BlockNumber = u64;
     type Hash = H256;
     type Hashing = BlakeTwo256;
     type AccountId = AccountId;
     type Lookup = IdentityLookup<Self::AccountId>;
-    type Header = Header;
     type RuntimeEvent = RuntimeEvent;
     type BlockHashCount = BlockHashCount;
     type Version = ();
@@ -94,6 +85,8 @@ impl system::Config for Test {
     type SS58Prefix = SS58Prefix;
     type OnSetCode = ();
     type MaxConsumers = frame_support::traits::ConstU32<16>;
+    type RuntimeTask = ();
+    type Nonce = u64;
 }
 
 pub struct TestSessionHandler;
@@ -172,10 +165,10 @@ pub fn new_test_ext(initial_authorities_len: u64) -> sp_io::TestExternalities {
         .map(|i| (i * 3, i * 3, UintAuthorityId(i * 3).into()))
         .collect();
 
-    let mut t = frame_system::GenesisConfig::default()
-        .build_storage::<Test>()
+    let mut t = frame_system::GenesisConfig::<Test>::default()
+        .build_storage()
         .unwrap();
-    BasicExternalities::execute_with_storage(&mut t, || {
+    BasicExternalities::build_storage(&mut t, || {
         for (ref k, ..) in &keys {
             frame_system::Pallet::<Test>::inc_providers(k);
         }
diff --git a/pallets/certification/src/mock.rs b/pallets/certification/src/mock.rs
index 6d730c280..033800b34 100644
--- a/pallets/certification/src/mock.rs
+++ b/pallets/certification/src/mock.rs
@@ -22,26 +22,19 @@ use frame_support::{
 use frame_system as system;
 use sp_core::H256;
 use sp_runtime::{
-    testing::Header,
     traits::{BlakeTwo256, IdentityLookup},
     BuildStorage,
 };
 
 type AccountId = u64;
-type BlockNumber = u64;
 type Block = frame_system::mocking::MockBlock<Test>;
 pub type IdtyIndex = u64;
-type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>;
 
 // Configure a mock runtime to test the pallet.
 frame_support::construct_runtime!(
-    pub enum Test where
-        Block = Block,
-        NodeBlock = Block,
-        UncheckedExtrinsic = UncheckedExtrinsic,
-    {
-        System: frame_system::{Pallet, Call, Config, Storage, Event<T>},
-        DefaultCertification: pallet_certification::{Pallet, Call, Event<T>, Storage, Config<T>},
+    pub enum Test {
+        System: frame_system,
+        DefaultCertification: pallet_certification,
     }
 );
 
@@ -54,16 +47,14 @@ impl system::Config for Test {
     type BaseCallFilter = Everything;
     type BlockWeights = ();
     type BlockLength = ();
+    type Block = Block;
     type DbWeight = ();
     type RuntimeOrigin = RuntimeOrigin;
     type RuntimeCall = RuntimeCall;
-    type Index = u64;
-    type BlockNumber = BlockNumber;
     type Hash = H256;
     type Hashing = BlakeTwo256;
     type AccountId = AccountId;
     type Lookup = IdentityLookup<Self::AccountId>;
-    type Header = Header;
     type RuntimeEvent = RuntimeEvent;
     type BlockHashCount = BlockHashCount;
     type Version = ();
@@ -75,6 +66,8 @@ impl system::Config for Test {
     type SS58Prefix = SS58Prefix;
     type OnSetCode = ();
     type MaxConsumers = frame_support::traits::ConstU32<16>;
+    type RuntimeTask = ();
+    type Nonce = u64;
 }
 
 parameter_types! {
@@ -102,7 +95,7 @@ impl pallet_certification::Config for Test {
 pub fn new_test_ext(
     gen_conf: pallet_certification::GenesisConfig<Test>,
 ) -> sp_io::TestExternalities {
-    GenesisConfig {
+    RuntimeGenesisConfig {
         system: SystemConfig::default(),
         default_certification: gen_conf,
     }
diff --git a/pallets/distance/src/mock.rs b/pallets/distance/src/mock.rs
index 6861b3c43..d56212bd7 100644
--- a/pallets/distance/src/mock.rs
+++ b/pallets/distance/src/mock.rs
@@ -19,23 +19,23 @@ use crate::{self as pallet_distance};
 use core::marker::PhantomData;
 use frame_support::{
     parameter_types,
-    traits::{Everything, GenesisBuild, OnFinalize, OnInitialize},
+    traits::{Everything, OnFinalize, OnInitialize},
 };
 use frame_system as system;
 use pallet_balances::AccountData;
 use pallet_session::ShouldEndSession;
 use sp_core::{ConstU32, H256};
+use sp_runtime::BuildStorage;
 use sp_runtime::{
     impl_opaque_keys,
     key_types::DUMMY,
-    testing::{Header, TestSignature, UintAuthorityId},
+    testing::{TestSignature, UintAuthorityId},
     traits::{BlakeTwo256, ConvertInto, IdentityLookup, IsMember, OpaqueKeys},
     KeyTypeId, Perbill,
 };
 
 type Balance = u64;
 type Block = frame_system::mocking::MockBlock<Test>;
-type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>;
 pub type AccountId = u64;
 
 impl_opaque_keys! {
@@ -52,18 +52,14 @@ impl From<UintAuthorityId> for MockSessionKeys {
 
 // Configure a mock runtime to test the pallet.
 frame_support::construct_runtime!(
-    pub enum Test where
-        Block = Block,
-        NodeBlock = Block,
-        UncheckedExtrinsic = UncheckedExtrinsic,
-    {
-        System: frame_system::{Pallet, Call, Config, Storage, Event<T>},
-        Session: pallet_session::{Pallet, Call, Storage, Config<T>, Event},
-        Authorship: pallet_authorship::{Pallet, Storage},
-        AuthorityMembers: pallet_authority_members::{Pallet, Call, Storage, Config<T>, Event<T>},
-        Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>},
-        Identity: pallet_identity::{Pallet, Call, Storage, Config<T>, Event<T>},
-        Distance: pallet_distance::{Pallet, Call, Storage, Event<T>},
+    pub enum Test    {
+        System: frame_system,
+        Session: pallet_session,
+        Authorship: pallet_authorship,
+        AuthorityMembers: pallet_authority_members,
+        Balances: pallet_balances,
+        Identity: pallet_identity,
+        Distance: pallet_distance,
     }
 );
 
@@ -76,16 +72,14 @@ impl system::Config for Test {
     type BaseCallFilter = Everything;
     type BlockWeights = ();
     type BlockLength = ();
+    type Block = Block;
     type DbWeight = ();
     type RuntimeOrigin = RuntimeOrigin;
     type RuntimeCall = RuntimeCall;
-    type Index = u64;
-    type BlockNumber = u64;
     type Hash = H256;
     type Hashing = BlakeTwo256;
     type AccountId = AccountId;
     type Lookup = IdentityLookup<Self::AccountId>;
-    type Header = Header;
     type RuntimeEvent = RuntimeEvent;
     type BlockHashCount = BlockHashCount;
     type Version = ();
@@ -97,6 +91,8 @@ impl system::Config for Test {
     type SS58Prefix = SS58Prefix;
     type OnSetCode = ();
     type MaxConsumers = frame_support::traits::ConstU32<16>;
+    type RuntimeTask = ();
+    type Nonce = u64;
 }
 
 pub struct TestSessionHandler;
@@ -207,10 +203,11 @@ impl pallet_balances::Config for Test {
     type MaxReserves = ();
     type ReserveIdentifier = [u8; 8];
     type RuntimeEvent = RuntimeEvent;
-    type HoldIdentifier = ();
     type FreezeIdentifier = ();
     type MaxHolds = ConstU32<0>;
     type MaxFreezes = ConstU32<0>;
+    type RuntimeHoldReason = ();
+    type RuntimeFreezeReason = ();
 }
 
 parameter_types! {
@@ -265,8 +262,8 @@ impl pallet_distance::Config for Test {
 // Build genesis storage according to the mock runtime.
 #[allow(dead_code)] // ??? Clippy triggers dead code for new_test_ext while it is used during test benchmark
 pub fn new_test_ext() -> sp_io::TestExternalities {
-    let mut t = frame_system::GenesisConfig::default()
-        .build_storage::<Test>()
+    let mut t = frame_system::GenesisConfig::<Test>::default()
+        .build_storage()
         .unwrap();
 
     pub const NAMES: [&str; 6] = ["Alice", "Bob", "Charlie", "Dave", "Eve", "Ferdie"];
diff --git a/pallets/duniter-account/Cargo.toml b/pallets/duniter-account/Cargo.toml
index d6625d274..6d565548d 100644
--- a/pallets/duniter-account/Cargo.toml
+++ b/pallets/duniter-account/Cargo.toml
@@ -20,6 +20,7 @@ std = [
     'frame-system/std',
     'frame-benchmarking/std',
     'pallet-balances/std',
+    'pallet-identity/std',
     'pallet-provide-randomness/std',
     'pallet-treasury/std',
     'serde',
@@ -117,4 +118,4 @@ version = '1.0.119'
 
 [dev-dependencies.sp-io]
 git = 'https://github.com/bgallois/duniter-polkadot-sdk'
-branch = 'duniter-v1.6.0'
\ No newline at end of file
+branch = 'duniter-v1.6.0'
diff --git a/pallets/duniter-wot/Cargo.toml b/pallets/duniter-wot/Cargo.toml
index 20d134b33..d4dcaa649 100644
--- a/pallets/duniter-wot/Cargo.toml
+++ b/pallets/duniter-wot/Cargo.toml
@@ -101,3 +101,7 @@ version = '1.0.119'
 [dev-dependencies.sp-io]
 git = 'https://github.com/bgallois/duniter-polkadot-sdk'
 branch = 'duniter-v1.6.0'
+
+[dev-dependencies.sp-state-machine]
+git = 'https://github.com/bgallois/duniter-polkadot-sdk'
+branch = 'duniter-v1.6.0'
diff --git a/pallets/duniter-wot/src/mock.rs b/pallets/duniter-wot/src/mock.rs
index 3ecb6c233..3ac80658c 100644
--- a/pallets/duniter-wot/src/mock.rs
+++ b/pallets/duniter-wot/src/mock.rs
@@ -19,15 +19,16 @@ use crate::{self as pallet_duniter_wot};
 use frame_support::{parameter_types, traits::Everything};
 use frame_system as system;
 use sp_core::H256;
+use sp_runtime::BuildStorage;
 use sp_runtime::{
-    testing::{Header, TestSignature, UintAuthorityId},
+    testing::{TestSignature, UintAuthorityId},
     traits::{BlakeTwo256, IdentityLookup},
 };
+use sp_state_machine::BasicExternalities;
 use std::collections::BTreeMap;
 
 type AccountId = u64;
 type Block = frame_system::mocking::MockBlock<Test>;
-type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>;
 
 pub struct IdentityIndexOf<T: pallet_identity::Config>(PhantomData<T>);
 impl<T: pallet_identity::Config> sp_runtime::traits::Convert<T::AccountId, Option<T::IdtyIndex>>
@@ -40,16 +41,12 @@ impl<T: pallet_identity::Config> sp_runtime::traits::Convert<T::AccountId, Optio
 
 // Configure a mock runtime to test the pallet.
 frame_support::construct_runtime!(
-    pub enum Test where
-        Block = Block,
-        NodeBlock = Block,
-        UncheckedExtrinsic = UncheckedExtrinsic,
-    {
-        System: frame_system::{Pallet, Call, Config, Storage, Event<T>},
-        DuniterWot: pallet_duniter_wot::{Pallet},
-        Identity: pallet_identity::{Pallet, Call, Config<T>, Storage, Event<T>},
-        Membership: pallet_membership::{Pallet, Config<T>, Storage, Event<T>},
-        Cert: pallet_certification::{Pallet, Call, Config<T>, Storage, Event<T>},
+    pub enum Test {
+        System: frame_system,
+        DuniterWot: pallet_duniter_wot,
+        Identity: pallet_identity,
+        Membership: pallet_membership,
+        Cert: pallet_certification,
     }
 );
 
@@ -64,15 +61,13 @@ impl system::Config for Test {
     type BlockWeights = ();
     type BlockLength = ();
     type DbWeight = ();
+    type Block = Block;
     type RuntimeOrigin = RuntimeOrigin;
     type RuntimeCall = RuntimeCall;
-    type Index = u64;
-    type BlockNumber = u64;
     type Hash = H256;
     type Hashing = BlakeTwo256;
     type AccountId = AccountId;
     type Lookup = IdentityLookup<Self::AccountId>;
-    type Header = Header;
     type RuntimeEvent = RuntimeEvent;
     type BlockHashCount = BlockHashCount;
     type Version = ();
@@ -84,6 +79,8 @@ impl system::Config for Test {
     type SS58Prefix = SS58Prefix;
     type OnSetCode = ();
     type MaxConsumers = frame_support::traits::ConstU32<16>;
+    type RuntimeTask = ();
+    type Nonce = u64;
 }
 
 // DuniterWot
@@ -181,8 +178,8 @@ pub const NAMES: [&str; 6] = ["Alice", "Bob", "Charlie", "Dave", "Eve", "Ferdie"
 
 // Build genesis storage according to the mock runtime.
 pub fn new_test_ext(initial_identities_len: usize) -> sp_io::TestExternalities {
-    let mut t = frame_system::GenesisConfig::default()
-        .build_storage::<Test>()
+    let mut t = frame_system::GenesisConfig::<Test>::default()
+        .build_storage()
         .unwrap();
 
     pallet_identity::GenesisConfig::<Test> {
@@ -226,7 +223,7 @@ pub fn new_test_ext(initial_identities_len: usize) -> sp_io::TestExternalities {
     .assimilate_storage(&mut t)
     .unwrap();
 
-    frame_support::BasicExternalities::execute_with_storage(&mut t, || {
+    BasicExternalities::execute_with_storage(&mut t, || {
         // manually increment genesis identities sufficient counter
         // In real world, this is done by pallet-identity
         for i in 1..=initial_identities_len {
diff --git a/pallets/identity/Cargo.toml b/pallets/identity/Cargo.toml
index 3ec1233c7..a9b44f3e8 100644
--- a/pallets/identity/Cargo.toml
+++ b/pallets/identity/Cargo.toml
@@ -77,3 +77,4 @@ branch = 'duniter-v1.6.0'
 serde = { version = "1", features = ["derive"] }
 sp-io = { git = 'https://github.com/bgallois/duniter-polkadot-sdk', branch = 'duniter-v1.6.0' }
 sp-keystore = { git = 'https://github.com/bgallois/duniter-polkadot-sdk', branch = 'duniter-v1.6.0' }
+sp-state-machine = { git = 'https://github.com/bgallois/duniter-polkadot-sdk', branch = 'duniter-v1.6.0' }
diff --git a/pallets/identity/src/mock.rs b/pallets/identity/src/mock.rs
index 59242164b..2458ca8f0 100644
--- a/pallets/identity/src/mock.rs
+++ b/pallets/identity/src/mock.rs
@@ -18,20 +18,20 @@ use super::*;
 use crate::{self as pallet_identity};
 use frame_support::{
     parameter_types,
-    traits::{Everything, GenesisBuild, OnFinalize, OnInitialize},
+    traits::{Everything, OnFinalize, OnInitialize},
 };
 use frame_system as system;
 use sp_core::{Pair, H256};
 use sp_keystore::{testing::MemoryKeystore, KeystoreExt};
+use sp_runtime::BuildStorage;
 use sp_runtime::{
-    testing::Header,
     traits::{BlakeTwo256, IdentityLookup},
     MultiSignature, MultiSigner,
 };
+use sp_state_machine::BasicExternalities;
 use std::sync::Arc;
 
 type Block = frame_system::mocking::MockBlock<Test>;
-type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>;
 pub type Signature = MultiSignature;
 pub type AccountPublic = <Signature as Verify>::Signer;
 pub type AccountId = <AccountPublic as IdentifyAccount>::AccountId;
@@ -43,13 +43,10 @@ fn account(id: u8) -> AccountId {
 
 // Configure a mock runtime to test the pallet.
 frame_support::construct_runtime!(
-    pub enum Test where
-        Block = Block,
-        NodeBlock = Block,
-        UncheckedExtrinsic = UncheckedExtrinsic,
+    pub enum Test
     {
-        System: frame_system::{Pallet, Call, Config, Storage, Event<T>},
-        Identity: pallet_identity::{Pallet, Call, Storage, Config<T>, Event<T>},
+        System: frame_system,
+        Identity: pallet_identity,
     }
 );
 
@@ -63,15 +60,13 @@ impl system::Config for Test {
     type BlockWeights = ();
     type BlockLength = ();
     type DbWeight = ();
+    type Block = Block;
     type RuntimeOrigin = RuntimeOrigin;
     type RuntimeCall = RuntimeCall;
-    type Index = u64;
-    type BlockNumber = u64;
     type Hash = H256;
     type Hashing = BlakeTwo256;
     type AccountId = AccountId;
     type Lookup = IdentityLookup<Self::AccountId>;
-    type Header = Header;
     type RuntimeEvent = RuntimeEvent;
     type BlockHashCount = BlockHashCount;
     type Version = ();
@@ -83,6 +78,8 @@ impl system::Config for Test {
     type SS58Prefix = SS58Prefix;
     type OnSetCode = ();
     type MaxConsumers = frame_support::traits::ConstU32<16>;
+    type RuntimeTask = ();
+    type Nonce = u64;
 }
 
 parameter_types! {
@@ -122,13 +119,13 @@ impl pallet_identity::Config for Test {
 
 // Build genesis storage according to the mock runtime.
 pub fn new_test_ext(gen_conf: pallet_identity::GenesisConfig<Test>) -> sp_io::TestExternalities {
-    let mut t = frame_system::GenesisConfig::default()
-        .build_storage::<Test>()
+    let mut t = frame_system::GenesisConfig::<Test>::default()
+        .build_storage()
         .unwrap();
 
     gen_conf.assimilate_storage(&mut t).unwrap();
 
-    frame_support::BasicExternalities::execute_with_storage(&mut t, || {
+    BasicExternalities::execute_with_storage(&mut t, || {
         frame_system::Pallet::<Test>::inc_providers(&account(2));
         frame_system::Pallet::<Test>::inc_providers(&account(3));
     });
diff --git a/pallets/membership/src/mock.rs b/pallets/membership/src/mock.rs
index f19769127..0815a5dd4 100644
--- a/pallets/membership/src/mock.rs
+++ b/pallets/membership/src/mock.rs
@@ -22,7 +22,6 @@ use frame_support::{
 use frame_system as system;
 use sp_core::H256;
 use sp_runtime::{
-    testing::Header,
     traits::{BlakeTwo256, ConvertInto, IdentityLookup},
     BuildStorage,
 };
@@ -31,17 +30,12 @@ type AccountId = u64;
 type BlockNumber = u64;
 type Block = frame_system::mocking::MockBlock<Test>;
 pub type IdtyId = u64;
-type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>;
 
 // Configure a mock runtime to test the pallet.
 frame_support::construct_runtime!(
-    pub enum Test where
-        Block = Block,
-        NodeBlock = Block,
-        UncheckedExtrinsic = UncheckedExtrinsic,
-    {
-        System: frame_system::{Pallet, Call, Config, Storage, Event<T>},
-        Membership: pallet_membership::{Pallet, Event<T>, Storage, Config<T>},
+    pub enum Test{
+        System: frame_system,
+        Membership: pallet_membership,
     }
 );
 
@@ -55,15 +49,13 @@ impl system::Config for Test {
     type BlockWeights = ();
     type BlockLength = ();
     type DbWeight = ();
+    type Block = Block;
     type RuntimeOrigin = RuntimeOrigin;
     type RuntimeCall = RuntimeCall;
-    type Index = u64;
-    type BlockNumber = BlockNumber;
     type Hash = H256;
     type Hashing = BlakeTwo256;
     type AccountId = AccountId;
     type Lookup = IdentityLookup<Self::AccountId>;
-    type Header = Header;
     type RuntimeEvent = RuntimeEvent;
     type BlockHashCount = BlockHashCount;
     type Version = ();
@@ -75,6 +67,8 @@ impl system::Config for Test {
     type SS58Prefix = SS58Prefix;
     type OnSetCode = ();
     type MaxConsumers = frame_support::traits::ConstU32<16>;
+    type RuntimeTask = ();
+    type Nonce = u64;
 }
 
 parameter_types! {
@@ -98,7 +92,7 @@ impl pallet_membership::Config for Test {
 
 // Build genesis storage according to the mock runtime.
 pub fn new_test_ext(gen_conf: pallet_membership::GenesisConfig<Test>) -> sp_io::TestExternalities {
-    GenesisConfig {
+    RuntimeGenesisConfig {
         system: SystemConfig::default(),
         membership: gen_conf,
     }
diff --git a/pallets/offences/src/mock.rs b/pallets/offences/src/mock.rs
index 57f8e7399..839b18851 100644
--- a/pallets/offences/src/mock.rs
+++ b/pallets/offences/src/mock.rs
@@ -25,8 +25,8 @@ use frame_support::{
     weights::{constants::RocksDbWeight, Weight},
 };
 use sp_core::H256;
+use sp_runtime::BuildStorage;
 use sp_runtime::{
-    testing::Header,
     traits::{BlakeTwo256, IdentityLookup},
     Perbill,
 };
@@ -54,17 +54,12 @@ impl<Reporter, Offender> pallet_offences::OnOffenceHandler<Reporter, Offender, W
     }
 }
 
-type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Runtime>;
 type Block = frame_system::mocking::MockBlock<Runtime>;
 
 frame_support::construct_runtime!(
-    pub struct Runtime where
-        Block = Block,
-        NodeBlock = Block,
-        UncheckedExtrinsic = UncheckedExtrinsic,
-    {
-        System: frame_system::{Pallet, Call, Config, Storage, Event<T>},
-        Offences: pallet_offences::{Pallet, Storage, Event},
+    pub struct Runtime {
+        System: frame_system,
+        Offences: pallet_offences,
     }
 );
 
@@ -74,14 +69,12 @@ impl frame_system::Config for Runtime {
     type BlockLength = ();
     type DbWeight = RocksDbWeight;
     type RuntimeOrigin = RuntimeOrigin;
-    type Index = u64;
-    type BlockNumber = u64;
+    type Block = Block;
     type RuntimeCall = RuntimeCall;
     type Hash = H256;
     type Hashing = BlakeTwo256;
     type AccountId = u64;
     type Lookup = IdentityLookup<Self::AccountId>;
-    type Header = Header;
     type RuntimeEvent = RuntimeEvent;
     type BlockHashCount = ConstU64<250>;
     type Version = ();
@@ -93,6 +86,8 @@ impl frame_system::Config for Runtime {
     type SS58Prefix = ();
     type OnSetCode = ();
     type MaxConsumers = ConstU32<16>;
+    type RuntimeTask = ();
+    type Nonce = u64;
 }
 
 impl Config for Runtime {
@@ -102,8 +97,8 @@ impl Config for Runtime {
 }
 
 pub fn new_test_ext() -> sp_io::TestExternalities {
-    let t = frame_system::GenesisConfig::default()
-        .build_storage::<Runtime>()
+    let t = frame_system::GenesisConfig::<Runtime>::default()
+        .build_storage()
         .unwrap();
     let mut ext = sp_io::TestExternalities::new(t);
     ext.execute_with(|| System::set_block_number(1));
diff --git a/pallets/oneshot-account/Cargo.toml b/pallets/oneshot-account/Cargo.toml
index a8f4e78ad..3989beeb2 100644
--- a/pallets/oneshot-account/Cargo.toml
+++ b/pallets/oneshot-account/Cargo.toml
@@ -24,6 +24,7 @@ std = [
     'sp-io/std',
     'sp-runtime/std',
     'sp-std/std',
+    'pallet-transaction-payment/std',
 ]
 try-runtime = ['frame-support/try-runtime']
 
diff --git a/pallets/oneshot-account/src/mock.rs b/pallets/oneshot-account/src/mock.rs
index 4353000ad..beee56bdc 100644
--- a/pallets/oneshot-account/src/mock.rs
+++ b/pallets/oneshot-account/src/mock.rs
@@ -20,27 +20,22 @@ use frame_system as system;
 use pallet_transaction_payment::CurrencyAdapter;
 use sp_core::{ConstU32, H256};
 use sp_runtime::{
-    testing::Header,
     traits::{BlakeTwo256, IdentityLookup},
     BuildStorage,
 };
 use sp_std::convert::{TryFrom, TryInto};
 
 type Balance = u64;
-type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>;
 type Block = frame_system::mocking::MockBlock<Test>;
 
 // Configure a mock runtime to test the pallet.
 frame_support::construct_runtime!(
-    pub enum Test where
-        Block = Block,
-        NodeBlock = Block,
-        UncheckedExtrinsic = UncheckedExtrinsic,
+    pub enum Test
     {
-        System: frame_system::{Pallet, Call, Config, Storage, Event<T>},
-        Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>},
-        TransactionPayment: pallet_transaction_payment::{Pallet, Storage, Event<T>},
-        OneshotAccount: pallet_oneshot_account::{Pallet, Call, Storage, Event<T>},
+        System: frame_system,
+        Balances: pallet_balances,
+        TransactionPayment: pallet_transaction_payment,
+        OneshotAccount: pallet_oneshot_account,
     }
 );
 
@@ -53,16 +48,14 @@ impl system::Config for Test {
     type BaseCallFilter = Everything;
     type BlockWeights = ();
     type BlockLength = ();
+    type Block = Block;
     type DbWeight = ();
     type RuntimeOrigin = RuntimeOrigin;
     type RuntimeCall = RuntimeCall;
-    type Index = u64;
-    type BlockNumber = u64;
     type Hash = H256;
     type Hashing = BlakeTwo256;
     type AccountId = u64;
     type Lookup = IdentityLookup<Self::AccountId>;
-    type Header = Header;
     type RuntimeEvent = RuntimeEvent;
     type BlockHashCount = BlockHashCount;
     type Version = ();
@@ -74,6 +67,8 @@ impl system::Config for Test {
     type SS58Prefix = SS58Prefix;
     type OnSetCode = ();
     type MaxConsumers = frame_support::traits::ConstU32<16>;
+    type RuntimeTask = ();
+    type Nonce = u64;
 }
 
 parameter_types! {
@@ -91,10 +86,11 @@ impl pallet_balances::Config for Test {
     type MaxReserves = ();
     type ReserveIdentifier = [u8; 8];
     type RuntimeEvent = RuntimeEvent;
-    type HoldIdentifier = ();
     type FreezeIdentifier = ();
     type MaxHolds = ConstU32<0>;
     type MaxFreezes = ConstU32<0>;
+    type RuntimeHoldReason = ();
+    type RuntimeFreezeReason = ();
 }
 impl pallet_transaction_payment::Config for Test {
     type RuntimeEvent = RuntimeEvent;
@@ -120,9 +116,10 @@ impl frame_support::traits::OnUnbalanced<NegativeImbalance> for HandleFees {
 // Build genesis storage according to the mock runtime.
 #[allow(dead_code)]
 pub fn new_test_ext() -> sp_io::TestExternalities {
-    GenesisConfig {
+    RuntimeGenesisConfig {
         system: SystemConfig::default(),
         balances: BalancesConfig::default(), // FIXME (explicit absence of oneshot account in genesis)
+        transaction_payment: TransactionPaymentConfig::default(),
     }
     .build_storage()
     .unwrap()
diff --git a/pallets/quota/src/mock.rs b/pallets/quota/src/mock.rs
index 06548263b..cf3bcbc0e 100644
--- a/pallets/quota/src/mock.rs
+++ b/pallets/quota/src/mock.rs
@@ -28,7 +28,6 @@ use sp_runtime::traits::IdentifyAccount;
 use sp_runtime::traits::Verify;
 use sp_runtime::BuildStorage;
 use sp_runtime::{
-    testing::Header,
     traits::{BlakeTwo256, IdentityLookup},
     MultiSignature, MultiSigner,
 };
@@ -36,7 +35,6 @@ use sp_runtime::{
 type BlockNumber = u64;
 type Balance = u64;
 type Block = frame_system::mocking::MockBlock<Test>;
-type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>;
 pub type Signature = MultiSignature;
 pub type AccountPublic = <Signature as Verify>::Signer;
 pub type AccountId = <AccountPublic as IdentifyAccount>::AccountId;
@@ -48,15 +46,11 @@ pub fn account(id: u8) -> AccountId {
 
 // Configure a mock runtime to test the pallet.
 frame_support::construct_runtime!(
-    pub enum Test where
-        Block = Block,
-        NodeBlock = Block,
-        UncheckedExtrinsic = UncheckedExtrinsic,
-    {
-        System: frame_system::{Pallet, Call, Config, Storage, Event<T>},
-        Quota: pallet_quota::{Pallet, Storage, Config<T>, Event<T>},
-        Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>},
-        Identity: pallet_identity::{Pallet, Call, Storage, Config<T>, Event<T>},
+    pub enum Test{
+        System: frame_system,
+        Quota: pallet_quota,
+        Balances: pallet_balances,
+        Identity: pallet_identity,
     }
 );
 
@@ -88,16 +82,14 @@ impl system::Config for Test {
     type BaseCallFilter = Everything;
     type BlockWeights = ();
     type BlockLength = ();
+    type Block = Block;
     type DbWeight = ();
     type RuntimeOrigin = RuntimeOrigin;
     type RuntimeCall = RuntimeCall;
-    type Index = u64;
-    type BlockNumber = BlockNumber;
     type Hash = H256;
     type Hashing = BlakeTwo256;
     type AccountId = AccountId;
     type Lookup = IdentityLookup<Self::AccountId>;
-    type Header = Header;
     type RuntimeEvent = RuntimeEvent;
     type BlockHashCount = BlockHashCount;
     type Version = ();
@@ -109,6 +101,8 @@ impl system::Config for Test {
     type SS58Prefix = SS58Prefix;
     type OnSetCode = ();
     type MaxConsumers = frame_support::traits::ConstU32<16>;
+    type RuntimeTask = ();
+    type Nonce = u64;
 }
 
 // BALANCES //
@@ -126,10 +120,11 @@ impl pallet_balances::Config for Test {
     type MaxReserves = ();
     type ReserveIdentifier = [u8; 8];
     type RuntimeEvent = RuntimeEvent;
-    type HoldIdentifier = ();
     type FreezeIdentifier = ();
     type MaxHolds = ConstU32<0>;
     type MaxFreezes = ConstU32<0>;
+    type RuntimeHoldReason = ();
+    type RuntimeFreezeReason = ();
 }
 
 // IDENTITY //
@@ -168,7 +163,7 @@ impl pallet_identity::Config for Test {
 
 // Build genesis storage according to the mock runtime.
 pub fn new_test_ext(gen_conf: pallet_quota::GenesisConfig<Test>) -> sp_io::TestExternalities {
-    GenesisConfig {
+    RuntimeGenesisConfig {
         system: SystemConfig::default(),
         balances: BalancesConfig::default(),
         quota: gen_conf,
diff --git a/pallets/smith-members/src/mock.rs b/pallets/smith-members/src/mock.rs
index cd2398e4d..de27e7705 100644
--- a/pallets/smith-members/src/mock.rs
+++ b/pallets/smith-members/src/mock.rs
@@ -26,7 +26,6 @@ use frame_support::{
 use sp_core::H256;
 use sp_runtime::traits::{ConvertInto, IsMember};
 use sp_runtime::{
-    testing::Header,
     traits::{BlakeTwo256, IdentityLookup},
     BuildStorage, Perbill,
 };
@@ -36,17 +35,12 @@ parameter_types! {
     pub static OffenceWeight: Weight = Default::default();
 }
 
-type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Runtime>;
 type Block = frame_system::mocking::MockBlock<Runtime>;
 
 frame_support::construct_runtime!(
-    pub struct Runtime where
-        Block = Block,
-        NodeBlock = Block,
-        UncheckedExtrinsic = UncheckedExtrinsic,
-    {
-        System: frame_system::{Pallet, Call, Config, Storage, Event<T>},
-        Smith: pallet_smith_members::{Pallet, Config<T>, Storage, Event<T>},
+    pub struct Runtime {
+        System: frame_system,
+        Smith: pallet_smith_members,
     }
 );
 
@@ -54,16 +48,14 @@ impl frame_system::Config for Runtime {
     type BaseCallFilter = frame_support::traits::Everything;
     type BlockWeights = ();
     type BlockLength = ();
+    type Block = Block;
     type DbWeight = RocksDbWeight;
     type RuntimeOrigin = RuntimeOrigin;
-    type Index = u64;
-    type BlockNumber = u64;
     type RuntimeCall = RuntimeCall;
     type Hash = H256;
     type Hashing = BlakeTwo256;
     type AccountId = u64;
     type Lookup = IdentityLookup<Self::AccountId>;
-    type Header = Header;
     type RuntimeEvent = RuntimeEvent;
     type BlockHashCount = ConstU64<250>;
     type Version = ();
@@ -75,6 +67,8 @@ impl frame_system::Config for Runtime {
     type SS58Prefix = ();
     type OnSetCode = ();
     type MaxConsumers = ConstU32<16>;
+    type RuntimeTask = ();
+    type Nonce = u64;
 }
 
 pub struct EveryoneExceptIdZero;
@@ -102,7 +96,7 @@ impl pallet_smith_members::Config for Runtime {
 pub fn new_test_ext(
     genesis_config: crate::pallet::GenesisConfig<Runtime>,
 ) -> sp_io::TestExternalities {
-    GenesisConfig {
+    RuntimeGenesisConfig {
         system: SystemConfig::default(),
         smith: genesis_config,
     }
diff --git a/pallets/universal-dividend/src/mock.rs b/pallets/universal-dividend/src/mock.rs
index a753ac163..afc84af99 100644
--- a/pallets/universal-dividend/src/mock.rs
+++ b/pallets/universal-dividend/src/mock.rs
@@ -23,7 +23,6 @@ use frame_support::{
 use frame_system as system;
 use sp_core::{ConstU32, H256};
 use sp_runtime::{
-    testing::Header,
     traits::{BlakeTwo256, IdentityLookup},
     BuildStorage,
 };
@@ -34,20 +33,16 @@ use sp_runtime::traits::ConvertInto;
 pub const BLOCK_TIME: u64 = 6_000;
 
 type Balance = u64;
-type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>;
 type Block = frame_system::mocking::MockBlock<Test>;
 
 // Configure a mock runtime to test the pallet.
 frame_support::construct_runtime!(
-    pub enum Test where
-        Block = Block,
-        NodeBlock = Block,
-        UncheckedExtrinsic = UncheckedExtrinsic,
+    pub enum Test
     {
-        System: frame_system::{Pallet, Call, Config, Storage, Event<T>},
-        Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent},
-        Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>},
-        UniversalDividend: pallet_universal_dividend::{Pallet, Storage, Config<T>, Event<T>},
+        System: frame_system,
+        Timestamp: pallet_timestamp,
+        Balances: pallet_balances,
+        UniversalDividend: pallet_universal_dividend,
     }
 );
 
@@ -60,16 +55,14 @@ impl system::Config for Test {
     type BaseCallFilter = Everything;
     type BlockWeights = ();
     type BlockLength = ();
+    type Block = Block;
     type DbWeight = ();
     type RuntimeOrigin = RuntimeOrigin;
     type RuntimeCall = RuntimeCall;
-    type Index = u64;
-    type BlockNumber = u64;
     type Hash = H256;
     type Hashing = BlakeTwo256;
     type AccountId = u32;
     type Lookup = IdentityLookup<Self::AccountId>;
-    type Header = Header;
     type RuntimeEvent = RuntimeEvent;
     type BlockHashCount = BlockHashCount;
     type Version = ();
@@ -81,6 +74,8 @@ impl system::Config for Test {
     type SS58Prefix = SS58Prefix;
     type OnSetCode = ();
     type MaxConsumers = frame_support::traits::ConstU32<16>;
+    type RuntimeTask = ();
+    type Nonce = u64;
 }
 
 parameter_types! {
@@ -109,10 +104,11 @@ impl pallet_balances::Config for Test {
     type MaxReserves = ();
     type ReserveIdentifier = [u8; 8];
     type RuntimeEvent = RuntimeEvent;
-    type HoldIdentifier = ();
     type FreezeIdentifier = ();
     type MaxHolds = ConstU32<0>;
     type MaxFreezes = ConstU32<0>;
+    type RuntimeHoldReason = ();
+    type RuntimeFreezeReason = ();
 }
 
 parameter_types! {
-- 
GitLab