mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 08:11:04 +00:00
pallet macro broke benchmarks_instance, fix by introducing benchmarks_instance_pallet (#8190)
Co-authored-by: Peter Goodspeed-Niklaus <coriolinus@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
d5b308f13c
commit
f2436b87b5
@@ -175,13 +175,33 @@ macro_rules! benchmarks {
|
||||
}
|
||||
|
||||
/// Same as [`benchmarks`] but for instantiable module.
|
||||
///
|
||||
/// NOTE: For pallet declared with [`frame_support::pallet`], use [`benchmarks_instance_pallet`].
|
||||
#[macro_export]
|
||||
macro_rules! benchmarks_instance {
|
||||
(
|
||||
$( $rest:tt )*
|
||||
) => {
|
||||
$crate::benchmarks_iter!(
|
||||
{ I }
|
||||
{ I: Instance }
|
||||
{ }
|
||||
( )
|
||||
( )
|
||||
$( $rest )*
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// Same as [`benchmarks`] but for instantiable pallet declared [`frame_support::pallet`].
|
||||
///
|
||||
/// NOTE: For pallet declared with `decl_module!`, use [`benchmarks_instance`].
|
||||
#[macro_export]
|
||||
macro_rules! benchmarks_instance_pallet {
|
||||
(
|
||||
$( $rest:tt )*
|
||||
) => {
|
||||
$crate::benchmarks_iter!(
|
||||
{ I: 'static }
|
||||
{ }
|
||||
( )
|
||||
( )
|
||||
@@ -195,7 +215,7 @@ macro_rules! benchmarks_instance {
|
||||
macro_rules! benchmarks_iter {
|
||||
// detect and extract where clause:
|
||||
(
|
||||
{ $( $instance:ident )? }
|
||||
{ $( $instance:ident: $instance_bound:tt )? }
|
||||
{ $( $where_clause:tt )* }
|
||||
( $( $names:tt )* )
|
||||
( $( $names_extra:tt )* )
|
||||
@@ -203,7 +223,7 @@ macro_rules! benchmarks_iter {
|
||||
$( $rest:tt )*
|
||||
) => {
|
||||
$crate::benchmarks_iter! {
|
||||
{ $( $instance)? }
|
||||
{ $( $instance: $instance_bound)? }
|
||||
{ $( $where_bound )* }
|
||||
( $( $names )* )
|
||||
( $( $names_extra )* )
|
||||
@@ -212,7 +232,7 @@ macro_rules! benchmarks_iter {
|
||||
};
|
||||
// detect and extract extra tag:
|
||||
(
|
||||
{ $( $instance:ident )? }
|
||||
{ $( $instance:ident: $instance_bound:tt )? }
|
||||
{ $( $where_clause:tt )* }
|
||||
( $( $names:tt )* )
|
||||
( $( $names_extra:tt )* )
|
||||
@@ -221,7 +241,7 @@ macro_rules! benchmarks_iter {
|
||||
$( $rest:tt )*
|
||||
) => {
|
||||
$crate::benchmarks_iter! {
|
||||
{ $( $instance)? }
|
||||
{ $( $instance: $instance_bound )? }
|
||||
{ $( $where_clause )* }
|
||||
( $( $names )* )
|
||||
( $( $names_extra )* $name )
|
||||
@@ -231,7 +251,7 @@ macro_rules! benchmarks_iter {
|
||||
};
|
||||
// mutation arm:
|
||||
(
|
||||
{ $( $instance:ident )? }
|
||||
{ $( $instance:ident: $instance_bound:tt )? }
|
||||
{ $( $where_clause:tt )* }
|
||||
( $( $names:tt )* ) // This contains $( $( { $instance } )? $name:ident )*
|
||||
( $( $names_extra:tt )* )
|
||||
@@ -240,7 +260,7 @@ macro_rules! benchmarks_iter {
|
||||
$( $rest:tt )*
|
||||
) => {
|
||||
$crate::benchmarks_iter! {
|
||||
{ $( $instance)? }
|
||||
{ $( $instance: $instance_bound )? }
|
||||
{ $( $where_clause )* }
|
||||
( $( $names )* )
|
||||
( $( $names_extra )* )
|
||||
@@ -251,7 +271,7 @@ macro_rules! benchmarks_iter {
|
||||
};
|
||||
// mutation arm:
|
||||
(
|
||||
{ $( $instance:ident )? }
|
||||
{ $( $instance:ident: $instance_bound:tt )? }
|
||||
{ $( $where_clause:tt )* }
|
||||
( $( $names:tt )* )
|
||||
( $( $names_extra:tt )* )
|
||||
@@ -260,7 +280,7 @@ macro_rules! benchmarks_iter {
|
||||
$( $rest:tt )*
|
||||
) => {
|
||||
$crate::benchmarks_iter! {
|
||||
{ $( $instance)? }
|
||||
{ $( $instance: $instance_bound )? }
|
||||
{ $( $where_clause )* }
|
||||
( $( $names )* )
|
||||
( $( $names_extra )* )
|
||||
@@ -277,7 +297,7 @@ macro_rules! benchmarks_iter {
|
||||
};
|
||||
// iteration arm:
|
||||
(
|
||||
{ $( $instance:ident )? }
|
||||
{ $( $instance:ident: $instance_bound:tt )? }
|
||||
{ $( $where_clause:tt )* }
|
||||
( $( $names:tt )* )
|
||||
( $( $names_extra:tt )* )
|
||||
@@ -286,7 +306,7 @@ macro_rules! benchmarks_iter {
|
||||
$( $rest:tt )*
|
||||
) => {
|
||||
$crate::benchmark_backend! {
|
||||
{ $( $instance)? }
|
||||
{ $( $instance: $instance_bound )? }
|
||||
$name
|
||||
{ $( $where_clause )* }
|
||||
{ }
|
||||
@@ -298,12 +318,12 @@ macro_rules! benchmarks_iter {
|
||||
#[cfg(test)]
|
||||
$crate::impl_benchmark_test!(
|
||||
{ $( $where_clause )* }
|
||||
{ $( $instance)? }
|
||||
{ $( $instance: $instance_bound )? }
|
||||
$name
|
||||
);
|
||||
|
||||
$crate::benchmarks_iter!(
|
||||
{ $( $instance)? }
|
||||
{ $( $instance: $instance_bound )? }
|
||||
{ $( $where_clause )* }
|
||||
( $( $names )* { $( $instance )? } $name )
|
||||
( $( $names_extra )* )
|
||||
@@ -312,26 +332,26 @@ macro_rules! benchmarks_iter {
|
||||
};
|
||||
// iteration-exit arm
|
||||
(
|
||||
{ $( $instance:ident )? }
|
||||
{ $( $instance:ident: $instance_bound:tt )? }
|
||||
{ $( $where_clause:tt )* }
|
||||
( $( $names:tt )* )
|
||||
( $( $names_extra:tt )* )
|
||||
) => {
|
||||
$crate::selected_benchmark!(
|
||||
{ $( $where_clause)* }
|
||||
{ $( $instance)? }
|
||||
{ $( $instance: $instance_bound )? }
|
||||
$( $names )*
|
||||
);
|
||||
$crate::impl_benchmark!(
|
||||
{ $( $where_clause )* }
|
||||
{ $( $instance)? }
|
||||
{ $( $instance: $instance_bound )? }
|
||||
( $( $names )* )
|
||||
( $( $names_extra ),* )
|
||||
);
|
||||
};
|
||||
// add verify block to _() format
|
||||
(
|
||||
{ $( $instance:ident )? }
|
||||
{ $( $instance:ident: $instance_bound:tt )? }
|
||||
{ $( $where_clause:tt )* }
|
||||
( $( $names:tt )* )
|
||||
( $( $names_extra:tt )* )
|
||||
@@ -339,7 +359,7 @@ macro_rules! benchmarks_iter {
|
||||
$( $rest:tt )*
|
||||
) => {
|
||||
$crate::benchmarks_iter! {
|
||||
{ $( $instance)? }
|
||||
{ $( $instance: $instance_bound )? }
|
||||
{ $( $where_clause )* }
|
||||
( $( $names )* )
|
||||
( $( $names_extra )* )
|
||||
@@ -350,7 +370,7 @@ macro_rules! benchmarks_iter {
|
||||
};
|
||||
// add verify block to name() format
|
||||
(
|
||||
{ $( $instance:ident )? }
|
||||
{ $( $instance:ident: $instance_bound:tt )? }
|
||||
{ $( $where_clause:tt )* }
|
||||
( $( $names:tt )* )
|
||||
( $( $names_extra:tt )* )
|
||||
@@ -358,7 +378,7 @@ macro_rules! benchmarks_iter {
|
||||
$( $rest:tt )*
|
||||
) => {
|
||||
$crate::benchmarks_iter! {
|
||||
{ $( $instance)? }
|
||||
{ $( $instance: $instance_bound )? }
|
||||
{ $( $where_clause )* }
|
||||
( $( $names )* )
|
||||
( $( $names_extra )* )
|
||||
@@ -369,7 +389,7 @@ macro_rules! benchmarks_iter {
|
||||
};
|
||||
// add verify block to {} format
|
||||
(
|
||||
{ $( $instance:ident )? }
|
||||
{ $( $instance:ident: $instance_bound:tt )? }
|
||||
{ $( $where_clause:tt )* }
|
||||
( $( $names:tt )* )
|
||||
( $( $names_extra:tt )* )
|
||||
@@ -377,7 +397,7 @@ macro_rules! benchmarks_iter {
|
||||
$( $rest:tt )*
|
||||
) => {
|
||||
$crate::benchmarks_iter!(
|
||||
{ $( $instance)? }
|
||||
{ $( $instance: $instance_bound )? }
|
||||
{ $( $where_clause )* }
|
||||
( $( $names )* )
|
||||
( $( $names_extra )* )
|
||||
@@ -393,7 +413,7 @@ macro_rules! benchmarks_iter {
|
||||
macro_rules! benchmark_backend {
|
||||
// parsing arms
|
||||
(
|
||||
{ $( $instance:ident )? }
|
||||
{ $( $instance:ident: $instance_bound:tt )? }
|
||||
$name:ident
|
||||
{ $( $where_clause:tt )* }
|
||||
{ $( PRE { $( $pre_parsed:tt )* } )* }
|
||||
@@ -405,7 +425,7 @@ macro_rules! benchmark_backend {
|
||||
$postcode:block
|
||||
) => {
|
||||
$crate::benchmark_backend! {
|
||||
{ $( $instance)? }
|
||||
{ $( $instance: $instance_bound )? }
|
||||
$name
|
||||
{ $( $where_clause )* }
|
||||
{
|
||||
@@ -418,7 +438,7 @@ macro_rules! benchmark_backend {
|
||||
}
|
||||
};
|
||||
(
|
||||
{ $( $instance:ident )? }
|
||||
{ $( $instance:ident: $instance_bound:tt )? }
|
||||
$name:ident
|
||||
{ $( $where_clause:tt )* }
|
||||
{ $( $parsed:tt )* }
|
||||
@@ -430,7 +450,7 @@ macro_rules! benchmark_backend {
|
||||
$postcode:block
|
||||
) => {
|
||||
$crate::benchmark_backend! {
|
||||
{ $( $instance)? }
|
||||
{ $( $instance: $instance_bound )? }
|
||||
$name
|
||||
{ $( $where_clause )* }
|
||||
{
|
||||
@@ -444,7 +464,7 @@ macro_rules! benchmark_backend {
|
||||
};
|
||||
// mutation arm to look after a single tt for param_from.
|
||||
(
|
||||
{ $( $instance:ident )? }
|
||||
{ $( $instance:ident: $instance_bound:tt )? }
|
||||
$name:ident
|
||||
{ $( $where_clause:tt )* }
|
||||
{ $( $parsed:tt )* }
|
||||
@@ -456,7 +476,7 @@ macro_rules! benchmark_backend {
|
||||
$postcode:block
|
||||
) => {
|
||||
$crate::benchmark_backend! {
|
||||
{ $( $instance)? }
|
||||
{ $( $instance: $instance_bound )? }
|
||||
$name
|
||||
{ $( $where_clause )* }
|
||||
{ $( $parsed )* }
|
||||
@@ -470,7 +490,7 @@ macro_rules! benchmark_backend {
|
||||
};
|
||||
// mutation arm to look after the default tail of `=> ()`
|
||||
(
|
||||
{ $( $instance:ident )? }
|
||||
{ $( $instance:ident: $instance_bound:tt )? }
|
||||
$name:ident
|
||||
{ $( $where_clause:tt )* }
|
||||
{ $( $parsed:tt )* }
|
||||
@@ -482,7 +502,7 @@ macro_rules! benchmark_backend {
|
||||
$postcode:block
|
||||
) => {
|
||||
$crate::benchmark_backend! {
|
||||
{ $( $instance)? }
|
||||
{ $( $instance: $instance_bound )? }
|
||||
$name
|
||||
{ $( $where_clause )* }
|
||||
{ $( $parsed )* }
|
||||
@@ -496,7 +516,7 @@ macro_rules! benchmark_backend {
|
||||
};
|
||||
// mutation arm to look after `let _ =`
|
||||
(
|
||||
{ $( $instance:ident )? }
|
||||
{ $( $instance:ident: $instance_bound:tt )? }
|
||||
$name:ident
|
||||
{ $( $where_clause:tt )* }
|
||||
{ $( $parsed:tt )* }
|
||||
@@ -508,7 +528,7 @@ macro_rules! benchmark_backend {
|
||||
$postcode:block
|
||||
) => {
|
||||
$crate::benchmark_backend! {
|
||||
{ $( $instance)? }
|
||||
{ $( $instance: $instance_bound )? }
|
||||
$name
|
||||
{ $( $where_clause )* }
|
||||
{ $( $parsed )* }
|
||||
@@ -522,7 +542,7 @@ macro_rules! benchmark_backend {
|
||||
};
|
||||
// actioning arm
|
||||
(
|
||||
{ $( $instance:ident )? }
|
||||
{ $( $instance:ident: $instance_bound:tt )? }
|
||||
$name:ident
|
||||
{ $( $where_clause:tt )* }
|
||||
{
|
||||
@@ -536,7 +556,7 @@ macro_rules! benchmark_backend {
|
||||
#[allow(non_camel_case_types)]
|
||||
struct $name;
|
||||
#[allow(unused_variables)]
|
||||
impl<T: Config $( <$instance>, I: Instance)? >
|
||||
impl<T: Config $( <$instance>, $instance: $instance_bound )? >
|
||||
$crate::BenchmarkingSetup<T $(, $instance)? > for $name
|
||||
where $( $where_clause )*
|
||||
{
|
||||
@@ -597,7 +617,7 @@ macro_rules! benchmark_backend {
|
||||
macro_rules! selected_benchmark {
|
||||
(
|
||||
{ $( $where_clause:tt )* }
|
||||
{ $( $instance:ident )? }
|
||||
{ $( $instance:ident: $instance_bound:tt )? }
|
||||
$( { $( $bench_inst:ident )? } $bench:ident )*
|
||||
) => {
|
||||
// The list of available benchmarks for this pallet.
|
||||
@@ -607,7 +627,7 @@ macro_rules! selected_benchmark {
|
||||
}
|
||||
|
||||
// Allow us to select a benchmark from the list of available benchmarks.
|
||||
impl<T: Config $( <$instance>, I: Instance )? >
|
||||
impl<T: Config $( <$instance>, $instance: $instance_bound )? >
|
||||
$crate::BenchmarkingSetup<T $(, $instance )? > for SelectedBenchmark
|
||||
where $( $where_clause )*
|
||||
{
|
||||
@@ -643,11 +663,11 @@ macro_rules! selected_benchmark {
|
||||
macro_rules! impl_benchmark {
|
||||
(
|
||||
{ $( $where_clause:tt )* }
|
||||
{ $( $instance:ident )? }
|
||||
{ $( $instance:ident: $instance_bound:tt )? }
|
||||
( $( { $( $name_inst:ident )? } $name:ident )* )
|
||||
( $( $name_extra:ident ),* )
|
||||
) => {
|
||||
impl<T: Config $(<$instance>, I: Instance)? >
|
||||
impl<T: Config $(<$instance>, $instance: $instance_bound )? >
|
||||
$crate::Benchmarking<$crate::BenchmarkResults> for Module<T $(, $instance)? >
|
||||
where T: frame_system::Config, $( $where_clause )*
|
||||
{
|
||||
@@ -866,7 +886,7 @@ macro_rules! impl_benchmark {
|
||||
macro_rules! impl_benchmark_test {
|
||||
(
|
||||
{ $( $where_clause:tt )* }
|
||||
{ $( $instance:ident )? }
|
||||
{ $( $instance:ident: $instance_bound:tt )? }
|
||||
$name:ident
|
||||
) => {
|
||||
$crate::paste::item! {
|
||||
|
||||
Reference in New Issue
Block a user