mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 11:07:56 +00:00
Runtime State Test + Integration with try-runtime (#10174)
* add missing version to dependencies * Huh * add features more * more fixing * last touches * it all finally works * remove some feature gates * remove unused * fix old macro * make it work again * fmt * remove unused import * ".git/.scripts/fmt.sh" 1 * Cleanup more * fix and rename everything * a few clippy fixes * Add try-runtime feature Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * small fixes * fmt * Update bin/node-template/runtime/src/lib.rs * fix build * Update utils/frame/try-runtime/cli/src/lib.rs Co-authored-by: David <dvdplm@gmail.com> * Update utils/frame/try-runtime/cli/src/commands/execute_block.rs Co-authored-by: David <dvdplm@gmail.com> * address all review comments * fix typos * revert spec change * last touches * update docs * fmt * remove some debug_assertions * fmt Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> Co-authored-by: command-bot <> Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> Co-authored-by: David <dvdplm@gmail.com>
This commit is contained in:
@@ -1549,6 +1549,35 @@ macro_rules! decl_module {
|
||||
{}
|
||||
};
|
||||
|
||||
(@impl_try_state_default
|
||||
{ $system:ident }
|
||||
$module:ident<$trait_instance:ident: $trait_name:ident$(<I>, $instance:ident: $instantiable:path)?>;
|
||||
{ $( $other_where_bounds:tt )* }
|
||||
) => {
|
||||
#[cfg(feature = "try-runtime")]
|
||||
impl<$trait_instance: $system::Config + $trait_name$(<I>, $instance: $instantiable)?>
|
||||
$crate::traits::TryState<<$trait_instance as $system::Config>::BlockNumber>
|
||||
for $module<$trait_instance$(, $instance)?> where $( $other_where_bounds )*
|
||||
{
|
||||
fn try_state(
|
||||
_: <$trait_instance as $system::Config>::BlockNumber,
|
||||
_: $crate::traits::TryStateSelect,
|
||||
) -> Result<(), &'static str> {
|
||||
let pallet_name = <<
|
||||
$trait_instance
|
||||
as
|
||||
$system::Config
|
||||
>::PalletInfo as $crate::traits::PalletInfo>::name::<Self>().unwrap_or("<unknown pallet name>");
|
||||
$crate::log::debug!(
|
||||
target: $crate::LOG_TARGET,
|
||||
"⚠️ pallet {} cannot have try-state because it is using decl_module!",
|
||||
pallet_name,
|
||||
);
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
(@impl_on_runtime_upgrade
|
||||
{ $system:ident }
|
||||
$module:ident<$trait_instance:ident: $trait_name:ident$(<I>, $instance:ident: $instantiable:path)?>;
|
||||
@@ -2026,6 +2055,13 @@ macro_rules! decl_module {
|
||||
$( $on_initialize )*
|
||||
}
|
||||
|
||||
$crate::decl_module! {
|
||||
@impl_try_state_default
|
||||
{ $system }
|
||||
$mod_type<$trait_instance: $trait_name $(<I>, $instance: $instantiable)?>;
|
||||
{ $( $other_where_bounds )* }
|
||||
}
|
||||
|
||||
$crate::decl_module! {
|
||||
@impl_on_runtime_upgrade
|
||||
{ $system }
|
||||
|
||||
Reference in New Issue
Block a user