fix: Complete snowbridge pezpallet rebrand and critical bug fixes
- snowbridge-pezpallet-* → pezsnowbridge-pezpallet-* (201 refs) - pallet/ directories → pezpallet/ (4 locations) - Fixed pezpallet.rs self-include recursion bug - Fixed sc-chain-spec hardcoded crate name in derive macro - Reverted .pezpallet_by_name() to .pallet_by_name() (subxt API) - Added BizinikiwiConfig type alias for zombienet tests - Deleted obsolete session state files Verified: pezsnowbridge-pezpallet-*, pezpallet-staking, pezpallet-staking-async, pezframe-benchmarking-cli all pass cargo check
This commit is contained in:
@@ -16,13 +16,13 @@
|
||||
// limitations under the License.
|
||||
|
||||
//! A set of benchmarks which can establish a global baseline for all other
|
||||
//! benchmarking. These benchmarks do not require a pallet to be deployed.
|
||||
//! benchmarking. These benchmarks do not require a pezpallet to be deployed.
|
||||
|
||||
#![cfg(feature = "runtime-benchmarks")]
|
||||
|
||||
use crate::benchmarks;
|
||||
use alloc::{vec, vec::Vec};
|
||||
use pezframe_system::Pallet as System;
|
||||
use pezframe_system::Pezpallet as System;
|
||||
use pezsp_runtime::{
|
||||
traits::{AppVerify, Hash},
|
||||
RuntimeAppPublic,
|
||||
@@ -36,7 +36,7 @@ mod crypto {
|
||||
}
|
||||
pub type SignerId = crypto::Public;
|
||||
|
||||
pub struct Pallet<T: Config>(System<T>);
|
||||
pub struct Pezpallet<T: Config>(System<T>);
|
||||
pub trait Config: pezframe_system::Config {}
|
||||
|
||||
benchmarks! {
|
||||
@@ -102,7 +102,7 @@ benchmarks! {
|
||||
}
|
||||
|
||||
impl_benchmark_test_suite!(
|
||||
Pallet,
|
||||
Pezpallet,
|
||||
mock::new_test_ext(),
|
||||
mock::Test,
|
||||
);
|
||||
|
||||
@@ -53,7 +53,7 @@ pub use analysis::{Analysis, AnalysisChoice, BenchmarkSelector};
|
||||
pub use utils::*;
|
||||
pub use v1::*;
|
||||
|
||||
/// Contains macros, structs, and traits associated with v2 of the pallet benchmarking syntax.
|
||||
/// Contains macros, structs, and traits associated with v2 of the pezpallet benchmarking syntax.
|
||||
///
|
||||
/// The [`v2::benchmarks`] and [`v2::instance_benchmarks`] macros can be used to designate a
|
||||
/// module as a benchmarking module that can contain benchmarks and benchmark tests. The
|
||||
@@ -71,7 +71,7 @@ pub use v1::*;
|
||||
/// ```ignore
|
||||
/// #![cfg(feature = "runtime-benchmarks")]
|
||||
///
|
||||
/// use super::{mock_helpers::*, Pallet as MyPallet};
|
||||
/// use super::{mock_helpers::*, Pezpallet as MyPallet};
|
||||
/// use pezframe_benchmarking::v2::*;
|
||||
///
|
||||
/// #[benchmarks]
|
||||
@@ -207,7 +207,7 @@ pub use v1::*;
|
||||
/// Some pallets require a where clause specifying constraints on their generics to make
|
||||
/// writing benchmarks feasible. To accommodate this situation, you can provide such a where
|
||||
/// clause as the (only) argument to the `#[benchmarks]` or `#[instance_benchmarks]` attribute
|
||||
/// macros. Below is an example of this taken from the `message-queue` pallet.
|
||||
/// macros. Below is an example of this taken from the `message-queue` pezpallet.
|
||||
///
|
||||
/// ```ignore
|
||||
/// #[benchmarks(
|
||||
@@ -226,7 +226,7 @@ pub use v1::*;
|
||||
/// Benchmark tests can be generated using the old syntax in `pezframe_benchmarking`,
|
||||
/// including the `pezframe_benchmarking::impl_benchmark_test_suite` macro.
|
||||
///
|
||||
/// An example is shown below (taken from the `message-queue` pallet's `benchmarking` module):
|
||||
/// An example is shown below (taken from the `message-queue` pezpallet's `benchmarking` module):
|
||||
/// ```ignore
|
||||
/// #[benchmarks]
|
||||
/// mod benchmarks {
|
||||
@@ -282,7 +282,7 @@ pub use v1::*;
|
||||
/// ```ignore
|
||||
/// #![cfg(feature = "runtime-benchmarks")]
|
||||
///
|
||||
/// use super::{mock_helpers::*, Pallet as MyPallet};
|
||||
/// use super::{mock_helpers::*, Pezpallet as MyPallet};
|
||||
/// use pezframe_benchmarking::v2::*;
|
||||
///
|
||||
/// #[benchmarks]
|
||||
@@ -331,7 +331,7 @@ pub use v1::*;
|
||||
/// function in v2, while `setup(y)?;` will be moved to the body of the function;
|
||||
/// 2. Move all the v1 setup code to the body of the v2 function;
|
||||
/// 3. Move the benchmarked code to the body of the v2 function under the appropriate macro
|
||||
/// attribute: `#[extrinsic_call]` for extrinsic pallet calls and `#[block]` for blocks of
|
||||
/// attribute: `#[extrinsic_call]` for extrinsic pezpallet calls and `#[block]` for blocks of
|
||||
/// code;
|
||||
/// 4. Move the v1 verify code block to the body of the v2 function, after the
|
||||
/// `#[extrinsic_call]` or `#[block]` attribute.
|
||||
|
||||
@@ -27,26 +27,26 @@ use pezsp_runtime::{
|
||||
};
|
||||
use std::cell::RefCell;
|
||||
|
||||
#[pezframe_support::pallet(dev_mode)]
|
||||
#[pezframe_support::pezpallet(dev_mode)]
|
||||
mod pezpallet_test {
|
||||
use pezframe_support::pezpallet_prelude::*;
|
||||
use pezframe_system::pezpallet_prelude::*;
|
||||
|
||||
#[pallet::pallet]
|
||||
pub struct Pallet<T>(_);
|
||||
#[pezpallet::pezpallet]
|
||||
pub struct Pezpallet<T>(_);
|
||||
|
||||
#[pallet::config]
|
||||
#[pezpallet::config]
|
||||
pub trait Config: pezframe_system::Config {
|
||||
type LowerBound: Get<u32>;
|
||||
type UpperBound: Get<u32>;
|
||||
type MaybeItem: Get<Option<u32>>;
|
||||
}
|
||||
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub(crate) type Value<T: Config> = StorageValue<_, u32, OptionQuery>;
|
||||
|
||||
#[pallet::call]
|
||||
impl<T: Config> Pallet<T> {
|
||||
#[pezpallet::call]
|
||||
impl<T: Config> Pezpallet<T> {
|
||||
pub fn set_value(origin: OriginFor<T>, n: u32) -> DispatchResult {
|
||||
let _sender = ensure_signed(origin)?;
|
||||
Value::<T>::put(n);
|
||||
@@ -131,7 +131,7 @@ mod benchmarks {
|
||||
use rusty_fork::rusty_fork_test;
|
||||
|
||||
// Additional used internally by the benchmark macro.
|
||||
use super::pezpallet_test::{Call, Config, Pallet};
|
||||
use super::pezpallet_test::{Call, Config, Pezpallet};
|
||||
|
||||
crate::benchmarks! {
|
||||
where_clause {
|
||||
@@ -340,18 +340,18 @@ mod benchmarks {
|
||||
#[test]
|
||||
fn benchmarks_generate_unit_tests() {
|
||||
new_test_ext().execute_with(|| {
|
||||
assert_ok!(Pallet::<Test>::test_benchmark_set_value());
|
||||
assert_ok!(Pallet::<Test>::test_benchmark_other_name());
|
||||
assert_ok!(Pallet::<Test>::test_benchmark_sort_vector());
|
||||
assert_err!(Pallet::<Test>::test_benchmark_bad_origin(), "Bad origin");
|
||||
assert_err!(Pallet::<Test>::test_benchmark_bad_verify(), "You forgot to sort!");
|
||||
assert_ok!(Pallet::<Test>::test_benchmark_no_components());
|
||||
assert_ok!(Pallet::<Test>::test_benchmark_variable_components());
|
||||
assert_ok!(Pezpallet::<Test>::test_benchmark_set_value());
|
||||
assert_ok!(Pezpallet::<Test>::test_benchmark_other_name());
|
||||
assert_ok!(Pezpallet::<Test>::test_benchmark_sort_vector());
|
||||
assert_err!(Pezpallet::<Test>::test_benchmark_bad_origin(), "Bad origin");
|
||||
assert_err!(Pezpallet::<Test>::test_benchmark_bad_verify(), "You forgot to sort!");
|
||||
assert_ok!(Pezpallet::<Test>::test_benchmark_no_components());
|
||||
assert_ok!(Pezpallet::<Test>::test_benchmark_variable_components());
|
||||
assert!(matches!(
|
||||
Pallet::<Test>::test_benchmark_override_benchmark(),
|
||||
Pezpallet::<Test>::test_benchmark_override_benchmark(),
|
||||
Err(BenchmarkError::Override(_)),
|
||||
));
|
||||
assert_eq!(Pallet::<Test>::test_benchmark_skip_benchmark(), Err(BenchmarkError::Skip),);
|
||||
assert_eq!(Pezpallet::<Test>::test_benchmark_skip_benchmark(), Err(BenchmarkError::Skip),);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -361,18 +361,18 @@ mod benchmarks {
|
||||
new_test_ext().execute_with(|| {
|
||||
// It resets when the error happens in the setup:
|
||||
assert_err!(
|
||||
Pallet::<Test>::test_benchmark_modify_in_setup_then_error(),
|
||||
Pezpallet::<Test>::test_benchmark_modify_in_setup_then_error(),
|
||||
"Should error"
|
||||
);
|
||||
assert_eq!(Value::<Test>::get(), None);
|
||||
|
||||
// It resets when the error happens in the call:
|
||||
assert_err!(Pallet::<Test>::test_benchmark_modify_in_call_then_error(), "Should error");
|
||||
assert_err!(Pezpallet::<Test>::test_benchmark_modify_in_call_then_error(), "Should error");
|
||||
assert_eq!(Value::<Test>::get(), None);
|
||||
|
||||
// It resets when the error happens in the verify:
|
||||
assert_err!(
|
||||
Pallet::<Test>::test_benchmark_modify_in_verify_then_error(),
|
||||
Pezpallet::<Test>::test_benchmark_modify_in_verify_then_error(),
|
||||
"Should error"
|
||||
);
|
||||
assert_eq!(Value::<Test>::get(), None);
|
||||
@@ -414,7 +414,7 @@ mod benchmarks {
|
||||
}
|
||||
|
||||
new_test_ext().execute_with(|| {
|
||||
let got = Pallet::<Test>::test_benchmark_values_per_component()
|
||||
let got = Pezpallet::<Test>::test_benchmark_values_per_component()
|
||||
.map(|_| VALUES_PER_COMPONENT.with(|v| v.borrow().clone()));
|
||||
|
||||
assert_eq!(got, output);
|
||||
|
||||
@@ -26,19 +26,19 @@ use pezsp_runtime::{
|
||||
BuildStorage,
|
||||
};
|
||||
|
||||
#[pezframe_support::pallet]
|
||||
#[pezframe_support::pezpallet]
|
||||
mod pezpallet_test {
|
||||
use pezframe_support::pezpallet_prelude::*;
|
||||
use pezframe_system::pezpallet_prelude::*;
|
||||
|
||||
#[pallet::pallet]
|
||||
pub struct Pallet<T, I = ()>(PhantomData<(T, I)>);
|
||||
#[pezpallet::pezpallet]
|
||||
pub struct Pezpallet<T, I = ()>(PhantomData<(T, I)>);
|
||||
|
||||
pub trait OtherConfig {
|
||||
type OtherEvent;
|
||||
}
|
||||
|
||||
#[pallet::config]
|
||||
#[pezpallet::config]
|
||||
pub trait Config<I: 'static = ()>: pezframe_system::Config + OtherConfig {
|
||||
#[allow(deprecated)]
|
||||
type RuntimeEvent: From<Event<Self, I>>
|
||||
@@ -47,19 +47,19 @@ mod pezpallet_test {
|
||||
type UpperBound: Get<u32>;
|
||||
}
|
||||
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub(crate) type Value<T: Config<I>, I: 'static = ()> = StorageValue<_, u32, OptionQuery>;
|
||||
|
||||
#[pallet::event]
|
||||
#[pezpallet::event]
|
||||
pub enum Event<T: Config<I>, I: 'static = ()> {}
|
||||
|
||||
#[pallet::call]
|
||||
impl<T: Config<I>, I: 'static> Pallet<T, I>
|
||||
#[pezpallet::call]
|
||||
impl<T: Config<I>, I: 'static> Pezpallet<T, I>
|
||||
where
|
||||
<T as OtherConfig>::OtherEvent: Into<<T as Config<I>>::RuntimeEvent>,
|
||||
{
|
||||
#[pallet::call_index(0)]
|
||||
#[pallet::weight({0})]
|
||||
#[pezpallet::call_index(0)]
|
||||
#[pezpallet::weight({0})]
|
||||
pub fn set_value(origin: OriginFor<T>, n: u32) -> DispatchResult {
|
||||
let _sender = ensure_signed(origin)?;
|
||||
assert!(n >= T::LowerBound::get());
|
||||
@@ -67,8 +67,8 @@ mod pezpallet_test {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[pallet::call_index(1)]
|
||||
#[pallet::weight({0})]
|
||||
#[pezpallet::call_index(1)]
|
||||
#[pezpallet::weight({0})]
|
||||
pub fn dummy(origin: OriginFor<T>, _n: u32) -> DispatchResult {
|
||||
let _sender = ensure_none(origin)?;
|
||||
Ok(())
|
||||
@@ -147,7 +147,7 @@ mod benchmarks {
|
||||
use pezsp_core::Get;
|
||||
|
||||
// Additional used internally by the benchmark macro.
|
||||
use super::pezpallet_test::{Call, Config, Pallet};
|
||||
use super::pezpallet_test::{Call, Config, Pezpallet};
|
||||
|
||||
crate::benchmarks_instance_pallet! {
|
||||
where_clause {
|
||||
@@ -182,7 +182,7 @@ mod benchmarks {
|
||||
}
|
||||
|
||||
impl_benchmark_test_suite!(
|
||||
Pallet,
|
||||
Pezpallet,
|
||||
crate::tests_instance::new_test_ext(),
|
||||
crate::tests_instance::Test
|
||||
)
|
||||
@@ -197,7 +197,7 @@ fn ensure_correct_instance_is_selected() {
|
||||
|
||||
let mut batches = Vec::<crate::BenchmarkBatch>::new();
|
||||
let config = crate::BenchmarkConfig {
|
||||
pallet: "pezpallet_test".bytes().collect::<Vec<_>>(),
|
||||
pezpallet: "pezpallet_test".bytes().collect::<Vec<_>>(),
|
||||
// We only want that this `instance` is used.
|
||||
// Otherwise the wrong components are used.
|
||||
instance: "TestPallet".bytes().collect::<Vec<_>>(),
|
||||
|
||||
@@ -77,10 +77,10 @@ impl std::fmt::Display for BenchmarkParameter {
|
||||
#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
|
||||
#[derive(Encode, Decode, Clone, PartialEq, Debug, TypeInfo)]
|
||||
pub struct BenchmarkBatch {
|
||||
/// The pallet containing this benchmark.
|
||||
/// The pezpallet containing this benchmark.
|
||||
#[cfg_attr(feature = "std", serde(with = "serde_as_str"))]
|
||||
pub pallet: Vec<u8>,
|
||||
/// The instance of this pallet being benchmarked.
|
||||
pub pezpallet: Vec<u8>,
|
||||
/// The instance of this pezpallet being benchmarked.
|
||||
#[cfg_attr(feature = "std", serde(with = "serde_as_str"))]
|
||||
pub instance: Vec<u8>,
|
||||
/// The extrinsic (or benchmark name) of this benchmark.
|
||||
@@ -95,10 +95,10 @@ pub struct BenchmarkBatch {
|
||||
#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
|
||||
#[derive(Encode, Decode, Clone, PartialEq, Debug)]
|
||||
pub struct BenchmarkBatchSplitResults {
|
||||
/// The pallet containing this benchmark.
|
||||
/// The pezpallet containing this benchmark.
|
||||
#[cfg_attr(feature = "std", serde(with = "serde_as_str"))]
|
||||
pub pallet: Vec<u8>,
|
||||
/// The instance of this pallet being benchmarked.
|
||||
pub pezpallet: Vec<u8>,
|
||||
/// The instance of this pezpallet being benchmarked.
|
||||
#[cfg_attr(feature = "std", serde(with = "serde_as_str"))]
|
||||
pub instance: Vec<u8>,
|
||||
/// The extrinsic (or benchmark name) of this benchmark.
|
||||
@@ -110,7 +110,7 @@ pub struct BenchmarkBatchSplitResults {
|
||||
pub db_results: Vec<BenchmarkResult>,
|
||||
}
|
||||
|
||||
/// Result from running benchmarks on a FRAME pallet.
|
||||
/// Result from running benchmarks on a FRAME pezpallet.
|
||||
/// Contains duration of the function call in nanoseconds along with the benchmark parameters
|
||||
/// used for that benchmark result.
|
||||
#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
|
||||
@@ -210,9 +210,9 @@ impl From<TransactionValidityError> for BenchmarkError {
|
||||
/// Configuration used to setup and run runtime benchmarks.
|
||||
#[derive(Encode, Decode, Default, Clone, PartialEq, Debug, TypeInfo)]
|
||||
pub struct BenchmarkConfig {
|
||||
/// The encoded name of the pallet to benchmark.
|
||||
pub pallet: Vec<u8>,
|
||||
/// The encoded name of the pallet instance to benchmark.
|
||||
/// The encoded name of the pezpallet to benchmark.
|
||||
pub pezpallet: Vec<u8>,
|
||||
/// The encoded name of the pezpallet instance to benchmark.
|
||||
pub instance: Vec<u8>,
|
||||
/// The encoded name of the benchmark/extrinsic to run.
|
||||
pub benchmark: Vec<u8>,
|
||||
@@ -224,12 +224,12 @@ pub struct BenchmarkConfig {
|
||||
pub internal_repeats: u32,
|
||||
}
|
||||
|
||||
/// A list of benchmarks available for a particular pallet and instance.
|
||||
/// A list of benchmarks available for a particular pezpallet and instance.
|
||||
///
|
||||
/// All `Vec<u8>` must be valid utf8 strings.
|
||||
#[derive(Encode, Decode, Default, Clone, PartialEq, Debug, TypeInfo)]
|
||||
pub struct BenchmarkList {
|
||||
pub pallet: Vec<u8>,
|
||||
pub pezpallet: Vec<u8>,
|
||||
pub instance: Vec<u8>,
|
||||
pub benchmarks: Vec<BenchmarkMetadata>,
|
||||
}
|
||||
@@ -350,9 +350,9 @@ pub trait Benchmarking {
|
||||
}
|
||||
}
|
||||
|
||||
/// The pallet benchmarking trait.
|
||||
/// The pezpallet benchmarking trait.
|
||||
pub trait Benchmarking {
|
||||
/// Get the benchmarks available for this pallet. Generally there is one benchmark per
|
||||
/// Get the benchmarks available for this pezpallet. Generally there is one benchmark per
|
||||
/// extrinsic, so these are sometimes just called "extrinsics".
|
||||
///
|
||||
/// Parameters
|
||||
@@ -360,7 +360,7 @@ pub trait Benchmarking {
|
||||
/// weight calculation.
|
||||
fn benchmarks(extra: bool) -> Vec<BenchmarkMetadata>;
|
||||
|
||||
/// Run the benchmarks for this pallet.
|
||||
/// Run the benchmarks for this pezpallet.
|
||||
fn run_benchmark(
|
||||
name: &[u8],
|
||||
selected_components: &[(BenchmarkParameter, u32)],
|
||||
|
||||
@@ -29,7 +29,7 @@ macro_rules! whitelist {
|
||||
};
|
||||
}
|
||||
|
||||
/// Construct pallet benchmarks for weighing dispatchables.
|
||||
/// Construct pezpallet benchmarks for weighing dispatchables.
|
||||
///
|
||||
/// Works around the idea of complexity parameters, named by a single letter (which is usually
|
||||
/// upper cased in complexity notation but is lower-cased for use in this macro).
|
||||
@@ -125,7 +125,7 @@ macro_rules! whitelist {
|
||||
///
|
||||
/// Test functions are automatically generated for each benchmark and are accessible to you when you
|
||||
/// run `cargo test`. All tests are named `test_benchmark_<benchmark_name>`, implemented on the
|
||||
/// Pallet struct, and run them in a test externalities environment. The test function runs your
|
||||
/// Pezpallet struct, and run them in a test externalities environment. The test function runs your
|
||||
/// benchmark just like a regular benchmark, but only testing at the lowest and highest values for
|
||||
/// each component. The function will return `Ok(())` if the benchmarks return no errors.
|
||||
///
|
||||
@@ -161,10 +161,10 @@ macro_rules! whitelist {
|
||||
/// #[test]
|
||||
/// fn test_benchmarks() {
|
||||
/// new_test_ext().execute_with(|| {
|
||||
/// assert_ok!(Pallet::<Test>::test_benchmark_dummy());
|
||||
/// assert_err!(Pallet::<Test>::test_benchmark_other_name(), "Bad origin");
|
||||
/// assert_ok!(Pallet::<Test>::test_benchmark_sort_vector());
|
||||
/// assert_err!(Pallet::<Test>::test_benchmark_broken_benchmark(), "You forgot to sort!");
|
||||
/// assert_ok!(Pezpallet::<Test>::test_benchmark_dummy());
|
||||
/// assert_err!(Pezpallet::<Test>::test_benchmark_other_name(), "Bad origin");
|
||||
/// assert_ok!(Pezpallet::<Test>::test_benchmark_sort_vector());
|
||||
/// assert_err!(Pezpallet::<Test>::test_benchmark_broken_benchmark(), "You forgot to sort!");
|
||||
/// });
|
||||
/// }
|
||||
/// ```
|
||||
@@ -188,7 +188,7 @@ macro_rules! benchmarks {
|
||||
|
||||
/// Same as [`benchmarks`] but for instantiable module.
|
||||
///
|
||||
/// NOTE: For pallet declared with [`pezframe_support::pallet`], use [`benchmarks_instance_pallet`].
|
||||
/// NOTE: For pezpallet declared with [`pezframe_support::pezpallet`], use [`benchmarks_instance_pallet`].
|
||||
#[macro_export]
|
||||
macro_rules! benchmarks_instance {
|
||||
(
|
||||
@@ -207,9 +207,9 @@ macro_rules! benchmarks_instance {
|
||||
}
|
||||
}
|
||||
|
||||
/// Same as [`benchmarks`] but for instantiable pallet declared [`pezframe_support::pallet`].
|
||||
/// Same as [`benchmarks`] but for instantiable pezpallet declared [`pezframe_support::pezpallet`].
|
||||
///
|
||||
/// NOTE: For pallet declared with `decl_module!`, use [`benchmarks_instance`].
|
||||
/// NOTE: For pezpallet declared with `decl_module!`, use [`benchmarks_instance`].
|
||||
#[macro_export]
|
||||
macro_rules! benchmarks_instance_pallet {
|
||||
(
|
||||
@@ -363,7 +363,7 @@ macro_rules! benchmarks_iter {
|
||||
$( $rest )*
|
||||
}
|
||||
};
|
||||
// detect and extract `#[pov_mode = Mode { Pallet::Storage: Mode ... }]` tag:
|
||||
// detect and extract `#[pov_mode = Mode { Pezpallet::Storage: Mode ... }]` tag:
|
||||
(
|
||||
{ $($bench_module:ident, $new_test_ext:expr, $test:path $(, $( $args:tt )* )?)? }
|
||||
{ $( $instance:ident: $instance_bound:tt )? }
|
||||
@@ -939,7 +939,7 @@ macro_rules! selected_benchmark {
|
||||
{ $( $instance:ident: $instance_bound:tt )? }
|
||||
$( { $( $bench_inst:ident )? } $bench:ident )*
|
||||
) => {
|
||||
// The list of available benchmarks for this pallet.
|
||||
// The list of available benchmarks for this pezpallet.
|
||||
#[allow(non_camel_case_types)]
|
||||
enum SelectedBenchmark {
|
||||
$( $bench, )*
|
||||
@@ -992,7 +992,7 @@ macro_rules! impl_benchmark {
|
||||
// We only need to implement benchmarks for the runtime-benchmarks feature or testing.
|
||||
#[cfg(any(feature = "runtime-benchmarks", test))]
|
||||
impl<T: Config $(<$instance>, $instance: $instance_bound )? >
|
||||
$crate::Benchmarking for Pallet<T $(, $instance)? >
|
||||
$crate::Benchmarking for Pezpallet<T $(, $instance)? >
|
||||
where T: pezframe_system::Config, $( $where_clause )*
|
||||
{
|
||||
fn benchmarks(extra: bool) -> $crate::__private::Vec<$crate::BenchmarkMetadata> {
|
||||
@@ -1076,8 +1076,8 @@ macro_rules! impl_benchmark {
|
||||
let mut results: $crate::__private::Vec<$crate::BenchmarkResult> = $crate::__private::Vec::new();
|
||||
let on_before_start = || {
|
||||
// Set the block number to at least 1 so events are deposited.
|
||||
if $crate::__private::Zero::is_zero(&pezframe_system::Pallet::<T>::block_number()) {
|
||||
pezframe_system::Pallet::<T>::set_block_number(1u32.into());
|
||||
if $crate::__private::Zero::is_zero(&pezframe_system::Pezpallet::<T>::block_number()) {
|
||||
pezframe_system::Pezpallet::<T>::set_block_number(1u32.into());
|
||||
}
|
||||
|
||||
// Commit the externalities to the database, flushing the DB cache.
|
||||
@@ -1165,7 +1165,7 @@ macro_rules! impl_benchmark {
|
||||
|
||||
#[cfg(test)]
|
||||
impl<T: Config $(<$instance>, $instance: $instance_bound )? >
|
||||
Pallet<T $(, $instance)? >
|
||||
Pezpallet<T $(, $instance)? >
|
||||
where T: pezframe_system::Config, $( $where_clause )*
|
||||
{
|
||||
/// Test a particular benchmark by name.
|
||||
@@ -1175,7 +1175,7 @@ macro_rules! impl_benchmark {
|
||||
/// that case.
|
||||
///
|
||||
/// This is generally intended to be used by child test modules such as those created
|
||||
/// by the `impl_benchmark_test_suite` macro. However, it is not an error if a pallet
|
||||
/// by the `impl_benchmark_test_suite` macro. However, it is not an error if a pezpallet
|
||||
/// author chooses not to implement benchmarks.
|
||||
#[allow(unused)]
|
||||
fn test_bench_by_name(name: &[u8]) -> Result<(), $crate::BenchmarkError> {
|
||||
@@ -1208,7 +1208,7 @@ macro_rules! impl_benchmark_test {
|
||||
$crate::__private::paste::item! {
|
||||
#[cfg(test)]
|
||||
impl<T: Config $(<$instance>, $instance: $instance_bound )? >
|
||||
Pallet<T $(, $instance)? >
|
||||
Pezpallet<T $(, $instance)? >
|
||||
where T: pezframe_system::Config, $( $where_clause )*
|
||||
{
|
||||
#[allow(unused)]
|
||||
@@ -1226,8 +1226,8 @@ macro_rules! impl_benchmark_test {
|
||||
|
||||
let on_before_start = || {
|
||||
// Set the block number to at least 1 so events are deposited.
|
||||
if $crate::__private::Zero::is_zero(&pezframe_system::Pallet::<T>::block_number()) {
|
||||
pezframe_system::Pallet::<T>::set_block_number(1u32.into());
|
||||
if $crate::__private::Zero::is_zero(&pezframe_system::Pezpallet::<T>::block_number()) {
|
||||
pezframe_system::Pezpallet::<T>::set_block_number(1u32.into());
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1296,7 +1296,7 @@ macro_rules! impl_benchmark_test {
|
||||
/// When called in `pezpallet_example_basic` as
|
||||
///
|
||||
/// ```rust,ignore
|
||||
/// impl_benchmark_test_suite!(Pallet, crate::tests::new_test_ext(), crate::tests::Test);
|
||||
/// impl_benchmark_test_suite!(Pezpallet, crate::tests::new_test_ext(), crate::tests::Test);
|
||||
/// ```
|
||||
///
|
||||
/// It expands to the equivalent of:
|
||||
@@ -1325,7 +1325,7 @@ macro_rules! impl_benchmark_test {
|
||||
/// benchmarks! {
|
||||
/// // Benchmarks omitted for brevity
|
||||
///
|
||||
/// impl_benchmark_test_suite!(Pallet, crate::tests::new_test_ext(), crate::tests::Test);
|
||||
/// impl_benchmark_test_suite!(Pezpallet, crate::tests::new_test_ext(), crate::tests::Test);
|
||||
/// }
|
||||
/// ```
|
||||
///
|
||||
@@ -1396,11 +1396,11 @@ macro_rules! impl_benchmark_test {
|
||||
/// }
|
||||
///
|
||||
/// mod tests {
|
||||
/// // because of macro syntax limitations, neither Pallet nor benches can be paths, but both have
|
||||
/// // because of macro syntax limitations, neither Pezpallet nor benches can be paths, but both have
|
||||
/// // to be idents in the scope of `impl_benchmark_test_suite`.
|
||||
/// use crate::{benches, Pallet};
|
||||
/// use crate::{benches, Pezpallet};
|
||||
///
|
||||
/// impl_benchmark_test_suite!(Pallet, new_test_ext(), Test, benchmarks_path = benches);
|
||||
/// impl_benchmark_test_suite!(Pezpallet, new_test_ext(), Test, benchmarks_path = benches);
|
||||
///
|
||||
/// // new_test_ext and the Test item are defined later in this module
|
||||
/// }
|
||||
@@ -1738,7 +1738,7 @@ pub fn show_benchmark_debug_info(
|
||||
error_message: &str,
|
||||
) -> alloc::string::String {
|
||||
alloc::format!(
|
||||
"\n* Pallet: {}\n\
|
||||
"\n* Pezpallet: {}\n\
|
||||
* Benchmark: {}\n\
|
||||
* Components: {:?}\n\
|
||||
* Verify: {:?}\n\
|
||||
@@ -1753,7 +1753,7 @@ pub fn show_benchmark_debug_info(
|
||||
)
|
||||
}
|
||||
|
||||
/// This macro adds pallet benchmarks to a `Vec<BenchmarkBatch>` object.
|
||||
/// This macro adds pezpallet benchmarks to a `Vec<BenchmarkBatch>` object.
|
||||
///
|
||||
/// First create an object that holds in the input parameters for the benchmark:
|
||||
///
|
||||
@@ -1799,7 +1799,7 @@ pub fn show_benchmark_debug_info(
|
||||
///
|
||||
/// At the end of `dispatch_benchmark`, you should return this batches object.
|
||||
///
|
||||
/// In the case where you have multiple instances of a pallet that you need to separately benchmark,
|
||||
/// In the case where you have multiple instances of a pezpallet that you need to separately benchmark,
|
||||
/// the name of your module struct will be used as a suffix to your outputted weight file. For
|
||||
/// example:
|
||||
///
|
||||
@@ -1822,14 +1822,14 @@ macro_rules! add_benchmark {
|
||||
let instance_string = stringify!($location).replace(" ", "").into_bytes();
|
||||
let (config, whitelist) = $params;
|
||||
let $crate::BenchmarkConfig {
|
||||
pallet,
|
||||
pezpallet,
|
||||
instance,
|
||||
benchmark,
|
||||
selected_components,
|
||||
verify,
|
||||
internal_repeats,
|
||||
} = config;
|
||||
if &pallet[..] == &pezpallet_string[..] && &instance[..] == &instance_string[..] {
|
||||
if &pezpallet[..] == &pezpallet_string[..] && &instance[..] == &instance_string[..] {
|
||||
let benchmark_result = <$location as $crate::Benchmarking>::run_benchmark(
|
||||
&benchmark[..],
|
||||
&selected_components[..],
|
||||
@@ -1883,7 +1883,7 @@ macro_rules! add_benchmark {
|
||||
|
||||
if let Some(final_results) = final_results {
|
||||
$batches.push($crate::BenchmarkBatch {
|
||||
pallet: pezpallet_string,
|
||||
pezpallet: pezpallet_string,
|
||||
instance: instance_string,
|
||||
benchmark: benchmark.clone(),
|
||||
results: final_results,
|
||||
@@ -1902,8 +1902,8 @@ macro_rules! add_benchmark {
|
||||
/// let mut list = Vec::<BenchmarkList>::new();
|
||||
/// ```
|
||||
///
|
||||
/// Then pass this `list` to the macro, along with the `extra` boolean, the pallet crate, and
|
||||
/// pallet struct:
|
||||
/// Then pass this `list` to the macro, along with the `extra` boolean, the pezpallet crate, and
|
||||
/// pezpallet struct:
|
||||
///
|
||||
/// ```ignore
|
||||
/// list_benchmark!(list, extra, pezpallet_balances, Balances);
|
||||
@@ -1919,7 +1919,7 @@ macro_rules! list_benchmark {
|
||||
let instance_string = stringify!($location).replace(" ", "").into_bytes();
|
||||
let benchmarks = <$location as $crate::Benchmarking>::benchmarks($extra);
|
||||
let pezpallet_benchmarks = $crate::BenchmarkList {
|
||||
pallet: pezpallet_string,
|
||||
pezpallet: pezpallet_string,
|
||||
instance: instance_string,
|
||||
benchmarks: benchmarks.to_vec(),
|
||||
};
|
||||
@@ -1927,7 +1927,7 @@ macro_rules! list_benchmark {
|
||||
};
|
||||
}
|
||||
|
||||
/// Defines pallet configs that `add_benchmarks` and `list_benchmarks` use.
|
||||
/// Defines pezpallet configs that `add_benchmarks` and `list_benchmarks` use.
|
||||
/// Should be preferred instead of having a repetitive list of configs
|
||||
/// in `add_benchmark` and `list_benchmark`.
|
||||
#[macro_export]
|
||||
|
||||
@@ -44,10 +44,10 @@
|
||||
// frame-omni-bencher
|
||||
// v1
|
||||
// benchmark
|
||||
// pallet
|
||||
// pezpallet
|
||||
// --extrinsic=*
|
||||
// --runtime=target/production/wbuild/pez-kitchensink-runtime/pez_kitchensink_runtime.wasm
|
||||
// --pallet=pezframe_benchmarking
|
||||
// --pezpallet=pezframe_benchmarking
|
||||
// --header=/__w/pezkuwi-sdk/pezkuwi-sdk/bizinikiwi/HEADER-APACHE2
|
||||
// --output=/__w/pezkuwi-sdk/pezkuwi-sdk/bizinikiwi/pezframe/benchmarking/src/weights.rs
|
||||
// --wasm-execution=compiled
|
||||
|
||||
Reference in New Issue
Block a user