Skip to content

Commit

Permalink
drop associate types, use bounds
Browse files Browse the repository at this point in the history
  • Loading branch information
muharem committed Dec 22, 2024
1 parent eae9d94 commit b54e16f
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 23 deletions.
2 changes: 0 additions & 2 deletions polkadot/runtime/westend/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1597,9 +1597,7 @@ pub type MetaTxExtension = (

impl pallet_meta_tx::Config for Runtime {
type WeightInfo = weights::pallet_meta_tx::WeightInfo<Runtime>;
type RuntimeOrigin = RuntimeOrigin;
type RuntimeEvent = RuntimeEvent;
type RuntimeCall = RuntimeCall;
#[cfg(not(feature = "runtime-benchmarks"))]
type Extension = MetaTxExtension;
#[cfg(feature = "runtime-benchmarks")]
Expand Down
2 changes: 0 additions & 2 deletions substrate/bin/node/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2365,9 +2365,7 @@ pub type MetaTxExtension = (

impl pallet_meta_tx::Config for Runtime {
type WeightInfo = ();
type RuntimeOrigin = RuntimeOrigin;
type RuntimeEvent = RuntimeEvent;
type RuntimeCall = RuntimeCall;
#[cfg(not(feature = "runtime-benchmarks"))]
type Extension = MetaTxExtension;
#[cfg(feature = "runtime-benchmarks")]
Expand Down
1 change: 0 additions & 1 deletion substrate/frame/meta-tx/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ fn assert_last_event<T: Config>(generic_event: <T as Config>::RuntimeEvent) {
where
T: Config,
<T as Config>::Extension: Default,
<T as Config>::RuntimeCall: From<frame_system::Call<T>>,
)]
mod benchmarks {
use super::*;
Expand Down
28 changes: 12 additions & 16 deletions substrate/frame/meta-tx/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,31 +98,27 @@ impl<Call, Extension> MetaTx<Call, Extension> {
}

/// The [`MetaTx`] for the given config.
pub type MetaTxFor<T> = MetaTx<<T as Config>::RuntimeCall, <T as Config>::Extension>;
pub type MetaTxFor<T> = MetaTx<<T as frame_system::Config>::RuntimeCall, <T as Config>::Extension>;

#[frame_support::pallet]
pub mod pallet {
use super::*;

#[pallet::config]
pub trait Config: frame_system::Config {
pub trait Config:
frame_system::Config<
RuntimeCall: Dispatchable<
Info = DispatchInfo,
PostInfo = PostDispatchInfo,
RuntimeOrigin = <Self as frame_system::Config>::RuntimeOrigin,
>,
RuntimeOrigin: AsTransactionAuthorizedOrigin + From<SystemOrigin<Self::AccountId>>,
>
{
/// Weight information for calls in this pallet.
type WeightInfo: WeightInfo;
/// The overarching origin type.
// We need extra `AsTransactionAuthorizedOrigin` bound to use `DispatchTransaction` impl.
type RuntimeOrigin: AsTransactionAuthorizedOrigin
+ From<SystemOrigin<Self::AccountId>>
+ IsType<<Self as frame_system::Config>::RuntimeOrigin>;
/// The overarching event type.
type RuntimeEvent: From<Event<Self>> + IsType<<Self as frame_system::Config>::RuntimeEvent>;
/// The overarching call type.
type RuntimeCall: Parameter
+ GetDispatchInfo
+ Dispatchable<
Info = DispatchInfo,
PostInfo = PostDispatchInfo,
RuntimeOrigin = <Self as Config>::RuntimeOrigin,
> + IsType<<Self as frame_system::Config>::RuntimeCall>;
/// Transaction extension/s for meta transactions.
///
/// The extensions that must be present in every meta transaction. This generally includes
Expand All @@ -138,7 +134,7 @@ pub mod pallet {
/// The extension must provide an origin and the extension's weight must be zero. Use
/// `pallet_meta_tx::WeightlessExtension` type when the `runtime-benchmarks` feature
/// enabled.
type Extension: TransactionExtension<<Self as Config>::RuntimeCall>;
type Extension: TransactionExtension<<Self as frame_system::Config>::RuntimeCall>;
}

#[pallet::error]
Expand Down
2 changes: 0 additions & 2 deletions substrate/frame/meta-tx/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,7 @@ mod tx_ext {

impl Config for Runtime {
type WeightInfo = ();
type RuntimeOrigin = RuntimeOrigin;
type RuntimeEvent = RuntimeEvent;
type RuntimeCall = RuntimeCall;
type Extension = MetaTxExtension;
}

Expand Down

0 comments on commit b54e16f

Please sign in to comment.