mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 23:21:06 +00:00
Switch All construct_runtimes to New Syntax (#2979)
Clean up all the old syntax. --------- Co-authored-by: command-bot <> Co-authored-by: gupnik <nikhilgupta.iitk@gmail.com> Co-authored-by: Nikhil Gupta <17176722+gupnik@users.noreply.github.com> Co-authored-by: Maksym H <1177472+mordamax@users.noreply.github.com>
This commit is contained in:
@@ -21,7 +21,7 @@
|
||||
//! order to get all the pallet parts for each pallet.
|
||||
//!
|
||||
//! Pallets can define their parts:
|
||||
//! - Implicitely: `System: frame_system`
|
||||
//! - Implicitly: `System: frame_system`
|
||||
//! - Explicitly: `System: frame_system::{Pallet, Call}`
|
||||
//!
|
||||
//! The `construct_runtime` transitions from the implicit definition to the explict one.
|
||||
@@ -172,7 +172,7 @@
|
||||
//!
|
||||
//! This call has no implicit pallet parts, thus it will expand to the runtime construction:
|
||||
//! ```ignore
|
||||
//! pub struct Runtime { ... }
|
||||
//! pub enum Runtime { ... }
|
||||
//! pub struct Call { ... }
|
||||
//! impl Call ...
|
||||
//! pub enum Origin { ... }
|
||||
@@ -342,7 +342,7 @@ fn construct_runtime_final_expansion(
|
||||
syn::Error::new(
|
||||
pallets_token.span.join(),
|
||||
"`System` pallet declaration is missing. \
|
||||
Please add this line: `System: frame_system::{Pallet, Call, Storage, Config<T>, Event<T>},`",
|
||||
Please add this line: `System: frame_system,`",
|
||||
)
|
||||
})?;
|
||||
if !system_pallet.cfg_pattern.is_empty() {
|
||||
|
||||
@@ -2291,7 +2291,7 @@ pub mod pallet_macros {
|
||||
/// # type Block = frame_system::mocking::MockBlock<Self>;
|
||||
/// # }
|
||||
/// construct_runtime! {
|
||||
/// pub struct Runtime {
|
||||
/// pub enum Runtime {
|
||||
/// System: frame_system,
|
||||
/// Custom: custom_pallet
|
||||
/// }
|
||||
|
||||
@@ -254,10 +254,10 @@ pub fn migrate_from_pallet_version_to_storage_version<
|
||||
/// construct_runtime! {
|
||||
/// pub enum Runtime
|
||||
/// {
|
||||
/// System: frame_system::{Pallet, Call, Storage, Config<T>, Event<T>} = 0,
|
||||
/// System: frame_system = 0,
|
||||
///
|
||||
/// SomePalletToRemove: pallet_something::{Pallet, Call, Storage, Event<T>} = 1,
|
||||
/// AnotherPalletToRemove: pallet_something_else::{Pallet, Call, Storage, Event<T>} = 2,
|
||||
/// SomePalletToRemove: pallet_something = 1,
|
||||
/// AnotherPalletToRemove: pallet_something_else = 2,
|
||||
///
|
||||
/// YourOtherPallets...
|
||||
/// }
|
||||
|
||||
@@ -83,7 +83,7 @@ pub type Block = generic::Block<Header, UncheckedExtrinsic>;
|
||||
pub type UncheckedExtrinsic = generic::UncheckedExtrinsic<u32, RuntimeCall, Signature, ()>;
|
||||
|
||||
construct_runtime!(
|
||||
pub struct Runtime {
|
||||
pub enum Runtime {
|
||||
System: renamed_frame_system,
|
||||
}
|
||||
);
|
||||
|
||||
@@ -68,8 +68,8 @@ mod tests {
|
||||
construct_runtime! {
|
||||
pub struct Runtime
|
||||
{
|
||||
System: frame_system::{Pallet, Call, Storage, Config<T>, Event<T>},
|
||||
Pallet: pallet::{Pallet, Config<T>},
|
||||
System: frame_system,
|
||||
Pallet: pallet,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
error: `System` pallet declaration is missing. Please add this line: `System: frame_system::{Pallet, Call, Storage, Config<T>, Event<T>},`
|
||||
error: `System` pallet declaration is missing. Please add this line: `System: frame_system,`
|
||||
--> tests/construct_runtime_ui/missing_system_module.rs:22:2
|
||||
|
|
||||
22 | / {
|
||||
|
||||
+1
-1
@@ -64,7 +64,7 @@ pub type UncheckedExtrinsic = sp_runtime::generic::UncheckedExtrinsic<u64, Runti
|
||||
pub type Block = sp_runtime::generic::Block<Header, UncheckedExtrinsic>;
|
||||
|
||||
frame_support::construct_runtime!(
|
||||
pub struct Runtime
|
||||
pub enum Runtime
|
||||
{
|
||||
// Exclude part `Storage` in order not to check its metadata in tests.
|
||||
System: frame_system,
|
||||
|
||||
@@ -201,7 +201,6 @@ pub type Block = generic::Block<Header, UncheckedExtrinsic>;
|
||||
|
||||
frame_support::construct_runtime!(
|
||||
pub enum Runtime
|
||||
|
||||
{
|
||||
System: frame_system,
|
||||
FinalKeysNone: no_instance,
|
||||
|
||||
@@ -278,24 +278,14 @@ pub type Block = generic::Block<Header, UncheckedExtrinsic>;
|
||||
frame_support::construct_runtime!(
|
||||
pub enum Runtime
|
||||
{
|
||||
System: frame_system::{Pallet, Call, Event<T>},
|
||||
Module1_1: module1::<Instance1>::{
|
||||
Pallet, Call, Storage, Event<T>, Config<T>, Origin<T>, Inherent
|
||||
},
|
||||
Module1_2: module1::<Instance2>::{
|
||||
Pallet, Call, Storage, Event<T>, Config<T>, Origin<T>, Inherent
|
||||
},
|
||||
Module2: module2::{Pallet, Call, Storage, Event<T>, Config<T>, Origin<T>, Inherent},
|
||||
Module2_1: module2::<Instance1>::{
|
||||
Pallet, Call, Storage, Event<T>, Config<T>, Origin<T>, Inherent
|
||||
},
|
||||
Module2_2: module2::<Instance2>::{
|
||||
Pallet, Call, Storage, Event<T>, Config<T>, Origin<T>, Inherent
|
||||
},
|
||||
Module2_3: module2::<Instance3>::{
|
||||
Pallet, Call, Storage, Event<T>, Config<T>, Origin<T>, Inherent
|
||||
},
|
||||
Module3: module3::{Pallet, Call},
|
||||
System: frame_system,
|
||||
Module1_1: module1::<Instance1>,
|
||||
Module1_2: module1::<Instance2>,
|
||||
Module2: module2,
|
||||
Module2_1: module2::<Instance1>,
|
||||
Module2_2: module2::<Instance2>,
|
||||
Module2_3: module2::<Instance3>,
|
||||
Module3: module3,
|
||||
}
|
||||
);
|
||||
|
||||
@@ -350,6 +340,7 @@ impl module3::Config for Runtime {
|
||||
|
||||
fn new_test_ext() -> sp_io::TestExternalities {
|
||||
RuntimeGenesisConfig {
|
||||
system: Default::default(),
|
||||
module_1_1: module1::GenesisConfig { value: 3, test: 2 },
|
||||
module_1_2: module1::GenesisConfig { value: 4, test: 5 },
|
||||
module_2: module2::GenesisConfig {
|
||||
|
||||
@@ -176,7 +176,7 @@ impl frame_system::Config for Runtime {
|
||||
impl module::Config for Runtime {}
|
||||
|
||||
frame_support::construct_runtime!(
|
||||
pub struct Runtime {
|
||||
pub enum Runtime {
|
||||
System: frame_system,
|
||||
Module: module,
|
||||
}
|
||||
|
||||
@@ -57,8 +57,8 @@ impl frame_system::Config for Runtime {
|
||||
construct_runtime! {
|
||||
pub struct Runtime
|
||||
{
|
||||
System: frame_system::{Pallet, Call, Storage, Config<T>, Event<T>},
|
||||
Pallet: test_pallet::{Pallet, Config<T>},
|
||||
System: frame_system,
|
||||
Pallet: test_pallet,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -94,7 +94,7 @@ impl frame_system::Config for Runtime {
|
||||
impl Config for Runtime {}
|
||||
|
||||
frame_support::construct_runtime!(
|
||||
pub struct Runtime {
|
||||
pub enum Runtime {
|
||||
System: frame_system,
|
||||
MyPallet: pallet,
|
||||
}
|
||||
|
||||
@@ -66,8 +66,8 @@ impl dummy_pallet::Config for Test {}
|
||||
construct_runtime!(
|
||||
pub enum Test
|
||||
{
|
||||
System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>} = 0,
|
||||
DummyPallet: dummy_pallet::{Pallet, Config<T>, Storage} = 1,
|
||||
System: frame_system = 0,
|
||||
DummyPallet: dummy_pallet = 1,
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user