From fd336071efe0a58ca5fc6dd755894fdfbdcf626e Mon Sep 17 00:00:00 2001 From: MrishoLukamba Date: Tue, 24 Dec 2024 16:29:37 +0300 Subject: [PATCH] feat(benchmark) cleanup & add dynamacity in set_addresses benches --- modules/ismp/pallets/token-gateway/src/lib.rs | 2 +- .../ismp/pallets/token-gateway/src/weights.rs | 4 +-- parachain/runtimes/gargantua/Cargo.toml | 1 - parachain/runtimes/gargantua/src/lib.rs | 26 ------------------- .../src/weights/pallet_token_gateway.rs | 5 ++-- 5 files changed, 6 insertions(+), 32 deletions(-) diff --git a/modules/ismp/pallets/token-gateway/src/lib.rs b/modules/ismp/pallets/token-gateway/src/lib.rs index 61999372..abb761a4 100644 --- a/modules/ismp/pallets/token-gateway/src/lib.rs +++ b/modules/ismp/pallets/token-gateway/src/lib.rs @@ -307,7 +307,7 @@ pub mod pallet { /// Set the token gateway address for specified chains #[pallet::call_index(1)] - #[pallet::weight(T::WeightInfo::set_token_gateway_addresses())] + #[pallet::weight(T::WeightInfo::set_token_gateway_addresses(addresses.len() as u32))] pub fn set_token_gateway_addresses( origin: OriginFor, addresses: BTreeMap>, diff --git a/modules/ismp/pallets/token-gateway/src/weights.rs b/modules/ismp/pallets/token-gateway/src/weights.rs index cb282ca1..eee4c42a 100644 --- a/modules/ismp/pallets/token-gateway/src/weights.rs +++ b/modules/ismp/pallets/token-gateway/src/weights.rs @@ -5,7 +5,7 @@ use frame_support::weights::Weight; pub trait WeightInfo { fn create_erc6160_asset() -> Weight; fn teleport() -> Weight; - fn set_token_gateway_addresses() -> Weight; + fn set_token_gateway_addresses(i:u32,) -> Weight; fn update_erc6160_asset() -> Weight; } @@ -18,7 +18,7 @@ impl WeightInfo for () { Weight::zero() } - fn set_token_gateway_addresses() -> Weight { + fn set_token_gateway_addresses(_i:u32,) -> Weight { Weight::zero() } diff --git a/parachain/runtimes/gargantua/Cargo.toml b/parachain/runtimes/gargantua/Cargo.toml index 219d9bc2..4a767226 100644 --- a/parachain/runtimes/gargantua/Cargo.toml +++ b/parachain/runtimes/gargantua/Cargo.toml @@ -220,7 +220,6 @@ runtime-benchmarks = [ "pallet-sudo/runtime-benchmarks", "parachains-common/runtime-benchmarks", "ismp-grandpa/runtime-benchmarks", - "pallet-token-gateway/runtime-benchmarks" ] try-runtime = [ diff --git a/parachain/runtimes/gargantua/src/lib.rs b/parachain/runtimes/gargantua/src/lib.rs index cfbc3153..69c6e64f 100644 --- a/parachain/runtimes/gargantua/src/lib.rs +++ b/parachain/runtimes/gargantua/src/lib.rs @@ -679,29 +679,6 @@ impl pallet_collective::Config for Runtime { type MaxProposalWeight = MaxCollectivesProposalWeight; } -impl pallet_token_gateway::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - - type Dispatcher = Ismp; - - type NativeCurrency = Balances; - - type AssetAdmin = TreasuryAccount; - - type Assets = Assets; - - type NativeAssetId = NativeAssetId; - - type AssetIdFactory = (); - - type Decimals = Decimals; - type WeightInfo = weights::pallet_token_gateway::WeightInfo; -} - -impl pallet_hyperbridge::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - type IsmpHost = Ismp; -} // Create the runtime by composing the FRAME pallets that were previously configured. construct_runtime!( pub enum Runtime @@ -753,8 +730,6 @@ construct_runtime!( Fishermen: pallet_fishermen = 61, TokenGatewayInspector: pallet_token_gateway_inspector = 62, IsmpSyncCommitteeGno: ismp_sync_committee::pallet:: = 63, - TokenGateway: pallet_token_gateway = 64, - HyperBridge: pallet_hyperbridge = 65, // Governance TechnicalCollective: pallet_collective = 80, @@ -789,7 +764,6 @@ mod benches { [cumulus_pallet_parachain_system, ParachainSystem] [pallet_session, SessionBench::] [ismp_grandpa, IsmpGrandpa] - [pallet_token_gateway, TokenGateway] ); } diff --git a/parachain/runtimes/gargantua/src/weights/pallet_token_gateway.rs b/parachain/runtimes/gargantua/src/weights/pallet_token_gateway.rs index da56337a..5f71ea79 100644 --- a/parachain/runtimes/gargantua/src/weights/pallet_token_gateway.rs +++ b/parachain/runtimes/gargantua/src/weights/pallet_token_gateway.rs @@ -23,6 +23,7 @@ #![allow(unused_parens)] #![allow(unused_imports)] #![allow(missing_docs)] +#![allow(dead_code)] use frame_support::{traits::Get, weights::Weight}; use core::marker::PhantomData; @@ -92,12 +93,12 @@ impl pallet_token_gateway::WeightInfo for WeightInfo } /// Storage: `TokenGateway::TokenGatewayAddresses` (r:0 w:1) /// Proof: `TokenGateway::TokenGatewayAddresses` (`max_values`: None, `max_size`: None, mode: `Measured`) - fn set_token_gateway_addresses() -> Weight { + fn set_token_gateway_addresses(i:u32,) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` // Minimum execution time: 10_000_000 picoseconds. - Weight::from_parts(10_000_000, 0) + Weight::from_parts(10_000_000, 0).saturating_mul(i.into()) .saturating_add(Weight::from_parts(0, 0)) .saturating_add(T::DbWeight::get().writes(1)) }