Implement batch_all and update Utility pallet for weight refunds (#7188)

* implement batch_all

* bump version

* updates

* Better weight story for utility

* small fixes

* weights

* assert_noop_ignore_postinfo doesnt make sense

* Apply suggestions from code review

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>

Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
This commit is contained in:
Xiliang Chen
2020-10-28 08:08:51 +13:00
committed by GitHub
parent f373ecbcf0
commit f14809779d
5 changed files with 414 additions and 24 deletions
@@ -56,6 +56,19 @@ benchmarks! {
let caller_key = frame_system::Account::<T>::hashed_key_for(&caller);
frame_benchmarking::benchmarking::add_to_whitelist(caller_key.into());
}: _(RawOrigin::Signed(caller), SEED as u16, call)
batch_all {
let c in 0 .. 1000;
let mut calls: Vec<<T as Trait>::Call> = Vec::new();
for i in 0 .. c {
let call = frame_system::Call::remark(vec![]).into();
calls.push(call);
}
let caller = whitelisted_caller();
}: _(RawOrigin::Signed(caller), calls)
verify {
assert_last_event::<T>(Event::BatchCompleted.into())
}
}
#[cfg(test)]
@@ -69,6 +82,7 @@ mod tests {
new_test_ext().execute_with(|| {
assert_ok!(test_benchmark_batch::<Test>());
assert_ok!(test_benchmark_as_derivative::<Test>());
assert_ok!(test_benchmark_batch_all::<Test>());
});
}
}