Skip to content
Snippets Groups Projects
Unverified Commit 3c6ea86a authored by clangenb's avatar clangenb Committed by GitHub
Browse files

migrate pallet-remarks to v2 bench syntax (#6291)


Part of:
* #6202

---------

Co-authored-by: default avatarOliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Co-authored-by: default avatarGitHub Action <action@github.com>
Co-authored-by: default avatarGiuseppe Re <giuseppe.re@parity.io>
parent ec61396e
No related merge requests found
Pipeline #504251 waiting for manual action with stages
in 10 minutes and 31 seconds
title: migrate pallet-remarks to v2 bench syntax
doc:
- audience: Runtime Dev
description: |-
Part of:
* #6202
crates:
- name: pallet-remark
bump: patch
......@@ -21,7 +21,7 @@
use super::*;
use alloc::vec;
use frame_benchmarking::v1::{benchmarks, whitelisted_caller};
use frame_benchmarking::v2::*;
use frame_system::{EventRecord, Pallet as System, RawOrigin};
#[cfg(test)]
......@@ -34,13 +34,24 @@ fn assert_last_event<T: Config>(generic_event: <T as Config>::RuntimeEvent) {
assert_eq!(event, &system_event);
}
benchmarks! {
store {
let l in 1 .. 1024*1024;
#[benchmarks]
mod benchmarks {
use super::*;
#[benchmark]
fn store(l: Linear<1, { 1024 * 1024 }>) {
let caller: T::AccountId = whitelisted_caller();
}: _(RawOrigin::Signed(caller.clone()), vec![0u8; l as usize])
verify {
assert_last_event::<T>(Event::Stored { sender: caller, content_hash: sp_io::hashing::blake2_256(&vec![0u8; l as usize]).into() }.into());
#[extrinsic_call]
_(RawOrigin::Signed(caller.clone()), vec![0u8; l as usize]);
assert_last_event::<T>(
Event::Stored {
sender: caller,
content_hash: sp_io::hashing::blake2_256(&vec![0u8; l as usize]).into(),
}
.into(),
);
}
impl_benchmark_test_suite!(Remark, crate::mock::new_test_ext(), crate::mock::Test);
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment