mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 23:21:02 +00:00
Change Fixed to WeightInfoBounds for Polkadot (#7077)
* Add polkadot XCM benchmarks * Add temp * ".git/.scripts/commands/bench/bench.sh" xcm polkadot pallet_xcm_benchmarks::fungible * ".git/.scripts/commands/bench/bench.sh" xcm polkadot pallet_xcm_benchmarks::generic * Add weights to XCM on Polkadot * Make CI fail on old files Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Update template Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Add reserve_asset_deposited benchmark * ".git/.scripts/commands/bench/bench.sh" xcm kusama pallet_xcm_benchmarks::generic * Update weights Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Change initiate_reserve_deposit in runtime weights * Update weights Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Remove trusted reserves from runtimes * Fix pallet-xcm-benchmarks mock * Fix test * Change pallet xcm weigher in kusama * Fix * Remove merge conflict artifact * Remove initiate_reserve_withdraw from generic benchmarks * Add missing implementation to XCM benchmark * Fix failing karura test * Remove dbg! Co-authored-by: Keith Yeung <kungfukeith11@gmail.com> * Fix fmt * Revert "Fix fmt" This reverts commit 676f2d8db07d7427750c79f95494d4988d06fda5. * Fix fmt * Remove duplicated template code * Add back part of the template * ".git/.scripts/commands/bench-vm/bench-vm.sh" xcm polkadot pallet_xcm_benchmarks::fungible * Don't skip reserve asset deposited benchmark * Remove call to non-generated benchmark yet * Underscore unused parameter * Skip not supported benchmarks and hardcode value * Remove ReserveAssetDeposited benchmark * ".git/.scripts/commands/bench-vm/bench-vm.sh" xcm polkadot pallet_xcm_benchmarks::fungible * Add back ReserveAssetDeposited * ".git/.scripts/commands/bench-vm/bench-vm.sh" xcm polkadot pallet_xcm_benchmarks::fungible * Use default benchmark for ReserveAssetDeposited * Add missing parameter * Revert reserve asset deposited benchmark * ".git/.scripts/commands/bench-vm/bench-vm.sh" xcm kusama pallet_xcm_benchmarks::fungible * ".git/.scripts/commands/bench-vm/bench-vm.sh" xcm westend pallet_xcm_benchmarks::fungible * ".git/.scripts/commands/bench/bench.sh" xcm rococo pallet_xcm_benchmarks::fungible * Add 'real' benchmarks * Add TrustedReserve to actual XcmConfig * Add TrustedReserve to actual XcmConfig (fix) * Whitelist from benchmarking XCM storage keys read each block (#6871) * Whitelist from benchmarking XCM storage keys read each block * ".git/.scripts/commands/bench/bench.sh" runtime polkadot pallet_xcm * ".git/.scripts/commands/bench/bench.sh" runtime polkadot pallet_xcm * ".git/.scripts/commands/bench/bench.sh" runtime westend pallet_xcm * ".git/.scripts/commands/bench/bench.sh" runtime rococo pallet_xcm * Remove XcmPallet SupportedVersion from the benchmark whitelist * ".git/.scripts/commands/bench/bench.sh" runtime polkadot pallet_xcm * ".git/.scripts/commands/bench/bench.sh" runtime kusama pallet_xcm * ".git/.scripts/commands/bench/bench.sh" runtime westend pallet_xcm * ".git/.scripts/commands/bench/bench.sh" runtime rococo pallet_xcm * WIP * Add necessary traits, remove unnecessary whitelisted keys * Fix tests * Remove unused file * Remove unused import --------- Co-authored-by: command-bot <> * ".git/.scripts/commands/bench/bench.sh" xcm kusama pallet_xcm_benchmarks::fungible * ".git/.scripts/commands/bench/bench.sh" xcm kusama pallet_xcm_benchmarks::fungible * ".git/.scripts/commands/bench/bench.sh" xcm kusama pallet_xcm_benchmarks::fungible * ".git/.scripts/commands/bench/bench.sh" xcm rococo pallet_xcm_benchmarks::fungible * ".git/.scripts/commands/bench/bench.sh" xcm westend pallet_xcm_benchmarks::fungible * Fix spellchecker issues * Remove unused migration code --------- Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> Co-authored-by: command-bot <> Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>
This commit is contained in:
committed by
GitHub
parent
c63b557e50
commit
cc9f8129af
@@ -131,6 +131,38 @@ benchmarks_instance_pallet! {
|
||||
// TODO: Check sender queue is not empty. #4426
|
||||
}
|
||||
|
||||
reserve_asset_deposited {
|
||||
let (trusted_reserve, transferable_reserve_asset) = T::TrustedReserve::get()
|
||||
.ok_or(BenchmarkError::Override(
|
||||
BenchmarkResult::from_weight(T::BlockWeights::get().max_block)
|
||||
))?;
|
||||
|
||||
let assets: MultiAssets = vec![ transferable_reserve_asset ].into();
|
||||
|
||||
let mut executor = new_executor::<T>(trusted_reserve);
|
||||
let instruction = Instruction::ReserveAssetDeposited(assets.clone());
|
||||
let xcm = Xcm(vec![instruction]);
|
||||
}: {
|
||||
executor.bench_process(xcm)?;
|
||||
} verify {
|
||||
assert!(executor.holding().ensure_contains(&assets).is_ok());
|
||||
}
|
||||
|
||||
initiate_reserve_withdraw {
|
||||
let holding = T::worst_case_holding(1);
|
||||
let assets_filter = MultiAssetFilter::Definite(holding.clone());
|
||||
let reserve = T::valid_destination().map_err(|_| BenchmarkError::Skip)?;
|
||||
let mut executor = new_executor::<T>(Default::default());
|
||||
executor.set_holding(holding.into());
|
||||
let instruction = Instruction::InitiateReserveWithdraw { assets: assets_filter, reserve, xcm: Xcm(vec![]) };
|
||||
let xcm = Xcm(vec![instruction]);
|
||||
}: {
|
||||
executor.bench_process(xcm)?;
|
||||
} verify {
|
||||
// The execute completing successfully is as good as we can check.
|
||||
// TODO: Potentially add new trait to XcmSender to detect a queued outgoing message. #4426
|
||||
}
|
||||
|
||||
receive_teleported_asset {
|
||||
// If there is no trusted teleporter, then we skip this benchmark.
|
||||
let (trusted_teleporter, teleportable_asset) = T::TrustedTeleporter::get()
|
||||
|
||||
@@ -132,7 +132,7 @@ impl xcm_executor::Config for XcmConfig {
|
||||
type XcmSender = DevNull;
|
||||
type AssetTransactor = AssetTransactor;
|
||||
type OriginConverter = ();
|
||||
type IsReserve = ();
|
||||
type IsReserve = TrustedReserves;
|
||||
type IsTeleporter = TrustedTeleporters;
|
||||
type UniversalLocation = UniversalLocation;
|
||||
type Barrier = AllowUnpaidExecutionFrom<Everything>;
|
||||
@@ -171,7 +171,8 @@ impl crate::Config for Test {
|
||||
}
|
||||
}
|
||||
|
||||
pub type TrustedTeleporters = (xcm_builder::Case<TeleportConcreteFungible>,);
|
||||
pub type TrustedTeleporters = xcm_builder::Case<TeleportConcreteFungible>;
|
||||
pub type TrustedReserves = xcm_builder::Case<ReserveConcreteFungible>;
|
||||
|
||||
parameter_types! {
|
||||
pub const CheckingAccount: Option<(u64, MintLocation)> = Some((100, MintLocation::Local));
|
||||
@@ -180,6 +181,10 @@ parameter_types! {
|
||||
ChildTeleporter::get(),
|
||||
MultiAsset { id: Concrete(Here.into_location()), fun: Fungible(100) },
|
||||
));
|
||||
pub const TrustedReserve: Option<(MultiLocation, MultiAsset)> = Some((
|
||||
ChildTeleporter::get(),
|
||||
MultiAsset { id: Concrete(Here.into_location()), fun: Fungible(100) },
|
||||
));
|
||||
pub const TeleportConcreteFungible: (MultiAssetFilter, MultiLocation) =
|
||||
(Wild(AllOf { fun: WildFungible, id: Concrete(Here.into_location()) }), ChildTeleporter::get());
|
||||
pub const ReserveConcreteFungible: (MultiAssetFilter, MultiLocation) =
|
||||
@@ -190,6 +195,7 @@ impl xcm_balances_benchmark::Config for Test {
|
||||
type TransactAsset = Balances;
|
||||
type CheckedAccount = CheckingAccount;
|
||||
type TrustedTeleporter = TrustedTeleporter;
|
||||
type TrustedReserve = TrustedReserve;
|
||||
|
||||
fn get_multi_asset() -> MultiAsset {
|
||||
let amount =
|
||||
|
||||
@@ -39,6 +39,10 @@ pub mod pallet {
|
||||
/// A trusted location which we allow teleports from, and the asset we allow to teleport.
|
||||
type TrustedTeleporter: Get<Option<(xcm::latest::MultiLocation, xcm::latest::MultiAsset)>>;
|
||||
|
||||
/// A trusted location where reserve assets are stored, and the asset we allow to be
|
||||
/// reserves.
|
||||
type TrustedReserve: Get<Option<(xcm::latest::MultiLocation, xcm::latest::MultiAsset)>>;
|
||||
|
||||
/// Give me a fungible asset that your asset transactor is going to accept.
|
||||
fn get_multi_asset() -> xcm::latest::MultiAsset;
|
||||
}
|
||||
|
||||
@@ -281,21 +281,6 @@ benchmarks! {
|
||||
assert!(!<T::XcmConfig as xcm_executor::Config>::SubscriptionService::is_subscribed(&origin));
|
||||
}
|
||||
|
||||
initiate_reserve_withdraw {
|
||||
let holding = T::worst_case_holding(1);
|
||||
let assets_filter = MultiAssetFilter::Definite(holding.clone());
|
||||
let reserve = T::valid_destination().map_err(|_| BenchmarkError::Skip)?;
|
||||
let mut executor = new_executor::<T>(Default::default());
|
||||
executor.set_holding(holding.into());
|
||||
let instruction = Instruction::InitiateReserveWithdraw { assets: assets_filter, reserve, xcm: Xcm(vec![]) };
|
||||
let xcm = Xcm(vec![instruction]);
|
||||
}: {
|
||||
executor.bench_process(xcm)?;
|
||||
} verify {
|
||||
// The execute completing successfully is as good as we can check.
|
||||
// TODO: Potentially add new trait to XcmSender to detect a queued outgoing message. #4426
|
||||
}
|
||||
|
||||
burn_asset {
|
||||
let holding = T::worst_case_holding(0);
|
||||
let assets = holding.clone();
|
||||
|
||||
Reference in New Issue
Block a user