git.delta.rocks / unique-network / refs/commits / bce2cc1e9ab8

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 super::{Call, Config, Pallet};20use frame_benchmarking::benchmarks;21use frame_system::RawOrigin;22use sp_core::{H160, H256};23use sp_std::{vec::Vec, vec};2425benchmarks! {26	where_clause { where <T as Config>::RuntimeEvent: codec::Encode }2728	begin {29	}: _(RawOrigin::Root, H160::default())3031	set_data {32		let b in 0..80;33		let address = H160::from_low_u64_be(b as u64);34		let mut data = Vec::new();35		for i in 0..b {36			data.push((37				H256::from_low_u64_be(i as u64),38				H256::from_low_u64_be(i as u64),39			));40		}41		<Pallet<T>>::begin(RawOrigin::Root.into(), address)?;42	}: _(RawOrigin::Root, address, data)4344	finish {45		let b in 0..80;46		let address = H160::from_low_u64_be(b as u64);47		let data: Vec<u8> = (0..b as u8).collect();48		<Pallet<T>>::begin(RawOrigin::Root.into(), address)?;49	}: _(RawOrigin::Root, address, data)5051	insert_eth_logs {52		let b in 0..200;53		let logs = (0..b).map(|_| ethereum::Log {54			address: H160([b as u8; 20]),55			data: vec![b as u8; 128],56			topics: vec![H256([b as u8; 32]); 6],57		}).collect::<Vec<_>>();58	}: _(RawOrigin::Root, logs)5960	insert_events {61		let b in 0..200;62		use codec::Encode;63		let logs = (0..b).map(|_| <T as Config>::RuntimeEvent::from(crate::Event::<T>::TestEvent).encode()).collect::<Vec<_>>();64	}: _(RawOrigin::Root, logs)65}