diff --git a/Cargo.lock b/Cargo.lock index 2d71369..df85f61 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -180,7 +180,7 @@ dependencies = [ "cfg-if", "const-hex", "derive_more 0.99.19", - "hex-literal", + "hex-literal 0.4.1", "itoa", "proptest", "rand 0.8.5", @@ -200,7 +200,7 @@ dependencies = [ "cfg-if", "const-hex", "derive_more 0.99.19", - "hex-literal", + "hex-literal 0.4.1", "itoa", "k256", "keccak-asm", @@ -3804,7 +3804,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8d162beedaa69905488a8da94f5ac3edb4dd4788b732fadb7bd120b2625c1976" dependencies = [ "data-encoding", - "syn 1.0.109", + "syn 2.0.100", ] [[package]] @@ -5961,6 +5961,12 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" +[[package]] +name = "hex-literal" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bcaaec4551594c969335c98c903c1397853d4198408ea609190f420500f6be71" + [[package]] name = "hkdf" version = "0.12.4" @@ -6071,7 +6077,7 @@ name = "hp-verifiers" version = "0.1.0" source = "git+https://github.com/zkVerify/zkVerify.git?tag=0.9.1-0.13.0#44fed482a11e6185c67e193627863ec729e43b07" dependencies = [ - "hex-literal", + "hex-literal 0.4.1", "parity-scale-codec", "scale-info", "sp-core", @@ -7689,7 +7695,7 @@ dependencies = [ "ed25519-dalek", "futures", "futures-timer", - "hex-literal", + "hex-literal 0.4.1", "indexmap 2.9.0", "libc", "mockall 0.12.1", @@ -8828,7 +8834,7 @@ dependencies = [ "frame-benchmarking", "frame-support", "frame-system", - "hex-literal", + "hex-literal 0.4.1", "hp-dispatch", "hp-on-proof-verified", "ismp", @@ -9164,6 +9170,25 @@ dependencies = [ "sp-state-machine", ] +[[package]] +name = "pallet-benchmark-dummy" +version = "0.1.0" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "hex-literal 1.0.0", + "pallet-balances", + "pallet-evm", + "pallet-timestamp", + "parity-scale-codec", + "scale-info", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std", +] + [[package]] name = "pallet-bounties" version = "37.0.2" @@ -9645,7 +9670,7 @@ dependencies = [ "frame-support", "frame-system", "hash-db", - "hex-literal", + "hex-literal 0.4.1", "impl-trait-for-tuples", "log", "parity-scale-codec", @@ -9799,7 +9824,7 @@ dependencies = [ "frame-benchmarking", "frame-support", "frame-system", - "hex-literal", + "hex-literal 0.4.1", "ismp", "log", "pallet-balances", @@ -9907,7 +9932,7 @@ dependencies = [ "anyhow", "hash-db", "hex", - "hex-literal", + "hex-literal 0.4.1", "ismp", "jsonrpsee", "pallet-ismp", @@ -10272,7 +10297,7 @@ dependencies = [ "frame-benchmarking", "frame-support", "frame-system", - "hex-literal", + "hex-literal 0.4.1", "hp-verifiers", "log", "pallet-verifiers", @@ -10519,7 +10544,7 @@ dependencies = [ "frame-benchmarking", "frame-support", "frame-system", - "hex-literal", + "hex-literal 0.4.1", "hp-verifiers", "log", "native", @@ -10969,7 +10994,7 @@ dependencies = [ "frame-benchmarking", "frame-support", "frame-system", - "hex-literal", + "hex-literal 0.4.1", "hp-verifiers", "log", "native", @@ -12432,7 +12457,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b57bc055fa389372ec5fc0001b99aeffd50f3fd379280ce572d935189bb58dd8" dependencies = [ "bitvec", - "hex-literal", + "hex-literal 0.4.1", "log", "parity-scale-codec", "polkadot-core-primitives", @@ -12459,7 +12484,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6bb20b75d33212150242d39890d7ededab55f1084160c337f15d0eb8ca8c3ad4" dependencies = [ "bitvec", - "hex-literal", + "hex-literal 0.4.1", "log", "parity-scale-codec", "polkadot-core-primitives", @@ -14278,7 +14303,7 @@ dependencies = [ "cfg-if", "digest 0.10.7", "hex", - "hex-literal", + "hex-literal 0.4.1", "metal", "paste", "rand_core 0.6.4", @@ -14347,7 +14372,7 @@ dependencies = [ "frame-system-benchmarking", "frame-system-rpc-runtime-api", "frame-try-runtime", - "hex-literal", + "hex-literal 0.4.1", "log", "pallet-asset-rate", "pallet-authority-discovery", @@ -16876,7 +16901,7 @@ dependencies = [ "ethabi-decode", "frame-support", "frame-system", - "hex-literal", + "hex-literal 0.4.1", "parity-scale-codec", "polkadot-parachain-primitives", "scale-info", @@ -16900,7 +16925,7 @@ dependencies = [ "ethabi-decode", "ethbloom", "ethereum-types", - "hex-literal", + "hex-literal 0.4.1", "parity-bytes", "parity-scale-codec", "rlp", @@ -16962,7 +16987,7 @@ dependencies = [ "frame-benchmarking", "frame-support", "frame-system", - "hex-literal", + "hex-literal 0.4.1", "log", "pallet-timestamp", "parity-scale-codec", @@ -16985,7 +17010,7 @@ version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3984b98465af1d862d4e87ba783e1731f2a3f851b148d6cb98d526cebd351185" dependencies = [ - "hex-literal", + "hex-literal 0.4.1", "snowbridge-beacon-primitives", "snowbridge-core", "sp-core", @@ -17003,7 +17028,7 @@ dependencies = [ "frame-benchmarking", "frame-support", "frame-system", - "hex-literal", + "hex-literal 0.4.1", "log", "pallet-balances", "parity-scale-codec", @@ -17027,7 +17052,7 @@ version = "0.18.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b1f251e579b3d3d93cf833c8e503122808742dee33e7ea53b0f292a76c024d66" dependencies = [ - "hex-literal", + "hex-literal 0.4.1", "snowbridge-beacon-primitives", "snowbridge-core", "sp-core", @@ -17085,7 +17110,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "aefe74eafeac92e1d9e46b7bb76ec297f6182b4a023f7e7eb7eb8be193f93bef" dependencies = [ "frame-support", - "hex-literal", + "hex-literal 0.4.1", "log", "parity-scale-codec", "scale-info", @@ -19446,7 +19471,7 @@ dependencies = [ "ark-ff 0.5.0", "ark-models-ext 0.6.0", "ark-std 0.5.0", - "hex-literal", + "hex-literal 0.4.1", "sha3", "snafu", ] @@ -20191,7 +20216,7 @@ dependencies = [ "frame-system-benchmarking", "frame-system-rpc-runtime-api", "frame-try-runtime", - "hex-literal", + "hex-literal 0.4.1", "log", "pallet-asset-rate", "pallet-authority-discovery", @@ -21058,7 +21083,7 @@ dependencies = [ "frame-benchmarking-cli", "frame-system", "futures", - "hex-literal", + "hex-literal 0.4.1", "jsonrpsee", "log", "pallet-transaction-payment", @@ -21129,11 +21154,12 @@ dependencies = [ "frame-system-rpc-runtime-api", "frame-try-runtime", "hex", - "hex-literal", + "hex-literal 0.4.1", "pallet-aura", "pallet-authorship", "pallet-balances", "pallet-base-fee", + "pallet-benchmark-dummy", "pallet-collator-selection", "pallet-ethereum", "pallet-evm", @@ -21194,7 +21220,7 @@ dependencies = [ "frame-system-benchmarking", "frame-system-rpc-runtime-api", "frame-try-runtime", - "hex-literal", + "hex-literal 0.4.1", "hp-dispatch", "hp-verifiers", "ismp", @@ -21290,7 +21316,7 @@ dependencies = [ "frame-system", "frame-system-rpc-runtime-api", "futures", - "hex-literal", + "hex-literal 0.4.1", "is_executable", "jsonrpsee", "kvdb", diff --git a/Cargo.toml b/Cargo.toml index f941854..b222e01 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,6 +8,7 @@ license = "GPL-3.0-only" [workspace] members = [ "node", + "pallets/benchmark-dummy", "pallets/parachain-inherent", "runtime", ] @@ -17,6 +18,7 @@ resolver = "2" # Local cumulus-client-parachain-inherent = {path = "pallets/parachain-inherent", default-features = false} +pallet-benchmark-dummy = {path = "pallets/benchmark-dummy", default-features = false} zkv-para-evm-runtime = {path = "runtime"} # Common diff --git a/pallets/benchmark-dummy/Cargo.toml b/pallets/benchmark-dummy/Cargo.toml new file mode 100644 index 0000000..1e96034 --- /dev/null +++ b/pallets/benchmark-dummy/Cargo.toml @@ -0,0 +1,60 @@ +[package] +name = "pallet-benchmark-dummy" +version = "0.1.0" +authors.workspace = true +edition.workspace = true +repository.workspace = true + +[dependencies] +hex-literal = { version = "1", default-features = false} +frame-benchmarking = {workspace = true, optional = true} +frame-support = {workspace = true} +frame-system = {workspace = true} +pallet-evm = {workspace = true} +parity-scale-codec = {workspace = true} +scale-info = {workspace = true} +sp-core = {workspace = true} + +[dev-dependencies] +sp-io = { workspace = true, features = ["std"] } +pallet-balances = {workspace = true } +pallet-timestamp = {workspace = true } +sp-runtime = {workspace = true} +sp-std = {workspace = true} + +[features] +default = [ "std" ] +std = [ + "frame-benchmarking?/std", + "frame-support/std", + "frame-system/std", + "pallet-balances/std", + "pallet-evm/std", + "pallet-timestamp/std", + "parity-scale-codec/std", + "scale-info/std", + "sp-core/std", + "sp-io/std", + "sp-runtime/std", + "sp-std/std", +] +runtime-benchmarks = [ + "frame-benchmarking/runtime-benchmarks", + "frame-support/runtime-benchmarks", + "frame-system/runtime-benchmarks", + "pallet-balances/runtime-benchmarks", + "pallet-evm/runtime-benchmarks", + "pallet-timestamp/runtime-benchmarks", + "sp-runtime/runtime-benchmarks", +] +try-runtime = [ + "frame-support/try-runtime", + "frame-system/try-runtime", + "pallet-balances/try-runtime", + "pallet-evm/try-runtime", + "pallet-timestamp/try-runtime", + "sp-runtime/try-runtime", +] + +[package.metadata.cargo-machete] +ignored = ["parity-scale-codec", "scale-info"] diff --git a/pallets/benchmark-dummy/src/benchmarking.rs b/pallets/benchmark-dummy/src/benchmarking.rs new file mode 100644 index 0000000..dda5108 --- /dev/null +++ b/pallets/benchmark-dummy/src/benchmarking.rs @@ -0,0 +1,86 @@ +use super::*; +use alloc::{vec, vec::Vec}; +use frame_benchmarking::v2::*; +use pallet_evm::AddressMapping; + +#[benchmarks(where T: pallet_evm::Config)] +mod benchmarks { + use super::*; + #[cfg(test)] + use crate::pallet::Pallet as Template; + + #[benchmark] + fn bench_heavy_contract_call(n: Linear<0, 100>) { + use frame_support::traits::Currency; + use hex_literal::hex; + use sp_core::{H160, U256}; + + // Fund an EVM account + let source = H160::repeat_byte(0x11); + + // Fund the account with a large balance + let account_id = ::AddressMapping::into_account_id(source); + let balance = 10_000_000_000_000_000_000u128 + .try_into() + .unwrap_or_default(); + let _ = ::Currency::deposit_creating(&account_id, balance); + + // Contract bytecode - simple counter contract + let contract_bytecode: Vec = hex!( + "6080604052348015600e575f5ffd5b506102308061001c5f395ff3fe608060405234801561000f575f5ffd5b5060043610610034575f3560e01c80633fa4f245146100385780636584ad8b14610056575b5f5ffd5b610040610072565b60405161004d91906100dd565b60405180910390f35b610070600480360381019061006b9190610124565b610077565b005b5f5481565b805f54610084919061017c565b5f819055505f5f548260405160200161009e9291906101cf565b604051602081830303815290604052805190602001205f1c9050805f54185f819055505050565b5f819050919050565b6100d7816100c5565b82525050565b5f6020820190506100f05f8301846100ce565b92915050565b5f5ffd5b610103816100c5565b811461010d575f5ffd5b50565b5f8135905061011e816100fa565b92915050565b5f60208284031215610139576101386100f6565b5b5f61014684828501610110565b91505092915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f610186826100c5565b9150610191836100c5565b92508282019050808211156101a9576101a861014f565b5b92915050565b5f819050919050565b6101c96101c4826100c5565b6101af565b82525050565b5f6101da82856101b8565b6020820191506101ea82846101b8565b602082019150819050939250505056fea26469706673582212208e02abce628bcfccab523202b1013d6da271be717c0a9a2cd26b6e881aa76e1964736f6c634300081e0033" + ).to_vec(); + + let value = U256::zero(); + let gas_limit: u64 = 5_000_000; + let max_fee_per_gas = U256::from(1_000_000_000u64); + let max_priority_fee_per_gas = Some(U256::from(1_000_000_000u64)); + let nonce = Some(U256::zero()); + let access_list: Vec<(H160, Vec)> = vec![]; + + // Deploy contract - the deployment should succeed since we've granted permission + let _ = pallet_evm::Pallet::::create( + frame_system::RawOrigin::Root.into(), + source, + contract_bytecode.clone(), + value, + gas_limit, + max_fee_per_gas, + max_priority_fee_per_gas, + nonce, + access_list.clone(), + ); + + // Use a hardcoded contract address for the benchmark + // This is deterministic for the given source + nonce + let contract_address = H160::from(hex!("d9145cce52d386f254917e481eb44e9943f39138")); + + // Function selector for doWork(uint256) + let selector = [0x65, 0x84, 0xad, 0x8b]; + let mut arg = [0u8; 32]; + U256::from(n.min(1)).to_big_endian(&mut arg); // Use at most 1 to avoid computation errors + let mut input: Vec = selector.to_vec(); + input.extend_from_slice(&arg); + + // Instead of asserting the call result, let's just benchmark the execution + #[block] + { + // Just call the contract without asserting the result + // This will still benchmark the cost of making the call + let _ = pallet_evm::Pallet::::call( + frame_system::RawOrigin::Root.into(), + source, + contract_address, + input.clone(), + value, + gas_limit, + max_fee_per_gas, + max_priority_fee_per_gas, + Some(U256::from(1)), // increment nonce for each call + access_list.clone(), + ); + } + } + + #[cfg(test)] + impl_benchmark_test_suite!(Template, crate::mock::new_test_ext(), crate::mock::Test); +} diff --git a/pallets/benchmark-dummy/src/lib.rs b/pallets/benchmark-dummy/src/lib.rs new file mode 100644 index 0000000..64bcb9c --- /dev/null +++ b/pallets/benchmark-dummy/src/lib.rs @@ -0,0 +1,27 @@ +#![cfg_attr(not(feature = "std"), no_std)] + +extern crate alloc; + +pub use pallet::*; +pub use weights::SubstrateWeight; +pub use weights::WeightInfo; + +#[frame_support::pallet] +pub mod pallet { + use super::WeightInfo; + + #[pallet::pallet] + pub struct Pallet(_); + + #[pallet::config] + pub trait Config: frame_system::Config + pallet_evm::Config { + type WeightInfo: WeightInfo; + } +} + +#[cfg(test)] +mod mock; + +#[cfg(feature = "runtime-benchmarks")] +mod benchmarking; +mod weights; diff --git a/pallets/benchmark-dummy/src/mock.rs b/pallets/benchmark-dummy/src/mock.rs new file mode 100644 index 0000000..d49ae49 --- /dev/null +++ b/pallets/benchmark-dummy/src/mock.rs @@ -0,0 +1,53 @@ +use crate::weights::SubstrateWeight; +use frame_support::derive_impl; +use sp_runtime::BuildStorage; + +pub type Block = frame_system::mocking::MockBlock; + +frame_support::construct_runtime!( + pub enum Test { + System: frame_system = 0, + Timestamp: pallet_timestamp = 1, + Balances: pallet_balances = 2, + Evm: pallet_evm = 3, + BenchmarkDummy: crate = 4, + } +); + +#[derive_impl(frame_system::config_preludes::TestDefaultConfig)] +impl frame_system::Config for Test { + type Block = Block; + type AccountId = sp_runtime::AccountId32; + type AccountData = pallet_balances::AccountData; + type Lookup = sp_runtime::traits::IdentityLookup; +} + +#[derive_impl(pallet_timestamp::config_preludes::TestDefaultConfig)] +impl pallet_timestamp::Config for Test {} + +#[derive_impl(pallet_balances::config_preludes::TestDefaultConfig)] +impl pallet_balances::Config for Test { + type AccountStore = System; +} + +#[derive_impl(pallet_evm::config_preludes::TestDefaultConfig)] +impl pallet_evm::Config for Test { + type AccountProvider = pallet_evm::FrameSystemAccountProvider; + type BlockHashMapping = pallet_evm::SubstrateBlockHashMapping; + type Timestamp = Timestamp; + type Currency = Balances; + type Runner = pallet_evm::runner::stack::Runner; +} + +// Implement the Config trait for our pallet +impl crate::Config for Test { + type WeightInfo = SubstrateWeight; +} + +// Test externalities initialization +pub fn new_test_ext() -> sp_io::TestExternalities { + frame_system::GenesisConfig::::default() + .build_storage() + .unwrap() + .into() +} diff --git a/pallets/benchmark-dummy/src/weights.rs b/pallets/benchmark-dummy/src/weights.rs new file mode 100644 index 0000000..868c1d4 --- /dev/null +++ b/pallets/benchmark-dummy/src/weights.rs @@ -0,0 +1,60 @@ +//! Autogenerated weights for `pallet_benchmark_dummy` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 43.0.0 +//! DATE: 2025-04-18, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `DESKTOP-37J5UBI`, CPU: `Intel(R) Core(TM) Ultra 9 185H` +//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: `1024` +// Executed Command: +// ./target/release/zkv-para-evm-node +// benchmark +// pallet +// --pallet +// pallet-benchmark-dummy +// --extrinsic +// +// --template +// scripts/templates/pallets-weight-template.hbs +// --output +// pallets/pallet-benchmark-dummy/src/weights.rs + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] +#![allow(missing_docs)] + +use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; +use core::marker::PhantomData; + +/// Weight function needed for `pallet_benchmark_dummy`. +pub trait WeightInfo { + fn bench_heavy_contract_call(n: u32) -> Weight; +} + +/// Substrate weight implementation for the pallet. +pub struct SubstrateWeight(PhantomData); + +impl WeightInfo for SubstrateWeight { + fn bench_heavy_contract_call(_n: u32) -> Weight { + // Proof Size summary in bytes: + // Measured: `109` + // Estimated: `3501` + // Minimum execution time: 8_740_000 picoseconds. + Weight::from_parts(9_191_000, 3501) + .saturating_add(RocksDbWeight::get().reads(1_u64)) + .saturating_add(RocksDbWeight::get().writes(1_u64)) + } +} + +// For backwards compatibility and tests. +impl WeightInfo for () { + fn bench_heavy_contract_call(_n: u32) -> Weight { + // Proof Size summary in bytes: + // Measured: `109` + // Estimated: `3501` + // Minimum execution time: 8_740_000 picoseconds. + Weight::from_parts(9_191_000, 3501) + .saturating_add(RocksDbWeight::get().reads(1_u64)) + .saturating_add(RocksDbWeight::get().writes(1_u64)) + } +} \ No newline at end of file diff --git a/runtime/Cargo.toml b/runtime/Cargo.toml index f29324b..4414a7b 100644 --- a/runtime/Cargo.toml +++ b/runtime/Cargo.toml @@ -28,6 +28,7 @@ frame-try-runtime = {workspace = true, optional = true} pallet-aura = {workspace = true} pallet-authorship = {workspace = true} pallet-balances = {workspace = true, features = ["insecure_zero_ed"]} +pallet-benchmark-dummy = {workspace = true} pallet-message-queue = {workspace = true} pallet-multisig = {workspace = true} pallet-proxy = {workspace = true} @@ -120,6 +121,7 @@ std = [ "pallet-authorship/std", "pallet-balances/std", "pallet-base-fee/std", + "pallet-benchmark-dummy/std", "pallet-collator-selection/std", "pallet-ethereum/std", "pallet-evm-chain-id/std", @@ -172,6 +174,7 @@ runtime-benchmarks = [ "frame-system-benchmarking/runtime-benchmarks", "frame-system/runtime-benchmarks", "pallet-balances/runtime-benchmarks", + "pallet-benchmark-dummy/runtime-benchmarks", "pallet-collator-selection/runtime-benchmarks", "pallet-ethereum/runtime-benchmarks", "pallet-evm/runtime-benchmarks", @@ -203,6 +206,7 @@ try-runtime = [ "pallet-authorship/try-runtime", "pallet-balances/try-runtime", "pallet-base-fee/try-runtime", + "pallet-benchmark-dummy/try-runtime", "pallet-collator-selection/try-runtime", "pallet-ethereum/try-runtime", "pallet-evm-chain-id/try-runtime", diff --git a/runtime/src/benchmark.rs b/runtime/src/benchmark.rs index f70cbfb..ffca686 100644 --- a/runtime/src/benchmark.rs +++ b/runtime/src/benchmark.rs @@ -33,6 +33,7 @@ frame_benchmarking::define_benchmarks!( [pallet_message_queue, MessageQueue] [pallet_evm, EVM] + [pallet_benchmark_dummy, BenchmarkDummy] ); use cumulus_primitives_core::{ChannelStatus, GetChannelInfo}; diff --git a/runtime/src/lib.rs b/runtime/src/lib.rs index 833e514..c68d5e6 100644 --- a/runtime/src/lib.rs +++ b/runtime/src/lib.rs @@ -218,6 +218,11 @@ cumulus_pallet_parachain_system::register_validate_block! { #[cfg(feature = "runtime-benchmarks")] mod benchmark; +// BenchmarkDummy pallet configuration +impl pallet_benchmark_dummy::Config for Runtime { + type WeightInfo = weights::pallet_benchmark_dummy::ZKVEvmWeight; +} + // Create the runtime by composing the FRAME pallets that were previously // configured. construct_runtime!( @@ -258,6 +263,9 @@ construct_runtime!( EVM: pallet_evm = 41, BaseFee: pallet_base_fee = 42, // No weight EVMChainId: pallet_evm_chain_id = 43, // No weight + + // Benchmarking + BenchmarkDummy: pallet_benchmark_dummy = 50, } ); diff --git a/runtime/src/weights.rs b/runtime/src/weights.rs index e908b38..0f48991 100644 --- a/runtime/src/weights.rs +++ b/runtime/src/weights.rs @@ -23,6 +23,7 @@ pub mod db; pub mod extrinsic_weights; pub mod frame_system; pub mod pallet_balances; +pub mod pallet_benchmark_dummy; pub mod pallet_collator_selection; pub mod pallet_evm; pub mod pallet_message_queue; diff --git a/runtime/src/weights/pallet_benchmark_dummy.rs b/runtime/src/weights/pallet_benchmark_dummy.rs new file mode 100644 index 0000000..997020d --- /dev/null +++ b/runtime/src/weights/pallet_benchmark_dummy.rs @@ -0,0 +1,67 @@ +// Copyright 2024, Horizen Labs, Inc. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//! Autogenerated weights for `pallet_benchmark_dummy` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 43.0.0 +//! DATE: 2025-06-04, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `mac.lan`, CPU: `` +//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: `1024` + +// Executed Command: +// /Users/rdoria/horizen/bis/bis/zkVerify-EVM-Parachain/target/production/zkv-para-evm-node +// benchmark +// pallet +// --genesis-builder=spec +// --pallet +// pallet-benchmark-dummy +// --extrinsic +// * +// --steps +// 50 +// --repeat +// 20 +// --heap-pages=4096 +// --header +// /Users/rdoria/horizen/bis/bis/zkVerify-EVM-Parachain/HEADER-APACHE2 +// --output +// /Users/rdoria/horizen/bis/bis/zkVerify-EVM-Parachain/runtime/src/weights/pallet_benchmark_dummy.rs +// --template +// /Users/rdoria/horizen/bis/bis/zkVerify-EVM-Parachain/scripts/templates/deploy-weight-template.hbs + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] +#![allow(missing_docs)] + +use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; +use core::marker::PhantomData; + +/// Weights for `pallet_benchmark_dummy` using the zkVerify node and recommended hardware. +pub struct ZKVEvmWeight(PhantomData); + +impl pallet_benchmark_dummy::WeightInfo for ZKVEvmWeight { + /// The range of component `n` is `[0, 100]`. + fn bench_heavy_contract_call(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 1_000_000 picoseconds. + Weight::from_parts(1_486_106, 0) + // Standard Error: 763 + .saturating_add(Weight::from_parts(159, 0).saturating_mul(n.into())) + } +}