You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
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 codelet 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]fnbench_name(x:LinearComponent<0,MAX_X>,y:LinearComponent<0,MAX_Y>){// Setup codelet z = x + y;let caller = whitelisted_caller();// The extrinsic call.extrinsic_name(z, other_arguments...);// Post condition verificationassert_eq!(MyPallet::<T>::my_var(), == z);}