rococo-runtime: Switch to latest construct_runtime! syntax (#4389)

* rococo-runtime: Switch to latest `construct_runtime!` syntax

Besides that it fixes pallet macro errors in other crates that popped up
because of this switch.

* FMT
This commit is contained in:
Bastian Köcher
2021-11-29 21:36:19 +01:00
committed by GitHub
parent b64caf97bf
commit 49d78d99f7
12 changed files with 137 additions and 139 deletions
@@ -41,8 +41,6 @@ use sp_std::{collections::btree_set::BTreeSet, prelude::*};
#[cfg(feature = "runtime-benchmarks")]
mod benchmarking;
pub use crate::Origin as ParachainOrigin;
/// Whether the dispute is local or remote.
#[derive(Encode, Decode, Clone, PartialEq, Eq, RuntimeDebug, TypeInfo)]
pub enum DisputeLocation {
@@ -345,9 +343,6 @@ pub mod pallet {
SingleSidedDispute,
}
#[pallet::origin]
pub type Origin = ParachainOrigin;
#[pallet::call]
impl<T: Config> Pallet<T> {
#[pallet::weight(<T as Config>::WeightInfo::force_unfreeze())]
+20 -18
View File
@@ -17,8 +17,8 @@
//! Mocks for all the traits.
use crate::{
configuration, disputes, dmp, hrmp, inclusion, initializer, paras, paras_inherent, scheduler,
session_info, shared,
configuration, disputes, dmp, hrmp, inclusion, initializer, origin, paras, paras_inherent,
scheduler, session_info, shared,
ump::{self, MessageId, UmpSink},
ParaId,
};
@@ -51,21 +51,22 @@ frame_support::construct_runtime!(
NodeBlock = Block,
UncheckedExtrinsic = UncheckedExtrinsic,
{
System: frame_system::{Pallet, Call, Config, Storage, Event<T>},
Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>},
Paras: paras::{Pallet, Origin, Call, Storage, Event, Config},
Configuration: configuration::{Pallet, Call, Storage, Config<T>},
ParasShared: shared::{Pallet, Call, Storage},
ParaInclusion: inclusion::{Pallet, Call, Storage, Event<T>},
ParaInherent: paras_inherent::{Pallet, Call, Storage},
Scheduler: scheduler::{Pallet, Storage},
Initializer: initializer::{Pallet, Call, Storage},
Dmp: dmp::{Pallet, Call, Storage},
Ump: ump::{Pallet, Call, Storage, Event},
Hrmp: hrmp::{Pallet, Call, Storage, Event<T>},
SessionInfo: session_info::{Pallet, Storage},
Disputes: disputes::{Pallet, Storage, Event<T>},
Babe: pallet_babe::{Pallet, Call, Storage, Config, ValidateUnsigned},
System: frame_system,
Balances: pallet_balances,
Paras: paras,
Configuration: configuration,
ParasShared: shared,
ParaInclusion: inclusion,
ParaInherent: paras_inherent,
Scheduler: scheduler,
Initializer: initializer,
Dmp: dmp,
Ump: ump,
Hrmp: hrmp,
ParachainsOrigin: origin,
SessionInfo: session_info,
Disputes: disputes,
Babe: pallet_babe,
}
);
@@ -177,8 +178,9 @@ impl crate::configuration::Config for Test {
impl crate::shared::Config for Test {}
impl origin::Config for Test {}
impl crate::paras::Config for Test {
type Origin = Origin;
type Event = Event;
type WeightInfo = crate::paras::TestWeightInfo;
}
+1 -9
View File
@@ -34,7 +34,7 @@ use primitives::v1::{
use scale_info::TypeInfo;
use sp_core::RuntimeDebug;
use sp_runtime::{traits::One, DispatchResult, SaturatedConversion};
use sp_std::{prelude::*, result};
use sp_std::prelude::*;
#[cfg(feature = "std")]
use serde::{Deserialize, Serialize};
@@ -307,11 +307,6 @@ pub mod pallet {
#[pallet::config]
pub trait Config: frame_system::Config + configuration::Config + shared::Config {
/// The outer origin type.
type Origin: From<Origin>
+ From<<Self as frame_system::Config>::Origin>
+ Into<result::Result<Origin, <Self as Config>::Origin>>;
type Event: From<Event> + IsType<<Self as frame_system::Config>::Event>;
/// Weight information for extrinsics in this pallet.
@@ -518,9 +513,6 @@ pub mod pallet {
}
}
#[pallet::origin]
pub type Origin = ParachainOrigin;
#[pallet::call]
impl<T: Config> Pallet<T> {
/// Set the storage for the parachain validation code immediately.