This repository was archived by the owner on Nov 15, 2023. It is now read-only.

Description
Currently benchmarks are written in the following form:
benchmarks! {
bench_name {
// Define the components, assumed to be linear.
let x in 0 .. MAX_X;
let y in 0 .. MAX_Y;
// Setup code
let z = x + y;
let caller = whitelisted_caller();
}: extrinsic_name(z, other_arguments...) // The extrinsic call.
verify {
// Post condition verification
assert_eq!(MyPallet::<T>::my_var() == z);
}
// More benchmarks here
}
A better way of writing them would be closer to how tests are written in rust:
#[pallet::benchmark]
fn bench_name(x: LinearComponent<0, MAX_X>, y: LinearComponent<0, MAX_Y>) {
// Setup code
let z = x + y;
let caller = whitelisted_caller();
// The extrinsic call.
extrinsic_name(z, other_arguments...);
// Post condition verification
assert_eq!(MyPallet::<T>::my_var(), == z);
}