git.delta.rocks / unique-network / refs/commits / 900be63a359f

difftreelog

source

pallets/evm-migration/src/benchmarking.rs2.0 KiBsourcehistory
1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617#![allow(missing_docs)]1819use frame_benchmarking::benchmarks;20use frame_system::RawOrigin;21use sp_core::{H160, H256};22use sp_std::{vec, vec::Vec};2324use super::{Call, Config, Pallet};2526benchmarks! {27	where_clause { where <T as Config>::RuntimeEvent: parity_scale_codec::Encode }2829	begin {30	}: _(RawOrigin::Root, H160::default())3132	set_data {33		let b in 0..80;34		let address = H160::from_low_u64_be(b as u64);35		let mut data = Vec::new();36		for i in 0..b {37			data.push((38				H256::from_low_u64_be(i as u64),39				H256::from_low_u64_be(i as u64),40			));41		}42		<Pallet<T>>::begin(RawOrigin::Root.into(), address)?;43	}: _(RawOrigin::Root, address, data)4445	finish {46		let b in 0..80;47		let address = H160::from_low_u64_be(b as u64);48		let data: Vec<u8> = (0..b as u8).collect();49		<Pallet<T>>::begin(RawOrigin::Root.into(), address)?;50	}: _(RawOrigin::Root, address, data)5152	insert_eth_logs {53		let b in 0..200;54		let logs = (0..b).map(|_| ethereum::Log {55			address: H160([b as u8; 20]),56			data: vec![b as u8; 128],57			topics: vec![H256([b as u8; 32]); 6],58		}).collect::<Vec<_>>();59	}: _(RawOrigin::Root, logs)6061	insert_events {62		let b in 0..200;63		use parity_scale_codec::Encode;64		let logs = (0..b).map(|_| <T as Config>::RuntimeEvent::from(crate::Event::<T>::TestEvent).encode()).collect::<Vec<_>>();65	}: _(RawOrigin::Root, logs)66}