Skip to content

Commit

Permalink
feat(benchmark) cleanup & add dynamacity in set_addresses benches
Browse files Browse the repository at this point in the history
  • Loading branch information
MrishoLukamba committed Dec 24, 2024
1 parent 8a7868b commit fd33607
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 32 deletions.
2 changes: 1 addition & 1 deletion modules/ismp/pallets/token-gateway/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<T>,
addresses: BTreeMap<StateMachine, Vec<u8>>,
Expand Down
4 changes: 2 additions & 2 deletions modules/ismp/pallets/token-gateway/src/weights.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand All @@ -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()
}

Expand Down
1 change: 0 additions & 1 deletion parachain/runtimes/gargantua/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down
26 changes: 0 additions & 26 deletions parachain/runtimes/gargantua/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Runtime>;
}

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
Expand Down Expand Up @@ -753,8 +730,6 @@ construct_runtime!(
Fishermen: pallet_fishermen = 61,
TokenGatewayInspector: pallet_token_gateway_inspector = 62,
IsmpSyncCommitteeGno: ismp_sync_committee::pallet::<Instance2> = 63,
TokenGateway: pallet_token_gateway = 64,
HyperBridge: pallet_hyperbridge = 65,

// Governance
TechnicalCollective: pallet_collective = 80,
Expand Down Expand Up @@ -789,7 +764,6 @@ mod benches {
[cumulus_pallet_parachain_system, ParachainSystem]
[pallet_session, SessionBench::<Runtime>]
[ismp_grandpa, IsmpGrandpa]
[pallet_token_gateway, TokenGateway]

);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -92,12 +93,12 @@ impl<T: frame_system::Config> pallet_token_gateway::WeightInfo for WeightInfo<T>
}
/// 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))
}
Expand Down

0 comments on commit fd33607

Please sign in to comment.