Files
pezkuwi-sdk/pezbridges/pezsnowbridge/pezpallets/system/src/benchmarking.rs
T
pezkuwichain 3ddf58cef9 fix: EnsureOrigin try_successful_origin and snowbridge rename
- Fix pezpallet-welati EnsureOrigin implementations (3 fixes)
  - Remove incorrect #[cfg(not(feature = "runtime-benchmarks"))] blocks
  - Affects EnsureSerok, EnsureParlementer, EnsureDiwan

- Fix asset-hub-zagros governance origins macros (2 fixes)
  - Remove non-benchmark try_successful_origin from decl_unit_ensures!
  - Remove non-benchmark try_successful_origin from decl_ensure!

- Rename snowbridge -> pezsnowbridge for consistency

- Update WORKFLOW_PLAN.md with build status and package names
  - Correct package names: pezkuwi-teyrchain-bin, pezstaging-node-cli
  - Mark completed builds: pezkuwi, pezkuwi-teyrchain-bin,
    pezstaging-node-cli, teyrchain-template-node
2025-12-25 01:26:18 +03:00

93 lines
2.1 KiB
Rust

// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: 2023 Snowfork <hello@snowfork.com>
//! Benchmarking setup for pezpallet-template
use super::*;
#[allow(unused)]
use crate::Pezpallet as SnowbridgeControl;
use pezframe_benchmarking::v2::*;
use pezframe_system::RawOrigin;
use pezsnowbridge_core::eth;
use pezsnowbridge_outbound_queue_primitives::OperatingMode;
use pezsp_runtime::SaturatedConversion;
use xcm::prelude::*;
#[benchmarks]
mod benchmarks {
use super::*;
#[benchmark]
fn upgrade() -> Result<(), BenchmarkError> {
let impl_address = H160::repeat_byte(1);
let impl_code_hash = H256::repeat_byte(1);
// Assume 256 bytes passed to initializer
let params: Vec<u8> = (0..256).map(|_| 1u8).collect();
#[extrinsic_call]
_(
RawOrigin::Root,
impl_address,
impl_code_hash,
Some(Initializer { params, maximum_required_gas: 100000 }),
);
Ok(())
}
#[benchmark]
fn set_operating_mode() -> Result<(), BenchmarkError> {
#[extrinsic_call]
_(RawOrigin::Root, OperatingMode::RejectingOutboundMessages);
Ok(())
}
#[benchmark]
fn set_pricing_parameters() -> Result<(), BenchmarkError> {
let params = T::DefaultPricingParameters::get();
#[extrinsic_call]
_(RawOrigin::Root, params);
Ok(())
}
#[benchmark]
fn set_token_transfer_fees() -> Result<(), BenchmarkError> {
#[extrinsic_call]
_(RawOrigin::Root, 1, 1, eth(1));
Ok(())
}
#[benchmark]
fn register_token() -> Result<(), BenchmarkError> {
let caller: T::AccountId = whitelisted_caller();
let amount: BalanceOf<T> =
(10_000_000_000_000_u128).saturated_into::<u128>().saturated_into();
T::Token::mint_into(&caller, amount)?;
let relay_token_asset_id: Location = Location::parent();
let asset = Box::new(VersionedLocation::from(relay_token_asset_id));
let asset_metadata = AssetMetadata {
name: "wnd".as_bytes().to_vec().try_into().unwrap(),
symbol: "wnd".as_bytes().to_vec().try_into().unwrap(),
decimals: 12,
};
#[extrinsic_call]
_(RawOrigin::Root, asset, asset_metadata);
Ok(())
}
impl_benchmark_test_suite!(
SnowbridgeControl,
crate::mock::new_test_ext(true),
crate::mock::Test
);
}