diff --git a/end2end-tests/tests/cucumber_tests.rs b/end2end-tests/tests/cucumber_tests.rs index 58a532b2d6b1f8bbfe2e59a06123e90528061785..c653027323240ebb88fa38d2d5cbed8e7c7ddb18 100644 --- a/end2end-tests/tests/cucumber_tests.rs +++ b/end2end-tests/tests/cucumber_tests.rs @@ -631,7 +631,7 @@ async fn main() { .before(move |feature, _rule, scenario, world| { let mut genesis_conf_file_path = PathBuf::new(); genesis_conf_file_path.push("cucumber-genesis"); - genesis_conf_file_path.push(&format!( + genesis_conf_file_path.push(format!( "{}.json", genesis_conf_name(&feature.tags, &scenario.tags) )); diff --git a/node/src/rpc.rs b/node/src/rpc.rs index f5e6f09b23a70f8f48131f89b7c92ff756a63386..2b05e5b5f8dc66a321c9ab66e887f822bb159559 100644 --- a/node/src/rpc.rs +++ b/node/src/rpc.rs @@ -15,6 +15,7 @@ // along with Duniter-v2S. If not, see <https://www.gnu.org/licenses/>. //! A collection of node-specific RPC methods. +//! //! Substrate provides the `sc-rpc` crate, which defines the core RPC layer //! used by Substrate nodes. This file extends those RPC definitions with //! capabilities that are specific to this project's runtime configuration. diff --git a/node/src/service/client.rs b/node/src/service/client.rs index 108f31f006a73a49877a030ce7761b50a8746eba..99b01cf1fe60098622eb469810cb27a5608defce 100644 --- a/node/src/service/client.rs +++ b/node/src/service/client.rs @@ -16,8 +16,8 @@ use common_runtime::{AccountId, Balance, Block, BlockNumber, Hash, Header, Index}; use sc_client_api::{ - AuxStore, Backend as BackendT, BlockBackend, BlockchainEvents, KeysIter, MerkleValue, - PairsIter, UsageProvider, + AuxStore, Backend as BackendT, BlockchainEvents, KeysIter, MerkleValue, PairsIter, + UsageProvider, }; use sp_api::{CallApiAt, ProvideRuntimeApi}; use sp_blockchain::{HeaderBackend, HeaderMetadata}; @@ -26,7 +26,7 @@ use sp_core::{Encode, Pair}; use sp_runtime::{ generic::SignedBlock, traits::{BlakeTwo256, Block as BlockT}, - Justifications, SaturatedConversion, + Justifications, }; use sp_storage::{ChildInfo, StorageData, StorageKey}; use std::sync::Arc; @@ -328,14 +328,11 @@ impl BenchmarkCallSigner<super::runtime_executor::runtime::RuntimeCall, sp_core: frame_system::CheckTxVersion::<super::runtime_executor::runtime::Runtime>::new(), frame_system::CheckGenesis::<super::runtime_executor::runtime::Runtime>::new(), frame_system::CheckEra::<super::runtime_executor::runtime::Runtime>::from( - sp_runtime::generic::Era::mortal( - period, - self.chain_info().best_number.saturated_into(), - ), + sp_runtime::generic::Era::mortal(period, current_block), ), pallet_oneshot_account::CheckNonce::<super::runtime_executor::runtime::Runtime>::from( frame_system::CheckNonce::<super::runtime_executor::runtime::Runtime>::from(nonce), - ), // TODO + ), frame_system::CheckWeight::<super::runtime_executor::runtime::Runtime>::new(), pallet_transaction_payment::ChargeTransactionPayment::< super::runtime_executor::runtime::Runtime, diff --git a/pallets/authority-members/src/lib.rs b/pallets/authority-members/src/lib.rs index f4118ee3aed9eb692ef20fecf8cd7dbd22cc3cff..b69c0d72993f568c507dbad2b5f9e773eb791f8b 100644 --- a/pallets/authority-members/src/lib.rs +++ b/pallets/authority-members/src/lib.rs @@ -68,6 +68,7 @@ use frame_support::traits::Get; use scale_info::prelude::{collections::BTreeMap, vec, vec::Vec}; use sp_runtime::traits::{Convert, IsMember}; +#[allow(unreachable_patterns)] #[frame_support::pallet] pub mod pallet { use super::*; diff --git a/pallets/authority-members/src/mock.rs b/pallets/authority-members/src/mock.rs index 8afd17edf1855d4cae6591f65a5dd05f63635ddf..1a582ef73b4a31082c1fc11bd90f28012920d8f5 100644 --- a/pallets/authority-members/src/mock.rs +++ b/pallets/authority-members/src/mock.rs @@ -16,7 +16,7 @@ use super::*; use crate::{self as pallet_authority_members}; -use frame_support::{pallet_prelude::*, parameter_types, traits::Everything}; +use frame_support::{derive_impl, pallet_prelude::*, parameter_types, traits::Everything}; use frame_system as system; use pallet_offences::{traits::OnOffenceHandler, SlashStrategy}; use pallet_session::ShouldEndSession; @@ -60,36 +60,22 @@ parameter_types! { pub const SS58Prefix: u8 = 42; } +#[derive_impl(frame_system::config_preludes::TestDefaultConfig)] impl system::Config for Test { - type AccountData = (); type AccountId = AccountId; type BaseCallFilter = Everything; type Block = Block; type BlockHashCount = BlockHashCount; - type BlockLength = (); - type BlockWeights = (); - type DbWeight = (); type Hash = H256; type Hashing = BlakeTwo256; type Lookup = IdentityLookup<Self::AccountId>; type MaxConsumers = frame_support::traits::ConstU32<16>; - type MultiBlockMigrator = (); type Nonce = u64; - type OnKilledAccount = (); - type OnNewAccount = (); - type OnSetCode = (); type PalletInfo = PalletInfo; - type PostInherents = (); - type PostTransactions = (); - type PreInherents = (); type RuntimeCall = RuntimeCall; type RuntimeEvent = RuntimeEvent; type RuntimeOrigin = RuntimeOrigin; - type RuntimeTask = (); type SS58Prefix = SS58Prefix; - type SingleBlockMigrations = (); - type SystemWeightInfo = (); - type Version = (); } pub struct TestSessionHandler; diff --git a/pallets/certification/src/lib.rs b/pallets/certification/src/lib.rs index 204c8cb08d70bb44323b8eaa53df92db2ff69154..c8301d22138ed72937bbfcceaaf3f31a10a830b0 100644 --- a/pallets/certification/src/lib.rs +++ b/pallets/certification/src/lib.rs @@ -49,6 +49,7 @@ use frame_support::{pallet_prelude::*, traits::StorageVersion}; use scale_info::prelude::{collections::BTreeMap, fmt::Debug, vec::Vec}; use sp_runtime::traits::AtLeast32BitUnsigned; +#[allow(unreachable_patterns)] #[frame_support::pallet] pub mod pallet { use super::*; diff --git a/pallets/certification/src/mock.rs b/pallets/certification/src/mock.rs index 7f24b214bb241c170a08a26e714ff77ebe621f6a..5f89fa5301d7df1bcbba9fdd5d91e66192e91d66 100644 --- a/pallets/certification/src/mock.rs +++ b/pallets/certification/src/mock.rs @@ -16,7 +16,7 @@ use crate::{self as pallet_certification}; use frame_support::{ - parameter_types, + derive_impl, parameter_types, traits::{Everything, OnFinalize, OnInitialize}, }; use frame_system as system; @@ -43,36 +43,22 @@ parameter_types! { pub const SS58Prefix: u8 = 42; } +#[derive_impl(frame_system::config_preludes::TestDefaultConfig)] impl system::Config for Test { - type AccountData = (); type AccountId = AccountId; type BaseCallFilter = Everything; type Block = Block; type BlockHashCount = BlockHashCount; - type BlockLength = (); - type BlockWeights = (); - type DbWeight = (); type Hash = H256; type Hashing = BlakeTwo256; type Lookup = IdentityLookup<Self::AccountId>; type MaxConsumers = frame_support::traits::ConstU32<16>; - type MultiBlockMigrator = (); type Nonce = u64; - type OnKilledAccount = (); - type OnNewAccount = (); - type OnSetCode = (); type PalletInfo = PalletInfo; - type PostInherents = (); - type PostTransactions = (); - type PreInherents = (); type RuntimeCall = RuntimeCall; type RuntimeEvent = RuntimeEvent; type RuntimeOrigin = RuntimeOrigin; - type RuntimeTask = (); type SS58Prefix = SS58Prefix; - type SingleBlockMigrations = (); - type SystemWeightInfo = (); - type Version = (); } parameter_types! { diff --git a/pallets/distance/src/lib.rs b/pallets/distance/src/lib.rs index 738ee59099fe5be6207f839093888f244d316760..497aa8a9c3a90e754e6c8d24fc72c3d1f710f6ce 100644 --- a/pallets/distance/src/lib.rs +++ b/pallets/distance/src/lib.rs @@ -103,6 +103,7 @@ pub const MAX_EVALUATIONS_PER_SESSION: u32 = 1_300; // See https://git.duniter.o /// Maximum number of evaluators in an evaluation period. pub const MAX_EVALUATORS_PER_SESSION: u32 = 100; +#[allow(unreachable_patterns)] #[frame_support::pallet()] pub mod pallet { use super::*; diff --git a/pallets/distance/src/mock.rs b/pallets/distance/src/mock.rs index 5198424e0f7f4970210adef99c0355edf93bda3a..e804df741245c2fc738b79305e15f226033c2333 100644 --- a/pallets/distance/src/mock.rs +++ b/pallets/distance/src/mock.rs @@ -17,7 +17,7 @@ use crate::{self as pallet_distance}; use core::marker::PhantomData; use frame_support::{ - parameter_types, + derive_impl, parameter_types, traits::{Everything, OnFinalize, OnInitialize}, }; use frame_system as system; @@ -66,36 +66,23 @@ parameter_types! { pub const SS58Prefix: u8 = 42; } +#[derive_impl(frame_system::config_preludes::TestDefaultConfig)] impl system::Config for Test { type AccountData = AccountData<u64>; type AccountId = AccountId; type BaseCallFilter = Everything; type Block = Block; type BlockHashCount = BlockHashCount; - type BlockLength = (); - type BlockWeights = (); - type DbWeight = (); type Hash = H256; type Hashing = BlakeTwo256; type Lookup = IdentityLookup<Self::AccountId>; type MaxConsumers = frame_support::traits::ConstU32<16>; - type MultiBlockMigrator = (); type Nonce = u64; - type OnKilledAccount = (); - type OnNewAccount = (); - type OnSetCode = (); type PalletInfo = PalletInfo; - type PostInherents = (); - type PostTransactions = (); - type PreInherents = (); type RuntimeCall = RuntimeCall; type RuntimeEvent = RuntimeEvent; type RuntimeOrigin = RuntimeOrigin; - type RuntimeTask = (); type SS58Prefix = SS58Prefix; - type SingleBlockMigrations = (); - type SystemWeightInfo = (); - type Version = (); } pub struct TestSessionHandler; @@ -199,6 +186,7 @@ parameter_types! { impl pallet_balances::Config for Test { type AccountStore = System; type Balance = Balance; + type DoneSlashHandler = (); type DustRemoval = (); type ExistentialDeposit = ExistentialDeposit; type FreezeIdentifier = (); diff --git a/pallets/duniter-account/src/lib.rs b/pallets/duniter-account/src/lib.rs index 94c05ec6f7bfa7a36438cf13c52b69b0a6557f46..82fb57f09fd8ec0cc1e9fd27a1cc847cab7b2dee 100644 --- a/pallets/duniter-account/src/lib.rs +++ b/pallets/duniter-account/src/lib.rs @@ -61,6 +61,7 @@ use scale_info::prelude::{ }; use sp_runtime::traits::{DispatchInfoOf, PostDispatchInfoOf, Saturating}; +#[allow(unreachable_patterns)] #[frame_support::pallet] pub mod pallet { use super::*; diff --git a/pallets/duniter-test-parameters/src/lib.rs b/pallets/duniter-test-parameters/src/lib.rs index 346a8823035c4707e5f209f865bcdd05122f08f7..b2bbc8bcc6ca2ae60c792609aabc92ed081da438 100644 --- a/pallets/duniter-test-parameters/src/lib.rs +++ b/pallets/duniter-test-parameters/src/lib.rs @@ -66,6 +66,7 @@ pub mod types { } } +#[allow(unreachable_patterns)] #[frame_support::pallet] pub mod pallet { use super::*; diff --git a/pallets/duniter-wot/src/lib.rs b/pallets/duniter-wot/src/lib.rs index 1a560bdf699808f4c7ee7d1da2f4c7189ec600e2..d05504a249d53d4b7b8485925a509da1ebbdcf46 100644 --- a/pallets/duniter-wot/src/lib.rs +++ b/pallets/duniter-wot/src/lib.rs @@ -61,6 +61,7 @@ use pallet_membership::MembershipRemovalReason; type IdtyIndex = u32; +#[allow(unreachable_patterns)] #[frame_support::pallet] pub mod pallet { use super::*; diff --git a/pallets/duniter-wot/src/mock.rs b/pallets/duniter-wot/src/mock.rs index ddb4bf63f64b807a7a40abe2aa40a9d91a43ad57..a3c550632f5febae809a1bf20cff4c28f75eb579 100644 --- a/pallets/duniter-wot/src/mock.rs +++ b/pallets/duniter-wot/src/mock.rs @@ -16,7 +16,7 @@ use super::*; use crate::{self as pallet_duniter_wot}; -use frame_support::{parameter_types, traits::Everything}; +use frame_support::{derive_impl, parameter_types, traits::Everything}; use frame_system as system; use sp_core::H256; use sp_runtime::{ @@ -47,36 +47,22 @@ parameter_types! { pub const SS58Prefix: u8 = 42; } +#[derive_impl(frame_system::config_preludes::TestDefaultConfig)] impl system::Config for Test { - type AccountData = (); type AccountId = AccountId; type BaseCallFilter = Everything; type Block = Block; type BlockHashCount = BlockHashCount; - type BlockLength = (); - type BlockWeights = (); - type DbWeight = (); type Hash = H256; type Hashing = BlakeTwo256; type Lookup = IdentityLookup<Self::AccountId>; type MaxConsumers = frame_support::traits::ConstU32<16>; - type MultiBlockMigrator = (); type Nonce = u64; - type OnKilledAccount = (); - type OnNewAccount = (); - type OnSetCode = (); type PalletInfo = PalletInfo; - type PostInherents = (); - type PostTransactions = (); - type PreInherents = (); type RuntimeCall = RuntimeCall; type RuntimeEvent = RuntimeEvent; type RuntimeOrigin = RuntimeOrigin; - type RuntimeTask = (); type SS58Prefix = SS58Prefix; - type SingleBlockMigrations = (); - type SystemWeightInfo = (); - type Version = (); } // DuniterWot diff --git a/pallets/identity/src/lib.rs b/pallets/identity/src/lib.rs index 805c3ec42ebccad767a4ee636fc4e7be43c6bd84..579fe685c6b4b1e6728567af88de5351ccd88277 100644 --- a/pallets/identity/src/lib.rs +++ b/pallets/identity/src/lib.rs @@ -83,6 +83,7 @@ pub const REVOCATION_PAYLOAD_PREFIX: [u8; 4] = [b'r', b'e', b'v', b'o']; // link = link (identity with account) pub const LINK_IDTY_PAYLOAD_PREFIX: [u8; 4] = [b'l', b'i', b'n', b'k']; +#[allow(unreachable_patterns)] #[frame_support::pallet] pub mod pallet { use super::*; diff --git a/pallets/identity/src/mock.rs b/pallets/identity/src/mock.rs index 92380ce2cc3d7cb54fd2bf45fa2c941de787608b..70758bc813260c41b9175e9e2225338b89c35c9f 100644 --- a/pallets/identity/src/mock.rs +++ b/pallets/identity/src/mock.rs @@ -17,7 +17,7 @@ use super::*; use crate::{self as pallet_identity}; use frame_support::{ - parameter_types, + derive_impl, parameter_types, traits::{Everything, OnFinalize, OnInitialize}, }; use frame_system as system; @@ -54,36 +54,22 @@ parameter_types! { pub const SS58Prefix: u8 = 42; } +#[derive_impl(frame_system::config_preludes::TestDefaultConfig)] impl system::Config for Test { - type AccountData = (); type AccountId = AccountId; type BaseCallFilter = Everything; type Block = Block; type BlockHashCount = BlockHashCount; - type BlockLength = (); - type BlockWeights = (); - type DbWeight = (); type Hash = H256; type Hashing = BlakeTwo256; type Lookup = IdentityLookup<Self::AccountId>; type MaxConsumers = frame_support::traits::ConstU32<16>; - type MultiBlockMigrator = (); type Nonce = u64; - type OnKilledAccount = (); - type OnNewAccount = (); - type OnSetCode = (); type PalletInfo = PalletInfo; - type PostInherents = (); - type PostTransactions = (); - type PreInherents = (); type RuntimeCall = RuntimeCall; type RuntimeEvent = RuntimeEvent; type RuntimeOrigin = RuntimeOrigin; - type RuntimeTask = (); type SS58Prefix = SS58Prefix; - type SingleBlockMigrations = (); - type SystemWeightInfo = (); - type Version = (); } parameter_types! { diff --git a/pallets/membership/src/lib.rs b/pallets/membership/src/lib.rs index 0a096b0a309bbcd093bf5caaac3c3ddfa82e7987..ffbd6b8798af9898a06d95cc8ec8bca2159e8ffd 100644 --- a/pallets/membership/src/lib.rs +++ b/pallets/membership/src/lib.rs @@ -69,6 +69,7 @@ pub enum MembershipRemovalReason { System, } +#[allow(unreachable_patterns)] #[frame_support::pallet] pub mod pallet { use super::*; diff --git a/pallets/membership/src/mock.rs b/pallets/membership/src/mock.rs index 6269ed615639f46c57dde4fd3dc6e882d67eade1..208e663f592cdac83d58025aeaff8c7ba3aa193d 100644 --- a/pallets/membership/src/mock.rs +++ b/pallets/membership/src/mock.rs @@ -16,7 +16,7 @@ use crate::{self as pallet_membership}; use frame_support::{ - parameter_types, + derive_impl, parameter_types, traits::{Everything, OnFinalize, OnInitialize}, }; use frame_system as system; @@ -44,36 +44,22 @@ parameter_types! { pub const SS58Prefix: u8 = 42; } +#[derive_impl(frame_system::config_preludes::TestDefaultConfig)] impl system::Config for Test { - type AccountData = (); type AccountId = AccountId; type BaseCallFilter = Everything; type Block = Block; type BlockHashCount = BlockHashCount; - type BlockLength = (); - type BlockWeights = (); - type DbWeight = (); type Hash = H256; type Hashing = BlakeTwo256; type Lookup = IdentityLookup<Self::AccountId>; type MaxConsumers = frame_support::traits::ConstU32<16>; - type MultiBlockMigrator = (); type Nonce = u64; - type OnKilledAccount = (); - type OnNewAccount = (); - type OnSetCode = (); type PalletInfo = PalletInfo; - type PostInherents = (); - type PostTransactions = (); - type PreInherents = (); type RuntimeCall = RuntimeCall; type RuntimeEvent = RuntimeEvent; type RuntimeOrigin = RuntimeOrigin; - type RuntimeTask = (); type SS58Prefix = SS58Prefix; - type SingleBlockMigrations = (); - type SystemWeightInfo = (); - type Version = (); } parameter_types! { diff --git a/pallets/offences/src/lib.rs b/pallets/offences/src/lib.rs index 8b2d32cc4ef802160ec069dfcfe4a8a182248d2b..ab9c03ca6328656c8146785baa6e134035a8d31f 100644 --- a/pallets/offences/src/lib.rs +++ b/pallets/offences/src/lib.rs @@ -65,6 +65,7 @@ pub enum SlashStrategy { Blacklist, } +#[allow(unreachable_patterns)] #[frame_support::pallet] pub mod pallet { use super::*; diff --git a/pallets/offences/src/mock.rs b/pallets/offences/src/mock.rs index 49611fb08cf700cc869405c661efd08c23547321..ac5db8b17026efa949fec2a2aa12e85ea161fd85 100644 --- a/pallets/offences/src/mock.rs +++ b/pallets/offences/src/mock.rs @@ -17,7 +17,7 @@ use crate::{self as pallet_offences, Config, SlashStrategy}; use codec::Encode; use frame_support::{ - parameter_types, + derive_impl, parameter_types, traits::{ConstU32, ConstU64}, weights::{constants::RocksDbWeight, Weight}, }; @@ -59,36 +59,22 @@ frame_support::construct_runtime!( } ); +#[derive_impl(frame_system::config_preludes::TestDefaultConfig)] impl frame_system::Config for Runtime { - type AccountData = (); type AccountId = u64; type BaseCallFilter = frame_support::traits::Everything; type Block = Block; type BlockHashCount = ConstU64<250>; - type BlockLength = (); - type BlockWeights = (); type DbWeight = RocksDbWeight; type Hash = H256; type Hashing = BlakeTwo256; type Lookup = IdentityLookup<Self::AccountId>; type MaxConsumers = ConstU32<16>; - type MultiBlockMigrator = (); type Nonce = u64; - type OnKilledAccount = (); - type OnNewAccount = (); - type OnSetCode = (); type PalletInfo = PalletInfo; - type PostInherents = (); - type PostTransactions = (); - type PreInherents = (); type RuntimeCall = RuntimeCall; type RuntimeEvent = RuntimeEvent; type RuntimeOrigin = RuntimeOrigin; - type RuntimeTask = (); - type SS58Prefix = (); - type SingleBlockMigrations = (); - type SystemWeightInfo = (); - type Version = (); } impl Config for Runtime { diff --git a/pallets/oneshot-account/src/lib.rs b/pallets/oneshot-account/src/lib.rs index 34b912d169de3d447c760f632bdb0058031f4dde..1b6735fb13a47bf971441e40eb1a2ac1b0f823ae 100644 --- a/pallets/oneshot-account/src/lib.rs +++ b/pallets/oneshot-account/src/lib.rs @@ -48,6 +48,7 @@ use sp_runtime::traits::{DispatchInfoOf, PostDispatchInfoOf, Saturating, StaticL type AccountIdOf<T> = <T as frame_system::Config>::AccountId; type BalanceOf<T> = <<T as Config>::Currency as fungible::Inspect<AccountIdOf<T>>>::Balance; +#[allow(unreachable_patterns)] #[frame_support::pallet] pub mod pallet { use super::*; diff --git a/pallets/oneshot-account/src/mock.rs b/pallets/oneshot-account/src/mock.rs index d742e3343b77c85bf0e3bf445879494d1a200195..aa75a55686043da319764ecae086a252e18e2fd4 100644 --- a/pallets/oneshot-account/src/mock.rs +++ b/pallets/oneshot-account/src/mock.rs @@ -15,7 +15,7 @@ // along with Duniter-v2S. If not, see <https://www.gnu.org/licenses/>. use crate::{self as pallet_oneshot_account}; -use frame_support::{parameter_types, traits::Everything, weights::IdentityFee}; +use frame_support::{derive_impl, parameter_types, traits::Everything, weights::IdentityFee}; use frame_system as system; use pallet_transaction_payment::FungibleAdapter; use sp_core::{ConstU32, H256}; @@ -43,36 +43,23 @@ parameter_types! { pub const SS58Prefix: u8 = 42; } +#[derive_impl(frame_system::config_preludes::TestDefaultConfig)] impl system::Config for Test { type AccountData = pallet_balances::AccountData<Balance>; type AccountId = u64; type BaseCallFilter = Everything; type Block = Block; type BlockHashCount = BlockHashCount; - type BlockLength = (); - type BlockWeights = (); - type DbWeight = (); type Hash = H256; type Hashing = BlakeTwo256; type Lookup = IdentityLookup<Self::AccountId>; type MaxConsumers = frame_support::traits::ConstU32<16>; - type MultiBlockMigrator = (); type Nonce = u64; - type OnKilledAccount = (); - type OnNewAccount = (); - type OnSetCode = (); type PalletInfo = PalletInfo; - type PostInherents = (); - type PostTransactions = (); - type PreInherents = (); type RuntimeCall = RuntimeCall; type RuntimeEvent = RuntimeEvent; type RuntimeOrigin = RuntimeOrigin; - type RuntimeTask = (); type SS58Prefix = SS58Prefix; - type SingleBlockMigrations = (); - type SystemWeightInfo = (); - type Version = (); } parameter_types! { @@ -83,6 +70,7 @@ parameter_types! { impl pallet_balances::Config for Test { type AccountStore = System; type Balance = Balance; + type DoneSlashHandler = (); type DustRemoval = (); type ExistentialDeposit = ExistentialDeposit; type FreezeIdentifier = (); @@ -101,6 +89,7 @@ impl pallet_transaction_payment::Config for Test { type OnChargeTransaction = OneshotAccount; type OperationalFeeMultiplier = frame_support::traits::ConstU8<5>; type RuntimeEvent = RuntimeEvent; + type WeightInfo = (); type WeightToFee = IdentityFee<u64>; } impl pallet_oneshot_account::Config for Test { diff --git a/pallets/provide-randomness/src/lib.rs b/pallets/provide-randomness/src/lib.rs index 20dcfa91bd1b8a06a31f1df75c6b2d0499283ad2..1534f1e950315955ad5db7778359342a9dcbd811 100644 --- a/pallets/provide-randomness/src/lib.rs +++ b/pallets/provide-randomness/src/lib.rs @@ -53,6 +53,7 @@ impl OnFilledRandomness for () { } } +#[allow(unreachable_patterns)] #[frame_support::pallet] pub mod pallet { use super::*; diff --git a/pallets/quota/src/lib.rs b/pallets/quota/src/lib.rs index 67340ef670a1d12c7294dbde1f93111e4bffa3e1..9ea7aa21050c7cadcde0a1c40275b0a6dfa3bb03 100644 --- a/pallets/quota/src/lib.rs +++ b/pallets/quota/src/lib.rs @@ -59,6 +59,7 @@ use scale_info::prelude::vec::Vec; use sp_runtime::traits::Zero; pub use weights::WeightInfo; +#[allow(unreachable_patterns)] #[frame_support::pallet] pub mod pallet { use super::*; diff --git a/pallets/quota/src/mock.rs b/pallets/quota/src/mock.rs index a21f3b85c552e77c4ff63397e2ebf5b60be8e812..f39b053dfe4c1f565549dd401b54bf52d8b0a1de 100644 --- a/pallets/quota/src/mock.rs +++ b/pallets/quota/src/mock.rs @@ -19,7 +19,7 @@ use super::*; pub use crate::pallet as pallet_quota; use frame_support::{ - parameter_types, + derive_impl, parameter_types, traits::{Everything, OnFinalize, OnInitialize}, }; use frame_system as system; @@ -75,36 +75,24 @@ parameter_types! { pub const BlockHashCount: u64 = 250; pub const SS58Prefix: u8 = 42; } + +#[derive_impl(frame_system::config_preludes::TestDefaultConfig)] impl system::Config for Test { type AccountData = pallet_balances::AccountData<Balance>; type AccountId = AccountId; type BaseCallFilter = Everything; type Block = Block; type BlockHashCount = BlockHashCount; - type BlockLength = (); - type BlockWeights = (); - type DbWeight = (); type Hash = H256; type Hashing = BlakeTwo256; type Lookup = IdentityLookup<Self::AccountId>; type MaxConsumers = frame_support::traits::ConstU32<16>; - type MultiBlockMigrator = (); type Nonce = u64; - type OnKilledAccount = (); - type OnNewAccount = (); - type OnSetCode = (); type PalletInfo = PalletInfo; - type PostInherents = (); - type PostTransactions = (); - type PreInherents = (); type RuntimeCall = RuntimeCall; type RuntimeEvent = RuntimeEvent; type RuntimeOrigin = RuntimeOrigin; - type RuntimeTask = (); type SS58Prefix = SS58Prefix; - type SingleBlockMigrations = (); - type SystemWeightInfo = (); - type Version = (); } // BALANCES // @@ -115,6 +103,7 @@ parameter_types! { impl pallet_balances::Config for Test { type AccountStore = System; type Balance = Balance; + type DoneSlashHandler = (); type DustRemoval = (); type ExistentialDeposit = ExistentialDeposit; type FreezeIdentifier = (); diff --git a/pallets/smith-members/src/lib.rs b/pallets/smith-members/src/lib.rs index e7c48962a8d187dd46348e21b72b1c86623375c6..d9246b0cc506c6f644cacd2048aef11a6d6d104c 100644 --- a/pallets/smith-members/src/lib.rs +++ b/pallets/smith-members/src/lib.rs @@ -96,6 +96,7 @@ pub enum SmithStatus { Excluded, } +#[allow(unreachable_patterns)] #[frame_support::pallet] pub mod pallet { use super::*; diff --git a/pallets/smith-members/src/mock.rs b/pallets/smith-members/src/mock.rs index 27ecfe8854e244347001eaa979a30823d2146b8d..388f7114775dc8c47bc4bd67b5b3a38eb0db11f6 100644 --- a/pallets/smith-members/src/mock.rs +++ b/pallets/smith-members/src/mock.rs @@ -16,6 +16,7 @@ use crate::{self as pallet_smith_members}; use frame_support::{ + derive_impl, pallet_prelude::Hooks, parameter_types, traits::{ConstU32, ConstU64}, @@ -41,36 +42,22 @@ frame_support::construct_runtime!( } ); +#[derive_impl(frame_system::config_preludes::TestDefaultConfig)] impl frame_system::Config for Runtime { - type AccountData = (); type AccountId = u64; type BaseCallFilter = frame_support::traits::Everything; type Block = Block; type BlockHashCount = ConstU64<250>; - type BlockLength = (); - type BlockWeights = (); type DbWeight = RocksDbWeight; type Hash = H256; type Hashing = BlakeTwo256; type Lookup = IdentityLookup<Self::AccountId>; type MaxConsumers = ConstU32<16>; - type MultiBlockMigrator = (); type Nonce = u64; - type OnKilledAccount = (); - type OnNewAccount = (); - type OnSetCode = (); type PalletInfo = PalletInfo; - type PostInherents = (); - type PostTransactions = (); - type PreInherents = (); type RuntimeCall = RuntimeCall; type RuntimeEvent = RuntimeEvent; type RuntimeOrigin = RuntimeOrigin; - type RuntimeTask = (); - type SS58Prefix = (); - type SingleBlockMigrations = (); - type SystemWeightInfo = (); - type Version = (); } pub struct EveryoneExceptIdZero; diff --git a/pallets/universal-dividend/src/lib.rs b/pallets/universal-dividend/src/lib.rs index 6fda9a68c9621cb34358ede9a3cc138b7eb58905..c0a0347259c0461dfcf81b8e414dd84231e3dd4c 100644 --- a/pallets/universal-dividend/src/lib.rs +++ b/pallets/universal-dividend/src/lib.rs @@ -56,6 +56,7 @@ use sp_arithmetic::{ }; use sp_runtime::traits::{Get, MaybeSerializeDeserialize, StaticLookup}; +#[allow(unreachable_patterns)] #[frame_support::pallet] pub mod pallet { use super::*; diff --git a/pallets/universal-dividend/src/mock.rs b/pallets/universal-dividend/src/mock.rs index 233ec61e7aa9e8c538c362a05036e56b6eec9835..077f6694b9194278130274fc96e31c9f10a9958d 100644 --- a/pallets/universal-dividend/src/mock.rs +++ b/pallets/universal-dividend/src/mock.rs @@ -17,7 +17,7 @@ use super::*; use crate::{self as pallet_universal_dividend}; use frame_support::{ - parameter_types, + derive_impl, parameter_types, traits::{Everything, OnFinalize, OnInitialize}, }; use frame_system as system; @@ -48,36 +48,23 @@ parameter_types! { pub const SS58Prefix: u8 = 42; } +#[derive_impl(frame_system::config_preludes::TestDefaultConfig)] impl system::Config for Test { type AccountData = pallet_balances::AccountData<Balance>; type AccountId = u32; type BaseCallFilter = Everything; type Block = Block; type BlockHashCount = BlockHashCount; - type BlockLength = (); - type BlockWeights = (); - type DbWeight = (); type Hash = H256; type Hashing = BlakeTwo256; type Lookup = IdentityLookup<Self::AccountId>; type MaxConsumers = frame_support::traits::ConstU32<16>; - type MultiBlockMigrator = (); type Nonce = u64; - type OnKilledAccount = (); - type OnNewAccount = (); - type OnSetCode = (); type PalletInfo = PalletInfo; - type PostInherents = (); - type PostTransactions = (); - type PreInherents = (); type RuntimeCall = RuntimeCall; type RuntimeEvent = RuntimeEvent; type RuntimeOrigin = RuntimeOrigin; - type RuntimeTask = (); type SS58Prefix = SS58Prefix; - type SingleBlockMigrations = (); - type SystemWeightInfo = (); - type Version = (); } parameter_types! { @@ -99,6 +86,7 @@ parameter_types! { impl pallet_balances::Config for Test { type AccountStore = System; type Balance = Balance; + type DoneSlashHandler = (); type DustRemoval = (); type ExistentialDeposit = ExistentialDeposit; type FreezeIdentifier = (); diff --git a/pallets/upgrade-origin/src/lib.rs b/pallets/upgrade-origin/src/lib.rs index b9d0e047973841854a7485ddd545618bb1fab0f8..20fb15f451898efb9c9940f9d7cc54c506ece885 100644 --- a/pallets/upgrade-origin/src/lib.rs +++ b/pallets/upgrade-origin/src/lib.rs @@ -30,6 +30,7 @@ use frame_support::{ use scale_info::prelude::boxed::Box; use sp_runtime::traits::Dispatchable; +#[allow(unreachable_patterns)] #[frame_support::pallet] pub mod pallet { use super::*; diff --git a/runtime/common/src/apis.rs b/runtime/common/src/apis.rs index 0a50497c60c12ded1ecf7f3e2c8f9a15100eace0..7853aacb3bdeba9c01d1c105254186c509e3aede 100644 --- a/runtime/common/src/apis.rs +++ b/runtime/common/src/apis.rs @@ -276,7 +276,7 @@ macro_rules! runtime_apis { config: frame_benchmarking::BenchmarkConfig ) -> Result< Vec<frame_benchmarking::BenchmarkBatch>, - sp_runtime::RuntimeString, + scale_info::prelude::string::String, > { use frame_benchmarking::{Benchmarking, BenchmarkBatch}; use frame_support::traits::TrackedStorageKey; diff --git a/runtime/common/src/constants.rs b/runtime/common/src/constants.rs index a9f31004c1b2ad447e3976056f11505aecd91d06..851dc98ad0a4b6b5234d6210e1eccab8a08db6ec 100644 --- a/runtime/common/src/constants.rs +++ b/runtime/common/src/constants.rs @@ -18,11 +18,10 @@ use crate::{Balance, BlockNumber}; use sp_runtime::Perbill; /// This determines the average expected block time that we are targeting. -/// Blocks will be produced at a minimum duration defined by `SLOT_DURATION`. -/// `SLOT_DURATION` is picked up by `pallet_timestamp` which is in turn picked -/// up by `pallet_babe` to implement `fn slot_duration()`. -/// -/// Change this to adjust the block time. +// Blocks will be produced at a minimum duration defined by `SLOT_DURATION`. +// `SLOT_DURATION` is picked up by `pallet_timestamp` which is in turn picked +// up by `pallet_babe` to implement `fn slot_duration()`. +// Change this to adjust the block time. pub const MILLISECS_PER_BLOCK: u64 = 6000; pub const SECS_PER_BLOCK: u64 = MILLISECS_PER_BLOCK / 1_000; @@ -41,7 +40,7 @@ pub const YEARS: BlockNumber = (SECS_PER_YEAR / SECS_PER_BLOCK) as BlockNumber; // 1 in 4 blocks (on average, not counting collisions) will be primary babe blocks. pub const PRIMARY_PROBABILITY: (u64, u64) = (1, 4); -/// The BABE epoch configuration at genesis. +// The BABE epoch configuration at genesis. pub const BABE_GENESIS_EPOCH_CONFIG: sp_consensus_babe::BabeEpochConfiguration = sp_consensus_babe::BabeEpochConfiguration { c: PRIMARY_PROBABILITY, diff --git a/runtime/common/src/handlers.rs b/runtime/common/src/handlers.rs index 46c61afa63fcd8048d97f2398656b5f754d85262..078bb6d7c28e01178db82b17c0e42c7ca0c2a315 100644 --- a/runtime/common/src/handlers.rs +++ b/runtime/common/src/handlers.rs @@ -95,6 +95,7 @@ impl< } /// Runtime handler for OnRemoveMembership, calling all implementations of +/// /// OnRemoveMembership and implementing logic at the runtime level. /// As the weight accounting is not trivial in this handler, the weight is /// done at the handler level. diff --git a/runtime/g1/src/lib.rs b/runtime/g1/src/lib.rs index 4a4f4488c1e057ac38cbb8cbf3797f1841319596..e24d78ba1eddd98d04d3fa5575bb1f7df9bbd710 100644 --- a/runtime/g1/src/lib.rs +++ b/runtime/g1/src/lib.rs @@ -56,7 +56,7 @@ use sp_core::OpaqueMetadata; #[cfg(any(feature = "std", test))] pub use sp_runtime::BuildStorage; use sp_runtime::{ - create_runtime_str, generic, impl_opaque_keys, + generic, impl_opaque_keys, traits::{AccountIdLookup, BlakeTwo256, Block as BlockT, NumberFor, OpaqueKeys}, transaction_validity::{TransactionSource, TransactionValidity}, ApplyExtrinsicResult, Cow, Perquintill, @@ -298,7 +298,7 @@ where type Extension = TxExtension; fn create_transaction(call: RuntimeCall, extension: TxExtension) -> UncheckedExtrinsic { - generic::UncheckedExtrinsic::new_transaction(call, extension).into() + generic::UncheckedExtrinsic::new_transaction(call, extension) } } @@ -307,7 +307,7 @@ where RuntimeCall: From<LocalCall>, { fn create_inherent(call: RuntimeCall) -> UncheckedExtrinsic { - generic::UncheckedExtrinsic::new_bare(call).into() + generic::UncheckedExtrinsic::new_bare(call) } } diff --git a/runtime/gdev/src/lib.rs b/runtime/gdev/src/lib.rs index c6b87f43c56e467ea250f289fc1b7f064f5de76d..6447396cb298b4b75a4d271593fb993e509135b3 100644 --- a/runtime/gdev/src/lib.rs +++ b/runtime/gdev/src/lib.rs @@ -56,7 +56,7 @@ use sp_core::OpaqueMetadata; #[cfg(any(feature = "std", test))] pub use sp_runtime::BuildStorage; use sp_runtime::{ - create_runtime_str, generic, impl_opaque_keys, + generic, impl_opaque_keys, traits::{AccountIdLookup, BlakeTwo256, Block as BlockT, NumberFor, OpaqueKeys}, transaction_validity::{TransactionSource, TransactionValidity}, ApplyExtrinsicResult, Cow, Perquintill, @@ -342,7 +342,7 @@ where type Extension = TxExtension; fn create_transaction(call: RuntimeCall, extension: TxExtension) -> UncheckedExtrinsic { - generic::UncheckedExtrinsic::new_transaction(call, extension).into() + generic::UncheckedExtrinsic::new_transaction(call, extension) } } @@ -351,7 +351,7 @@ where RuntimeCall: From<LocalCall>, { fn create_inherent(call: RuntimeCall) -> UncheckedExtrinsic { - generic::UncheckedExtrinsic::new_bare(call).into() + generic::UncheckedExtrinsic::new_bare(call) } } diff --git a/runtime/gdev/tests/common/mod.rs b/runtime/gdev/tests/common/mod.rs index 82b5ade8d586dfb587c83b5ebd850b5d6b303500..1345f8ffb482f2afefdc2e3a39a0353eeea66b0b 100644 --- a/runtime/gdev/tests/common/mod.rs +++ b/runtime/gdev/tests/common/mod.rs @@ -30,7 +30,7 @@ use sp_membership::MembershipData; use sp_runtime::{ generic::SignedPayload, testing::{Digest, DigestItem}, - traits::{Extrinsic, IdentifyAccount, Verify}, + traits::{ExtrinsicLike, IdentifyAccount, Verify}, }; use std::collections::BTreeMap; @@ -492,25 +492,29 @@ pub fn get_unchecked_extrinsic( tip: Balance, nonce: u32, ) -> gdev_runtime::UncheckedExtrinsic { - let extra: gdev_runtime::SignedExtra = ( + let tx_ext: gdev_runtime::TxExtension = ( frame_system::CheckNonZeroSender::<gdev_runtime::Runtime>::new(), frame_system::CheckSpecVersion::<gdev_runtime::Runtime>::new(), frame_system::CheckTxVersion::<gdev_runtime::Runtime>::new(), frame_system::CheckGenesis::<gdev_runtime::Runtime>::new(), - frame_system::CheckMortality::<gdev_runtime::Runtime>::from( - sp_runtime::generic::Era::mortal(era, block), + frame_system::CheckEra::<gdev_runtime::Runtime>::from(sp_runtime::generic::Era::mortal( + era, block, + )), + pallet_oneshot_account::CheckNonce::<gdev_runtime::Runtime>::from( + frame_system::CheckNonce::<gdev_runtime::Runtime>::from(nonce), ), - frame_system::CheckNonce::<gdev_runtime::Runtime>::from(nonce).into(), frame_system::CheckWeight::<gdev_runtime::Runtime>::new(), pallet_transaction_payment::ChargeTransactionPayment::<gdev_runtime::Runtime>::from(tip), + //frame_metadata_hash_extension::CheckMetadataHash::<gdev_runtime::Runtime>::new(false), TODO ); - let payload = SignedPayload::new(call.clone(), extra.clone()).unwrap(); + let payload = SignedPayload::new(call.clone(), tx_ext.clone()).unwrap(); let origin = signer; let sig = payload.using_encoded(|payload| origin.pair().sign(payload)); - gdev_runtime::UncheckedExtrinsic::new( + gdev_runtime::UncheckedExtrinsic::new_signed( call, - Some((origin.to_account_id().into(), sig.into(), extra)), + origin.to_account_id().into(), + sig.into(), + tx_ext, ) - .unwrap() } diff --git a/runtime/gtest/src/lib.rs b/runtime/gtest/src/lib.rs index f4e44e95b02bbb0824726bed375c41259eed96ed..a6f1cd70c04c2877ada6aab2feb6626151578700 100644 --- a/runtime/gtest/src/lib.rs +++ b/runtime/gtest/src/lib.rs @@ -55,7 +55,7 @@ use sp_core::OpaqueMetadata; #[cfg(any(feature = "std", test))] pub use sp_runtime::BuildStorage; use sp_runtime::{ - create_runtime_str, generic, impl_opaque_keys, + generic, impl_opaque_keys, traits::{AccountIdLookup, BlakeTwo256, Block as BlockT, NumberFor, OpaqueKeys}, transaction_validity::{TransactionSource, TransactionValidity}, ApplyExtrinsicResult, Cow, Perquintill, @@ -305,7 +305,7 @@ where type Extension = TxExtension; fn create_transaction(call: RuntimeCall, extension: TxExtension) -> UncheckedExtrinsic { - generic::UncheckedExtrinsic::new_transaction(call, extension).into() + generic::UncheckedExtrinsic::new_transaction(call, extension) } } @@ -314,7 +314,7 @@ where RuntimeCall: From<LocalCall>, { fn create_inherent(call: RuntimeCall) -> UncheckedExtrinsic { - generic::UncheckedExtrinsic::new_bare(call).into() + generic::UncheckedExtrinsic::new_bare(call) } }