mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-19 01:45:41 +00:00
Proposal: Flatten AllPallets and similar types (#11813)
* flratten AllPallets types * feature flag it * fix * fix * fmt * remove todo * Update frame/support/src/traits/metadata.rs Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> * Update frame/support/src/migrations.rs Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> * fix * mark as deprecated * add docs * fix ui test? * fmt Co-authored-by: parity-processbot <> Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
This commit is contained in:
@@ -38,7 +38,9 @@ pub trait OnInitialize<BlockNumber> {
|
||||
}
|
||||
}
|
||||
|
||||
#[impl_for_tuples(30)]
|
||||
#[cfg_attr(all(not(feature = "tuples-96"), not(feature = "tuples-128")), impl_for_tuples(64))]
|
||||
#[cfg_attr(all(feature = "tuples-96", not(feature = "tuples-128")), impl_for_tuples(96))]
|
||||
#[cfg_attr(feature = "tuples-128", impl_for_tuples(128))]
|
||||
impl<BlockNumber: Clone> OnInitialize<BlockNumber> for Tuple {
|
||||
fn on_initialize(n: BlockNumber) -> crate::weights::Weight {
|
||||
let mut weight = 0;
|
||||
@@ -50,7 +52,9 @@ impl<BlockNumber: Clone> OnInitialize<BlockNumber> for Tuple {
|
||||
/// The block finalization trait.
|
||||
///
|
||||
/// Implementing this lets you express what should happen for your pallet when the block is ending.
|
||||
#[impl_for_tuples(30)]
|
||||
#[cfg_attr(all(not(feature = "tuples-96"), not(feature = "tuples-128")), impl_for_tuples(64))]
|
||||
#[cfg_attr(all(feature = "tuples-96", not(feature = "tuples-128")), impl_for_tuples(96))]
|
||||
#[cfg_attr(feature = "tuples-128", impl_for_tuples(128))]
|
||||
pub trait OnFinalize<BlockNumber> {
|
||||
/// The block is being finalized. Implement to have something happen.
|
||||
///
|
||||
@@ -79,7 +83,9 @@ pub trait OnIdle<BlockNumber> {
|
||||
}
|
||||
}
|
||||
|
||||
#[impl_for_tuples(30)]
|
||||
#[cfg_attr(all(not(feature = "tuples-96"), not(feature = "tuples-128")), impl_for_tuples(64))]
|
||||
#[cfg_attr(all(feature = "tuples-96", not(feature = "tuples-128")), impl_for_tuples(96))]
|
||||
#[cfg_attr(feature = "tuples-128", impl_for_tuples(128))]
|
||||
impl<BlockNumber: Copy + AtLeast32BitUnsigned> OnIdle<BlockNumber> for Tuple {
|
||||
fn on_idle(n: BlockNumber, remaining_weight: crate::weights::Weight) -> crate::weights::Weight {
|
||||
let on_idle_functions: &[fn(
|
||||
@@ -105,7 +111,9 @@ impl<BlockNumber: Copy + AtLeast32BitUnsigned> OnIdle<BlockNumber> for Tuple {
|
||||
/// Implementing this trait for a pallet let's you express operations that should
|
||||
/// happen at genesis. It will be called in an externalities provided environment and
|
||||
/// will see the genesis state after all pallets have written their genesis state.
|
||||
#[impl_for_tuples(30)]
|
||||
#[cfg_attr(all(not(feature = "tuples-96"), not(feature = "tuples-128")), impl_for_tuples(64))]
|
||||
#[cfg_attr(all(feature = "tuples-96", not(feature = "tuples-128")), impl_for_tuples(96))]
|
||||
#[cfg_attr(feature = "tuples-128", impl_for_tuples(128))]
|
||||
pub trait OnGenesis {
|
||||
/// Something that should happen at genesis.
|
||||
fn on_genesis() {}
|
||||
@@ -187,7 +195,9 @@ pub trait OnRuntimeUpgrade {
|
||||
}
|
||||
}
|
||||
|
||||
#[impl_for_tuples(30)]
|
||||
#[cfg_attr(all(not(feature = "tuples-96"), not(feature = "tuples-128")), impl_for_tuples(64))]
|
||||
#[cfg_attr(all(feature = "tuples-96", not(feature = "tuples-128")), impl_for_tuples(96))]
|
||||
#[cfg_attr(feature = "tuples-128", impl_for_tuples(128))]
|
||||
impl OnRuntimeUpgrade for Tuple {
|
||||
fn on_runtime_upgrade() -> crate::weights::Weight {
|
||||
let mut weight = 0;
|
||||
@@ -210,6 +220,19 @@ impl OnRuntimeUpgrade for Tuple {
|
||||
}
|
||||
}
|
||||
|
||||
/// Type that provide some integrity tests.
|
||||
///
|
||||
/// This implemented for modules by `decl_module`.
|
||||
#[cfg_attr(all(not(feature = "tuples-96"), not(feature = "tuples-128")), impl_for_tuples(64))]
|
||||
#[cfg_attr(all(feature = "tuples-96", not(feature = "tuples-128")), impl_for_tuples(96))]
|
||||
#[cfg_attr(feature = "tuples-128", impl_for_tuples(128))]
|
||||
pub trait IntegrityTest {
|
||||
/// Run integrity test.
|
||||
///
|
||||
/// The test is not executed in a externalities provided environment.
|
||||
fn integrity_test() {}
|
||||
}
|
||||
|
||||
/// The pallet hooks trait. Implementing this lets you express some logic to execute.
|
||||
pub trait Hooks<BlockNumber> {
|
||||
/// The block is being finalized. Implement to have something happen.
|
||||
@@ -321,7 +344,9 @@ pub trait GenesisBuild<T, I = ()>: Default + sp_runtime::traits::MaybeSerializeD
|
||||
}
|
||||
|
||||
/// A trait which is called when the timestamp is set in the runtime.
|
||||
#[impl_for_tuples(30)]
|
||||
#[cfg_attr(all(not(feature = "tuples-96"), not(feature = "tuples-128")), impl_for_tuples(64))]
|
||||
#[cfg_attr(all(feature = "tuples-96", not(feature = "tuples-128")), impl_for_tuples(96))]
|
||||
#[cfg_attr(feature = "tuples-128", impl_for_tuples(128))]
|
||||
pub trait OnTimestampSet<Moment> {
|
||||
/// Called when the timestamp is set.
|
||||
fn on_timestamp_set(moment: Moment);
|
||||
|
||||
Reference in New Issue
Block a user