cumulus: add asset-hub-rococo runtime based on asset-hub-kusama and add asset-bridging support to it (#1215)

This commit adds Rococo Asset Hub dedicated runtime so we can test new
features here, before merging them in Kusama Asset Hub.
Also adds one such feature: asset transfer over bridge (Rococo AssetHub
<> Wococo AssetHub)

- clone `asset-hub-kusama-runtime` -> `asset-hub-rococo-runtime`
- make it use Rococo primitives, names, assets, constants, etc
- add asset-transfer-over-bridge support to Rococo AssetHub <> Wococo
AssetHub

Fixes #1128

---------

Co-authored-by: Branislav Kontur <bkontur@gmail.com>
Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com>
Co-authored-by: Francisco Aguirre <franciscoaguirreperez@gmail.com>
This commit is contained in:
Adrian Catangiu
2023-10-18 09:47:45 +03:00
committed by GitHub
parent e73729b15f
commit 8b3905d2a5
95 changed files with 14143 additions and 767 deletions
+5
View File
@@ -59,6 +59,11 @@ short-benchmark-asset-hub-kusama:
variables:
RUNTIME_CHAIN: asset-hub-kusama-dev
short-benchmark-asset-hub-rococo:
<<: *short-bench-cumulus
variables:
RUNTIME_CHAIN: asset-hub-rococo-dev
short-benchmark-asset-hub-westend:
<<: *short-bench-cumulus
variables:
Generated
+118 -2
View File
@@ -796,13 +796,103 @@ dependencies = [
name = "asset-hub-rococo-integration-tests"
version = "1.0.0"
dependencies = [
"assert_matches",
"asset-hub-rococo-runtime",
"frame-support",
"frame-system",
"integration-tests-common",
"pallet-asset-conversion",
"pallet-assets",
"pallet-balances",
"pallet-xcm",
"parachains-common",
"parity-scale-codec",
"polkadot-core-primitives",
"polkadot-parachain-primitives",
"polkadot-runtime-parachains",
"sp-runtime",
"staging-xcm",
"xcm-emulator",
]
[[package]]
name = "asset-hub-rococo-runtime"
version = "0.9.420"
dependencies = [
"asset-test-utils",
"assets-common",
"bp-asset-hub-rococo",
"bp-asset-hub-wococo",
"bp-bridge-hub-rococo",
"bp-bridge-hub-wococo",
"cumulus-pallet-aura-ext",
"cumulus-pallet-dmp-queue",
"cumulus-pallet-parachain-system",
"cumulus-pallet-session-benchmarking",
"cumulus-pallet-xcm",
"cumulus-pallet-xcmp-queue",
"cumulus-primitives-core",
"cumulus-primitives-utility",
"frame-benchmarking",
"frame-executive",
"frame-support",
"frame-system",
"frame-system-benchmarking",
"frame-system-rpc-runtime-api",
"frame-try-runtime",
"hex-literal",
"log",
"pallet-asset-conversion",
"pallet-asset-conversion-tx-payment",
"pallet-assets",
"pallet-aura",
"pallet-authorship",
"pallet-balances",
"pallet-collator-selection",
"pallet-multisig",
"pallet-nft-fractionalization",
"pallet-nfts",
"pallet-nfts-runtime-api",
"pallet-proxy",
"pallet-session",
"pallet-state-trie-migration",
"pallet-timestamp",
"pallet-transaction-payment",
"pallet-transaction-payment-rpc-runtime-api",
"pallet-uniques",
"pallet-utility",
"pallet-xcm",
"pallet-xcm-benchmarks",
"pallet-xcm-bridge-hub-router",
"parachain-info",
"parachains-common",
"parity-scale-codec",
"polkadot-core-primitives",
"polkadot-parachain-primitives",
"polkadot-runtime-common",
"primitive-types",
"rococo-runtime-constants",
"scale-info",
"smallvec",
"sp-api",
"sp-block-builder",
"sp-consensus-aura",
"sp-core",
"sp-inherents",
"sp-offchain",
"sp-runtime",
"sp-session",
"sp-std",
"sp-storage",
"sp-transaction-pool",
"sp-version",
"sp-weights",
"staging-xcm",
"staging-xcm-builder",
"staging-xcm-executor",
"substrate-wasm-builder",
]
[[package]]
name = "asset-hub-westend-integration-tests"
version = "1.0.0"
@@ -925,6 +1015,7 @@ dependencies = [
"pallet-collator-selection",
"pallet-session",
"pallet-xcm",
"pallet-xcm-bridge-hub-router",
"parachain-info",
"parachains-common",
"parachains-runtimes-test-utils",
@@ -936,6 +1027,7 @@ dependencies = [
"sp-runtime",
"sp-std",
"staging-xcm",
"staging-xcm-builder",
"staging-xcm-executor",
"substrate-wasm-builder",
]
@@ -1490,6 +1582,26 @@ dependencies = [
"sp-runtime",
]
[[package]]
name = "bp-asset-hub-rococo"
version = "0.1.0"
dependencies = [
"bp-xcm-bridge-hub-router",
"frame-support",
"parity-scale-codec",
"scale-info",
]
[[package]]
name = "bp-asset-hub-wococo"
version = "0.1.0"
dependencies = [
"bp-xcm-bridge-hub-router",
"frame-support",
"parity-scale-codec",
"scale-info",
]
[[package]]
name = "bp-bridge-hub-cumulus"
version = "0.1.0"
@@ -1908,6 +2020,8 @@ dependencies = [
name = "bridge-hub-rococo-runtime"
version = "0.1.0"
dependencies = [
"bp-asset-hub-rococo",
"bp-asset-hub-wococo",
"bp-bridge-hub-rococo",
"bp-bridge-hub-wococo",
"bp-header-chain",
@@ -1989,7 +2103,6 @@ dependencies = [
name = "bridge-hub-test-utils"
version = "0.1.0"
dependencies = [
"assert_matches",
"asset-test-utils",
"bp-bridge-hub-rococo",
"bp-bridge-hub-wococo",
@@ -2027,6 +2140,7 @@ dependencies = [
"sp-io",
"sp-keyring",
"sp-runtime",
"sp-tracing",
"staging-xcm",
"staging-xcm-builder",
"staging-xcm-executor",
@@ -3577,6 +3691,7 @@ dependencies = [
name = "cumulus-pallet-xcmp-queue"
version = "0.1.0"
dependencies = [
"bp-xcm-bridge-hub-router",
"cumulus-pallet-parachain-system",
"cumulus-primitives-core",
"frame-benchmarking",
@@ -6335,6 +6450,7 @@ version = "1.0.0"
dependencies = [
"asset-hub-kusama-runtime",
"asset-hub-polkadot-runtime",
"asset-hub-rococo-runtime",
"asset-hub-westend-runtime",
"bp-messages",
"bridge-hub-kusama-runtime",
@@ -10992,7 +11108,6 @@ dependencies = [
"sp-std",
"staging-xcm",
"staging-xcm-builder",
"staging-xcm-executor",
"substrate-wasm-builder",
"westend-runtime-constants",
]
@@ -12410,6 +12525,7 @@ dependencies = [
"assert_cmd",
"asset-hub-kusama-runtime",
"asset-hub-polkadot-runtime",
"asset-hub-rococo-runtime",
"asset-hub-westend-runtime",
"async-trait",
"bridge-hub-kusama-runtime",
+3
View File
@@ -16,6 +16,8 @@ members = [
"bridges/modules/xcm-bridge-hub-router",
"bridges/primitives/chain-asset-hub-kusama",
"bridges/primitives/chain-asset-hub-polkadot",
"bridges/primitives/chain-asset-hub-rococo",
"bridges/primitives/chain-asset-hub-wococo",
"bridges/primitives/chain-bridge-hub-cumulus",
"bridges/primitives/chain-bridge-hub-kusama",
"bridges/primitives/chain-bridge-hub-polkadot",
@@ -69,6 +71,7 @@ members = [
"cumulus/parachains/pallets/ping",
"cumulus/parachains/runtimes/assets/asset-hub-kusama",
"cumulus/parachains/runtimes/assets/asset-hub-polkadot",
"cumulus/parachains/runtimes/assets/asset-hub-rococo",
"cumulus/parachains/runtimes/assets/asset-hub-westend",
"cumulus/parachains/runtimes/assets/common",
"cumulus/parachains/runtimes/assets/test-utils",
@@ -60,6 +60,8 @@ benchmarks_instance_pallet! {
is_congested: false,
delivery_fee_factor: MINIMAL_DELIVERY_FEE_FACTOR + MINIMAL_DELIVERY_FEE_FACTOR,
});
let _ = T::ensure_bridged_target_destination();
T::make_congested();
}: {
crate::Pallet::<T, I>::on_initialize(Zero::zero())
@@ -79,11 +81,11 @@ benchmarks_instance_pallet! {
}
send_message {
// make local queue congested, because it means additional db write
T::make_congested();
let dest = T::ensure_bridged_target_destination();
let xcm = sp_std::vec![].into();
// make local queue congested, because it means additional db write
T::make_congested();
}: {
send_xcm::<crate::Pallet<T, I>>(dest, xcm).expect("message is sent")
}
@@ -0,0 +1,26 @@
[package]
name = "bp-asset-hub-rococo"
description = "Primitives of AssetHubRococo parachain runtime."
version = "0.1.0"
authors.workspace = true
edition.workspace = true
license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
[dependencies]
codec = { package = "parity-scale-codec", version = "3.1.5", default-features = false }
scale-info = { version = "2.9.0", default-features = false, features = ["derive"] }
# Substrate Dependencies
frame-support = { path = "../../../substrate/frame/support", default-features = false }
# Bridge Dependencies
bp-xcm-bridge-hub-router = { path = "../xcm-bridge-hub-router", default-features = false }
[features]
default = [ "std" ]
std = [
"bp-xcm-bridge-hub-router/std",
"codec/std",
"frame-support/std",
"scale-info/std",
]
@@ -0,0 +1,52 @@
// Copyright (C) Parity Technologies (UK) Ltd.
// This file is part of Parity Bridges Common.
// Parity Bridges Common is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Parity Bridges Common is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with Parity Bridges Common. If not, see <http://www.gnu.org/licenses/>.
//! Module with configuration which reflects AssetHubRococo runtime setup.
#![cfg_attr(not(feature = "std"), no_std)]
use codec::{Decode, Encode};
use scale_info::TypeInfo;
pub use bp_xcm_bridge_hub_router::XcmBridgeHubRouterCall;
/// `AssetHubRococo` Runtime `Call` enum.
///
/// The enum represents a subset of possible `Call`s we can send to `AssetHubRococo` chain.
/// Ideally this code would be auto-generated from metadata, because we want to
/// avoid depending directly on the ENTIRE runtime just to get the encoding of `Dispatchable`s.
///
/// All entries here (like pretty much in the entire file) must be kept in sync with
/// `AssetHubRococo` `construct_runtime`, so that we maintain SCALE-compatibility.
#[allow(clippy::large_enum_variant)]
#[derive(Encode, Decode, Debug, PartialEq, Eq, Clone, TypeInfo)]
pub enum Call {
/// `ToWococoXcmRouter` bridge pallet.
#[codec(index = 43)]
ToWococoXcmRouter(XcmBridgeHubRouterCall),
}
frame_support::parameter_types! {
/// Some sane weight to execute `xcm::Transact(pallet-xcm-bridge-hub-router::Call::report_bridge_status)`.
pub const XcmBridgeHubRouterTransactCallMaxWeight: frame_support::weights::Weight = frame_support::weights::Weight::from_parts(200_000_000, 6144);
/// Base delivery fee to `BridgeHubRococo`.
/// (initially was calculated by test `BridgeHubRococo::can_calculate_weight_for_paid_export_message_with_reserve_transfer`)
pub const BridgeHubRococoBaseFeeInRocs: u128 = 1214739988;
}
/// Identifier of AssetHubRococo in the Rococo relay chain.
pub const ASSET_HUB_ROCOCO_PARACHAIN_ID: u32 = 1000;
@@ -0,0 +1,26 @@
[package]
name = "bp-asset-hub-wococo"
description = "Primitives of AssetHubWococo parachain runtime."
version = "0.1.0"
authors.workspace = true
edition.workspace = true
license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
[dependencies]
codec = { package = "parity-scale-codec", version = "3.1.5", default-features = false }
scale-info = { version = "2.9.0", default-features = false, features = ["derive"] }
# Substrate Dependencies
frame-support = { path = "../../../substrate/frame/support", default-features = false }
# Bridge Dependencies
bp-xcm-bridge-hub-router = { path = "../xcm-bridge-hub-router", default-features = false }
[features]
default = [ "std" ]
std = [
"bp-xcm-bridge-hub-router/std",
"codec/std",
"frame-support/std",
"scale-info/std",
]
@@ -0,0 +1,52 @@
// Copyright (C) Parity Technologies (UK) Ltd.
// This file is part of Parity Bridges Common.
// Parity Bridges Common is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Parity Bridges Common is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with Parity Bridges Common. If not, see <http://www.gnu.org/licenses/>.
//! Module with configuration which reflects AssetHubWococo runtime setup.
#![cfg_attr(not(feature = "std"), no_std)]
use codec::{Decode, Encode};
use scale_info::TypeInfo;
pub use bp_xcm_bridge_hub_router::XcmBridgeHubRouterCall;
/// `AssetHubWococo` Runtime `Call` enum.
///
/// The enum represents a subset of possible `Call`s we can send to `AssetHubWococo` chain.
/// Ideally this code would be auto-generated from metadata, because we want to
/// avoid depending directly on the ENTIRE runtime just to get the encoding of `Dispatchable`s.
///
/// All entries here (like pretty much in the entire file) must be kept in sync with
/// `AssetHubWococo` `construct_runtime`, so that we maintain SCALE-compatibility.
#[allow(clippy::large_enum_variant)]
#[derive(Encode, Decode, Debug, PartialEq, Eq, Clone, TypeInfo)]
pub enum Call {
/// `ToRococoXcmRouter` bridge pallet.
#[codec(index = 44)]
ToRococoXcmRouter(XcmBridgeHubRouterCall),
}
frame_support::parameter_types! {
/// Some sane weight to execute `xcm::Transact(pallet-xcm-bridge-hub-router::Call::report_bridge_status)`.
pub const XcmBridgeHubRouterTransactCallMaxWeight: frame_support::weights::Weight = frame_support::weights::Weight::from_parts(200_000_000, 6144);
/// Base delivery fee to `BridgeHubWococo`.
/// (initially was calculated by test `BridgeHubWococo::can_calculate_weight_for_paid_export_message_with_reserve_transfer`)
pub const BridgeHubWococoBaseFeeInWocs: u128 = 1214739988;
}
/// Identifier of AssetHubWococo in the Wococo relay chain.
pub const ASSET_HUB_WOCOCO_PARACHAIN_ID: u32 = 1000;
@@ -74,5 +74,8 @@ pub const WITH_BRIDGE_HUB_ROCOCO_MESSAGES_PALLET_NAME: &str = "BridgeRococoMessa
/// chains.
pub const WITH_BRIDGE_HUB_ROCOCO_RELAYERS_PALLET_NAME: &str = "BridgeRelayers";
/// Pallet index of `BridgeWococoMessages: pallet_bridge_messages::<Instance1>`.
pub const WITH_BRIDGE_WOCOCO_MESSAGES_PALLET_INDEX: u8 = 46;
decl_bridge_finality_runtime_apis!(bridge_hub_rococo);
decl_bridge_messages_runtime_apis!(bridge_hub_rococo);
@@ -68,5 +68,8 @@ pub const WITH_BRIDGE_HUB_WOCOCO_MESSAGES_PALLET_NAME: &str = "BridgeWococoMessa
/// chains.
pub const WITH_BRIDGE_HUB_WOCOCO_RELAYERS_PALLET_NAME: &str = "BridgeRelayers";
/// Pallet index of `BridgeRococoMessages: pallet_bridge_messages::<Instance2>`.
pub const WITH_BRIDGE_ROCOCO_MESSAGES_PALLET_INDEX: u8 = 45;
decl_bridge_finality_runtime_apis!(bridge_hub_wococo);
decl_bridge_messages_runtime_apis!(bridge_hub_wococo);
+5
View File
@@ -28,6 +28,9 @@ cumulus-primitives-core = { path = "../../primitives/core", default-features = f
# Optional import for benchmarking
frame-benchmarking = { path = "../../../substrate/frame/benchmarking", default-features = false, optional = true}
# Bridges
bp-xcm-bridge-hub-router = { path = "../../../bridges/primitives/xcm-bridge-hub-router", default-features = false, optional = true }
[dev-dependencies]
# Substrate
@@ -43,6 +46,7 @@ cumulus-pallet-parachain-system = { path = "../parachain-system", features = ["p
[features]
default = [ "std" ]
std = [
"bp-xcm-bridge-hub-router?/std",
"codec/std",
"cumulus-primitives-core/std",
"frame-benchmarking?/std",
@@ -77,3 +81,4 @@ try-runtime = [
"polkadot-runtime-common/try-runtime",
"sp-runtime/try-runtime",
]
bridging = [ "bp-xcm-bridge-hub-router" ]
@@ -0,0 +1,95 @@
// Copyright (C) Parity Technologies (UK) Ltd.
// 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.
use crate::{pallet, OutboundState};
use cumulus_primitives_core::ParaId;
use frame_support::pallet_prelude::Get;
/// Adapter implementation for `bp_xcm_bridge_hub_router::XcmChannelStatusProvider` which checks
/// both `OutboundXcmpStatus` and `InboundXcmpStatus` for defined `ParaId` if any of those is
/// suspended.
pub struct InAndOutXcmpChannelStatusProvider<SiblingBridgeHubParaId, Runtime>(
sp_std::marker::PhantomData<(SiblingBridgeHubParaId, Runtime)>,
);
impl<SiblingBridgeHubParaId: Get<ParaId>, Runtime: crate::Config>
bp_xcm_bridge_hub_router::XcmChannelStatusProvider
for InAndOutXcmpChannelStatusProvider<SiblingBridgeHubParaId, Runtime>
{
fn is_congested() -> bool {
// if the inbound channel with recipient is suspended, it means that we are unable to
// receive congestion reports from the bridge hub. So we assume the bridge pipeline is
// congested too
if pallet::Pallet::<Runtime>::is_inbound_channel_suspended(SiblingBridgeHubParaId::get()) {
return true
}
// if the outbound channel with recipient is suspended, it means that one of further
// bridge queues (e.g. bridge queue between two bridge hubs) is overloaded, so we shall
// take larger fee for our outbound messages
OutXcmpChannelStatusProvider::<SiblingBridgeHubParaId, Runtime>::is_congested()
}
}
/// Adapter implementation for `bp_xcm_bridge_hub_router::XcmChannelStatusProvider` which checks
/// only `OutboundXcmpStatus` for defined `SiblingParaId` if is suspended.
pub struct OutXcmpChannelStatusProvider<SiblingBridgeHubParaId, Runtime>(
sp_std::marker::PhantomData<(SiblingBridgeHubParaId, Runtime)>,
);
impl<SiblingBridgeHubParaId: Get<ParaId>, Runtime: crate::Config>
bp_xcm_bridge_hub_router::XcmChannelStatusProvider
for OutXcmpChannelStatusProvider<SiblingBridgeHubParaId, Runtime>
{
fn is_congested() -> bool {
let sibling_bridge_hub_id: ParaId = SiblingBridgeHubParaId::get();
// let's find the channel's state with the sibling parachain,
let Some((outbound_state, queued_pages)) = pallet::Pallet::<Runtime>::outbound_channel_state(sibling_bridge_hub_id) else {
return false
};
// suspended channel => it is congested
if outbound_state == OutboundState::Suspended {
return true
}
// TODO: https://github.com/paritytech/polkadot-sdk/pull/1556 - once this PR is merged, we may
// remove the following code.
// TODO: the following restriction is arguable, we may live without that, assuming that
// There can't be more than some `N` messages queued at the bridge queue (at the source BH)
// AND before accepting next (or next-after-next) delivery transaction, we'll receive the
// suspension signal from the target parachain and stop accepting delivery transactions.
// It takes some time for target parachain to suspend inbound channel with the target BH and
// during that we will keep accepting new message delivery transactions. Let's also reject
// new deliveries if there are too many "pages" (concatenated XCM messages) in the target BH
// -> target parachain queue.
// If the outbound channel has at least `N` pages enqueued, let's assume it is congested.
// Normally, the chain with a few opened HRMP channels, will "send" pages at every block.
// Having `N` pages means that for last `N` blocks we either have not sent any messages,
// or have sent signals.
const MAX_QUEUED_PAGES_BEFORE_DEACTIVATION: u16 = 4;
if queued_pages > MAX_QUEUED_PAGES_BEFORE_DEACTIVATION {
return true
}
false
}
}
#[cfg(feature = "runtime-benchmarks")]
pub fn suspend_channel_for_benchmarks<T: crate::Config>(target: ParaId) {
pallet::Pallet::<T>::suspend_channel(target)
}
+20
View File
@@ -35,6 +35,8 @@ mod tests;
#[cfg(feature = "runtime-benchmarks")]
mod benchmarking;
#[cfg(feature = "bridging")]
pub mod bridging;
pub mod weights;
pub use weights::WeightInfo;
@@ -947,6 +949,24 @@ impl<T: Config> Pallet<T> {
}
});
}
#[cfg(feature = "bridging")]
fn is_inbound_channel_suspended(sender: ParaId) -> bool {
<InboundXcmpStatus<T>>::get()
.iter()
.find(|c| c.sender == sender)
.map(|c| c.state == InboundState::Suspended)
.unwrap_or(false)
}
#[cfg(feature = "bridging")]
/// Returns tuple of `OutboundState` and number of queued pages.
fn outbound_channel_state(target: ParaId) -> Option<(OutboundState, u16)> {
<OutboundXcmpStatus<T>>::get().iter().find(|c| c.recipient == target).map(|c| {
let queued_pages = c.last_index.saturating_sub(c.first_index);
(c.state, queued_pages)
})
}
}
impl<T: Config> XcmpMessageHandler for Pallet<T> {
-3
View File
@@ -35,7 +35,6 @@ polkadot-core-primitives = { path = "../../../polkadot/core-primitives", default
polkadot-primitives = { path = "../../../polkadot/primitives", default-features = false}
xcm = { package = "staging-xcm", path = "../../../polkadot/xcm", default-features = false}
xcm-builder = { package = "staging-xcm-builder", path = "../../../polkadot/xcm/xcm-builder", default-features = false}
xcm-executor = { package = "staging-xcm-executor", path = "../../../polkadot/xcm/xcm-executor", default-features = false}
# Cumulus
pallet-collator-selection = { path = "../../pallets/collator-selection", default-features = false }
@@ -72,7 +71,6 @@ std = [
"sp-std/std",
"westend-runtime-constants/std",
"xcm-builder/std",
"xcm-executor/std",
"xcm/std",
]
@@ -87,5 +85,4 @@ runtime-benchmarks = [
"polkadot-primitives/runtime-benchmarks",
"sp-runtime/runtime-benchmarks",
"xcm-builder/runtime-benchmarks",
"xcm-executor/runtime-benchmarks",
]
+1
View File
@@ -20,6 +20,7 @@ pub mod kusama;
pub mod polkadot;
pub mod rococo;
pub mod westend;
pub mod wococo;
pub mod xcm_config;
pub use constants::*;
pub use opaque::*;
+17
View File
@@ -0,0 +1,17 @@
// Copyright (C) Parity Technologies (UK) Ltd.
// 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.
// re-export rococo
pub use crate::rococo::{consensus, currency, fee};
+1 -1
View File
@@ -14,7 +14,6 @@
// limitations under the License.
use crate::impls::AccountIdOf;
use core::marker::PhantomData;
use cumulus_primitives_core::{IsSystem, ParaId};
use frame_support::{
traits::{fungibles::Inspect, tokens::ConversionToAssetBalance, ContainsPair},
@@ -22,6 +21,7 @@ use frame_support::{
};
use log;
use sp_runtime::traits::Get;
use sp_std::marker::PhantomData;
use xcm::latest::prelude::*;
/// A `ChargeFeeInFungibles` implementation that converts the output of
@@ -3,15 +3,32 @@ name = "asset-hub-rococo-integration-tests"
version = "1.0.0"
authors.workspace = true
edition.workspace = true
license = "Apache-2.0"
description = "Asset Hub Rococo runtime integration tests with xcm-emulator"
publish = false
[dependencies]
codec = { package = "parity-scale-codec", version = "3.4.0", default-features = false }
assert_matches = "1.5.0"
# Substrate
sp-runtime = { path = "../../../../../../substrate/primitives/runtime", default-features = false}
frame-support = { path = "../../../../../../substrate/frame/support", default-features = false}
frame-system = { path = "../../../../../../substrate/frame/system", default-features = false}
pallet-balances = { path = "../../../../../../substrate/frame/balances", default-features = false}
pallet-assets = { path = "../../../../../../substrate/frame/assets", default-features = false}
pallet-asset-conversion = { path = "../../../../../../substrate/frame/asset-conversion", default-features = false}
# Polkadot
polkadot-core-primitives = { path = "../../../../../../polkadot/core-primitives", default-features = false}
polkadot-parachain-primitives = { path = "../../../../../../polkadot/parachain", default-features = false}
polkadot-runtime-parachains = { path = "../../../../../../polkadot/runtime/parachains" }
xcm = { package = "staging-xcm", path = "../../../../../../polkadot/xcm", default-features = false}
pallet-xcm = { path = "../../../../../../polkadot/xcm/pallet-xcm", default-features = false}
# Cumulus
parachains-common = { path = "../../../../common" }
asset-hub-rococo-runtime = { path = "../../../../runtimes/assets/asset-hub-rococo" }
# Local
xcm-emulator = { path = "../../../../../xcm/xcm-emulator", default-features = false}
@@ -19,6 +36,16 @@ integration-tests-common = { path = "../../common", default-features = false}
[features]
runtime-benchmarks = [
"asset-hub-rococo-runtime/runtime-benchmarks",
"frame-support/runtime-benchmarks",
"frame-system/runtime-benchmarks",
"integration-tests-common/runtime-benchmarks",
"pallet-asset-conversion/runtime-benchmarks",
"pallet-assets/runtime-benchmarks",
"pallet-balances/runtime-benchmarks",
"pallet-xcm/runtime-benchmarks",
"parachains-common/runtime-benchmarks",
"polkadot-parachain-primitives/runtime-benchmarks",
"polkadot-runtime-parachains/runtime-benchmarks",
"sp-runtime/runtime-benchmarks",
]
@@ -13,14 +13,79 @@
// See the License for the specific language governing permissions and
// limitations under the License.
pub use frame_support::assert_ok;
pub use integration_tests_common::{
constants::asset_hub_rococo::ED as ASSET_HUB_ROCOCO_ED, test_parachain_is_trusted_teleporter,
AssetHubRococo, AssetHubRococoPallet, AssetHubRococoSender, BridgeHubRococo,
BridgeHubRococoReceiver,
pub use codec::Encode;
pub use frame_support::{
assert_err, assert_ok,
pallet_prelude::Weight,
sp_runtime::{AccountId32, DispatchError, DispatchResult},
traits::fungibles::Inspect,
};
pub use xcm::prelude::*;
pub use xcm_emulator::{assert_expected_events, bx, Chain, Parachain, TestExt};
pub use integration_tests_common::{
constants::{
asset_hub_rococo::ED as ASSET_HUB_ROCOCO_ED, rococo::ED as ROCOCO_ED, PROOF_SIZE_THRESHOLD,
REF_TIME_THRESHOLD, XCM_V3,
},
test_parachain_is_trusted_teleporter,
xcm_helpers::{xcm_transact_paid_execution, xcm_transact_unpaid_execution},
AssetHubRococo, AssetHubRococoPallet, AssetHubRococoReceiver, AssetHubRococoSender,
BridgeHubRococo, BridgeHubRococoReceiver, PenpalRococoA, PenpalRococoAPallet,
PenpalRococoAReceiver, PenpalRococoASender, PenpalRococoB, PenpalRococoBPallet, Rococo,
RococoPallet, RococoReceiver, RococoSender,
};
pub use parachains_common::{AccountId, Balance};
pub use xcm::{
prelude::{AccountId32 as AccountId32Junction, *},
v3::{Error, NetworkId::Rococo as RococoId},
};
pub use xcm_emulator::{
assert_expected_events, bx, helpers::weight_within_threshold, Chain, Parachain as Para,
RelayChain as Relay, Test, TestArgs, TestContext, TestExt,
};
pub const ASSET_ID: u32 = 1;
pub const ASSET_MIN_BALANCE: u128 = 1000;
// `Assets` pallet index
pub const ASSETS_PALLET_ID: u8 = 50;
pub type RelayToSystemParaTest = Test<Rococo, AssetHubRococo>;
pub type SystemParaToRelayTest = Test<AssetHubRococo, Rococo>;
pub type SystemParaToParaTest = Test<AssetHubRococo, PenpalRococoA>;
/// Returns a `TestArgs` instance to de used for the Relay Chain accross integraton tests
pub fn relay_test_args(amount: Balance) -> TestArgs {
TestArgs {
dest: Rococo::child_location_of(AssetHubRococo::para_id()),
beneficiary: AccountId32Junction {
network: None,
id: AssetHubRococoReceiver::get().into(),
}
.into(),
amount,
assets: (Here, amount).into(),
asset_id: None,
fee_asset_item: 0,
weight_limit: WeightLimit::Unlimited,
}
}
/// Returns a `TestArgs` instance to de used for the System Parachain accross integraton tests
pub fn system_para_test_args(
dest: MultiLocation,
beneficiary_id: AccountId32,
amount: Balance,
assets: MultiAssets,
asset_id: Option<u32>,
) -> TestArgs {
TestArgs {
dest,
beneficiary: AccountId32Junction { network: None, id: beneficiary_id.into() }.into(),
amount,
assets,
asset_id,
fee_asset_item: 0,
weight_limit: WeightLimit::Unlimited,
}
}
#[cfg(test)]
mod tests;
@@ -13,4 +13,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.
mod reserve_transfer;
mod send;
mod set_xcm_versions;
mod swap;
mod teleport;
@@ -0,0 +1,416 @@
// Copyright (C) Parity Technologies (UK) Ltd.
// 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.
use crate::*;
fn relay_origin_assertions(t: RelayToSystemParaTest) {
type RuntimeEvent = <Rococo as Chain>::RuntimeEvent;
Rococo::assert_xcm_pallet_attempted_complete(Some(Weight::from_parts(630_092_000, 6_196)));
assert_expected_events!(
Rococo,
vec![
// Amount to reserve transfer is transferred to System Parachain's Sovereign account
RuntimeEvent::Balances(pallet_balances::Event::Transfer { from, to, amount }) => {
from: *from == t.sender.account_id,
to: *to == Rococo::sovereign_account_id_of(
t.args.dest
),
amount: *amount == t.args.amount,
},
]
);
}
fn system_para_dest_assertions_incomplete(_t: RelayToSystemParaTest) {
AssetHubRococo::assert_dmp_queue_incomplete(
Some(Weight::from_parts(1_000_000_000, 0)),
Some(Error::UntrustedReserveLocation),
);
}
fn system_para_to_relay_assertions(_t: SystemParaToRelayTest) {
AssetHubRococo::assert_xcm_pallet_attempted_error(Some(XcmError::Barrier))
}
fn system_para_to_para_assertions(t: SystemParaToParaTest) {
type RuntimeEvent = <AssetHubRococo as Chain>::RuntimeEvent;
AssetHubRococo::assert_xcm_pallet_attempted_complete(Some(Weight::from_parts(
630_092_000,
6_196,
)));
assert_expected_events!(
AssetHubRococo,
vec![
// Amount to reserve transfer is transferred to Parachain's Sovereing account
RuntimeEvent::Balances(
pallet_balances::Event::Transfer { from, to, amount }
) => {
from: *from == t.sender.account_id,
to: *to == AssetHubRococo::sovereign_account_id_of(
t.args.dest
),
amount: *amount == t.args.amount,
},
]
);
}
fn system_para_to_para_assets_assertions(t: SystemParaToParaTest) {
type RuntimeEvent = <AssetHubRococo as Chain>::RuntimeEvent;
AssetHubRococo::assert_xcm_pallet_attempted_complete(Some(Weight::from_parts(
676_119_000,
6196,
)));
assert_expected_events!(
AssetHubRococo,
vec![
// Amount to reserve transfer is transferred to Parachain's Sovereing account
RuntimeEvent::Assets(
pallet_assets::Event::Transferred { asset_id, from, to, amount }
) => {
asset_id: *asset_id == ASSET_ID,
from: *from == t.sender.account_id,
to: *to == AssetHubRococo::sovereign_account_id_of(
t.args.dest
),
amount: *amount == t.args.amount,
},
]
);
}
fn relay_limited_reserve_transfer_assets(t: RelayToSystemParaTest) -> DispatchResult {
<Rococo as RococoPallet>::XcmPallet::limited_reserve_transfer_assets(
t.signed_origin,
bx!(t.args.dest.into()),
bx!(t.args.beneficiary.into()),
bx!(t.args.assets.into()),
t.args.fee_asset_item,
t.args.weight_limit,
)
}
fn relay_reserve_transfer_assets(t: RelayToSystemParaTest) -> DispatchResult {
<Rococo as RococoPallet>::XcmPallet::reserve_transfer_assets(
t.signed_origin,
bx!(t.args.dest.into()),
bx!(t.args.beneficiary.into()),
bx!(t.args.assets.into()),
t.args.fee_asset_item,
)
}
fn system_para_limited_reserve_transfer_assets(t: SystemParaToRelayTest) -> DispatchResult {
<AssetHubRococo as AssetHubRococoPallet>::PolkadotXcm::limited_reserve_transfer_assets(
t.signed_origin,
bx!(t.args.dest.into()),
bx!(t.args.beneficiary.into()),
bx!(t.args.assets.into()),
t.args.fee_asset_item,
t.args.weight_limit,
)
}
fn system_para_reserve_transfer_assets(t: SystemParaToRelayTest) -> DispatchResult {
<AssetHubRococo as AssetHubRococoPallet>::PolkadotXcm::reserve_transfer_assets(
t.signed_origin,
bx!(t.args.dest.into()),
bx!(t.args.beneficiary.into()),
bx!(t.args.assets.into()),
t.args.fee_asset_item,
)
}
fn system_para_to_para_limited_reserve_transfer_assets(t: SystemParaToParaTest) -> DispatchResult {
<AssetHubRococo as AssetHubRococoPallet>::PolkadotXcm::limited_reserve_transfer_assets(
t.signed_origin,
bx!(t.args.dest.into()),
bx!(t.args.beneficiary.into()),
bx!(t.args.assets.into()),
t.args.fee_asset_item,
t.args.weight_limit,
)
}
fn system_para_to_para_reserve_transfer_assets(t: SystemParaToParaTest) -> DispatchResult {
<AssetHubRococo as AssetHubRococoPallet>::PolkadotXcm::reserve_transfer_assets(
t.signed_origin,
bx!(t.args.dest.into()),
bx!(t.args.beneficiary.into()),
bx!(t.args.assets.into()),
t.args.fee_asset_item,
)
}
/// Limited Reserve Transfers of native asset from Relay Chain to the System Parachain shouldn't
/// work
#[test]
fn limited_reserve_transfer_native_asset_from_relay_to_system_para_fails() {
// Init values for Relay Chain
let amount_to_send: Balance = ROCOCO_ED * 1000;
let test_args = TestContext {
sender: RococoSender::get(),
receiver: AssetHubRococoReceiver::get(),
args: relay_test_args(amount_to_send),
};
let mut test = RelayToSystemParaTest::new(test_args);
let sender_balance_before = test.sender.balance;
let receiver_balance_before = test.receiver.balance;
test.set_assertion::<Rococo>(relay_origin_assertions);
test.set_assertion::<AssetHubRococo>(system_para_dest_assertions_incomplete);
test.set_dispatchable::<Rococo>(relay_limited_reserve_transfer_assets);
test.assert();
let sender_balance_after = test.sender.balance;
let receiver_balance_after = test.receiver.balance;
assert_eq!(sender_balance_before - amount_to_send, sender_balance_after);
assert_eq!(receiver_balance_before, receiver_balance_after);
}
/// Limited Reserve Transfers of native asset from System Parachain to Relay Chain shoudln't work
#[test]
fn limited_reserve_transfer_native_asset_from_system_para_to_relay_fails() {
// Init values for System Parachain
let destination = AssetHubRococo::parent_location();
let beneficiary_id = RococoReceiver::get();
let amount_to_send: Balance = ASSET_HUB_ROCOCO_ED * 1000;
let assets = (Parent, amount_to_send).into();
let test_args = TestContext {
sender: AssetHubRococoSender::get(),
receiver: RococoReceiver::get(),
args: system_para_test_args(destination, beneficiary_id, amount_to_send, assets, None),
};
let mut test = SystemParaToRelayTest::new(test_args);
let sender_balance_before = test.sender.balance;
let receiver_balance_before = test.receiver.balance;
test.set_assertion::<AssetHubRococo>(system_para_to_relay_assertions);
test.set_dispatchable::<AssetHubRococo>(system_para_limited_reserve_transfer_assets);
test.assert();
let sender_balance_after = test.sender.balance;
let receiver_balance_after = test.receiver.balance;
assert_eq!(sender_balance_before, sender_balance_after);
assert_eq!(receiver_balance_before, receiver_balance_after);
}
/// Reserve Transfers of native asset from Relay Chain to the System Parachain shouldn't work
#[test]
fn reserve_transfer_native_asset_from_relay_to_system_para_fails() {
// Init values for Relay Chain
let amount_to_send: Balance = ROCOCO_ED * 1000;
let test_args = TestContext {
sender: RococoSender::get(),
receiver: AssetHubRococoReceiver::get(),
args: relay_test_args(amount_to_send),
};
let mut test = RelayToSystemParaTest::new(test_args);
let sender_balance_before = test.sender.balance;
let receiver_balance_before = test.receiver.balance;
test.set_assertion::<Rococo>(relay_origin_assertions);
test.set_assertion::<AssetHubRococo>(system_para_dest_assertions_incomplete);
test.set_dispatchable::<Rococo>(relay_reserve_transfer_assets);
test.assert();
let sender_balance_after = test.sender.balance;
let receiver_balance_after = test.receiver.balance;
assert_eq!(sender_balance_before - amount_to_send, sender_balance_after);
assert_eq!(receiver_balance_before, receiver_balance_after);
}
/// Reserve Transfers of native asset from System Parachain to Relay Chain shouldn't work
#[test]
fn reserve_transfer_native_asset_from_system_para_to_relay_fails() {
// Init values for System Parachain
let destination = AssetHubRococo::parent_location();
let beneficiary_id = RococoReceiver::get();
let amount_to_send: Balance = ASSET_HUB_ROCOCO_ED * 1000;
let assets = (Parent, amount_to_send).into();
let test_args = TestContext {
sender: AssetHubRococoSender::get(),
receiver: RococoReceiver::get(),
args: system_para_test_args(destination, beneficiary_id, amount_to_send, assets, None),
};
let mut test = SystemParaToRelayTest::new(test_args);
let sender_balance_before = test.sender.balance;
let receiver_balance_before = test.receiver.balance;
test.set_assertion::<AssetHubRococo>(system_para_to_relay_assertions);
test.set_dispatchable::<AssetHubRococo>(system_para_reserve_transfer_assets);
test.assert();
let sender_balance_after = test.sender.balance;
let receiver_balance_after = test.receiver.balance;
assert_eq!(sender_balance_before, sender_balance_after);
assert_eq!(receiver_balance_before, receiver_balance_after);
}
/// Limited Reserve Transfers of native asset from System Parachain to Parachain should work
#[test]
fn limited_reserve_transfer_native_asset_from_system_para_to_para() {
// Init values for System Parachain
let destination = AssetHubRococo::sibling_location_of(PenpalRococoA::para_id());
let beneficiary_id = PenpalRococoAReceiver::get();
let amount_to_send: Balance = ASSET_HUB_ROCOCO_ED * 1000;
let assets = (Parent, amount_to_send).into();
let test_args = TestContext {
sender: AssetHubRococoSender::get(),
receiver: PenpalRococoAReceiver::get(),
args: system_para_test_args(destination, beneficiary_id, amount_to_send, assets, None),
};
let mut test = SystemParaToParaTest::new(test_args);
let sender_balance_before = test.sender.balance;
test.set_assertion::<AssetHubRococo>(system_para_to_para_assertions);
// TODO: Add assertion for Penpal runtime. Right now message is failing with
// `UntrustedReserveLocation`
test.set_dispatchable::<AssetHubRococo>(system_para_to_para_limited_reserve_transfer_assets);
test.assert();
let sender_balance_after = test.sender.balance;
assert_eq!(sender_balance_before - amount_to_send, sender_balance_after);
// TODO: Check receiver balance when Penpal runtime is improved to propery handle reserve
// transfers
}
/// Reserve Transfers of native asset from System Parachain to Parachain should work
#[test]
fn reserve_transfer_native_asset_from_system_para_to_para() {
// Init values for System Parachain
let destination = AssetHubRococo::sibling_location_of(PenpalRococoA::para_id());
let beneficiary_id = PenpalRococoAReceiver::get();
let amount_to_send: Balance = ASSET_HUB_ROCOCO_ED * 1000;
let assets = (Parent, amount_to_send).into();
let test_args = TestContext {
sender: AssetHubRococoSender::get(),
receiver: PenpalRococoAReceiver::get(),
args: system_para_test_args(destination, beneficiary_id, amount_to_send, assets, None),
};
let mut test = SystemParaToParaTest::new(test_args);
let sender_balance_before = test.sender.balance;
test.set_assertion::<AssetHubRococo>(system_para_to_para_assertions);
// TODO: Add assertion for Penpal runtime. Right now message is failing with
// `UntrustedReserveLocation`
test.set_dispatchable::<AssetHubRococo>(system_para_to_para_reserve_transfer_assets);
test.assert();
let sender_balance_after = test.sender.balance;
assert_eq!(sender_balance_before - amount_to_send, sender_balance_after);
// TODO: Check receiver balance when Penpal runtime is improved to propery handle reserve
// transfers
}
/// Limited Reserve Transfers of a local asset from System Parachain to Parachain should work
#[test]
fn limited_reserve_transfer_asset_from_system_para_to_para() {
// Force create asset from Relay Chain and mint assets for System Parachain's sender account
AssetHubRococo::force_create_and_mint_asset(
ASSET_ID,
ASSET_MIN_BALANCE,
true,
AssetHubRococoSender::get(),
Some(Weight::from_parts(1_019_445_000, 200_000)),
ASSET_MIN_BALANCE * 1000000,
);
// Init values for System Parachain
let destination = AssetHubRococo::sibling_location_of(PenpalRococoA::para_id());
let beneficiary_id = PenpalRococoAReceiver::get();
let amount_to_send = ASSET_MIN_BALANCE * 1000;
let assets =
(X2(PalletInstance(ASSETS_PALLET_ID), GeneralIndex(ASSET_ID.into())), amount_to_send)
.into();
let system_para_test_args = TestContext {
sender: AssetHubRococoSender::get(),
receiver: PenpalRococoAReceiver::get(),
args: system_para_test_args(destination, beneficiary_id, amount_to_send, assets, None),
};
let mut system_para_test = SystemParaToParaTest::new(system_para_test_args);
system_para_test.set_assertion::<AssetHubRococo>(system_para_to_para_assets_assertions);
// TODO: Add assertions when Penpal is able to manage assets
system_para_test
.set_dispatchable::<AssetHubRococo>(system_para_to_para_limited_reserve_transfer_assets);
system_para_test.assert();
}
/// Reserve Transfers of a local asset from System Parachain to Parachain should work
#[test]
fn reserve_transfer_asset_from_system_para_to_para() {
// Force create asset from Relay Chain and mint assets for System Parachain's sender account
AssetHubRococo::force_create_and_mint_asset(
ASSET_ID,
ASSET_MIN_BALANCE,
true,
AssetHubRococoSender::get(),
Some(Weight::from_parts(1_019_445_000, 200_000)),
ASSET_MIN_BALANCE * 1000000,
);
// Init values for System Parachain
let destination = AssetHubRococo::sibling_location_of(PenpalRococoA::para_id());
let beneficiary_id = PenpalRococoAReceiver::get();
let amount_to_send = ASSET_MIN_BALANCE * 1000;
let assets =
(X2(PalletInstance(ASSETS_PALLET_ID), GeneralIndex(ASSET_ID.into())), amount_to_send)
.into();
let system_para_test_args = TestContext {
sender: AssetHubRococoSender::get(),
receiver: PenpalRococoAReceiver::get(),
args: system_para_test_args(destination, beneficiary_id, amount_to_send, assets, None),
};
let mut system_para_test = SystemParaToParaTest::new(system_para_test_args);
system_para_test.set_assertion::<AssetHubRococo>(system_para_to_para_assets_assertions);
// TODO: Add assertions when Penpal is able to manage assets
system_para_test
.set_dispatchable::<AssetHubRococo>(system_para_to_para_reserve_transfer_assets);
system_para_test.assert();
}
@@ -0,0 +1,102 @@
// Copyright (C) Parity Technologies (UK) Ltd.
// 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.
use crate::*;
/// Relay Chain should be able to execute `Transact` instructions in System Parachain
/// when `OriginKind::Superuser`.
#[test]
fn send_transact_as_superuser_from_relay_to_system_para_works() {
AssetHubRococo::force_create_asset_from_relay_as_root(
ASSET_ID,
ASSET_MIN_BALANCE,
true,
AssetHubRococoSender::get().into(),
Some(Weight::from_parts(1_019_445_000, 200_000)),
)
}
/// Parachain should be able to send XCM paying its fee with sufficient asset
/// in the System Parachain
#[test]
fn send_xcm_from_para_to_system_para_paying_fee_with_assets_works() {
let para_sovereign_account = AssetHubRococo::sovereign_account_id_of(
AssetHubRococo::sibling_location_of(PenpalRococoA::para_id()),
);
// Force create and mint assets for Parachain's sovereign account
AssetHubRococo::force_create_and_mint_asset(
ASSET_ID,
ASSET_MIN_BALANCE,
true,
para_sovereign_account.clone(),
Some(Weight::from_parts(1_019_445_000, 200_000)),
ASSET_MIN_BALANCE * 1000000000,
);
// We just need a call that can pass the `SafeCallFilter`
// Call values are not relevant
let call = AssetHubRococo::force_create_asset_call(
ASSET_ID,
para_sovereign_account.clone(),
true,
ASSET_MIN_BALANCE,
);
let origin_kind = OriginKind::SovereignAccount;
let fee_amount = ASSET_MIN_BALANCE * 1000000;
let native_asset =
(X2(PalletInstance(ASSETS_PALLET_ID), GeneralIndex(ASSET_ID.into())), fee_amount).into();
let root_origin = <PenpalRococoA as Chain>::RuntimeOrigin::root();
let system_para_destination =
PenpalRococoA::sibling_location_of(AssetHubRococo::para_id()).into();
let xcm = xcm_transact_paid_execution(
call,
origin_kind,
native_asset,
para_sovereign_account.clone(),
);
PenpalRococoA::execute_with(|| {
assert_ok!(<PenpalRococoA as PenpalRococoAPallet>::PolkadotXcm::send(
root_origin,
bx!(system_para_destination),
bx!(xcm),
));
PenpalRococoA::assert_xcm_pallet_sent();
});
AssetHubRococo::execute_with(|| {
type RuntimeEvent = <AssetHubRococo as Chain>::RuntimeEvent;
AssetHubRococo::assert_xcmp_queue_success(Some(Weight::from_parts(2_176_414_000, 203_593)));
assert_expected_events!(
AssetHubRococo,
vec![
RuntimeEvent::Assets(pallet_assets::Event::Burned { asset_id, owner, balance }) => {
asset_id: *asset_id == ASSET_ID,
owner: *owner == para_sovereign_account,
balance: *balance == fee_amount,
},
RuntimeEvent::Assets(pallet_assets::Event::Issued { asset_id, .. }) => {
asset_id: *asset_id == ASSET_ID,
},
]
);
});
}
@@ -0,0 +1,83 @@
// Copyright (C) Parity Technologies (UK) Ltd.
// 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.
use crate::*;
#[test]
fn relay_sets_system_para_xcm_supported_version() {
// Init tests variables
let sudo_origin = <Rococo as Chain>::RuntimeOrigin::root();
let system_para_destination: MultiLocation =
Rococo::child_location_of(AssetHubRococo::para_id());
// Relay Chain sets supported version for Asset Parachain
Rococo::execute_with(|| {
assert_ok!(<Rococo as RococoPallet>::XcmPallet::force_xcm_version(
sudo_origin,
bx!(system_para_destination),
XCM_V3
));
type RuntimeEvent = <Rococo as Chain>::RuntimeEvent;
assert_expected_events!(
Rococo,
vec![
RuntimeEvent::XcmPallet(pallet_xcm::Event::SupportedVersionChanged {
location,
version: XCM_V3
}) => { location: *location == system_para_destination, },
]
);
});
}
#[test]
fn system_para_sets_relay_xcm_supported_version() {
// Init test variables
let parent_location = AssetHubRococo::parent_location();
let force_xcm_version_call =
<AssetHubRococo as Chain>::RuntimeCall::PolkadotXcm(pallet_xcm::Call::<
<AssetHubRococo as Chain>::Runtime,
>::force_xcm_version {
location: bx!(parent_location),
version: XCM_V3,
})
.encode()
.into();
// System Parachain sets supported version for Relay Chain through it
Rococo::send_unpaid_transact_to_parachain_as_root(
AssetHubRococo::para_id(),
force_xcm_version_call,
);
// System Parachain receive the XCM message
AssetHubRococo::execute_with(|| {
type RuntimeEvent = <AssetHubRococo as Chain>::RuntimeEvent;
AssetHubRococo::assert_dmp_queue_complete(Some(Weight::from_parts(1_019_210_000, 200_000)));
assert_expected_events!(
AssetHubRococo,
vec![
RuntimeEvent::PolkadotXcm(pallet_xcm::Event::SupportedVersionChanged {
location,
version: XCM_V3
}) => { location: *location == parent_location, },
]
);
});
}
@@ -0,0 +1,364 @@
// Copyright (C) Parity Technologies (UK) Ltd.
// 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.
use crate::*;
use frame_support::{instances::Instance2, BoundedVec};
use parachains_common::rococo::currency::EXISTENTIAL_DEPOSIT;
use sp_runtime::{DispatchError, ModuleError};
#[test]
fn swap_locally_on_chain_using_local_assets() {
let asset_native = Box::new(asset_hub_rococo_runtime::xcm_config::TokenLocation::get());
let asset_one = Box::new(MultiLocation {
parents: 0,
interior: X2(PalletInstance(ASSETS_PALLET_ID), GeneralIndex(ASSET_ID.into())),
});
AssetHubRococo::execute_with(|| {
type RuntimeEvent = <AssetHubRococo as Chain>::RuntimeEvent;
assert_ok!(<AssetHubRococo as AssetHubRococoPallet>::Assets::create(
<AssetHubRococo as Chain>::RuntimeOrigin::signed(AssetHubRococoSender::get()),
ASSET_ID.into(),
AssetHubRococoSender::get().into(),
1000,
));
assert!(<AssetHubRococo as AssetHubRococoPallet>::Assets::asset_exists(ASSET_ID));
assert_ok!(<AssetHubRococo as AssetHubRococoPallet>::Assets::mint(
<AssetHubRococo as Chain>::RuntimeOrigin::signed(AssetHubRococoSender::get()),
ASSET_ID.into(),
AssetHubRococoSender::get().into(),
100_000_000_000_000,
));
assert_ok!(<AssetHubRococo as AssetHubRococoPallet>::Balances::force_set_balance(
<AssetHubRococo as Chain>::RuntimeOrigin::root(),
AssetHubRococoSender::get().into(),
100_000_000_000_000,
));
assert_ok!(<AssetHubRococo as AssetHubRococoPallet>::AssetConversion::create_pool(
<AssetHubRococo as Chain>::RuntimeOrigin::signed(AssetHubRococoSender::get()),
asset_native.clone(),
asset_one.clone(),
));
assert_expected_events!(
AssetHubRococo,
vec![
RuntimeEvent::AssetConversion(pallet_asset_conversion::Event::PoolCreated { .. }) => {},
]
);
assert_ok!(<AssetHubRococo as AssetHubRococoPallet>::AssetConversion::add_liquidity(
<AssetHubRococo as Chain>::RuntimeOrigin::signed(AssetHubRococoSender::get()),
asset_native.clone(),
asset_one.clone(),
1_000_000_000_000,
2_000_000_000_000,
0,
0,
AssetHubRococoSender::get().into()
));
assert_expected_events!(
AssetHubRococo,
vec![
RuntimeEvent::AssetConversion(pallet_asset_conversion::Event::LiquidityAdded {lp_token_minted, .. }) => { lp_token_minted: *lp_token_minted == 1414213562273, },
]
);
let path = BoundedVec::<_, _>::truncate_from(vec![asset_native.clone(), asset_one.clone()]);
assert_ok!(
<AssetHubRococo as AssetHubRococoPallet>::AssetConversion::swap_exact_tokens_for_tokens(
<AssetHubRococo as Chain>::RuntimeOrigin::signed(AssetHubRococoSender::get()),
path,
100,
1,
AssetHubRococoSender::get().into(),
true
)
);
assert_expected_events!(
AssetHubRococo,
vec![
RuntimeEvent::AssetConversion(pallet_asset_conversion::Event::SwapExecuted { amount_in, amount_out, .. }) => {
amount_in: *amount_in == 100,
amount_out: *amount_out == 199,
},
]
);
assert_ok!(<AssetHubRococo as AssetHubRococoPallet>::AssetConversion::remove_liquidity(
<AssetHubRococo as Chain>::RuntimeOrigin::signed(AssetHubRococoSender::get()),
asset_native,
asset_one,
1414213562273 - EXISTENTIAL_DEPOSIT * 2, // all but the 2 EDs can't be retrieved.
0,
0,
AssetHubRococoSender::get().into(),
));
});
}
#[test]
fn swap_locally_on_chain_using_foreign_assets() {
use frame_support::weights::WeightToFee;
let asset_native = Box::new(asset_hub_rococo_runtime::xcm_config::TokenLocation::get());
let foreign_asset1_at_asset_hub_rococo = Box::new(MultiLocation {
parents: 1,
interior: X3(
Parachain(PenpalRococoA::para_id().into()),
PalletInstance(ASSETS_PALLET_ID),
GeneralIndex(ASSET_ID.into()),
),
});
let assets_para_destination: VersionedMultiLocation =
MultiLocation { parents: 1, interior: X1(Parachain(AssetHubRococo::para_id().into())) }
.into();
let penpal_location =
MultiLocation { parents: 1, interior: X1(Parachain(PenpalRococoA::para_id().into())) };
// 1. Create asset on penpal:
PenpalRococoA::execute_with(|| {
assert_ok!(<PenpalRococoA as PenpalRococoAPallet>::Assets::create(
<PenpalRococoA as Chain>::RuntimeOrigin::signed(PenpalRococoASender::get()),
ASSET_ID.into(),
PenpalRococoASender::get().into(),
1000,
));
assert!(<PenpalRococoA as PenpalRococoAPallet>::Assets::asset_exists(ASSET_ID));
});
// 2. Create foreign asset on asset_hub_rococo:
let require_weight_at_most = Weight::from_parts(1_100_000_000_000, 30_000);
let origin_kind = OriginKind::Xcm;
let sov_penpal_on_asset_hub_rococo = AssetHubRococo::sovereign_account_id_of(penpal_location);
AssetHubRococo::fund_accounts(vec![
(AssetHubRococoSender::get().into(), 5_000_000 * ROCOCO_ED), /* An account to swap dot
* for something else. */
(sov_penpal_on_asset_hub_rococo.clone().into(), 1000_000_000_000_000_000 * ROCOCO_ED),
]);
let sov_penpal_on_asset_hub_rococo_as_location: MultiLocation = MultiLocation {
parents: 0,
interior: X1(AccountId32Junction {
network: None,
id: sov_penpal_on_asset_hub_rococo.clone().into(),
}),
};
let call_foreign_assets_create =
<AssetHubRococo as Chain>::RuntimeCall::ForeignAssets(pallet_assets::Call::<
<AssetHubRococo as Chain>::Runtime,
Instance2,
>::create {
id: *foreign_asset1_at_asset_hub_rococo,
min_balance: 1000,
admin: sov_penpal_on_asset_hub_rococo.clone().into(),
})
.encode()
.into();
let buy_execution_fee_amount = parachains_common::rococo::fee::WeightToFee::weight_to_fee(
&Weight::from_parts(10_100_000_000_000, 300_000),
);
let buy_execution_fee = MultiAsset {
id: Concrete(MultiLocation { parents: 1, interior: Here }),
fun: Fungible(buy_execution_fee_amount),
};
let xcm = VersionedXcm::from(Xcm(vec![
WithdrawAsset { 0: vec![buy_execution_fee.clone()].into() },
BuyExecution { fees: buy_execution_fee.clone(), weight_limit: Unlimited },
Transact { require_weight_at_most, origin_kind, call: call_foreign_assets_create },
RefundSurplus,
DepositAsset {
assets: All.into(),
beneficiary: sov_penpal_on_asset_hub_rococo_as_location,
},
]));
// Send XCM message from penpal => asset_hub_rococo
let sudo_penpal_origin = <PenpalRococoA as Chain>::RuntimeOrigin::root();
PenpalRococoA::execute_with(|| {
assert_ok!(<PenpalRococoA as PenpalRococoAPallet>::PolkadotXcm::send(
sudo_penpal_origin.clone(),
bx!(assets_para_destination.clone()),
bx!(xcm),
));
type RuntimeEvent = <PenpalRococoA as Chain>::RuntimeEvent;
assert_expected_events!(
PenpalRococoA,
vec![
RuntimeEvent::PolkadotXcm(pallet_xcm::Event::Sent { .. }) => {},
]
);
});
// Receive XCM message in Assets Parachain
AssetHubRococo::execute_with(|| {
assert!(<AssetHubRococo as AssetHubRococoPallet>::ForeignAssets::asset_exists(
*foreign_asset1_at_asset_hub_rococo
));
// 3: Mint foreign asset on asset_hub_rococo:
//
// (While it might be nice to use batch,
// currently that's disabled due to safe call filters.)
type RuntimeEvent = <AssetHubRococo as Chain>::RuntimeEvent;
// 3. Mint foreign asset (in reality this should be a teleport or some such)
assert_ok!(<AssetHubRococo as AssetHubRococoPallet>::ForeignAssets::mint(
<AssetHubRococo as Chain>::RuntimeOrigin::signed(
sov_penpal_on_asset_hub_rococo.clone().into()
),
*foreign_asset1_at_asset_hub_rococo,
sov_penpal_on_asset_hub_rococo.clone().into(),
3_000_000_000_000,
));
assert_expected_events!(
AssetHubRococo,
vec![
RuntimeEvent::ForeignAssets(pallet_assets::Event::Issued { .. }) => {},
]
);
// 4. Create pool:
assert_ok!(<AssetHubRococo as AssetHubRococoPallet>::AssetConversion::create_pool(
<AssetHubRococo as Chain>::RuntimeOrigin::signed(AssetHubRococoSender::get()),
asset_native.clone(),
foreign_asset1_at_asset_hub_rococo.clone(),
));
assert_expected_events!(
AssetHubRococo,
vec![
RuntimeEvent::AssetConversion(pallet_asset_conversion::Event::PoolCreated { .. }) => {},
]
);
// 5. Add liquidity:
assert_ok!(<AssetHubRococo as AssetHubRococoPallet>::AssetConversion::add_liquidity(
<AssetHubRococo as Chain>::RuntimeOrigin::signed(
sov_penpal_on_asset_hub_rococo.clone()
),
asset_native.clone(),
foreign_asset1_at_asset_hub_rococo.clone(),
1_000_000_000_000,
2_000_000_000_000,
0,
0,
sov_penpal_on_asset_hub_rococo.clone().into()
));
assert_expected_events!(
AssetHubRococo,
vec![
RuntimeEvent::AssetConversion(pallet_asset_conversion::Event::LiquidityAdded {lp_token_minted, .. }) => {
lp_token_minted: *lp_token_minted == 1414213562273,
},
]
);
// 6. Swap!
let path = BoundedVec::<_, _>::truncate_from(vec![
asset_native.clone(),
foreign_asset1_at_asset_hub_rococo.clone(),
]);
assert_ok!(
<AssetHubRococo as AssetHubRococoPallet>::AssetConversion::swap_exact_tokens_for_tokens(
<AssetHubRococo as Chain>::RuntimeOrigin::signed(AssetHubRococoSender::get()),
path,
100000,
1000,
AssetHubRococoSender::get().into(),
true
)
);
assert_expected_events!(
AssetHubRococo,
vec![
RuntimeEvent::AssetConversion(pallet_asset_conversion::Event::SwapExecuted { amount_in, amount_out, .. },) => {
amount_in: *amount_in == 100000,
amount_out: *amount_out == 199399,
},
]
);
// 7. Remove liquidity
assert_ok!(<AssetHubRococo as AssetHubRococoPallet>::AssetConversion::remove_liquidity(
<AssetHubRococo as Chain>::RuntimeOrigin::signed(
sov_penpal_on_asset_hub_rococo.clone()
),
asset_native,
foreign_asset1_at_asset_hub_rococo,
1414213562273 - 2_000_000_000, // all but the 2 EDs can't be retrieved.
0,
0,
sov_penpal_on_asset_hub_rococo.clone().into(),
));
});
}
#[test]
fn cannot_create_pool_from_pool_assets() {
let asset_native = Box::new(asset_hub_rococo_runtime::xcm_config::TokenLocation::get());
let mut asset_one = asset_hub_rococo_runtime::xcm_config::PoolAssetsPalletLocation::get();
asset_one.append_with(GeneralIndex(ASSET_ID.into())).expect("pool assets");
AssetHubRococo::execute_with(|| {
let pool_owner_account_id = asset_hub_rococo_runtime::AssetConversionOrigin::get();
assert_ok!(<AssetHubRococo as AssetHubRococoPallet>::PoolAssets::create(
<AssetHubRococo as Chain>::RuntimeOrigin::signed(pool_owner_account_id.clone()),
ASSET_ID.into(),
pool_owner_account_id.clone().into(),
1000,
));
assert!(<AssetHubRococo as AssetHubRococoPallet>::PoolAssets::asset_exists(ASSET_ID));
assert_ok!(<AssetHubRococo as AssetHubRococoPallet>::PoolAssets::mint(
<AssetHubRococo as Chain>::RuntimeOrigin::signed(pool_owner_account_id),
ASSET_ID.into(),
AssetHubRococoSender::get().into(),
3_000_000_000_000,
));
assert_matches::assert_matches!(
<AssetHubRococo as AssetHubRococoPallet>::AssetConversion::create_pool(
<AssetHubRococo as Chain>::RuntimeOrigin::signed(AssetHubRococoSender::get()),
asset_native.clone(),
Box::new(asset_one),
),
Err(DispatchError::Module(ModuleError{index: _, error: _, message})) => assert_eq!(message, Some("UnsupportedAsset"))
);
});
}
@@ -15,6 +15,347 @@
use crate::*;
fn relay_origin_assertions(t: RelayToSystemParaTest) {
type RuntimeEvent = <Rococo as Chain>::RuntimeEvent;
Rococo::assert_xcm_pallet_attempted_complete(Some(Weight::from_parts(631_531_000, 7_186)));
assert_expected_events!(
Rococo,
vec![
// Amount to teleport is withdrawn from Sender
RuntimeEvent::Balances(pallet_balances::Event::Withdraw { who, amount }) => {
who: *who == t.sender.account_id,
amount: *amount == t.args.amount,
},
// Amount to teleport is deposited in Relay's `CheckAccount`
RuntimeEvent::Balances(pallet_balances::Event::Deposit { who, amount }) => {
who: *who == <Rococo as RococoPallet>::XcmPallet::check_account(),
amount: *amount == t.args.amount,
},
]
);
}
fn relay_dest_assertions(t: SystemParaToRelayTest) {
type RuntimeEvent = <Rococo as Chain>::RuntimeEvent;
Rococo::assert_ump_queue_processed(
true,
Some(AssetHubRococo::para_id()),
Some(Weight::from_parts(307_225_000, 7_186)),
);
assert_expected_events!(
Rococo,
vec![
// Amount is witdrawn from Relay Chain's `CheckAccount`
RuntimeEvent::Balances(pallet_balances::Event::Withdraw { who, amount }) => {
who: *who == <Rococo as RococoPallet>::XcmPallet::check_account(),
amount: *amount == t.args.amount,
},
// Amount minus fees are deposited in Receiver's account
RuntimeEvent::Balances(pallet_balances::Event::Deposit { who, .. }) => {
who: *who == t.receiver.account_id,
},
]
);
}
fn relay_dest_assertions_fail(_t: SystemParaToRelayTest) {
Rococo::assert_ump_queue_processed(
false,
Some(AssetHubRococo::para_id()),
Some(Weight::from_parts(148_433_000, 3_593)),
);
}
fn para_origin_assertions(t: SystemParaToRelayTest) {
type RuntimeEvent = <AssetHubRococo as Chain>::RuntimeEvent;
AssetHubRococo::assert_xcm_pallet_attempted_complete(Some(Weight::from_parts(
534_872_000,
7_133,
)));
AssetHubRococo::assert_parachain_system_ump_sent();
assert_expected_events!(
AssetHubRococo,
vec![
// Amount is withdrawn from Sender's account
RuntimeEvent::Balances(pallet_balances::Event::Withdraw { who, amount }) => {
who: *who == t.sender.account_id,
amount: *amount == t.args.amount,
},
]
);
}
fn para_dest_assertions(t: RelayToSystemParaTest) {
type RuntimeEvent = <AssetHubRococo as Chain>::RuntimeEvent;
AssetHubRococo::assert_dmp_queue_complete(Some(Weight::from_parts(165_592_000, 0)));
assert_expected_events!(
AssetHubRococo,
vec![
// Amount minus fees are deposited in Receiver's account
RuntimeEvent::Balances(pallet_balances::Event::Deposit { who, .. }) => {
who: *who == t.receiver.account_id,
},
]
);
}
fn relay_limited_teleport_assets(t: RelayToSystemParaTest) -> DispatchResult {
<Rococo as RococoPallet>::XcmPallet::limited_teleport_assets(
t.signed_origin,
bx!(t.args.dest.into()),
bx!(t.args.beneficiary.into()),
bx!(t.args.assets.into()),
t.args.fee_asset_item,
t.args.weight_limit,
)
}
fn relay_teleport_assets(t: RelayToSystemParaTest) -> DispatchResult {
<Rococo as RococoPallet>::XcmPallet::teleport_assets(
t.signed_origin,
bx!(t.args.dest.into()),
bx!(t.args.beneficiary.into()),
bx!(t.args.assets.into()),
t.args.fee_asset_item,
)
}
fn system_para_limited_teleport_assets(t: SystemParaToRelayTest) -> DispatchResult {
<AssetHubRococo as AssetHubRococoPallet>::PolkadotXcm::limited_teleport_assets(
t.signed_origin,
bx!(t.args.dest.into()),
bx!(t.args.beneficiary.into()),
bx!(t.args.assets.into()),
t.args.fee_asset_item,
t.args.weight_limit,
)
}
fn system_para_teleport_assets(t: SystemParaToRelayTest) -> DispatchResult {
<AssetHubRococo as AssetHubRococoPallet>::PolkadotXcm::teleport_assets(
t.signed_origin,
bx!(t.args.dest.into()),
bx!(t.args.beneficiary.into()),
bx!(t.args.assets.into()),
t.args.fee_asset_item,
)
}
/// Limited Teleport of native asset from Relay Chain to the System Parachain should work
#[test]
fn limited_teleport_native_assets_from_relay_to_system_para_works() {
// Init values for Relay Chain
let amount_to_send: Balance = ROCOCO_ED * 1000;
let test_args = TestContext {
sender: RococoSender::get(),
receiver: AssetHubRococoReceiver::get(),
args: relay_test_args(amount_to_send),
};
let mut test = RelayToSystemParaTest::new(test_args);
let sender_balance_before = test.sender.balance;
let receiver_balance_before = test.receiver.balance;
test.set_assertion::<Rococo>(relay_origin_assertions);
test.set_assertion::<AssetHubRococo>(para_dest_assertions);
test.set_dispatchable::<Rococo>(relay_limited_teleport_assets);
test.assert();
let sender_balance_after = test.sender.balance;
let receiver_balance_after = test.receiver.balance;
// Sender's balance is reduced
assert_eq!(sender_balance_before - amount_to_send, sender_balance_after);
// Receiver's balance is increased
assert!(receiver_balance_after > receiver_balance_before);
}
/// Limited Teleport of native asset from System Parachain to Relay Chain
/// should work when there is enough balance in Relay Chain's `CheckAccount`
#[test]
fn limited_teleport_native_assets_back_from_system_para_to_relay_works() {
// Dependency - Relay Chain's `CheckAccount` should have enough balance
limited_teleport_native_assets_from_relay_to_system_para_works();
// Init values for Relay Chain
let amount_to_send: Balance = ASSET_HUB_ROCOCO_ED * 1000;
let destination = AssetHubRococo::parent_location();
let beneficiary_id = RococoReceiver::get();
let assets = (Parent, amount_to_send).into();
let test_args = TestContext {
sender: AssetHubRococoSender::get(),
receiver: RococoReceiver::get(),
args: system_para_test_args(destination, beneficiary_id, amount_to_send, assets, None),
};
let mut test = SystemParaToRelayTest::new(test_args);
let sender_balance_before = test.sender.balance;
let receiver_balance_before = test.receiver.balance;
test.set_assertion::<AssetHubRococo>(para_origin_assertions);
test.set_assertion::<Rococo>(relay_dest_assertions);
test.set_dispatchable::<AssetHubRococo>(system_para_limited_teleport_assets);
test.assert();
let sender_balance_after = test.sender.balance;
let receiver_balance_after = test.receiver.balance;
// Sender's balance is reduced
assert_eq!(sender_balance_before - amount_to_send, sender_balance_after);
// Receiver's balance is increased
assert!(receiver_balance_after > receiver_balance_before);
}
/// Limited Teleport of native asset from System Parachain to Relay Chain
/// should't work when there is not enough balance in Relay Chain's `CheckAccount`
#[test]
fn limited_teleport_native_assets_from_system_para_to_relay_fails() {
// Init values for Relay Chain
let amount_to_send: Balance = ASSET_HUB_ROCOCO_ED * 1000;
let destination = AssetHubRococo::parent_location().into();
let beneficiary_id = RococoReceiver::get().into();
let assets = (Parent, amount_to_send).into();
let test_args = TestContext {
sender: AssetHubRococoSender::get(),
receiver: RococoReceiver::get(),
args: system_para_test_args(destination, beneficiary_id, amount_to_send, assets, None),
};
let mut test = SystemParaToRelayTest::new(test_args);
let sender_balance_before = test.sender.balance;
let receiver_balance_before = test.receiver.balance;
test.set_assertion::<AssetHubRococo>(para_origin_assertions);
test.set_assertion::<Rococo>(relay_dest_assertions_fail);
test.set_dispatchable::<AssetHubRococo>(system_para_limited_teleport_assets);
test.assert();
let sender_balance_after = test.sender.balance;
let receiver_balance_after = test.receiver.balance;
// Sender's balance is reduced
assert_eq!(sender_balance_before - amount_to_send, sender_balance_after);
// Receiver's balance does not change
assert_eq!(receiver_balance_after, receiver_balance_before);
}
/// Teleport of native asset from Relay Chain to the System Parachain should work
#[test]
fn teleport_native_assets_from_relay_to_system_para_works() {
// Init values for Relay Chain
let amount_to_send: Balance = ROCOCO_ED * 1000;
let test_args = TestContext {
sender: RococoSender::get(),
receiver: AssetHubRococoReceiver::get(),
args: relay_test_args(amount_to_send),
};
let mut test = RelayToSystemParaTest::new(test_args);
let sender_balance_before = test.sender.balance;
let receiver_balance_before = test.receiver.balance;
test.set_assertion::<Rococo>(relay_origin_assertions);
test.set_assertion::<AssetHubRococo>(para_dest_assertions);
test.set_dispatchable::<Rococo>(relay_teleport_assets);
test.assert();
let sender_balance_after = test.sender.balance;
let receiver_balance_after = test.receiver.balance;
// Sender's balance is reduced
assert_eq!(sender_balance_before - amount_to_send, sender_balance_after);
// Receiver's balance is increased
assert!(receiver_balance_after > receiver_balance_before);
}
/// Teleport of native asset from System Parachains to the Relay Chain
/// should work when there is enough balance in Relay Chain's `CheckAccount`
#[test]
fn teleport_native_assets_back_from_system_para_to_relay_works() {
// Dependency - Relay Chain's `CheckAccount` should have enough balance
teleport_native_assets_from_relay_to_system_para_works();
// Init values for Relay Chain
let amount_to_send: Balance = ASSET_HUB_ROCOCO_ED * 1000;
let destination = AssetHubRococo::parent_location();
let beneficiary_id = RococoReceiver::get();
let assets = (Parent, amount_to_send).into();
let test_args = TestContext {
sender: AssetHubRococoSender::get(),
receiver: RococoReceiver::get(),
args: system_para_test_args(destination, beneficiary_id, amount_to_send, assets, None),
};
let mut test = SystemParaToRelayTest::new(test_args);
let sender_balance_before = test.sender.balance;
let receiver_balance_before = test.receiver.balance;
test.set_assertion::<AssetHubRococo>(para_origin_assertions);
test.set_assertion::<Rococo>(relay_dest_assertions);
test.set_dispatchable::<AssetHubRococo>(system_para_teleport_assets);
test.assert();
let sender_balance_after = test.sender.balance;
let receiver_balance_after = test.receiver.balance;
// Sender's balance is reduced
assert_eq!(sender_balance_before - amount_to_send, sender_balance_after);
// Receiver's balance is increased
assert!(receiver_balance_after > receiver_balance_before);
}
/// Teleport of native asset from System Parachain to Relay Chain
/// shouldn't work when there is not enough balance in Relay Chain's `CheckAccount`
#[test]
fn teleport_native_assets_from_system_para_to_relay_fails() {
// Init values for Relay Chain
let amount_to_send: Balance = ASSET_HUB_ROCOCO_ED * 1000;
let destination = AssetHubRococo::parent_location();
let beneficiary_id = RococoReceiver::get();
let assets = (Parent, amount_to_send).into();
let test_args = TestContext {
sender: AssetHubRococoSender::get(),
receiver: RococoReceiver::get(),
args: system_para_test_args(destination, beneficiary_id, amount_to_send, assets, None),
};
let mut test = SystemParaToRelayTest::new(test_args);
let sender_balance_before = test.sender.balance;
let receiver_balance_before = test.receiver.balance;
test.set_assertion::<AssetHubRococo>(para_origin_assertions);
test.set_assertion::<Rococo>(relay_dest_assertions_fail);
test.set_dispatchable::<AssetHubRococo>(system_para_teleport_assets);
test.assert();
let sender_balance_after = test.sender.balance;
let receiver_balance_after = test.receiver.balance;
// Sender's balance is reduced
assert_eq!(sender_balance_before - amount_to_send, sender_balance_after);
// Receiver's balance does not change
assert_eq!(receiver_balance_after, receiver_balance_before);
}
#[test]
fn teleport_to_other_system_parachains_works() {
let amount = ASSET_HUB_ROCOCO_ED * 100;
@@ -44,6 +44,7 @@ cumulus-primitives-core = { path = "../../../../primitives/core" }
penpal-runtime = { path = "../../../runtimes/testing/penpal" }
asset-hub-polkadot-runtime = { path = "../../../runtimes/assets/asset-hub-polkadot" }
asset-hub-kusama-runtime = { path = "../../../runtimes/assets/asset-hub-kusama" }
asset-hub-rococo-runtime = { path = "../../../runtimes/assets/asset-hub-rococo" }
asset-hub-westend-runtime = { path = "../../../runtimes/assets/asset-hub-westend" }
collectives-polkadot-runtime = { path = "../../../runtimes/collectives/collectives-polkadot" }
bridge-hub-kusama-runtime = { path = "../../../runtimes/bridge-hubs/bridge-hub-kusama" }
@@ -61,6 +62,7 @@ bridge-runtime-common = { path = "../../../../../bridges/bin/runtime-common" }
runtime-benchmarks = [
"asset-hub-kusama-runtime/runtime-benchmarks",
"asset-hub-polkadot-runtime/runtime-benchmarks",
"asset-hub-rococo-runtime/runtime-benchmarks",
"asset-hub-westend-runtime/runtime-benchmarks",
"bridge-hub-kusama-runtime/runtime-benchmarks",
"bridge-hub-polkadot-runtime/runtime-benchmarks",
@@ -27,8 +27,12 @@ use sp_runtime::{
// Cumulus
use parachains_common::{AccountId, AssetHubPolkadotAuraId, AuraId, Balance, BlockNumber};
use polkadot_parachain_primitives::primitives::{HeadData, ValidationCode};
use polkadot_primitives::{AssignmentId, ValidatorId};
use polkadot_runtime_parachains::configuration::HostConfiguration;
use polkadot_runtime_parachains::{
configuration::HostConfiguration,
paras::{ParaGenesisArgs, ParaKind},
};
use polkadot_service::chain_spec::get_authority_keys_from_seed_no_beefy;
use xcm;
@@ -331,6 +335,41 @@ pub mod rococo {
key: Some(get_account_id_from_seed::<sr25519::Public>("Alice")),
},
configuration: rococo_runtime::ConfigurationConfig { config: get_host_config() },
paras: rococo_runtime::ParasConfig {
paras: vec![
(
asset_hub_rococo::PARA_ID.into(),
ParaGenesisArgs {
genesis_head: HeadData::default(),
validation_code: ValidationCode(
asset_hub_rococo_runtime::WASM_BINARY.unwrap().to_vec(),
),
para_kind: ParaKind::Parachain,
},
),
(
penpal::PARA_ID_A.into(),
ParaGenesisArgs {
genesis_head: HeadData::default(),
validation_code: ValidationCode(
penpal_runtime::WASM_BINARY.unwrap().to_vec(),
),
para_kind: ParaKind::Parachain,
},
),
(
penpal::PARA_ID_B.into(),
ParaGenesisArgs {
genesis_head: HeadData::default(),
validation_code: ValidationCode(
penpal_runtime::WASM_BINARY.unwrap().to_vec(),
),
para_kind: ParaKind::Parachain,
},
),
],
..Default::default()
},
registrar: rococo_runtime::RegistrarConfig {
next_free_para_id: polkadot_primitives::LOWEST_PUBLIC_ID,
..Default::default()
@@ -399,32 +438,31 @@ pub mod asset_hub_westend {
}
}
// Asset Hub Kusama
pub mod asset_hub_rococo {
use super::*;
pub const PARA_ID: u32 = 1000;
pub const ED: Balance = parachains_common::rococo::currency::EXISTENTIAL_DEPOSIT;
pub fn genesis() -> Storage {
let genesis_config = asset_hub_westend_runtime::RuntimeGenesisConfig {
system: asset_hub_westend_runtime::SystemConfig {
code: asset_hub_westend_runtime::WASM_BINARY
let genesis_config = asset_hub_rococo_runtime::RuntimeGenesisConfig {
system: asset_hub_rococo_runtime::SystemConfig {
code: asset_hub_rococo_runtime::WASM_BINARY
.expect("WASM binary was not build, please build it!")
.to_vec(),
..Default::default()
},
balances: asset_hub_westend_runtime::BalancesConfig {
balances: asset_hub_rococo_runtime::BalancesConfig {
balances: accounts::init_balances()
.iter()
.cloned()
.map(|k| (k, ED * 4096))
.map(|k| (k, ED * 4096 * 4096))
.collect(),
},
parachain_info: asset_hub_westend_runtime::ParachainInfoConfig {
parachain_info: asset_hub_rococo_runtime::ParachainInfoConfig {
parachain_id: PARA_ID.into(),
..Default::default()
},
collator_selection: asset_hub_westend_runtime::CollatorSelectionConfig {
collator_selection: asset_hub_rococo_runtime::CollatorSelectionConfig {
invulnerables: collators::invulnerables()
.iter()
.cloned()
@@ -433,19 +471,75 @@ pub mod asset_hub_rococo {
candidacy_bond: ED * 16,
..Default::default()
},
session: asset_hub_westend_runtime::SessionConfig {
session: asset_hub_rococo_runtime::SessionConfig {
keys: collators::invulnerables()
.into_iter()
.map(|(acc, aura)| {
(
acc.clone(), // account id
acc, // validator id
asset_hub_westend_runtime::SessionKeys { aura }, // session keys
acc.clone(), // account id
acc, // validator id
asset_hub_rococo_runtime::SessionKeys { aura }, // session keys
)
})
.collect(),
},
polkadot_xcm: asset_hub_westend_runtime::PolkadotXcmConfig {
polkadot_xcm: asset_hub_rococo_runtime::PolkadotXcmConfig {
safe_xcm_version: Some(SAFE_XCM_VERSION),
..Default::default()
},
..Default::default()
};
genesis_config.build_storage().unwrap()
}
}
pub mod asset_hub_wococo {
use super::*;
pub const PARA_ID: u32 = 1000;
pub const ED: Balance = parachains_common::wococo::currency::EXISTENTIAL_DEPOSIT;
pub fn genesis() -> Storage {
let genesis_config = asset_hub_rococo_runtime::RuntimeGenesisConfig {
system: asset_hub_rococo_runtime::SystemConfig {
code: asset_hub_rococo_runtime::WASM_BINARY
.expect("WASM binary was not build, please build it!")
.to_vec(),
..Default::default()
},
balances: asset_hub_rococo_runtime::BalancesConfig {
balances: accounts::init_balances()
.iter()
.cloned()
.map(|k| (k, ED * 4096))
.collect(),
},
parachain_info: asset_hub_rococo_runtime::ParachainInfoConfig {
parachain_id: PARA_ID.into(),
..Default::default()
},
collator_selection: asset_hub_rococo_runtime::CollatorSelectionConfig {
invulnerables: collators::invulnerables()
.iter()
.cloned()
.map(|(acc, _)| acc)
.collect(),
candidacy_bond: ED * 16,
..Default::default()
},
session: asset_hub_rococo_runtime::SessionConfig {
keys: collators::invulnerables()
.into_iter()
.map(|(acc, aura)| {
(
acc.clone(), // account id
acc, // validator id
asset_hub_rococo_runtime::SessionKeys { aura }, // session keys
)
})
.collect(),
},
polkadot_xcm: asset_hub_rococo_runtime::PolkadotXcmConfig {
safe_xcm_version: Some(SAFE_XCM_VERSION),
..Default::default()
},
@@ -20,7 +20,8 @@ pub mod xcm_helpers;
use constants::{
accounts::{ALICE, BOB},
asset_hub_rococo, asset_hub_westend, bridge_hub_rococo, penpal, rococo, westend,
asset_hub_rococo, asset_hub_westend, asset_hub_wococo, bridge_hub_rococo, penpal, rococo,
westend,
};
use impls::{RococoWococoMessageHandler, WococoRococoMessageHandler};
pub use paste;
@@ -72,6 +73,7 @@ decl_test_relay_chains! {
XcmPallet: rococo_runtime::XcmPallet,
Sudo: rococo_runtime::Sudo,
Balances: rococo_runtime::Balances,
Hrmp: rococo_runtime::Hrmp,
}
},
#[api_version(8)]
@@ -150,58 +152,26 @@ decl_test_parachains! {
Balances: bridge_hub_rococo_runtime::Balances,
}
},
// AssetHubRococo (aka Rockmine/Rockmine2) mirrors AssetHubKusama
// AssetHubRococo
pub struct AssetHubRococo {
genesis = asset_hub_rococo::genesis(),
on_init = {
asset_hub_polkadot_runtime::AuraExt::on_initialize(1);
asset_hub_rococo_runtime::AuraExt::on_initialize(1);
},
runtime = asset_hub_kusama_runtime,
runtime = asset_hub_rococo_runtime,
core = {
XcmpMessageHandler: asset_hub_kusama_runtime::XcmpQueue,
DmpMessageHandler: asset_hub_kusama_runtime::DmpQueue,
LocationToAccountId: asset_hub_kusama_runtime::xcm_config::LocationToAccountId,
ParachainInfo: asset_hub_kusama_runtime::ParachainInfo,
XcmpMessageHandler: asset_hub_rococo_runtime::XcmpQueue,
DmpMessageHandler: asset_hub_rococo_runtime::DmpQueue,
LocationToAccountId: asset_hub_rococo_runtime::xcm_config::LocationToAccountId,
ParachainInfo: asset_hub_rococo_runtime::ParachainInfo,
},
pallets = {
PolkadotXcm: asset_hub_kusama_runtime::PolkadotXcm,
Assets: asset_hub_kusama_runtime::Assets,
Balances: asset_hub_kusama_runtime::Balances,
}
},
// Wococo Parachains
pub struct BridgeHubWococo {
genesis = bridge_hub_rococo::genesis(),
on_init = {
bridge_hub_rococo_runtime::AuraExt::on_initialize(1);
},
runtime = bridge_hub_rococo_runtime,
core = {
XcmpMessageHandler: bridge_hub_rococo_runtime::XcmpQueue,
DmpMessageHandler: bridge_hub_rococo_runtime::DmpQueue,
LocationToAccountId: bridge_hub_rococo_runtime::xcm_config::LocationToAccountId,
ParachainInfo: bridge_hub_rococo_runtime::ParachainInfo,
},
pallets = {
PolkadotXcm: bridge_hub_rococo_runtime::PolkadotXcm,
}
},
pub struct AssetHubWococo {
genesis = asset_hub_westend::genesis(),
on_init = {
asset_hub_polkadot_runtime::AuraExt::on_initialize(1);
},
runtime = asset_hub_polkadot_runtime,
core = {
XcmpMessageHandler: asset_hub_polkadot_runtime::XcmpQueue,
DmpMessageHandler: asset_hub_polkadot_runtime::DmpQueue,
LocationToAccountId: asset_hub_polkadot_runtime::xcm_config::LocationToAccountId,
ParachainInfo: asset_hub_polkadot_runtime::ParachainInfo,
},
pallets = {
PolkadotXcm: asset_hub_polkadot_runtime::PolkadotXcm,
Assets: asset_hub_polkadot_runtime::Assets,
Balances: asset_hub_polkadot_runtime::Balances,
PolkadotXcm: asset_hub_rococo_runtime::PolkadotXcm,
Assets: asset_hub_rococo_runtime::Assets,
ForeignAssets: asset_hub_rococo_runtime::ForeignAssets,
PoolAssets: asset_hub_rococo_runtime::PoolAssets,
AssetConversion: asset_hub_rococo_runtime::AssetConversion,
Balances: asset_hub_rococo_runtime::Balances,
}
},
pub struct PenpalRococoA {
@@ -220,6 +190,63 @@ decl_test_parachains! {
PolkadotXcm: penpal_runtime::PolkadotXcm,
Assets: penpal_runtime::Assets,
}
},
pub struct PenpalRococoB {
genesis = penpal::genesis(penpal::PARA_ID_B),
on_init = {
penpal_runtime::AuraExt::on_initialize(1);
},
runtime = penpal_runtime,
core = {
XcmpMessageHandler: penpal_runtime::XcmpQueue,
DmpMessageHandler: penpal_runtime::DmpQueue,
LocationToAccountId: penpal_runtime::xcm_config::LocationToAccountId,
ParachainInfo: penpal_runtime::ParachainInfo,
},
pallets = {
PolkadotXcm: penpal_runtime::PolkadotXcm,
Assets: penpal_runtime::Assets,
}
},
// Wococo Parachains
pub struct BridgeHubWococo {
genesis = bridge_hub_rococo::genesis(),
on_init = {
bridge_hub_rococo_runtime::AuraExt::on_initialize(1);
// TODO: manage to set_wococo_flavor with `set_storage`
},
runtime = bridge_hub_rococo_runtime,
core = {
XcmpMessageHandler: bridge_hub_rococo_runtime::XcmpQueue,
DmpMessageHandler: bridge_hub_rococo_runtime::DmpQueue,
LocationToAccountId: bridge_hub_rococo_runtime::xcm_config::LocationToAccountId,
ParachainInfo: bridge_hub_rococo_runtime::ParachainInfo,
},
pallets = {
PolkadotXcm: bridge_hub_rococo_runtime::PolkadotXcm,
}
},
pub struct AssetHubWococo {
genesis = asset_hub_wococo::genesis(),
on_init = {
asset_hub_rococo_runtime::AuraExt::on_initialize(1);
// TODO: manage to set_wococo_flavor with `set_storage`
},
runtime = asset_hub_rococo_runtime,
core = {
XcmpMessageHandler: asset_hub_rococo_runtime::XcmpQueue,
DmpMessageHandler: asset_hub_rococo_runtime::DmpQueue,
LocationToAccountId: asset_hub_rococo_runtime::xcm_config::LocationToAccountId,
ParachainInfo: asset_hub_rococo_runtime::ParachainInfo,
},
pallets = {
PolkadotXcm: asset_hub_rococo_runtime::PolkadotXcm,
Assets: asset_hub_rococo_runtime::Assets,
ForeignAssets: asset_hub_rococo_runtime::ForeignAssets,
PoolAssets: asset_hub_rococo_runtime::PoolAssets,
AssetConversion: asset_hub_rococo_runtime::AssetConversion,
Balances: asset_hub_rococo_runtime::Balances,
}
}
}
@@ -238,6 +265,7 @@ decl_test_networks! {
AssetHubRococo,
BridgeHubRococo,
PenpalRococoA,
PenpalRococoB,
],
bridge = RococoWococoMockBridge
},
@@ -272,6 +300,7 @@ impl_send_transact_helpers_for_relay_chain!(Westend);
// Rococo implementation
impl_accounts_helpers_for_relay_chain!(Rococo);
impl_assert_events_helpers_for_relay_chain!(Rococo);
impl_hrmp_channels_helpers_for_relay_chain!(Rococo);
impl_send_transact_helpers_for_relay_chain!(Rococo);
// Wococo implementation
@@ -284,6 +313,11 @@ impl_accounts_helpers_for_parachain!(AssetHubWestend);
impl_assets_helpers_for_parachain!(AssetHubWestend, Westend);
impl_assert_events_helpers_for_parachain!(AssetHubWestend);
// AssetHubRococo implementation
impl_accounts_helpers_for_parachain!(AssetHubRococo);
impl_assets_helpers_for_parachain!(AssetHubRococo, Rococo);
impl_assert_events_helpers_for_parachain!(AssetHubRococo);
// PenpalWestendA implementation
impl_assert_events_helpers_for_parachain!(PenpalWestendA);
@@ -291,6 +325,10 @@ impl_assert_events_helpers_for_parachain!(PenpalWestendA);
impl_accounts_helpers_for_parachain!(BridgeHubRococo);
impl_assert_events_helpers_for_parachain!(BridgeHubRococo);
// PenpalRococo implementations
impl_assert_events_helpers_for_parachain!(PenpalRococoA);
impl_assert_events_helpers_for_parachain!(PenpalRococoB);
decl_test_sender_receiver_accounts_parameter_types! {
// Relays
Westend { sender: ALICE, receiver: BOB },
@@ -305,5 +343,6 @@ decl_test_sender_receiver_accounts_parameter_types! {
BridgeHubWococo { sender: ALICE, receiver: BOB },
// Penpals
PenpalWestendA { sender: ALICE, receiver: BOB },
PenpalRococoA { sender: ALICE, receiver: BOB }
PenpalRococoA { sender: ALICE, receiver: BOB },
PenpalRococoB { sender: ALICE, receiver: BOB }
}
@@ -449,7 +449,7 @@ pub type Barrier = TrailingSetTopicAsId<
// Allow XCMs with some computed origins to pass through.
WithComputedOrigin<
(
// If the message is one that immediately attemps to pay for execution, then
// If the message is one that immediately attempts to pay for execution, then
// allow it.
AllowTopLevelPaidExecutionFrom<Everything>,
// Parent and its pluralities (i.e. governance bodies) get free execution.
@@ -367,7 +367,7 @@ pub type Barrier = TrailingSetTopicAsId<
// Allow XCMs with some computed origins to pass through.
WithComputedOrigin<
(
// If the message is one that immediately attemps to pay for execution, then
// If the message is one that immediately attempts to pay for execution, then
// allow it.
AllowTopLevelPaidExecutionFrom<Everything>,
// Parent, its pluralities (i.e. governance bodies), and the Fellows plurality
@@ -0,0 +1,241 @@
[package]
name = "asset-hub-rococo-runtime"
version = "0.9.420"
authors.workspace = true
edition.workspace = true
description = "Rococo variant of Asset Hub parachain runtime"
[dependencies]
codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive", "max-encoded-len"] }
hex-literal = { version = "0.4.1" }
log = { version = "0.4.20", default-features = false }
scale-info = { version = "2.9.0", default-features = false, features = ["derive"] }
smallvec = "1.11.0"
# Substrate
frame-benchmarking = { path = "../../../../../substrate/frame/benchmarking", default-features = false, optional = true}
frame-executive = { path = "../../../../../substrate/frame/executive", default-features = false}
frame-support = { path = "../../../../../substrate/frame/support", default-features = false}
frame-system = { path = "../../../../../substrate/frame/system", default-features = false}
frame-system-benchmarking = { path = "../../../../../substrate/frame/system/benchmarking", default-features = false, optional = true}
frame-system-rpc-runtime-api = { path = "../../../../../substrate/frame/system/rpc/runtime-api", default-features = false}
frame-try-runtime = { path = "../../../../../substrate/frame/try-runtime", default-features = false, optional = true}
pallet-asset-conversion-tx-payment = { path = "../../../../../substrate/frame/transaction-payment/asset-conversion-tx-payment", default-features = false}
pallet-assets = { path = "../../../../../substrate/frame/assets", default-features = false}
pallet-asset-conversion = { path = "../../../../../substrate/frame/asset-conversion", default-features = false}
pallet-aura = { path = "../../../../../substrate/frame/aura", default-features = false}
pallet-authorship = { path = "../../../../../substrate/frame/authorship", default-features = false}
pallet-balances = { path = "../../../../../substrate/frame/balances", default-features = false}
pallet-multisig = { path = "../../../../../substrate/frame/multisig", default-features = false}
pallet-nft-fractionalization = { path = "../../../../../substrate/frame/nft-fractionalization", default-features = false}
pallet-nfts = { path = "../../../../../substrate/frame/nfts", default-features = false}
pallet-nfts-runtime-api = { path = "../../../../../substrate/frame/nfts/runtime-api", default-features = false}
pallet-proxy = { path = "../../../../../substrate/frame/proxy", default-features = false}
pallet-session = { path = "../../../../../substrate/frame/session", default-features = false}
pallet-state-trie-migration = { path = "../../../../../substrate/frame/state-trie-migration", default-features = false, optional = true }
pallet-timestamp = { path = "../../../../../substrate/frame/timestamp", default-features = false}
pallet-transaction-payment = { path = "../../../../../substrate/frame/transaction-payment", default-features = false}
pallet-transaction-payment-rpc-runtime-api = { path = "../../../../../substrate/frame/transaction-payment/rpc/runtime-api", default-features = false}
pallet-uniques = { path = "../../../../../substrate/frame/uniques", default-features = false}
pallet-utility = { path = "../../../../../substrate/frame/utility", default-features = false}
sp-api = { path = "../../../../../substrate/primitives/api", default-features = false}
sp-block-builder = { path = "../../../../../substrate/primitives/block-builder", default-features = false}
sp-consensus-aura = { path = "../../../../../substrate/primitives/consensus/aura", default-features = false}
sp-core = { path = "../../../../../substrate/primitives/core", default-features = false}
sp-inherents = { path = "../../../../../substrate/primitives/inherents", default-features = false}
sp-offchain = { path = "../../../../../substrate/primitives/offchain", default-features = false}
sp-runtime = { path = "../../../../../substrate/primitives/runtime", default-features = false}
sp-session = { path = "../../../../../substrate/primitives/session", default-features = false}
sp-std = { path = "../../../../../substrate/primitives/std", default-features = false}
sp-storage = { path = "../../../../../substrate/primitives/storage", default-features = false}
sp-transaction-pool = { path = "../../../../../substrate/primitives/transaction-pool", default-features = false}
sp-version = { path = "../../../../../substrate/primitives/version", default-features = false}
sp-weights = { path = "../../../../../substrate/primitives/weights", default-features = false}
# num-traits feature needed for dex integer sq root:
primitive-types = { version = "0.12.1", default-features = false, features = ["codec", "scale-info", "num-traits"] }
# Polkadot
rococo-runtime-constants = { path = "../../../../../polkadot/runtime/rococo/constants", default-features = false}
pallet-xcm = { path = "../../../../../polkadot/xcm/pallet-xcm", default-features = false}
pallet-xcm-benchmarks = { path = "../../../../../polkadot/xcm/pallet-xcm-benchmarks", default-features = false, optional = true }
polkadot-core-primitives = { path = "../../../../../polkadot/core-primitives", default-features = false}
polkadot-parachain-primitives = { path = "../../../../../polkadot/parachain", default-features = false}
polkadot-runtime-common = { path = "../../../../../polkadot/runtime/common", default-features = false}
xcm = { package = "staging-xcm", path = "../../../../../polkadot/xcm", default-features = false}
xcm-builder = { package = "staging-xcm-builder", path = "../../../../../polkadot/xcm/xcm-builder", default-features = false}
xcm-executor = { package = "staging-xcm-executor", path = "../../../../../polkadot/xcm/xcm-executor", default-features = false}
# Cumulus
cumulus-pallet-aura-ext = { path = "../../../../pallets/aura-ext", default-features = false }
cumulus-pallet-dmp-queue = { path = "../../../../pallets/dmp-queue", default-features = false }
cumulus-pallet-parachain-system = { path = "../../../../pallets/parachain-system", default-features = false, features = ["parameterized-consensus-hook",] }
cumulus-pallet-session-benchmarking = { path = "../../../../pallets/session-benchmarking", default-features = false}
cumulus-pallet-xcm = { path = "../../../../pallets/xcm", default-features = false }
cumulus-pallet-xcmp-queue = { path = "../../../../pallets/xcmp-queue", default-features = false, features = ["bridging"] }
cumulus-primitives-core = { path = "../../../../primitives/core", default-features = false }
cumulus-primitives-utility = { path = "../../../../primitives/utility", default-features = false }
pallet-collator-selection = { path = "../../../../pallets/collator-selection", default-features = false }
parachain-info = { path = "../../../pallets/parachain-info", default-features = false }
parachains-common = { path = "../../../common", default-features = false }
assets-common = { path = "../common", default-features = false }
# Bridges
pallet-xcm-bridge-hub-router = { path = "../../../../../bridges/modules/xcm-bridge-hub-router", default-features = false }
bp-asset-hub-rococo = { path = "../../../../../bridges/primitives/chain-asset-hub-rococo", default-features = false }
bp-asset-hub-wococo = { path = "../../../../../bridges/primitives/chain-asset-hub-wococo", default-features = false }
bp-bridge-hub-rococo = { path = "../../../../../bridges/primitives/chain-bridge-hub-rococo", default-features = false }
bp-bridge-hub-wococo = { path = "../../../../../bridges/primitives/chain-bridge-hub-wococo", default-features = false }
[dev-dependencies]
asset-test-utils = { path = "../test-utils" }
[build-dependencies]
substrate-wasm-builder = { path = "../../../../../substrate/utils/wasm-builder", optional = true }
[features]
default = [ "std" ]
# When enabled the `state_version` is set to `1`.
# This means that the chain will start using the new state format. The migration is lazy, so
# it requires to write a storage value to use the new state format. To migrate all the other
# storage values that aren't touched the state migration pallet is added as well.
# This pallet will migrate the entire state, controlled through some account.
#
# This feature should be removed when the main-net will be migrated.
state-trie-version-1 = [ "pallet-state-trie-migration" ]
runtime-benchmarks = [
"assets-common/runtime-benchmarks",
"cumulus-pallet-parachain-system/runtime-benchmarks",
"cumulus-pallet-session-benchmarking/runtime-benchmarks",
"cumulus-pallet-xcmp-queue/runtime-benchmarks",
"cumulus-primitives-utility/runtime-benchmarks",
"frame-benchmarking/runtime-benchmarks",
"frame-support/runtime-benchmarks",
"frame-system-benchmarking/runtime-benchmarks",
"frame-system/runtime-benchmarks",
"pallet-asset-conversion/runtime-benchmarks",
"pallet-assets/runtime-benchmarks",
"pallet-balances/runtime-benchmarks",
"pallet-collator-selection/runtime-benchmarks",
"pallet-multisig/runtime-benchmarks",
"pallet-nft-fractionalization/runtime-benchmarks",
"pallet-nfts/runtime-benchmarks",
"pallet-proxy/runtime-benchmarks",
"pallet-state-trie-migration/runtime-benchmarks",
"pallet-timestamp/runtime-benchmarks",
"pallet-uniques/runtime-benchmarks",
"pallet-utility/runtime-benchmarks",
"pallet-xcm-benchmarks/runtime-benchmarks",
"pallet-xcm-bridge-hub-router/runtime-benchmarks",
"pallet-xcm/runtime-benchmarks",
"parachains-common/runtime-benchmarks",
"polkadot-parachain-primitives/runtime-benchmarks",
"polkadot-runtime-common/runtime-benchmarks",
"sp-runtime/runtime-benchmarks",
"xcm-builder/runtime-benchmarks",
"xcm-executor/runtime-benchmarks",
]
try-runtime = [
"cumulus-pallet-aura-ext/try-runtime",
"cumulus-pallet-dmp-queue/try-runtime",
"cumulus-pallet-parachain-system/try-runtime",
"cumulus-pallet-xcm/try-runtime",
"cumulus-pallet-xcmp-queue/try-runtime",
"frame-executive/try-runtime",
"frame-support/try-runtime",
"frame-system/try-runtime",
"frame-try-runtime/try-runtime",
"pallet-asset-conversion-tx-payment/try-runtime",
"pallet-asset-conversion/try-runtime",
"pallet-assets/try-runtime",
"pallet-aura/try-runtime",
"pallet-authorship/try-runtime",
"pallet-balances/try-runtime",
"pallet-collator-selection/try-runtime",
"pallet-multisig/try-runtime",
"pallet-nft-fractionalization/try-runtime",
"pallet-nfts/try-runtime",
"pallet-proxy/try-runtime",
"pallet-session/try-runtime",
"pallet-state-trie-migration/try-runtime",
"pallet-timestamp/try-runtime",
"pallet-transaction-payment/try-runtime",
"pallet-uniques/try-runtime",
"pallet-utility/try-runtime",
"pallet-xcm-bridge-hub-router/try-runtime",
"pallet-xcm/try-runtime",
"parachain-info/try-runtime",
"polkadot-runtime-common/try-runtime",
"sp-runtime/try-runtime",
]
std = [
"assets-common/std",
"bp-asset-hub-rococo/std",
"bp-asset-hub-wococo/std",
"bp-bridge-hub-rococo/std",
"bp-bridge-hub-wococo/std",
"codec/std",
"cumulus-pallet-aura-ext/std",
"cumulus-pallet-dmp-queue/std",
"cumulus-pallet-parachain-system/std",
"cumulus-pallet-session-benchmarking/std",
"cumulus-pallet-xcm/std",
"cumulus-pallet-xcmp-queue/std",
"cumulus-primitives-core/std",
"cumulus-primitives-utility/std",
"frame-benchmarking?/std",
"frame-executive/std",
"frame-support/std",
"frame-system-benchmarking?/std",
"frame-system-rpc-runtime-api/std",
"frame-system/std",
"frame-try-runtime?/std",
"log/std",
"pallet-asset-conversion-tx-payment/std",
"pallet-asset-conversion/std",
"pallet-assets/std",
"pallet-aura/std",
"pallet-authorship/std",
"pallet-balances/std",
"pallet-collator-selection/std",
"pallet-multisig/std",
"pallet-nft-fractionalization/std",
"pallet-nfts-runtime-api/std",
"pallet-nfts/std",
"pallet-proxy/std",
"pallet-session/std",
"pallet-state-trie-migration/std",
"pallet-timestamp/std",
"pallet-transaction-payment-rpc-runtime-api/std",
"pallet-transaction-payment/std",
"pallet-uniques/std",
"pallet-utility/std",
"pallet-xcm-benchmarks?/std",
"pallet-xcm-bridge-hub-router/std",
"pallet-xcm/std",
"parachain-info/std",
"parachains-common/std",
"polkadot-core-primitives/std",
"polkadot-parachain-primitives/std",
"polkadot-runtime-common/std",
"rococo-runtime-constants/std",
"scale-info/std",
"sp-api/std",
"sp-block-builder/std",
"sp-consensus-aura/std",
"sp-core/std",
"sp-inherents/std",
"sp-offchain/std",
"sp-runtime/std",
"sp-session/std",
"sp-std/std",
"sp-storage/std",
"sp-transaction-pool/std",
"sp-version/std",
"sp-weights/std",
"substrate-wasm-builder",
"xcm-builder/std",
"xcm-executor/std",
"xcm/std",
]
experimental = [ "pallet-aura/experimental" ]
@@ -0,0 +1,26 @@
// Copyright (C) Parity Technologies (UK) Ltd.
// 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.
#[cfg(feature = "std")]
fn main() {
substrate_wasm_builder::WasmBuilder::new()
.with_current_project()
.export_heap_base()
.import_memory()
.build()
}
#[cfg(not(feature = "std"))]
fn main() {}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,53 @@
// This file is part of Substrate.
// Copyright (C) Parity Technologies (UK) Ltd.
// 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.
pub mod constants {
use frame_support::{
parameter_types,
weights::{constants, Weight},
};
parameter_types! {
/// Importing a block with 0 Extrinsics.
pub const BlockExecutionWeight: Weight =
Weight::from_parts(constants::WEIGHT_REF_TIME_PER_NANOS.saturating_mul(5_000_000), 0);
}
#[cfg(test)]
mod test_weights {
use frame_support::weights::constants;
/// Checks that the weight exists and is sane.
// NOTE: If this test fails but you are sure that the generated values are fine,
// you can delete it.
#[test]
fn sane() {
let w = super::constants::BlockExecutionWeight::get();
// At least 100 µs.
assert!(
w.ref_time() >= 100u64 * constants::WEIGHT_REF_TIME_PER_MICROS,
"Weight should be at least 100 µs."
);
// At most 50 ms.
assert!(
w.ref_time() <= 50u64 * constants::WEIGHT_REF_TIME_PER_MILLIS,
"Weight should be at most 50 ms."
);
}
}
}
@@ -0,0 +1,77 @@
// Copyright (C) Parity Technologies (UK) Ltd.
// This file is part of Cumulus.
// Cumulus is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Cumulus is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
//! Autogenerated weights for `cumulus_pallet_xcmp_queue`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
//! DATE: 2023-07-31, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `runner-ynta1nyy-project-238-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz`
//! EXECUTION: ``, WASM-EXECUTION: `Compiled`, CHAIN: `Some("asset-hub-rococo-dev")`, DB CACHE: 1024
// Executed Command:
// ./target/production/polkadot-parachain
// benchmark
// pallet
// --chain=asset-hub-rococo-dev
// --wasm-execution=compiled
// --pallet=cumulus_pallet_xcmp_queue
// --no-storage-info
// --no-median-slopes
// --no-min-squares
// --extrinsic=*
// --steps=50
// --repeat=20
// --json
// --header=./file_header.txt
// --output=./parachains/runtimes/assets/asset-hub-rococo/src/weights/
#![cfg_attr(rustfmt, rustfmt_skip)]
#![allow(unused_parens)]
#![allow(unused_imports)]
#![allow(missing_docs)]
use frame_support::{traits::Get, weights::Weight};
use core::marker::PhantomData;
/// Weight functions for `cumulus_pallet_xcmp_queue`.
pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Config> cumulus_pallet_xcmp_queue::WeightInfo for WeightInfo<T> {
/// Storage: `XcmpQueue::QueueConfig` (r:1 w:1)
/// Proof: `XcmpQueue::QueueConfig` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
fn set_config_with_u32() -> Weight {
// Proof Size summary in bytes:
// Measured: `76`
// Estimated: `1561`
// Minimum execution time: 5_467_000 picoseconds.
Weight::from_parts(5_634_000, 0)
.saturating_add(Weight::from_parts(0, 1561))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `XcmpQueue::QueueConfig` (r:1 w:1)
/// Proof: `XcmpQueue::QueueConfig` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
fn set_config_with_weight() -> Weight {
// Proof Size summary in bytes:
// Measured: `76`
// Estimated: `1561`
// Minimum execution time: 5_409_000 picoseconds.
Weight::from_parts(5_570_000, 0)
.saturating_add(Weight::from_parts(0, 1561))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
}
@@ -0,0 +1,53 @@
// This file is part of Substrate.
// Copyright (C) Parity Technologies (UK) Ltd.
// 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.
pub mod constants {
use frame_support::{
parameter_types,
weights::{constants, Weight},
};
parameter_types! {
/// Executing a NO-OP `System::remarks` Extrinsic.
pub const ExtrinsicBaseWeight: Weight =
Weight::from_parts(constants::WEIGHT_REF_TIME_PER_NANOS.saturating_mul(125_000), 0);
}
#[cfg(test)]
mod test_weights {
use frame_support::weights::constants;
/// Checks that the weight exists and is sane.
// NOTE: If this test fails but you are sure that the generated values are fine,
// you can delete it.
#[test]
fn sane() {
let w = super::constants::ExtrinsicBaseWeight::get();
// At least 10 µs.
assert!(
w.ref_time() >= 10u64 * constants::WEIGHT_REF_TIME_PER_MICROS,
"Weight should be at least 10 µs."
);
// At most 1 ms.
assert!(
w.ref_time() <= constants::WEIGHT_REF_TIME_PER_MILLIS,
"Weight should be at most 1 ms."
);
}
}
}
@@ -0,0 +1,155 @@
// Copyright (C) Parity Technologies (UK) Ltd.
// This file is part of Cumulus.
// Cumulus is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Cumulus is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
//! Autogenerated weights for `frame_system`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
//! DATE: 2023-07-31, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `runner-ynta1nyy-project-238-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz`
//! EXECUTION: ``, WASM-EXECUTION: `Compiled`, CHAIN: `Some("asset-hub-rococo-dev")`, DB CACHE: 1024
// Executed Command:
// ./target/production/polkadot-parachain
// benchmark
// pallet
// --chain=asset-hub-rococo-dev
// --wasm-execution=compiled
// --pallet=frame_system
// --no-storage-info
// --no-median-slopes
// --no-min-squares
// --extrinsic=*
// --steps=50
// --repeat=20
// --json
// --header=./file_header.txt
// --output=./parachains/runtimes/assets/asset-hub-rococo/src/weights/
#![cfg_attr(rustfmt, rustfmt_skip)]
#![allow(unused_parens)]
#![allow(unused_imports)]
#![allow(missing_docs)]
use frame_support::{traits::Get, weights::Weight};
use core::marker::PhantomData;
/// Weight functions for `frame_system`.
pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Config> frame_system::WeightInfo for WeightInfo<T> {
/// The range of component `b` is `[0, 3932160]`.
fn remark(b: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 2_106_000 picoseconds.
Weight::from_parts(1_884_213, 0)
.saturating_add(Weight::from_parts(0, 0))
// Standard Error: 0
.saturating_add(Weight::from_parts(388, 0).saturating_mul(b.into()))
}
/// The range of component `b` is `[0, 3932160]`.
fn remark_with_event(b: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 7_528_000 picoseconds.
Weight::from_parts(27_081_927, 0)
.saturating_add(Weight::from_parts(0, 0))
// Standard Error: 7
.saturating_add(Weight::from_parts(1_730, 0).saturating_mul(b.into()))
}
/// Storage: `System::Digest` (r:1 w:1)
/// Proof: `System::Digest` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: UNKNOWN KEY `0x3a686561707061676573` (r:0 w:1)
/// Proof: UNKNOWN KEY `0x3a686561707061676573` (r:0 w:1)
fn set_heap_pages() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `1485`
// Minimum execution time: 3_882_000 picoseconds.
Weight::from_parts(4_149_000, 0)
.saturating_add(Weight::from_parts(0, 1485))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(2))
}
/// Storage: `ParachainSystem::ValidationData` (r:1 w:0)
/// Proof: `ParachainSystem::ValidationData` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `ParachainSystem::UpgradeRestrictionSignal` (r:1 w:0)
/// Proof: `ParachainSystem::UpgradeRestrictionSignal` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `ParachainSystem::PendingValidationCode` (r:1 w:1)
/// Proof: `ParachainSystem::PendingValidationCode` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `ParachainSystem::HostConfiguration` (r:1 w:0)
/// Proof: `ParachainSystem::HostConfiguration` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `ParachainSystem::NewValidationCode` (r:0 w:1)
/// Proof: `ParachainSystem::NewValidationCode` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `ParachainSystem::DidSetValidationCode` (r:0 w:1)
/// Proof: `ParachainSystem::DidSetValidationCode` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
fn set_code() -> Weight {
// Proof Size summary in bytes:
// Measured: `119`
// Estimated: `1604`
// Minimum execution time: 103_389_161_000 picoseconds.
Weight::from_parts(106_870_091_000, 0)
.saturating_add(Weight::from_parts(0, 1604))
.saturating_add(T::DbWeight::get().reads(4))
.saturating_add(T::DbWeight::get().writes(3))
}
/// Storage: `Skipped::Metadata` (r:0 w:0)
/// Proof: `Skipped::Metadata` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// The range of component `i` is `[0, 1000]`.
fn set_storage(i: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 2_236_000 picoseconds.
Weight::from_parts(2_302_000, 0)
.saturating_add(Weight::from_parts(0, 0))
// Standard Error: 2_045
.saturating_add(Weight::from_parts(763_456, 0).saturating_mul(i.into()))
.saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into())))
}
/// Storage: `Skipped::Metadata` (r:0 w:0)
/// Proof: `Skipped::Metadata` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// The range of component `i` is `[0, 1000]`.
fn kill_storage(i: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 2_175_000 picoseconds.
Weight::from_parts(2_238_000, 0)
.saturating_add(Weight::from_parts(0, 0))
// Standard Error: 1_040
.saturating_add(Weight::from_parts(571_397, 0).saturating_mul(i.into()))
.saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into())))
}
/// Storage: `Skipped::Metadata` (r:0 w:0)
/// Proof: `Skipped::Metadata` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// The range of component `p` is `[0, 1000]`.
fn kill_prefix(p: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `84 + p * (69 ±0)`
// Estimated: `80 + p * (70 ±0)`
// Minimum execution time: 3_843_000 picoseconds.
Weight::from_parts(3_947_000, 0)
.saturating_add(Weight::from_parts(0, 80))
// Standard Error: 2_188
.saturating_add(Weight::from_parts(1_212_360, 0).saturating_mul(p.into()))
.saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(p.into())))
.saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(p.into())))
.saturating_add(Weight::from_parts(0, 70).saturating_mul(p.into()))
}
}
@@ -0,0 +1,45 @@
// Copyright (C) Parity Technologies (UK) Ltd.
// This file is part of Cumulus.
// Cumulus is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Cumulus is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
pub mod block_weights;
pub mod cumulus_pallet_xcmp_queue;
pub mod extrinsic_weights;
pub mod frame_system;
pub mod pallet_asset_conversion;
pub mod pallet_assets_foreign;
pub mod pallet_assets_local;
pub mod pallet_assets_pool;
pub mod pallet_balances;
pub mod pallet_collator_selection;
pub mod pallet_multisig;
pub mod pallet_nft_fractionalization;
pub mod pallet_nfts;
pub mod pallet_proxy;
pub mod pallet_session;
pub mod pallet_timestamp;
pub mod pallet_uniques;
pub mod pallet_utility;
pub mod pallet_xcm;
pub mod pallet_xcm_bridge_hub_router_to_rococo;
pub mod pallet_xcm_bridge_hub_router_to_wococo;
pub mod paritydb_weights;
pub mod rocksdb_weights;
pub mod xcm;
pub use block_weights::constants::BlockExecutionWeight;
pub use extrinsic_weights::constants::ExtrinsicBaseWeight;
pub use paritydb_weights::constants::ParityDbWeight;
pub use rocksdb_weights::constants::RocksDbWeight;
@@ -0,0 +1,155 @@
// Copyright (C) Parity Technologies (UK) Ltd.
// This file is part of Cumulus.
// Cumulus is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Cumulus is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
//! Autogenerated weights for `pallet_asset_conversion`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
//! DATE: 2023-07-26, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `runner-ynta1nyy-project-238-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz`
//! EXECUTION: ``, WASM-EXECUTION: `Compiled`, CHAIN: `Some("asset-hub-rococo-dev")`, DB CACHE: 1024
// Executed Command:
// target/production/polkadot-parachain
// benchmark
// pallet
// --steps=50
// --repeat=20
// --extrinsic=*
// --wasm-execution=compiled
// --heap-pages=4096
// --json-file=/builds/parity/mirrors/cumulus/.git/.artifacts/bench.json
// --pallet=pallet_asset_conversion
// --chain=asset-hub-rococo-dev
// --header=./file_header.txt
// --output=./parachains/runtimes/assets/asset-hub-rococo/src/weights/
#![cfg_attr(rustfmt, rustfmt_skip)]
#![allow(unused_parens)]
#![allow(unused_imports)]
#![allow(missing_docs)]
use frame_support::{traits::Get, weights::Weight};
use core::marker::PhantomData;
/// Weight functions for `pallet_asset_conversion`.
pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Config> pallet_asset_conversion::WeightInfo for WeightInfo<T> {
/// Storage: `AssetConversion::Pools` (r:1 w:1)
/// Proof: `AssetConversion::Pools` (`max_values`: None, `max_size`: Some(1224), added: 3699, mode: `MaxEncodedLen`)
/// Storage: UNKNOWN KEY `0x76a2c49709deec21d9c05f96c1f47351` (r:1 w:0)
/// Proof: UNKNOWN KEY `0x76a2c49709deec21d9c05f96c1f47351` (r:1 w:0)
/// Storage: `System::Account` (r:2 w:1)
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
/// Storage: `ForeignAssets::Account` (r:1 w:1)
/// Proof: `ForeignAssets::Account` (`max_values`: None, `max_size`: Some(732), added: 3207, mode: `MaxEncodedLen`)
/// Storage: `ForeignAssets::Asset` (r:1 w:1)
/// Proof: `ForeignAssets::Asset` (`max_values`: None, `max_size`: Some(808), added: 3283, mode: `MaxEncodedLen`)
/// Storage: `AssetConversion::NextPoolAssetId` (r:1 w:1)
/// Proof: `AssetConversion::NextPoolAssetId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
/// Storage: `PoolAssets::Asset` (r:1 w:1)
/// Proof: `PoolAssets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
/// Storage: `PoolAssets::Account` (r:1 w:1)
/// Proof: `PoolAssets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`)
fn create_pool() -> Weight {
// Proof Size summary in bytes:
// Measured: `480`
// Estimated: `6196`
// Minimum execution time: 88_484_000 picoseconds.
Weight::from_parts(92_964_000, 0)
.saturating_add(Weight::from_parts(0, 6196))
.saturating_add(T::DbWeight::get().reads(9))
.saturating_add(T::DbWeight::get().writes(7))
}
/// Storage: `AssetConversion::Pools` (r:1 w:0)
/// Proof: `AssetConversion::Pools` (`max_values`: None, `max_size`: Some(1224), added: 3699, mode: `MaxEncodedLen`)
/// Storage: `System::Account` (r:1 w:1)
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
/// Storage: `ForeignAssets::Asset` (r:1 w:1)
/// Proof: `ForeignAssets::Asset` (`max_values`: None, `max_size`: Some(808), added: 3283, mode: `MaxEncodedLen`)
/// Storage: `ForeignAssets::Account` (r:2 w:2)
/// Proof: `ForeignAssets::Account` (`max_values`: None, `max_size`: Some(732), added: 3207, mode: `MaxEncodedLen`)
/// Storage: `PoolAssets::Asset` (r:1 w:1)
/// Proof: `PoolAssets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
/// Storage: `PoolAssets::Account` (r:2 w:2)
/// Proof: `PoolAssets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`)
fn add_liquidity() -> Weight {
// Proof Size summary in bytes:
// Measured: `1117`
// Estimated: `7404`
// Minimum execution time: 153_015_000 picoseconds.
Weight::from_parts(157_018_000, 0)
.saturating_add(Weight::from_parts(0, 7404))
.saturating_add(T::DbWeight::get().reads(8))
.saturating_add(T::DbWeight::get().writes(7))
}
/// Storage: `AssetConversion::Pools` (r:1 w:0)
/// Proof: `AssetConversion::Pools` (`max_values`: None, `max_size`: Some(1224), added: 3699, mode: `MaxEncodedLen`)
/// Storage: `System::Account` (r:1 w:1)
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
/// Storage: `ForeignAssets::Asset` (r:1 w:1)
/// Proof: `ForeignAssets::Asset` (`max_values`: None, `max_size`: Some(808), added: 3283, mode: `MaxEncodedLen`)
/// Storage: `ForeignAssets::Account` (r:2 w:2)
/// Proof: `ForeignAssets::Account` (`max_values`: None, `max_size`: Some(732), added: 3207, mode: `MaxEncodedLen`)
/// Storage: `PoolAssets::Asset` (r:1 w:1)
/// Proof: `PoolAssets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
/// Storage: UNKNOWN KEY `0x2433d831722b1f4aeb1666953f1c0e77` (r:1 w:0)
/// Proof: UNKNOWN KEY `0x2433d831722b1f4aeb1666953f1c0e77` (r:1 w:0)
/// Storage: `PoolAssets::Account` (r:1 w:1)
/// Proof: `PoolAssets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`)
fn remove_liquidity() -> Weight {
// Proof Size summary in bytes:
// Measured: `1106`
// Estimated: `7404`
// Minimum execution time: 141_726_000 picoseconds.
Weight::from_parts(147_865_000, 0)
.saturating_add(Weight::from_parts(0, 7404))
.saturating_add(T::DbWeight::get().reads(8))
.saturating_add(T::DbWeight::get().writes(6))
}
/// Storage: `ForeignAssets::Asset` (r:2 w:2)
/// Proof: `ForeignAssets::Asset` (`max_values`: None, `max_size`: Some(808), added: 3283, mode: `MaxEncodedLen`)
/// Storage: `ForeignAssets::Account` (r:4 w:4)
/// Proof: `ForeignAssets::Account` (`max_values`: None, `max_size`: Some(732), added: 3207, mode: `MaxEncodedLen`)
/// Storage: `System::Account` (r:2 w:2)
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
fn swap_exact_tokens_for_tokens() -> Weight {
// Proof Size summary in bytes:
// Measured: `1148`
// Estimated: `13818`
// Minimum execution time: 168_619_000 picoseconds.
Weight::from_parts(174_283_000, 0)
.saturating_add(Weight::from_parts(0, 13818))
.saturating_add(T::DbWeight::get().reads(8))
.saturating_add(T::DbWeight::get().writes(8))
}
/// Storage: `System::Account` (r:2 w:2)
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
/// Storage: `ForeignAssets::Asset` (r:2 w:2)
/// Proof: `ForeignAssets::Asset` (`max_values`: None, `max_size`: Some(808), added: 3283, mode: `MaxEncodedLen`)
/// Storage: `ForeignAssets::Account` (r:4 w:4)
/// Proof: `ForeignAssets::Account` (`max_values`: None, `max_size`: Some(732), added: 3207, mode: `MaxEncodedLen`)
fn swap_tokens_for_exact_tokens() -> Weight {
// Proof Size summary in bytes:
// Measured: `1148`
// Estimated: `13818`
// Minimum execution time: 171_565_000 picoseconds.
Weight::from_parts(173_702_000, 0)
.saturating_add(Weight::from_parts(0, 13818))
.saturating_add(T::DbWeight::get().reads(8))
.saturating_add(T::DbWeight::get().writes(8))
}
}
@@ -0,0 +1,534 @@
// Copyright (C) Parity Technologies (UK) Ltd.
// This file is part of Cumulus.
// Cumulus is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Cumulus is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
//! Autogenerated weights for `pallet_assets`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
//! DATE: 2023-06-20, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `runner-ynta1nyy-project-238-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz`
//! EXECUTION: ``, WASM-EXECUTION: `Compiled`, CHAIN: `Some("asset-hub-rococo-dev")`, DB CACHE: 1024
// Executed Command:
// ./target/production/polkadot-parachain
// benchmark
// pallet
// --steps=50
// --repeat=20
// --extrinsic=*
// --execution=wasm
// --wasm-execution=compiled
// --heap-pages=4096
// --json-file=/var/lib/gitlab-runner/builds/zyw4fam_/0/parity/mirrors/cumulus/.git/.artifacts/bench.json
// --pallet=pallet_assets
// --no-storage-info
// --no-median-slopes
// --no-min-squares
// --extrinsic=*
// --steps=50
// --repeat=20
// --json
// --header=./file_header.txt
// --output=./parachains/runtimes/assets/asset-hub-rococo/src/weights/
#![cfg_attr(rustfmt, rustfmt_skip)]
#![allow(unused_parens)]
#![allow(unused_imports)]
#![allow(missing_docs)]
use frame_support::{traits::Get, weights::Weight};
use core::marker::PhantomData;
/// Weight functions for `pallet_assets`.
pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Config> pallet_assets::WeightInfo for WeightInfo<T> {
/// Storage: `ParachainInfo::ParachainId` (r:1 w:0)
/// Proof: `ParachainInfo::ParachainId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
/// Storage: `ForeignAssets::Asset` (r:1 w:1)
/// Proof: `ForeignAssets::Asset` (`max_values`: None, `max_size`: Some(808), added: 3283, mode: `MaxEncodedLen`)
/// Storage: `System::Account` (r:1 w:1)
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
fn create() -> Weight {
// Proof Size summary in bytes:
// Measured: `107`
// Estimated: `4273`
// Minimum execution time: 30_485_000 picoseconds.
Weight::from_parts(31_007_000, 0)
.saturating_add(Weight::from_parts(0, 4273))
.saturating_add(T::DbWeight::get().reads(3))
.saturating_add(T::DbWeight::get().writes(2))
}
/// Storage: `ForeignAssets::Asset` (r:1 w:1)
/// Proof: `ForeignAssets::Asset` (`max_values`: None, `max_size`: Some(808), added: 3283, mode: `MaxEncodedLen`)
fn force_create() -> Weight {
// Proof Size summary in bytes:
// Measured: `4`
// Estimated: `4273`
// Minimum execution time: 12_991_000 picoseconds.
Weight::from_parts(13_304_000, 0)
.saturating_add(Weight::from_parts(0, 4273))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `ForeignAssets::Asset` (r:1 w:1)
/// Proof: `ForeignAssets::Asset` (`max_values`: None, `max_size`: Some(808), added: 3283, mode: `MaxEncodedLen`)
fn start_destroy() -> Weight {
// Proof Size summary in bytes:
// Measured: `276`
// Estimated: `4273`
// Minimum execution time: 15_689_000 picoseconds.
Weight::from_parts(16_063_000, 0)
.saturating_add(Weight::from_parts(0, 4273))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: ForeignAssets Asset (r:1 w:1)
/// Proof: ForeignAssets Asset (max_values: None, max_size: Some(808), added: 3283, mode: MaxEncodedLen)
/// Storage: ForeignAssets Account (r:1001 w:1000)
/// Proof: ForeignAssets Account (max_values: None, max_size: Some(732), added: 3207, mode: MaxEncodedLen)
/// Storage: System Account (r:1000 w:1000)
/// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen)
/// The range of component `c` is `[0, 1000]`.
/// The range of component `c` is `[0, 1000]`.
fn destroy_accounts(c: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `0 + c * (208 ±0)`
// Estimated: `4273 + c * (3207 ±0)`
// Minimum execution time: 18_533_000 picoseconds.
Weight::from_parts(18_791_000, 0)
.saturating_add(Weight::from_parts(0, 4273))
// Standard Error: 5_059
.saturating_add(Weight::from_parts(12_049_659, 0).saturating_mul(c.into()))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().reads((2_u64).saturating_mul(c.into())))
.saturating_add(T::DbWeight::get().writes(1))
.saturating_add(T::DbWeight::get().writes((2_u64).saturating_mul(c.into())))
.saturating_add(Weight::from_parts(0, 3207).saturating_mul(c.into()))
}
/// Storage: ForeignAssets Asset (r:1 w:1)
/// Proof: ForeignAssets Asset (max_values: None, max_size: Some(808), added: 3283, mode: MaxEncodedLen)
/// Storage: ForeignAssets Approvals (r:1001 w:1000)
/// Proof: ForeignAssets Approvals (max_values: None, max_size: Some(746), added: 3221, mode: MaxEncodedLen)
/// The range of component `a` is `[0, 1000]`.
/// The range of component `a` is `[0, 1000]`.
fn destroy_approvals(a: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `413 + a * (86 ±0)`
// Estimated: `4273 + a * (3221 ±0)`
// Minimum execution time: 20_028_000 picoseconds.
Weight::from_parts(20_148_000, 0)
.saturating_add(Weight::from_parts(0, 4273))
// Standard Error: 3_401
.saturating_add(Weight::from_parts(13_897_319, 0).saturating_mul(a.into()))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(a.into())))
.saturating_add(T::DbWeight::get().writes(1))
.saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(a.into())))
.saturating_add(Weight::from_parts(0, 3221).saturating_mul(a.into()))
}
/// Storage: `ForeignAssets::Asset` (r:1 w:1)
/// Proof: `ForeignAssets::Asset` (`max_values`: None, `max_size`: Some(808), added: 3283, mode: `MaxEncodedLen`)
/// Storage: `ForeignAssets::Metadata` (r:1 w:0)
/// Proof: `ForeignAssets::Metadata` (`max_values`: None, `max_size`: Some(738), added: 3213, mode: `MaxEncodedLen`)
fn finish_destroy() -> Weight {
// Proof Size summary in bytes:
// Measured: `242`
// Estimated: `4273`
// Minimum execution time: 15_949_000 picoseconds.
Weight::from_parts(16_241_000, 0)
.saturating_add(Weight::from_parts(0, 4273))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `ForeignAssets::Asset` (r:1 w:1)
/// Proof: `ForeignAssets::Asset` (`max_values`: None, `max_size`: Some(808), added: 3283, mode: `MaxEncodedLen`)
/// Storage: `ForeignAssets::Account` (r:1 w:1)
/// Proof: `ForeignAssets::Account` (`max_values`: None, `max_size`: Some(732), added: 3207, mode: `MaxEncodedLen`)
fn mint() -> Weight {
// Proof Size summary in bytes:
// Measured: `242`
// Estimated: `4273`
// Minimum execution time: 27_156_000 picoseconds.
Weight::from_parts(28_182_000, 0)
.saturating_add(Weight::from_parts(0, 4273))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(2))
}
/// Storage: `ForeignAssets::Asset` (r:1 w:1)
/// Proof: `ForeignAssets::Asset` (`max_values`: None, `max_size`: Some(808), added: 3283, mode: `MaxEncodedLen`)
/// Storage: `ForeignAssets::Account` (r:1 w:1)
/// Proof: `ForeignAssets::Account` (`max_values`: None, `max_size`: Some(732), added: 3207, mode: `MaxEncodedLen`)
fn burn() -> Weight {
// Proof Size summary in bytes:
// Measured: `350`
// Estimated: `4273`
// Minimum execution time: 33_503_000 picoseconds.
Weight::from_parts(33_860_000, 0)
.saturating_add(Weight::from_parts(0, 4273))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(2))
}
/// Storage: `ForeignAssets::Asset` (r:1 w:1)
/// Proof: `ForeignAssets::Asset` (`max_values`: None, `max_size`: Some(808), added: 3283, mode: `MaxEncodedLen`)
/// Storage: `ForeignAssets::Account` (r:2 w:2)
/// Proof: `ForeignAssets::Account` (`max_values`: None, `max_size`: Some(732), added: 3207, mode: `MaxEncodedLen`)
/// Storage: `System::Account` (r:1 w:1)
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
fn transfer() -> Weight {
// Proof Size summary in bytes:
// Measured: `350`
// Estimated: `7404`
// Minimum execution time: 45_065_000 picoseconds.
Weight::from_parts(45_856_000, 0)
.saturating_add(Weight::from_parts(0, 7404))
.saturating_add(T::DbWeight::get().reads(4))
.saturating_add(T::DbWeight::get().writes(4))
}
/// Storage: `ForeignAssets::Asset` (r:1 w:1)
/// Proof: `ForeignAssets::Asset` (`max_values`: None, `max_size`: Some(808), added: 3283, mode: `MaxEncodedLen`)
/// Storage: `ForeignAssets::Account` (r:2 w:2)
/// Proof: `ForeignAssets::Account` (`max_values`: None, `max_size`: Some(732), added: 3207, mode: `MaxEncodedLen`)
/// Storage: `System::Account` (r:1 w:1)
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
fn transfer_keep_alive() -> Weight {
// Proof Size summary in bytes:
// Measured: `350`
// Estimated: `7404`
// Minimum execution time: 39_913_000 picoseconds.
Weight::from_parts(40_791_000, 0)
.saturating_add(Weight::from_parts(0, 7404))
.saturating_add(T::DbWeight::get().reads(4))
.saturating_add(T::DbWeight::get().writes(4))
}
/// Storage: `ForeignAssets::Asset` (r:1 w:1)
/// Proof: `ForeignAssets::Asset` (`max_values`: None, `max_size`: Some(808), added: 3283, mode: `MaxEncodedLen`)
/// Storage: `ForeignAssets::Account` (r:2 w:2)
/// Proof: `ForeignAssets::Account` (`max_values`: None, `max_size`: Some(732), added: 3207, mode: `MaxEncodedLen`)
/// Storage: `System::Account` (r:1 w:1)
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
fn force_transfer() -> Weight {
// Proof Size summary in bytes:
// Measured: `350`
// Estimated: `7404`
// Minimum execution time: 45_337_000 picoseconds.
Weight::from_parts(45_980_000, 0)
.saturating_add(Weight::from_parts(0, 7404))
.saturating_add(T::DbWeight::get().reads(4))
.saturating_add(T::DbWeight::get().writes(4))
}
/// Storage: `ForeignAssets::Asset` (r:1 w:0)
/// Proof: `ForeignAssets::Asset` (`max_values`: None, `max_size`: Some(808), added: 3283, mode: `MaxEncodedLen`)
/// Storage: `ForeignAssets::Account` (r:1 w:1)
/// Proof: `ForeignAssets::Account` (`max_values`: None, `max_size`: Some(732), added: 3207, mode: `MaxEncodedLen`)
fn freeze() -> Weight {
// Proof Size summary in bytes:
// Measured: `350`
// Estimated: `4273`
// Minimum execution time: 19_012_000 picoseconds.
Weight::from_parts(19_326_000, 0)
.saturating_add(Weight::from_parts(0, 4273))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `ForeignAssets::Asset` (r:1 w:0)
/// Proof: `ForeignAssets::Asset` (`max_values`: None, `max_size`: Some(808), added: 3283, mode: `MaxEncodedLen`)
/// Storage: `ForeignAssets::Account` (r:1 w:1)
/// Proof: `ForeignAssets::Account` (`max_values`: None, `max_size`: Some(732), added: 3207, mode: `MaxEncodedLen`)
fn thaw() -> Weight {
// Proof Size summary in bytes:
// Measured: `350`
// Estimated: `4273`
// Minimum execution time: 18_656_000 picoseconds.
Weight::from_parts(19_205_000, 0)
.saturating_add(Weight::from_parts(0, 4273))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `ForeignAssets::Asset` (r:1 w:1)
/// Proof: `ForeignAssets::Asset` (`max_values`: None, `max_size`: Some(808), added: 3283, mode: `MaxEncodedLen`)
fn freeze_asset() -> Weight {
// Proof Size summary in bytes:
// Measured: `276`
// Estimated: `4273`
// Minimum execution time: 15_440_000 picoseconds.
Weight::from_parts(15_825_000, 0)
.saturating_add(Weight::from_parts(0, 4273))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `ForeignAssets::Asset` (r:1 w:1)
/// Proof: `ForeignAssets::Asset` (`max_values`: None, `max_size`: Some(808), added: 3283, mode: `MaxEncodedLen`)
fn thaw_asset() -> Weight {
// Proof Size summary in bytes:
// Measured: `276`
// Estimated: `4273`
// Minimum execution time: 15_465_000 picoseconds.
Weight::from_parts(15_769_000, 0)
.saturating_add(Weight::from_parts(0, 4273))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `ForeignAssets::Asset` (r:1 w:1)
/// Proof: `ForeignAssets::Asset` (`max_values`: None, `max_size`: Some(808), added: 3283, mode: `MaxEncodedLen`)
/// Storage: `ForeignAssets::Metadata` (r:1 w:0)
/// Proof: `ForeignAssets::Metadata` (`max_values`: None, `max_size`: Some(738), added: 3213, mode: `MaxEncodedLen`)
fn transfer_ownership() -> Weight {
// Proof Size summary in bytes:
// Measured: `242`
// Estimated: `4273`
// Minimum execution time: 16_579_000 picoseconds.
Weight::from_parts(16_931_000, 0)
.saturating_add(Weight::from_parts(0, 4273))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `ForeignAssets::Asset` (r:1 w:1)
/// Proof: `ForeignAssets::Asset` (`max_values`: None, `max_size`: Some(808), added: 3283, mode: `MaxEncodedLen`)
fn set_team() -> Weight {
// Proof Size summary in bytes:
// Measured: `242`
// Estimated: `4273`
// Minimum execution time: 15_138_000 picoseconds.
Weight::from_parts(15_435_000, 0)
.saturating_add(Weight::from_parts(0, 4273))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: ForeignAssets Asset (r:1 w:0)
/// Proof: ForeignAssets Asset (max_values: None, max_size: Some(808), added: 3283, mode: MaxEncodedLen)
/// Storage: ForeignAssets Metadata (r:1 w:1)
/// Proof: ForeignAssets Metadata (max_values: None, max_size: Some(738), added: 3213, mode: MaxEncodedLen)
/// The range of component `n` is `[0, 50]`.
/// The range of component `s` is `[0, 50]`.
/// The range of component `n` is `[0, 50]`.
/// The range of component `s` is `[0, 50]`.
fn set_metadata(_n: u32, _s: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `242`
// Estimated: `4273`
// Minimum execution time: 29_846_000 picoseconds.
Weight::from_parts(31_607_649, 0)
.saturating_add(Weight::from_parts(0, 4273))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `ForeignAssets::Asset` (r:1 w:0)
/// Proof: `ForeignAssets::Asset` (`max_values`: None, `max_size`: Some(808), added: 3283, mode: `MaxEncodedLen`)
/// Storage: `ForeignAssets::Metadata` (r:1 w:1)
/// Proof: `ForeignAssets::Metadata` (`max_values`: None, `max_size`: Some(738), added: 3213, mode: `MaxEncodedLen`)
fn clear_metadata() -> Weight {
// Proof Size summary in bytes:
// Measured: `406`
// Estimated: `4273`
// Minimum execution time: 30_582_000 picoseconds.
Weight::from_parts(31_008_000, 0)
.saturating_add(Weight::from_parts(0, 4273))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: ForeignAssets Asset (r:1 w:0)
/// Proof: ForeignAssets Asset (max_values: None, max_size: Some(808), added: 3283, mode: MaxEncodedLen)
/// Storage: ForeignAssets Metadata (r:1 w:1)
/// Proof: ForeignAssets Metadata (max_values: None, max_size: Some(738), added: 3213, mode: MaxEncodedLen)
/// The range of component `n` is `[0, 50]`.
/// The range of component `s` is `[0, 50]`.
/// The range of component `n` is `[0, 50]`.
/// The range of component `s` is `[0, 50]`.
fn force_set_metadata(_n: u32, s: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `81`
// Estimated: `4273`
// Minimum execution time: 14_186_000 picoseconds.
Weight::from_parts(14_717_332, 0)
.saturating_add(Weight::from_parts(0, 4273))
// Standard Error: 517
.saturating_add(Weight::from_parts(2_595, 0).saturating_mul(s.into()))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `ForeignAssets::Asset` (r:1 w:0)
/// Proof: `ForeignAssets::Asset` (`max_values`: None, `max_size`: Some(808), added: 3283, mode: `MaxEncodedLen`)
/// Storage: `ForeignAssets::Metadata` (r:1 w:1)
/// Proof: `ForeignAssets::Metadata` (`max_values`: None, `max_size`: Some(738), added: 3213, mode: `MaxEncodedLen`)
fn force_clear_metadata() -> Weight {
// Proof Size summary in bytes:
// Measured: `406`
// Estimated: `4273`
// Minimum execution time: 29_499_000 picoseconds.
Weight::from_parts(29_918_000, 0)
.saturating_add(Weight::from_parts(0, 4273))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `ForeignAssets::Asset` (r:1 w:1)
/// Proof: `ForeignAssets::Asset` (`max_values`: None, `max_size`: Some(808), added: 3283, mode: `MaxEncodedLen`)
fn force_asset_status() -> Weight {
// Proof Size summary in bytes:
// Measured: `242`
// Estimated: `4273`
// Minimum execution time: 13_815_000 picoseconds.
Weight::from_parts(14_138_000, 0)
.saturating_add(Weight::from_parts(0, 4273))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `ForeignAssets::Asset` (r:1 w:1)
/// Proof: `ForeignAssets::Asset` (`max_values`: None, `max_size`: Some(808), added: 3283, mode: `MaxEncodedLen`)
/// Storage: `ForeignAssets::Approvals` (r:1 w:1)
/// Proof: `ForeignAssets::Approvals` (`max_values`: None, `max_size`: Some(746), added: 3221, mode: `MaxEncodedLen`)
fn approve_transfer() -> Weight {
// Proof Size summary in bytes:
// Measured: `276`
// Estimated: `4273`
// Minimum execution time: 33_029_000 picoseconds.
Weight::from_parts(33_524_000, 0)
.saturating_add(Weight::from_parts(0, 4273))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(2))
}
/// Storage: `ForeignAssets::Asset` (r:1 w:1)
/// Proof: `ForeignAssets::Asset` (`max_values`: None, `max_size`: Some(808), added: 3283, mode: `MaxEncodedLen`)
/// Storage: `ForeignAssets::Approvals` (r:1 w:1)
/// Proof: `ForeignAssets::Approvals` (`max_values`: None, `max_size`: Some(746), added: 3221, mode: `MaxEncodedLen`)
/// Storage: `ForeignAssets::Account` (r:2 w:2)
/// Proof: `ForeignAssets::Account` (`max_values`: None, `max_size`: Some(732), added: 3207, mode: `MaxEncodedLen`)
/// Storage: `System::Account` (r:1 w:1)
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
fn transfer_approved() -> Weight {
// Proof Size summary in bytes:
// Measured: `520`
// Estimated: `7404`
// Minimum execution time: 63_205_000 picoseconds.
Weight::from_parts(64_078_000, 0)
.saturating_add(Weight::from_parts(0, 7404))
.saturating_add(T::DbWeight::get().reads(5))
.saturating_add(T::DbWeight::get().writes(5))
}
/// Storage: `ForeignAssets::Asset` (r:1 w:1)
/// Proof: `ForeignAssets::Asset` (`max_values`: None, `max_size`: Some(808), added: 3283, mode: `MaxEncodedLen`)
/// Storage: `ForeignAssets::Approvals` (r:1 w:1)
/// Proof: `ForeignAssets::Approvals` (`max_values`: None, `max_size`: Some(746), added: 3221, mode: `MaxEncodedLen`)
fn cancel_approval() -> Weight {
// Proof Size summary in bytes:
// Measured: `446`
// Estimated: `4273`
// Minimum execution time: 34_948_000 picoseconds.
Weight::from_parts(35_484_000, 0)
.saturating_add(Weight::from_parts(0, 4273))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(2))
}
/// Storage: `ForeignAssets::Asset` (r:1 w:1)
/// Proof: `ForeignAssets::Asset` (`max_values`: None, `max_size`: Some(808), added: 3283, mode: `MaxEncodedLen`)
/// Storage: `ForeignAssets::Approvals` (r:1 w:1)
/// Proof: `ForeignAssets::Approvals` (`max_values`: None, `max_size`: Some(746), added: 3221, mode: `MaxEncodedLen`)
fn force_cancel_approval() -> Weight {
// Proof Size summary in bytes:
// Measured: `446`
// Estimated: `4273`
// Minimum execution time: 35_722_000 picoseconds.
Weight::from_parts(36_266_000, 0)
.saturating_add(Weight::from_parts(0, 4273))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(2))
}
/// Storage: `ForeignAssets::Asset` (r:1 w:1)
/// Proof: `ForeignAssets::Asset` (`max_values`: None, `max_size`: Some(808), added: 3283, mode: `MaxEncodedLen`)
fn set_min_balance() -> Weight {
// Proof Size summary in bytes:
// Measured: `242`
// Estimated: `4273`
// Minimum execution time: 15_855_000 picoseconds.
Weight::from_parts(16_182_000, 0)
.saturating_add(Weight::from_parts(0, 4273))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `ForeignAssets::Account` (r:1 w:1)
/// Proof: `ForeignAssets::Account` (`max_values`: None, `max_size`: Some(732), added: 3207, mode: `MaxEncodedLen`)
/// Storage: `ForeignAssets::Asset` (r:1 w:1)
/// Proof: `ForeignAssets::Asset` (`max_values`: None, `max_size`: Some(808), added: 3283, mode: `MaxEncodedLen`)
/// Storage: `System::Account` (r:1 w:1)
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
fn touch() -> Weight {
// Proof Size summary in bytes:
// Measured: `345`
// Estimated: `4273`
// Minimum execution time: 34_984_000 picoseconds.
Weight::from_parts(35_512_000, 0)
.saturating_add(Weight::from_parts(0, 4273))
.saturating_add(T::DbWeight::get().reads(3))
.saturating_add(T::DbWeight::get().writes(3))
}
/// Storage: `ForeignAssets::Account` (r:1 w:1)
/// Proof: `ForeignAssets::Account` (`max_values`: None, `max_size`: Some(732), added: 3207, mode: `MaxEncodedLen`)
/// Storage: `ForeignAssets::Asset` (r:1 w:1)
/// Proof: `ForeignAssets::Asset` (`max_values`: None, `max_size`: Some(808), added: 3283, mode: `MaxEncodedLen`)
fn touch_other() -> Weight {
// Proof Size summary in bytes:
// Measured: `242`
// Estimated: `4273`
// Minimum execution time: 33_041_000 picoseconds.
Weight::from_parts(34_124_000, 0)
.saturating_add(Weight::from_parts(0, 4273))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(2))
}
/// Storage: `ForeignAssets::Account` (r:1 w:1)
/// Proof: `ForeignAssets::Account` (`max_values`: None, `max_size`: Some(732), added: 3207, mode: `MaxEncodedLen`)
/// Storage: `ForeignAssets::Asset` (r:1 w:1)
/// Proof: `ForeignAssets::Asset` (`max_values`: None, `max_size`: Some(808), added: 3283, mode: `MaxEncodedLen`)
/// Storage: `System::Account` (r:1 w:1)
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
fn refund() -> Weight {
// Proof Size summary in bytes:
// Measured: `471`
// Estimated: `4273`
// Minimum execution time: 31_728_000 picoseconds.
Weight::from_parts(32_012_000, 0)
.saturating_add(Weight::from_parts(0, 4273))
.saturating_add(T::DbWeight::get().reads(3))
.saturating_add(T::DbWeight::get().writes(3))
}
/// Storage: `ForeignAssets::Account` (r:1 w:1)
/// Proof: `ForeignAssets::Account` (`max_values`: None, `max_size`: Some(732), added: 3207, mode: `MaxEncodedLen`)
/// Storage: `ForeignAssets::Asset` (r:1 w:1)
/// Proof: `ForeignAssets::Asset` (`max_values`: None, `max_size`: Some(808), added: 3283, mode: `MaxEncodedLen`)
fn refund_other() -> Weight {
// Proof Size summary in bytes:
// Measured: `401`
// Estimated: `4273`
// Minimum execution time: 29_432_000 picoseconds.
Weight::from_parts(29_968_000, 0)
.saturating_add(Weight::from_parts(0, 4273))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(2))
}
/// Storage: `ForeignAssets::Asset` (r:1 w:0)
/// Proof: `ForeignAssets::Asset` (`max_values`: None, `max_size`: Some(808), added: 3283, mode: `MaxEncodedLen`)
/// Storage: `ForeignAssets::Account` (r:1 w:1)
/// Proof: `ForeignAssets::Account` (`max_values`: None, `max_size`: Some(732), added: 3207, mode: `MaxEncodedLen`)
fn block() -> Weight {
// Proof Size summary in bytes:
// Measured: `350`
// Estimated: `4273`
// Minimum execution time: 18_827_000 picoseconds.
Weight::from_parts(19_172_000, 0)
.saturating_add(Weight::from_parts(0, 4273))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(1))
}
}
@@ -0,0 +1,531 @@
// Copyright (C) Parity Technologies (UK) Ltd.
// This file is part of Cumulus.
// Cumulus is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Cumulus is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
//! Autogenerated weights for `pallet_assets`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
//! DATE: 2023-07-31, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `runner-ynta1nyy-project-238-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz`
//! EXECUTION: ``, WASM-EXECUTION: `Compiled`, CHAIN: `Some("asset-hub-rococo-dev")`, DB CACHE: 1024
// Executed Command:
// ./target/production/polkadot-parachain
// benchmark
// pallet
// --chain=asset-hub-rococo-dev
// --wasm-execution=compiled
// --pallet=pallet_assets
// --no-storage-info
// --no-median-slopes
// --no-min-squares
// --extrinsic=*
// --steps=50
// --repeat=20
// --json
// --header=./file_header.txt
// --output=./parachains/runtimes/assets/asset-hub-rococo/src/weights/
#![cfg_attr(rustfmt, rustfmt_skip)]
#![allow(unused_parens)]
#![allow(unused_imports)]
#![allow(missing_docs)]
use frame_support::{traits::Get, weights::Weight};
use core::marker::PhantomData;
/// Weight functions for `pallet_assets`.
pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Config> pallet_assets::WeightInfo for WeightInfo<T> {
/// Storage: `Assets::Asset` (r:1 w:1)
/// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
/// Storage: `System::Account` (r:1 w:1)
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
fn create() -> Weight {
// Proof Size summary in bytes:
// Measured: `109`
// Estimated: `3675`
// Minimum execution time: 26_510_000 picoseconds.
Weight::from_parts(27_332_000, 0)
.saturating_add(Weight::from_parts(0, 3675))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(2))
}
/// Storage: `Assets::Asset` (r:1 w:1)
/// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
fn force_create() -> Weight {
// Proof Size summary in bytes:
// Measured: `6`
// Estimated: `3675`
// Minimum execution time: 10_899_000 picoseconds.
Weight::from_parts(11_395_000, 0)
.saturating_add(Weight::from_parts(0, 3675))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `Assets::Asset` (r:1 w:1)
/// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
fn start_destroy() -> Weight {
// Proof Size summary in bytes:
// Measured: `277`
// Estimated: `3675`
// Minimum execution time: 13_593_000 picoseconds.
Weight::from_parts(14_108_000, 0)
.saturating_add(Weight::from_parts(0, 3675))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `Assets::Asset` (r:1 w:1)
/// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
/// Storage: `Assets::Account` (r:1001 w:1000)
/// Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`)
/// Storage: `System::Account` (r:1000 w:1000)
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
/// The range of component `c` is `[0, 1000]`.
/// The range of component `c` is `[0, 1000]`.
fn destroy_accounts(c: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `0 + c * (208 ±0)`
// Estimated: `3675 + c * (2609 ±0)`
// Minimum execution time: 16_216_000 picoseconds.
Weight::from_parts(16_636_000, 0)
.saturating_add(Weight::from_parts(0, 3675))
// Standard Error: 9_346
.saturating_add(Weight::from_parts(15_306_152, 0).saturating_mul(c.into()))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().reads((2_u64).saturating_mul(c.into())))
.saturating_add(T::DbWeight::get().writes(1))
.saturating_add(T::DbWeight::get().writes((2_u64).saturating_mul(c.into())))
.saturating_add(Weight::from_parts(0, 2609).saturating_mul(c.into()))
}
/// Storage: `Assets::Asset` (r:1 w:1)
/// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
/// Storage: `Assets::Approvals` (r:1001 w:1000)
/// Proof: `Assets::Approvals` (`max_values`: None, `max_size`: Some(148), added: 2623, mode: `MaxEncodedLen`)
/// The range of component `a` is `[0, 1000]`.
/// The range of component `a` is `[0, 1000]`.
fn destroy_approvals(a: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `414 + a * (86 ±0)`
// Estimated: `3675 + a * (2623 ±0)`
// Minimum execution time: 16_745_000 picoseconds.
Weight::from_parts(17_247_000, 0)
.saturating_add(Weight::from_parts(0, 3675))
.saturating_add(Weight::from_parts(15_634_963, 0).saturating_mul(a.into()))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(a.into())))
.saturating_add(T::DbWeight::get().writes(1))
.saturating_add(Weight::from_parts(0, 2623).saturating_mul(a.into()))
}
/// Storage: `Assets::Asset` (r:1 w:1)
/// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
/// Storage: `Assets::Metadata` (r:1 w:0)
/// Proof: `Assets::Metadata` (`max_values`: None, `max_size`: Some(140), added: 2615, mode: `MaxEncodedLen`)
fn finish_destroy() -> Weight {
// Proof Size summary in bytes:
// Measured: `243`
// Estimated: `3675`
// Minimum execution time: 13_650_000 picoseconds.
Weight::from_parts(14_721_000, 0)
.saturating_add(Weight::from_parts(0, 3675))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `Assets::Asset` (r:1 w:1)
/// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
/// Storage: `Assets::Account` (r:1 w:1)
/// Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`)
fn mint() -> Weight {
// Proof Size summary in bytes:
// Measured: `243`
// Estimated: `3675`
// Minimum execution time: 24_121_000 picoseconds.
Weight::from_parts(25_023_000, 0)
.saturating_add(Weight::from_parts(0, 3675))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(2))
}
/// Storage: `Assets::Asset` (r:1 w:1)
/// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
/// Storage: `Assets::Account` (r:1 w:1)
/// Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`)
fn burn() -> Weight {
// Proof Size summary in bytes:
// Measured: `351`
// Estimated: `3675`
// Minimum execution time: 31_414_000 picoseconds.
Weight::from_parts(32_235_000, 0)
.saturating_add(Weight::from_parts(0, 3675))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(2))
}
/// Storage: `Assets::Asset` (r:1 w:1)
/// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
/// Storage: `Assets::Account` (r:2 w:2)
/// Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`)
/// Storage: `System::Account` (r:1 w:1)
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
fn transfer() -> Weight {
// Proof Size summary in bytes:
// Measured: `351`
// Estimated: `6208`
// Minimum execution time: 43_114_000 picoseconds.
Weight::from_parts(44_106_000, 0)
.saturating_add(Weight::from_parts(0, 6208))
.saturating_add(T::DbWeight::get().reads(4))
.saturating_add(T::DbWeight::get().writes(4))
}
/// Storage: `Assets::Asset` (r:1 w:1)
/// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
/// Storage: `Assets::Account` (r:2 w:2)
/// Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`)
/// Storage: `System::Account` (r:1 w:1)
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
fn transfer_keep_alive() -> Weight {
// Proof Size summary in bytes:
// Measured: `351`
// Estimated: `6208`
// Minimum execution time: 37_954_000 picoseconds.
Weight::from_parts(38_772_000, 0)
.saturating_add(Weight::from_parts(0, 6208))
.saturating_add(T::DbWeight::get().reads(4))
.saturating_add(T::DbWeight::get().writes(4))
}
/// Storage: `Assets::Asset` (r:1 w:1)
/// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
/// Storage: `Assets::Account` (r:2 w:2)
/// Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`)
/// Storage: `System::Account` (r:1 w:1)
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
fn force_transfer() -> Weight {
// Proof Size summary in bytes:
// Measured: `351`
// Estimated: `6208`
// Minimum execution time: 43_051_000 picoseconds.
Weight::from_parts(44_003_000, 0)
.saturating_add(Weight::from_parts(0, 6208))
.saturating_add(T::DbWeight::get().reads(4))
.saturating_add(T::DbWeight::get().writes(4))
}
/// Storage: `Assets::Asset` (r:1 w:0)
/// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
/// Storage: `Assets::Account` (r:1 w:1)
/// Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`)
fn freeze() -> Weight {
// Proof Size summary in bytes:
// Measured: `351`
// Estimated: `3675`
// Minimum execution time: 17_048_000 picoseconds.
Weight::from_parts(17_614_000, 0)
.saturating_add(Weight::from_parts(0, 3675))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `Assets::Asset` (r:1 w:0)
/// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
/// Storage: `Assets::Account` (r:1 w:1)
/// Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`)
fn thaw() -> Weight {
// Proof Size summary in bytes:
// Measured: `351`
// Estimated: `3675`
// Minimum execution time: 16_705_000 picoseconds.
Weight::from_parts(17_581_000, 0)
.saturating_add(Weight::from_parts(0, 3675))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `Assets::Asset` (r:1 w:1)
/// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
fn freeze_asset() -> Weight {
// Proof Size summary in bytes:
// Measured: `277`
// Estimated: `3675`
// Minimum execution time: 13_284_000 picoseconds.
Weight::from_parts(13_735_000, 0)
.saturating_add(Weight::from_parts(0, 3675))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `Assets::Asset` (r:1 w:1)
/// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
fn thaw_asset() -> Weight {
// Proof Size summary in bytes:
// Measured: `277`
// Estimated: `3675`
// Minimum execution time: 13_030_000 picoseconds.
Weight::from_parts(13_417_000, 0)
.saturating_add(Weight::from_parts(0, 3675))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `Assets::Asset` (r:1 w:1)
/// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
/// Storage: `Assets::Metadata` (r:1 w:0)
/// Proof: `Assets::Metadata` (`max_values`: None, `max_size`: Some(140), added: 2615, mode: `MaxEncodedLen`)
fn transfer_ownership() -> Weight {
// Proof Size summary in bytes:
// Measured: `243`
// Estimated: `3675`
// Minimum execution time: 14_174_000 picoseconds.
Weight::from_parts(14_660_000, 0)
.saturating_add(Weight::from_parts(0, 3675))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `Assets::Asset` (r:1 w:1)
/// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
fn set_team() -> Weight {
// Proof Size summary in bytes:
// Measured: `243`
// Estimated: `3675`
// Minimum execution time: 12_737_000 picoseconds.
Weight::from_parts(13_172_000, 0)
.saturating_add(Weight::from_parts(0, 3675))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `Assets::Asset` (r:1 w:0)
/// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
/// Storage: `Assets::Metadata` (r:1 w:1)
/// Proof: `Assets::Metadata` (`max_values`: None, `max_size`: Some(140), added: 2615, mode: `MaxEncodedLen`)
/// The range of component `n` is `[0, 50]`.
/// The range of component `s` is `[0, 50]`.
/// The range of component `n` is `[0, 50]`.
/// The range of component `s` is `[0, 50]`.
fn set_metadata(n: u32, s: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `243`
// Estimated: `3675`
// Minimum execution time: 27_707_000 picoseconds.
Weight::from_parts(29_036_880, 0)
.saturating_add(Weight::from_parts(0, 3675))
// Standard Error: 688
.saturating_add(Weight::from_parts(2_426, 0).saturating_mul(n.into()))
// Standard Error: 688
.saturating_add(Weight::from_parts(776, 0).saturating_mul(s.into()))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `Assets::Asset` (r:1 w:0)
/// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
/// Storage: `Assets::Metadata` (r:1 w:1)
/// Proof: `Assets::Metadata` (`max_values`: None, `max_size`: Some(140), added: 2615, mode: `MaxEncodedLen`)
fn clear_metadata() -> Weight {
// Proof Size summary in bytes:
// Measured: `407`
// Estimated: `3675`
// Minimum execution time: 28_514_000 picoseconds.
Weight::from_parts(29_216_000, 0)
.saturating_add(Weight::from_parts(0, 3675))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `Assets::Asset` (r:1 w:0)
/// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
/// Storage: `Assets::Metadata` (r:1 w:1)
/// Proof: `Assets::Metadata` (`max_values`: None, `max_size`: Some(140), added: 2615, mode: `MaxEncodedLen`)
/// The range of component `n` is `[0, 50]`.
/// The range of component `s` is `[0, 50]`.
/// The range of component `n` is `[0, 50]`.
/// The range of component `s` is `[0, 50]`.
fn force_set_metadata(n: u32, s: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `82`
// Estimated: `3675`
// Minimum execution time: 12_452_000 picoseconds.
Weight::from_parts(13_095_356, 0)
.saturating_add(Weight::from_parts(0, 3675))
// Standard Error: 275
.saturating_add(Weight::from_parts(826, 0).saturating_mul(n.into()))
// Standard Error: 275
.saturating_add(Weight::from_parts(808, 0).saturating_mul(s.into()))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `Assets::Asset` (r:1 w:0)
/// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
/// Storage: `Assets::Metadata` (r:1 w:1)
/// Proof: `Assets::Metadata` (`max_values`: None, `max_size`: Some(140), added: 2615, mode: `MaxEncodedLen`)
fn force_clear_metadata() -> Weight {
// Proof Size summary in bytes:
// Measured: `407`
// Estimated: `3675`
// Minimum execution time: 28_181_000 picoseconds.
Weight::from_parts(29_050_000, 0)
.saturating_add(Weight::from_parts(0, 3675))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `Assets::Asset` (r:1 w:1)
/// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
fn force_asset_status() -> Weight {
// Proof Size summary in bytes:
// Measured: `243`
// Estimated: `3675`
// Minimum execution time: 12_253_000 picoseconds.
Weight::from_parts(12_545_000, 0)
.saturating_add(Weight::from_parts(0, 3675))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `Assets::Asset` (r:1 w:1)
/// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
/// Storage: `Assets::Approvals` (r:1 w:1)
/// Proof: `Assets::Approvals` (`max_values`: None, `max_size`: Some(148), added: 2623, mode: `MaxEncodedLen`)
fn approve_transfer() -> Weight {
// Proof Size summary in bytes:
// Measured: `277`
// Estimated: `3675`
// Minimum execution time: 31_084_000 picoseconds.
Weight::from_parts(32_052_000, 0)
.saturating_add(Weight::from_parts(0, 3675))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(2))
}
/// Storage: `Assets::Asset` (r:1 w:1)
/// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
/// Storage: `Assets::Approvals` (r:1 w:1)
/// Proof: `Assets::Approvals` (`max_values`: None, `max_size`: Some(148), added: 2623, mode: `MaxEncodedLen`)
/// Storage: `Assets::Account` (r:2 w:2)
/// Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`)
/// Storage: `System::Account` (r:1 w:1)
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
fn transfer_approved() -> Weight {
// Proof Size summary in bytes:
// Measured: `521`
// Estimated: `6208`
// Minimum execution time: 61_756_000 picoseconds.
Weight::from_parts(62_740_000, 0)
.saturating_add(Weight::from_parts(0, 6208))
.saturating_add(T::DbWeight::get().reads(5))
.saturating_add(T::DbWeight::get().writes(5))
}
/// Storage: `Assets::Asset` (r:1 w:1)
/// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
/// Storage: `Assets::Approvals` (r:1 w:1)
/// Proof: `Assets::Approvals` (`max_values`: None, `max_size`: Some(148), added: 2623, mode: `MaxEncodedLen`)
fn cancel_approval() -> Weight {
// Proof Size summary in bytes:
// Measured: `447`
// Estimated: `3675`
// Minimum execution time: 33_370_000 picoseconds.
Weight::from_parts(34_127_000, 0)
.saturating_add(Weight::from_parts(0, 3675))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(2))
}
/// Storage: `Assets::Asset` (r:1 w:1)
/// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
/// Storage: `Assets::Approvals` (r:1 w:1)
/// Proof: `Assets::Approvals` (`max_values`: None, `max_size`: Some(148), added: 2623, mode: `MaxEncodedLen`)
fn force_cancel_approval() -> Weight {
// Proof Size summary in bytes:
// Measured: `447`
// Estimated: `3675`
// Minimum execution time: 33_753_000 picoseconds.
Weight::from_parts(34_613_000, 0)
.saturating_add(Weight::from_parts(0, 3675))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(2))
}
/// Storage: `Assets::Asset` (r:1 w:1)
/// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
fn set_min_balance() -> Weight {
// Proof Size summary in bytes:
// Measured: `243`
// Estimated: `3675`
// Minimum execution time: 13_508_000 picoseconds.
Weight::from_parts(13_997_000, 0)
.saturating_add(Weight::from_parts(0, 3675))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `Assets::Account` (r:1 w:1)
/// Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`)
/// Storage: `Assets::Asset` (r:1 w:1)
/// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
/// Storage: `System::Account` (r:1 w:1)
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
fn touch() -> Weight {
// Proof Size summary in bytes:
// Measured: `346`
// Estimated: `3675`
// Minimum execution time: 32_578_000 picoseconds.
Weight::from_parts(33_675_000, 0)
.saturating_add(Weight::from_parts(0, 3675))
.saturating_add(T::DbWeight::get().reads(3))
.saturating_add(T::DbWeight::get().writes(3))
}
/// Storage: `Assets::Account` (r:1 w:1)
/// Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`)
/// Storage: `Assets::Asset` (r:1 w:1)
/// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
fn touch_other() -> Weight {
// Proof Size summary in bytes:
// Measured: `243`
// Estimated: `3675`
// Minimum execution time: 30_768_000 picoseconds.
Weight::from_parts(31_710_000, 0)
.saturating_add(Weight::from_parts(0, 3675))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(2))
}
/// Storage: `Assets::Account` (r:1 w:1)
/// Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`)
/// Storage: `Assets::Asset` (r:1 w:1)
/// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
/// Storage: `System::Account` (r:1 w:1)
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
fn refund() -> Weight {
// Proof Size summary in bytes:
// Measured: `472`
// Estimated: `3675`
// Minimum execution time: 30_028_000 picoseconds.
Weight::from_parts(30_793_000, 0)
.saturating_add(Weight::from_parts(0, 3675))
.saturating_add(T::DbWeight::get().reads(3))
.saturating_add(T::DbWeight::get().writes(3))
}
/// Storage: `Assets::Account` (r:1 w:1)
/// Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`)
/// Storage: `Assets::Asset` (r:1 w:1)
/// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
fn refund_other() -> Weight {
// Proof Size summary in bytes:
// Measured: `402`
// Estimated: `3675`
// Minimum execution time: 28_354_000 picoseconds.
Weight::from_parts(29_097_000, 0)
.saturating_add(Weight::from_parts(0, 3675))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(2))
}
/// Storage: `Assets::Asset` (r:1 w:0)
/// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
/// Storage: `Assets::Account` (r:1 w:1)
/// Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`)
fn block() -> Weight {
// Proof Size summary in bytes:
// Measured: `351`
// Estimated: `3675`
// Minimum execution time: 16_607_000 picoseconds.
Weight::from_parts(17_433_000, 0)
.saturating_add(Weight::from_parts(0, 3675))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(1))
}
}
@@ -0,0 +1,531 @@
// Copyright (C) Parity Technologies (UK) Ltd.
// This file is part of Cumulus.
// Cumulus is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Cumulus is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
//! Autogenerated weights for `pallet_assets`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
//! DATE: 2023-07-27, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `runner-ynta1nyy-project-238-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz`
//! EXECUTION: ``, WASM-EXECUTION: `Compiled`, CHAIN: `Some("asset-hub-rococo-dev")`, DB CACHE: 1024
// Executed Command:
// target/production/polkadot-parachain
// benchmark
// pallet
// --steps=50
// --repeat=20
// --extrinsic=*
// --wasm-execution=compiled
// --heap-pages=4096
// --json-file=/builds/parity/mirrors/cumulus/.git/.artifacts/bench.json
// --pallet=pallet_assets
// --chain=asset-hub-rococo-dev
// --header=./file_header.txt
// --output=./parachains/runtimes/assets/asset-hub-rococo/src/weights/
#![cfg_attr(rustfmt, rustfmt_skip)]
#![allow(unused_parens)]
#![allow(unused_imports)]
#![allow(missing_docs)]
use frame_support::{traits::Get, weights::Weight};
use core::marker::PhantomData;
/// Weight functions for `pallet_assets`.
pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Config> pallet_assets::WeightInfo for WeightInfo<T> {
/// Storage: `PoolAssets::Asset` (r:1 w:1)
/// Proof: `PoolAssets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
fn create() -> Weight {
// Proof Size summary in bytes:
// Measured: `42`
// Estimated: `3675`
// Minimum execution time: 11_591_000 picoseconds.
Weight::from_parts(11_901_000, 0)
.saturating_add(Weight::from_parts(0, 3675))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `PoolAssets::Asset` (r:1 w:1)
/// Proof: `PoolAssets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
fn force_create() -> Weight {
// Proof Size summary in bytes:
// Measured: `42`
// Estimated: `3675`
// Minimum execution time: 11_184_000 picoseconds.
Weight::from_parts(11_640_000, 0)
.saturating_add(Weight::from_parts(0, 3675))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `PoolAssets::Asset` (r:1 w:1)
/// Proof: `PoolAssets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
fn start_destroy() -> Weight {
// Proof Size summary in bytes:
// Measured: `314`
// Estimated: `3675`
// Minimum execution time: 13_809_000 picoseconds.
Weight::from_parts(14_226_000, 0)
.saturating_add(Weight::from_parts(0, 3675))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `PoolAssets::Asset` (r:1 w:1)
/// Proof: `PoolAssets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
/// Storage: `PoolAssets::Account` (r:1001 w:1000)
/// Proof: `PoolAssets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`)
/// Storage: `System::Account` (r:1000 w:1000)
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
/// The range of component `c` is `[0, 1000]`.
/// The range of component `c` is `[0, 1000]`.
/// The range of component `c` is `[0, 1000]`.
fn destroy_accounts(c: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `0 + c * (208 ±0)`
// Estimated: `3675 + c * (2609 ±0)`
// Minimum execution time: 16_439_000 picoseconds.
Weight::from_parts(16_743_000, 0)
.saturating_add(Weight::from_parts(0, 3675))
// Standard Error: 4_792
.saturating_add(Weight::from_parts(14_463_991, 0).saturating_mul(c.into()))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().reads((2_u64).saturating_mul(c.into())))
.saturating_add(T::DbWeight::get().writes(1))
.saturating_add(T::DbWeight::get().writes((2_u64).saturating_mul(c.into())))
.saturating_add(Weight::from_parts(0, 2609).saturating_mul(c.into()))
}
/// Storage: `PoolAssets::Asset` (r:1 w:1)
/// Proof: `PoolAssets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
/// Storage: `PoolAssets::Approvals` (r:1001 w:1000)
/// Proof: `PoolAssets::Approvals` (`max_values`: None, `max_size`: Some(148), added: 2623, mode: `MaxEncodedLen`)
/// The range of component `a` is `[0, 1000]`.
/// The range of component `a` is `[0, 1000]`.
/// The range of component `a` is `[0, 1000]`.
fn destroy_approvals(a: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `451 + a * (86 ±0)`
// Estimated: `3675 + a * (2623 ±0)`
// Minimum execution time: 17_218_000 picoseconds.
Weight::from_parts(17_585_000, 0)
.saturating_add(Weight::from_parts(0, 3675))
// Standard Error: 2_056
.saturating_add(Weight::from_parts(5_323_866, 0).saturating_mul(a.into()))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(a.into())))
.saturating_add(T::DbWeight::get().writes(1))
.saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(a.into())))
.saturating_add(Weight::from_parts(0, 2623).saturating_mul(a.into()))
}
/// Storage: `PoolAssets::Asset` (r:1 w:1)
/// Proof: `PoolAssets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
/// Storage: `PoolAssets::Metadata` (r:1 w:0)
/// Proof: `PoolAssets::Metadata` (`max_values`: None, `max_size`: Some(140), added: 2615, mode: `MaxEncodedLen`)
fn finish_destroy() -> Weight {
// Proof Size summary in bytes:
// Measured: `280`
// Estimated: `3675`
// Minimum execution time: 13_848_000 picoseconds.
Weight::from_parts(14_325_000, 0)
.saturating_add(Weight::from_parts(0, 3675))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `PoolAssets::Asset` (r:1 w:1)
/// Proof: `PoolAssets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
/// Storage: `PoolAssets::Account` (r:1 w:1)
/// Proof: `PoolAssets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`)
fn mint() -> Weight {
// Proof Size summary in bytes:
// Measured: `280`
// Estimated: `3675`
// Minimum execution time: 24_904_000 picoseconds.
Weight::from_parts(25_607_000, 0)
.saturating_add(Weight::from_parts(0, 3675))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(2))
}
/// Storage: `PoolAssets::Asset` (r:1 w:1)
/// Proof: `PoolAssets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
/// Storage: `PoolAssets::Account` (r:1 w:1)
/// Proof: `PoolAssets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`)
fn burn() -> Weight {
// Proof Size summary in bytes:
// Measured: `388`
// Estimated: `3675`
// Minimum execution time: 31_477_000 picoseconds.
Weight::from_parts(32_338_000, 0)
.saturating_add(Weight::from_parts(0, 3675))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(2))
}
/// Storage: `PoolAssets::Asset` (r:1 w:1)
/// Proof: `PoolAssets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
/// Storage: `PoolAssets::Account` (r:2 w:2)
/// Proof: `PoolAssets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`)
/// Storage: `System::Account` (r:1 w:1)
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
fn transfer() -> Weight {
// Proof Size summary in bytes:
// Measured: `388`
// Estimated: `6208`
// Minimum execution time: 42_994_000 picoseconds.
Weight::from_parts(44_041_000, 0)
.saturating_add(Weight::from_parts(0, 6208))
.saturating_add(T::DbWeight::get().reads(4))
.saturating_add(T::DbWeight::get().writes(4))
}
/// Storage: `PoolAssets::Asset` (r:1 w:1)
/// Proof: `PoolAssets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
/// Storage: `PoolAssets::Account` (r:2 w:2)
/// Proof: `PoolAssets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`)
/// Storage: `System::Account` (r:1 w:1)
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
fn transfer_keep_alive() -> Weight {
// Proof Size summary in bytes:
// Measured: `388`
// Estimated: `6208`
// Minimum execution time: 37_551_000 picoseconds.
Weight::from_parts(38_648_000, 0)
.saturating_add(Weight::from_parts(0, 6208))
.saturating_add(T::DbWeight::get().reads(4))
.saturating_add(T::DbWeight::get().writes(4))
}
/// Storage: `PoolAssets::Asset` (r:1 w:1)
/// Proof: `PoolAssets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
/// Storage: `PoolAssets::Account` (r:2 w:2)
/// Proof: `PoolAssets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`)
/// Storage: `System::Account` (r:1 w:1)
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
fn force_transfer() -> Weight {
// Proof Size summary in bytes:
// Measured: `388`
// Estimated: `6208`
// Minimum execution time: 42_829_000 picoseconds.
Weight::from_parts(44_029_000, 0)
.saturating_add(Weight::from_parts(0, 6208))
.saturating_add(T::DbWeight::get().reads(4))
.saturating_add(T::DbWeight::get().writes(4))
}
/// Storage: `PoolAssets::Asset` (r:1 w:0)
/// Proof: `PoolAssets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
/// Storage: `PoolAssets::Account` (r:1 w:1)
/// Proof: `PoolAssets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`)
fn freeze() -> Weight {
// Proof Size summary in bytes:
// Measured: `388`
// Estimated: `3675`
// Minimum execution time: 17_304_000 picoseconds.
Weight::from_parts(17_782_000, 0)
.saturating_add(Weight::from_parts(0, 3675))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `PoolAssets::Asset` (r:1 w:0)
/// Proof: `PoolAssets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
/// Storage: `PoolAssets::Account` (r:1 w:1)
/// Proof: `PoolAssets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`)
fn thaw() -> Weight {
// Proof Size summary in bytes:
// Measured: `388`
// Estimated: `3675`
// Minimum execution time: 17_040_000 picoseconds.
Weight::from_parts(17_698_000, 0)
.saturating_add(Weight::from_parts(0, 3675))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `PoolAssets::Asset` (r:1 w:1)
/// Proof: `PoolAssets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
fn freeze_asset() -> Weight {
// Proof Size summary in bytes:
// Measured: `314`
// Estimated: `3675`
// Minimum execution time: 13_238_000 picoseconds.
Weight::from_parts(13_810_000, 0)
.saturating_add(Weight::from_parts(0, 3675))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `PoolAssets::Asset` (r:1 w:1)
/// Proof: `PoolAssets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
fn thaw_asset() -> Weight {
// Proof Size summary in bytes:
// Measured: `314`
// Estimated: `3675`
// Minimum execution time: 13_034_000 picoseconds.
Weight::from_parts(13_603_000, 0)
.saturating_add(Weight::from_parts(0, 3675))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `PoolAssets::Asset` (r:1 w:1)
/// Proof: `PoolAssets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
/// Storage: `PoolAssets::Metadata` (r:1 w:0)
/// Proof: `PoolAssets::Metadata` (`max_values`: None, `max_size`: Some(140), added: 2615, mode: `MaxEncodedLen`)
fn transfer_ownership() -> Weight {
// Proof Size summary in bytes:
// Measured: `280`
// Estimated: `3675`
// Minimum execution time: 14_357_000 picoseconds.
Weight::from_parts(14_774_000, 0)
.saturating_add(Weight::from_parts(0, 3675))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `PoolAssets::Asset` (r:1 w:1)
/// Proof: `PoolAssets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
fn set_team() -> Weight {
// Proof Size summary in bytes:
// Measured: `280`
// Estimated: `3675`
// Minimum execution time: 13_040_000 picoseconds.
Weight::from_parts(13_616_000, 0)
.saturating_add(Weight::from_parts(0, 3675))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `PoolAssets::Asset` (r:1 w:0)
/// Proof: `PoolAssets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
/// Storage: `PoolAssets::Metadata` (r:1 w:1)
/// Proof: `PoolAssets::Metadata` (`max_values`: None, `max_size`: Some(140), added: 2615, mode: `MaxEncodedLen`)
/// The range of component `n` is `[0, 50]`.
/// The range of component `s` is `[0, 50]`.
/// The range of component `n` is `[0, 50]`.
/// The range of component `s` is `[0, 50]`.
/// The range of component `n` is `[0, 50]`.
/// The range of component `s` is `[0, 50]`.
fn set_metadata(n: u32, s: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `280`
// Estimated: `3675`
// Minimum execution time: 15_274_000 picoseconds.
Weight::from_parts(16_096_881, 0)
.saturating_add(Weight::from_parts(0, 3675))
// Standard Error: 239
.saturating_add(Weight::from_parts(1_631, 0).saturating_mul(n.into()))
// Standard Error: 239
.saturating_add(Weight::from_parts(2_334, 0).saturating_mul(s.into()))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `PoolAssets::Asset` (r:1 w:0)
/// Proof: `PoolAssets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
/// Storage: `PoolAssets::Metadata` (r:1 w:1)
/// Proof: `PoolAssets::Metadata` (`max_values`: None, `max_size`: Some(140), added: 2615, mode: `MaxEncodedLen`)
fn clear_metadata() -> Weight {
// Proof Size summary in bytes:
// Measured: `444`
// Estimated: `3675`
// Minimum execution time: 15_900_000 picoseconds.
Weight::from_parts(16_526_000, 0)
.saturating_add(Weight::from_parts(0, 3675))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `PoolAssets::Asset` (r:1 w:0)
/// Proof: `PoolAssets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
/// Storage: `PoolAssets::Metadata` (r:1 w:1)
/// Proof: `PoolAssets::Metadata` (`max_values`: None, `max_size`: Some(140), added: 2615, mode: `MaxEncodedLen`)
/// The range of component `n` is `[0, 50]`.
/// The range of component `s` is `[0, 50]`.
/// The range of component `n` is `[0, 50]`.
/// The range of component `s` is `[0, 50]`.
/// The range of component `n` is `[0, 50]`.
/// The range of component `s` is `[0, 50]`.
fn force_set_metadata(n: u32, s: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `119`
// Estimated: `3675`
// Minimum execution time: 13_391_000 picoseconds.
Weight::from_parts(14_047_176, 0)
.saturating_add(Weight::from_parts(0, 3675))
// Standard Error: 172
.saturating_add(Weight::from_parts(2_617, 0).saturating_mul(n.into()))
// Standard Error: 172
.saturating_add(Weight::from_parts(2_081, 0).saturating_mul(s.into()))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `PoolAssets::Asset` (r:1 w:0)
/// Proof: `PoolAssets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
/// Storage: `PoolAssets::Metadata` (r:1 w:1)
/// Proof: `PoolAssets::Metadata` (`max_values`: None, `max_size`: Some(140), added: 2615, mode: `MaxEncodedLen`)
fn force_clear_metadata() -> Weight {
// Proof Size summary in bytes:
// Measured: `444`
// Estimated: `3675`
// Minimum execution time: 15_794_000 picoseconds.
Weight::from_parts(16_279_000, 0)
.saturating_add(Weight::from_parts(0, 3675))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `PoolAssets::Asset` (r:1 w:1)
/// Proof: `PoolAssets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
fn force_asset_status() -> Weight {
// Proof Size summary in bytes:
// Measured: `280`
// Estimated: `3675`
// Minimum execution time: 12_538_000 picoseconds.
Weight::from_parts(13_080_000, 0)
.saturating_add(Weight::from_parts(0, 3675))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `PoolAssets::Asset` (r:1 w:1)
/// Proof: `PoolAssets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
/// Storage: `PoolAssets::Approvals` (r:1 w:1)
/// Proof: `PoolAssets::Approvals` (`max_values`: None, `max_size`: Some(148), added: 2623, mode: `MaxEncodedLen`)
fn approve_transfer() -> Weight {
// Proof Size summary in bytes:
// Measured: `314`
// Estimated: `3675`
// Minimum execution time: 18_991_000 picoseconds.
Weight::from_parts(19_812_000, 0)
.saturating_add(Weight::from_parts(0, 3675))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(2))
}
/// Storage: `PoolAssets::Asset` (r:1 w:1)
/// Proof: `PoolAssets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
/// Storage: `PoolAssets::Approvals` (r:1 w:1)
/// Proof: `PoolAssets::Approvals` (`max_values`: None, `max_size`: Some(148), added: 2623, mode: `MaxEncodedLen`)
/// Storage: `PoolAssets::Account` (r:2 w:2)
/// Proof: `PoolAssets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`)
/// Storage: `System::Account` (r:1 w:1)
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
fn transfer_approved() -> Weight {
// Proof Size summary in bytes:
// Measured: `558`
// Estimated: `6208`
// Minimum execution time: 50_336_000 picoseconds.
Weight::from_parts(51_441_000, 0)
.saturating_add(Weight::from_parts(0, 6208))
.saturating_add(T::DbWeight::get().reads(5))
.saturating_add(T::DbWeight::get().writes(5))
}
/// Storage: `PoolAssets::Asset` (r:1 w:1)
/// Proof: `PoolAssets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
/// Storage: `PoolAssets::Approvals` (r:1 w:1)
/// Proof: `PoolAssets::Approvals` (`max_values`: None, `max_size`: Some(148), added: 2623, mode: `MaxEncodedLen`)
fn cancel_approval() -> Weight {
// Proof Size summary in bytes:
// Measured: `484`
// Estimated: `3675`
// Minimum execution time: 21_195_000 picoseconds.
Weight::from_parts(21_946_000, 0)
.saturating_add(Weight::from_parts(0, 3675))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(2))
}
/// Storage: `PoolAssets::Asset` (r:1 w:1)
/// Proof: `PoolAssets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
/// Storage: `PoolAssets::Approvals` (r:1 w:1)
/// Proof: `PoolAssets::Approvals` (`max_values`: None, `max_size`: Some(148), added: 2623, mode: `MaxEncodedLen`)
fn force_cancel_approval() -> Weight {
// Proof Size summary in bytes:
// Measured: `484`
// Estimated: `3675`
// Minimum execution time: 21_568_000 picoseconds.
Weight::from_parts(22_366_000, 0)
.saturating_add(Weight::from_parts(0, 3675))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(2))
}
/// Storage: `PoolAssets::Asset` (r:1 w:1)
/// Proof: `PoolAssets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
fn set_min_balance() -> Weight {
// Proof Size summary in bytes:
// Measured: `280`
// Estimated: `3675`
// Minimum execution time: 13_690_000 picoseconds.
Weight::from_parts(14_086_000, 0)
.saturating_add(Weight::from_parts(0, 3675))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `PoolAssets::Account` (r:1 w:1)
/// Proof: `PoolAssets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`)
/// Storage: `PoolAssets::Asset` (r:1 w:1)
/// Proof: `PoolAssets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
fn touch() -> Weight {
// Proof Size summary in bytes:
// Measured: `280`
// Estimated: `3675`
// Minimum execution time: 18_240_000 picoseconds.
Weight::from_parts(19_000_000, 0)
.saturating_add(Weight::from_parts(0, 3675))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(2))
}
/// Storage: `PoolAssets::Account` (r:1 w:1)
/// Proof: `PoolAssets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`)
/// Storage: `PoolAssets::Asset` (r:1 w:1)
/// Proof: `PoolAssets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
fn touch_other() -> Weight {
// Proof Size summary in bytes:
// Measured: `280`
// Estimated: `3675`
// Minimum execution time: 18_469_000 picoseconds.
Weight::from_parts(19_040_000, 0)
.saturating_add(Weight::from_parts(0, 3675))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(2))
}
/// Storage: `PoolAssets::Account` (r:1 w:1)
/// Proof: `PoolAssets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`)
/// Storage: `PoolAssets::Asset` (r:1 w:1)
/// Proof: `PoolAssets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
fn refund() -> Weight {
// Proof Size summary in bytes:
// Measured: `406`
// Estimated: `3675`
// Minimum execution time: 14_633_000 picoseconds.
Weight::from_parts(15_296_000, 0)
.saturating_add(Weight::from_parts(0, 3675))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(2))
}
/// Storage: `PoolAssets::Account` (r:1 w:1)
/// Proof: `PoolAssets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`)
/// Storage: `PoolAssets::Asset` (r:1 w:1)
/// Proof: `PoolAssets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
fn refund_other() -> Weight {
// Proof Size summary in bytes:
// Measured: `439`
// Estimated: `3675`
// Minimum execution time: 14_751_000 picoseconds.
Weight::from_parts(15_312_000, 0)
.saturating_add(Weight::from_parts(0, 3675))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(2))
}
/// Storage: `PoolAssets::Asset` (r:1 w:0)
/// Proof: `PoolAssets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
/// Storage: `PoolAssets::Account` (r:1 w:1)
/// Proof: `PoolAssets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`)
fn block() -> Weight {
// Proof Size summary in bytes:
// Measured: `388`
// Estimated: `3675`
// Minimum execution time: 16_930_000 picoseconds.
Weight::from_parts(17_653_000, 0)
.saturating_add(Weight::from_parts(0, 3675))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(1))
}
}
@@ -0,0 +1,153 @@
// Copyright (C) Parity Technologies (UK) Ltd.
// This file is part of Cumulus.
// Cumulus is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Cumulus is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
//! Autogenerated weights for `pallet_balances`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
//! DATE: 2023-07-31, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `runner-ynta1nyy-project-238-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz`
//! EXECUTION: ``, WASM-EXECUTION: `Compiled`, CHAIN: `Some("asset-hub-rococo-dev")`, DB CACHE: 1024
// Executed Command:
// ./target/production/polkadot-parachain
// benchmark
// pallet
// --chain=asset-hub-rococo-dev
// --wasm-execution=compiled
// --pallet=pallet_balances
// --no-storage-info
// --no-median-slopes
// --no-min-squares
// --extrinsic=*
// --steps=50
// --repeat=20
// --json
// --header=./file_header.txt
// --output=./parachains/runtimes/assets/asset-hub-rococo/src/weights/
#![cfg_attr(rustfmt, rustfmt_skip)]
#![allow(unused_parens)]
#![allow(unused_imports)]
#![allow(missing_docs)]
use frame_support::{traits::Get, weights::Weight};
use core::marker::PhantomData;
/// Weight functions for `pallet_balances`.
pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Config> pallet_balances::WeightInfo for WeightInfo<T> {
/// Storage: `System::Account` (r:1 w:1)
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
fn transfer_allow_death() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `3593`
// Minimum execution time: 55_040_000 picoseconds.
Weight::from_parts(56_106_000, 0)
.saturating_add(Weight::from_parts(0, 3593))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `System::Account` (r:1 w:1)
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
fn transfer_keep_alive() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `3593`
// Minimum execution time: 41_342_000 picoseconds.
Weight::from_parts(41_890_000, 0)
.saturating_add(Weight::from_parts(0, 3593))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `System::Account` (r:1 w:1)
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
fn force_set_balance_creating() -> Weight {
// Proof Size summary in bytes:
// Measured: `103`
// Estimated: `3593`
// Minimum execution time: 14_723_000 picoseconds.
Weight::from_parts(15_182_000, 0)
.saturating_add(Weight::from_parts(0, 3593))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `System::Account` (r:1 w:1)
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
fn force_set_balance_killing() -> Weight {
// Proof Size summary in bytes:
// Measured: `103`
// Estimated: `3593`
// Minimum execution time: 22_073_000 picoseconds.
Weight::from_parts(22_638_000, 0)
.saturating_add(Weight::from_parts(0, 3593))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `System::Account` (r:2 w:2)
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
fn force_transfer() -> Weight {
// Proof Size summary in bytes:
// Measured: `103`
// Estimated: `6196`
// Minimum execution time: 57_265_000 picoseconds.
Weight::from_parts(58_222_000, 0)
.saturating_add(Weight::from_parts(0, 6196))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(2))
}
/// Storage: `System::Account` (r:1 w:1)
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
fn transfer_all() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `3593`
// Minimum execution time: 51_485_000 picoseconds.
Weight::from_parts(52_003_000, 0)
.saturating_add(Weight::from_parts(0, 3593))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `System::Account` (r:1 w:1)
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
fn force_unreserve() -> Weight {
// Proof Size summary in bytes:
// Measured: `103`
// Estimated: `3593`
// Minimum execution time: 17_460_000 picoseconds.
Weight::from_parts(17_849_000, 0)
.saturating_add(Weight::from_parts(0, 3593))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `System::Account` (r:999 w:999)
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
/// The range of component `u` is `[1, 1000]`.
fn upgrade_accounts(u: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `0 + u * (136 ±0)`
// Estimated: `990 + u * (2603 ±0)`
// Minimum execution time: 17_259_000 picoseconds.
Weight::from_parts(17_478_000, 0)
.saturating_add(Weight::from_parts(0, 990))
// Standard Error: 16_756
.saturating_add(Weight::from_parts(15_291_954, 0).saturating_mul(u.into()))
.saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(u.into())))
.saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(u.into())))
.saturating_add(Weight::from_parts(0, 2603).saturating_mul(u.into()))
}
}
@@ -0,0 +1,225 @@
// Copyright (C) Parity Technologies (UK) Ltd.
// This file is part of Cumulus.
// Cumulus is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Cumulus is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
//! Autogenerated weights for `pallet_collator_selection`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
//! DATE: 2023-07-31, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `runner-ynta1nyy-project-238-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz`
//! EXECUTION: ``, WASM-EXECUTION: `Compiled`, CHAIN: `Some("asset-hub-rococo-dev")`, DB CACHE: 1024
// Executed Command:
// ./target/production/polkadot-parachain
// benchmark
// pallet
// --chain=asset-hub-rococo-dev
// --wasm-execution=compiled
// --pallet=pallet_collator_selection
// --no-storage-info
// --no-median-slopes
// --no-min-squares
// --extrinsic=*
// --steps=50
// --repeat=20
// --json
// --header=./file_header.txt
// --output=./parachains/runtimes/assets/asset-hub-rococo/src/weights/
#![cfg_attr(rustfmt, rustfmt_skip)]
#![allow(unused_parens)]
#![allow(unused_imports)]
#![allow(missing_docs)]
use frame_support::{traits::Get, weights::Weight};
use core::marker::PhantomData;
/// Weight functions for `pallet_collator_selection`.
pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Config> pallet_collator_selection::WeightInfo for WeightInfo<T> {
/// Storage: `Session::NextKeys` (r:20 w:0)
/// Proof: `Session::NextKeys` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `CollatorSelection::Invulnerables` (r:0 w:1)
/// Proof: `CollatorSelection::Invulnerables` (`max_values`: Some(1), `max_size`: Some(641), added: 1136, mode: `MaxEncodedLen`)
/// The range of component `b` is `[1, 20]`.
fn set_invulnerables(b: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `163 + b * (79 ±0)`
// Estimated: `1154 + b * (2555 ±0)`
// Minimum execution time: 15_408_000 picoseconds.
Weight::from_parts(13_068_592, 0)
.saturating_add(Weight::from_parts(0, 1154))
// Standard Error: 7_395
.saturating_add(Weight::from_parts(3_219_916, 0).saturating_mul(b.into()))
.saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(b.into())))
.saturating_add(T::DbWeight::get().writes(1))
.saturating_add(Weight::from_parts(0, 2555).saturating_mul(b.into()))
}
/// Storage: `Session::NextKeys` (r:1 w:0)
/// Proof: `Session::NextKeys` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `CollatorSelection::Invulnerables` (r:1 w:1)
/// Proof: `CollatorSelection::Invulnerables` (`max_values`: Some(1), `max_size`: Some(641), added: 1136, mode: `MaxEncodedLen`)
/// Storage: `CollatorSelection::Candidates` (r:1 w:1)
/// Proof: `CollatorSelection::Candidates` (`max_values`: Some(1), `max_size`: Some(4802), added: 5297, mode: `MaxEncodedLen`)
/// Storage: `System::Account` (r:1 w:1)
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
/// The range of component `b` is `[1, 19]`.
/// The range of component `c` is `[1, 99]`.
fn add_invulnerable(b: u32, c: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `756 + b * (32 ±0) + c * (53 ±0)`
// Estimated: `6287 + b * (37 ±0) + c * (53 ±0)`
// Minimum execution time: 49_692_000 picoseconds.
Weight::from_parts(51_768_986, 0)
.saturating_add(Weight::from_parts(0, 6287))
// Standard Error: 18_404
.saturating_add(Weight::from_parts(55_676, 0).saturating_mul(b.into()))
// Standard Error: 3_488
.saturating_add(Weight::from_parts(184_343, 0).saturating_mul(c.into()))
.saturating_add(T::DbWeight::get().reads(4))
.saturating_add(T::DbWeight::get().writes(3))
.saturating_add(Weight::from_parts(0, 37).saturating_mul(b.into()))
.saturating_add(Weight::from_parts(0, 53).saturating_mul(c.into()))
}
/// Storage: `CollatorSelection::Candidates` (r:1 w:0)
/// Proof: `CollatorSelection::Candidates` (`max_values`: Some(1), `max_size`: Some(4802), added: 5297, mode: `MaxEncodedLen`)
/// Storage: `CollatorSelection::Invulnerables` (r:1 w:1)
/// Proof: `CollatorSelection::Invulnerables` (`max_values`: Some(1), `max_size`: Some(641), added: 1136, mode: `MaxEncodedLen`)
/// The range of component `b` is `[5, 20]`.
fn remove_invulnerable(b: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `119 + b * (32 ±0)`
// Estimated: `6287`
// Minimum execution time: 16_486_000 picoseconds.
Weight::from_parts(16_646_017, 0)
.saturating_add(Weight::from_parts(0, 6287))
// Standard Error: 3_230
.saturating_add(Weight::from_parts(148_941, 0).saturating_mul(b.into()))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `CollatorSelection::DesiredCandidates` (r:0 w:1)
/// Proof: `CollatorSelection::DesiredCandidates` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
fn set_desired_candidates() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 7_806_000 picoseconds.
Weight::from_parts(8_002_000, 0)
.saturating_add(Weight::from_parts(0, 0))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `CollatorSelection::CandidacyBond` (r:0 w:1)
/// Proof: `CollatorSelection::CandidacyBond` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`)
fn set_candidacy_bond() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 7_937_000 picoseconds.
Weight::from_parts(8_161_000, 0)
.saturating_add(Weight::from_parts(0, 0))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `CollatorSelection::Candidates` (r:1 w:1)
/// Proof: `CollatorSelection::Candidates` (`max_values`: Some(1), `max_size`: Some(4802), added: 5297, mode: `MaxEncodedLen`)
/// Storage: `CollatorSelection::DesiredCandidates` (r:1 w:0)
/// Proof: `CollatorSelection::DesiredCandidates` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
/// Storage: `CollatorSelection::Invulnerables` (r:1 w:0)
/// Proof: `CollatorSelection::Invulnerables` (`max_values`: Some(1), `max_size`: Some(641), added: 1136, mode: `MaxEncodedLen`)
/// Storage: `Session::NextKeys` (r:1 w:0)
/// Proof: `Session::NextKeys` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `CollatorSelection::CandidacyBond` (r:1 w:0)
/// Proof: `CollatorSelection::CandidacyBond` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`)
/// Storage: `CollatorSelection::LastAuthoredBlock` (r:0 w:1)
/// Proof: `CollatorSelection::LastAuthoredBlock` (`max_values`: None, `max_size`: Some(44), added: 2519, mode: `MaxEncodedLen`)
/// The range of component `c` is `[1, 99]`.
fn register_as_candidate(c: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `736 + c * (52 ±0)`
// Estimated: `6287 + c * (54 ±0)`
// Minimum execution time: 42_805_000 picoseconds.
Weight::from_parts(45_979_502, 0)
.saturating_add(Weight::from_parts(0, 6287))
// Standard Error: 2_336
.saturating_add(Weight::from_parts(221_049, 0).saturating_mul(c.into()))
.saturating_add(T::DbWeight::get().reads(5))
.saturating_add(T::DbWeight::get().writes(2))
.saturating_add(Weight::from_parts(0, 54).saturating_mul(c.into()))
}
/// Storage: `CollatorSelection::Candidates` (r:1 w:1)
/// Proof: `CollatorSelection::Candidates` (`max_values`: Some(1), `max_size`: Some(4802), added: 5297, mode: `MaxEncodedLen`)
/// Storage: `CollatorSelection::Invulnerables` (r:1 w:0)
/// Proof: `CollatorSelection::Invulnerables` (`max_values`: Some(1), `max_size`: Some(641), added: 1136, mode: `MaxEncodedLen`)
/// Storage: `CollatorSelection::LastAuthoredBlock` (r:0 w:1)
/// Proof: `CollatorSelection::LastAuthoredBlock` (`max_values`: None, `max_size`: Some(44), added: 2519, mode: `MaxEncodedLen`)
/// The range of component `c` is `[4, 100]`.
fn leave_intent(c: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `306 + c * (50 ±0)`
// Estimated: `6287`
// Minimum execution time: 34_814_000 picoseconds.
Weight::from_parts(36_371_520, 0)
.saturating_add(Weight::from_parts(0, 6287))
// Standard Error: 2_391
.saturating_add(Weight::from_parts(201_700, 0).saturating_mul(c.into()))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(2))
}
/// Storage: `System::Account` (r:2 w:2)
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
/// Storage: `System::BlockWeight` (r:1 w:1)
/// Proof: `System::BlockWeight` (`max_values`: Some(1), `max_size`: Some(48), added: 543, mode: `MaxEncodedLen`)
/// Storage: `CollatorSelection::LastAuthoredBlock` (r:0 w:1)
/// Proof: `CollatorSelection::LastAuthoredBlock` (`max_values`: None, `max_size`: Some(44), added: 2519, mode: `MaxEncodedLen`)
fn note_author() -> Weight {
// Proof Size summary in bytes:
// Measured: `103`
// Estimated: `6196`
// Minimum execution time: 46_989_000 picoseconds.
Weight::from_parts(48_151_000, 0)
.saturating_add(Weight::from_parts(0, 6196))
.saturating_add(T::DbWeight::get().reads(3))
.saturating_add(T::DbWeight::get().writes(4))
}
/// Storage: `CollatorSelection::Candidates` (r:1 w:0)
/// Proof: `CollatorSelection::Candidates` (`max_values`: Some(1), `max_size`: Some(4802), added: 5297, mode: `MaxEncodedLen`)
/// Storage: `CollatorSelection::LastAuthoredBlock` (r:100 w:0)
/// Proof: `CollatorSelection::LastAuthoredBlock` (`max_values`: None, `max_size`: Some(44), added: 2519, mode: `MaxEncodedLen`)
/// Storage: `CollatorSelection::Invulnerables` (r:1 w:0)
/// Proof: `CollatorSelection::Invulnerables` (`max_values`: Some(1), `max_size`: Some(641), added: 1136, mode: `MaxEncodedLen`)
/// Storage: `System::BlockWeight` (r:1 w:1)
/// Proof: `System::BlockWeight` (`max_values`: Some(1), `max_size`: Some(48), added: 543, mode: `MaxEncodedLen`)
/// Storage: `System::Account` (r:97 w:97)
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
/// The range of component `r` is `[1, 100]`.
/// The range of component `c` is `[1, 100]`.
fn new_session(r: u32, c: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `2243 + c * (97 ±0) + r * (112 ±0)`
// Estimated: `6287 + c * (2519 ±0) + r * (2603 ±0)`
// Minimum execution time: 17_547_000 picoseconds.
Weight::from_parts(17_854_000, 0)
.saturating_add(Weight::from_parts(0, 6287))
// Standard Error: 370_637
.saturating_add(Weight::from_parts(15_798_857, 0).saturating_mul(c.into()))
.saturating_add(T::DbWeight::get().reads(4))
.saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(c.into())))
.saturating_add(T::DbWeight::get().writes(1))
.saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(c.into())))
.saturating_add(Weight::from_parts(0, 2519).saturating_mul(c.into()))
.saturating_add(Weight::from_parts(0, 2603).saturating_mul(r.into()))
}
}
@@ -0,0 +1,165 @@
// Copyright (C) Parity Technologies (UK) Ltd.
// This file is part of Cumulus.
// Cumulus is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Cumulus is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
//! Autogenerated weights for `pallet_multisig`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
//! DATE: 2023-07-31, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `runner-ynta1nyy-project-238-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz`
//! EXECUTION: ``, WASM-EXECUTION: `Compiled`, CHAIN: `Some("asset-hub-rococo-dev")`, DB CACHE: 1024
// Executed Command:
// ./target/production/polkadot-parachain
// benchmark
// pallet
// --chain=asset-hub-rococo-dev
// --wasm-execution=compiled
// --pallet=pallet_multisig
// --no-storage-info
// --no-median-slopes
// --no-min-squares
// --extrinsic=*
// --steps=50
// --repeat=20
// --json
// --header=./file_header.txt
// --output=./parachains/runtimes/assets/asset-hub-rococo/src/weights/
#![cfg_attr(rustfmt, rustfmt_skip)]
#![allow(unused_parens)]
#![allow(unused_imports)]
#![allow(missing_docs)]
use frame_support::{traits::Get, weights::Weight};
use core::marker::PhantomData;
/// Weight functions for `pallet_multisig`.
pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Config> pallet_multisig::WeightInfo for WeightInfo<T> {
/// The range of component `z` is `[0, 10000]`.
fn as_multi_threshold_1(z: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 13_714_000 picoseconds.
Weight::from_parts(14_440_231, 0)
.saturating_add(Weight::from_parts(0, 0))
// Standard Error: 5
.saturating_add(Weight::from_parts(598, 0).saturating_mul(z.into()))
}
/// Storage: `Multisig::Multisigs` (r:1 w:1)
/// Proof: `Multisig::Multisigs` (`max_values`: None, `max_size`: Some(3346), added: 5821, mode: `MaxEncodedLen`)
/// The range of component `s` is `[2, 100]`.
/// The range of component `z` is `[0, 10000]`.
fn as_multi_create(s: u32, z: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `262 + s * (2 ±0)`
// Estimated: `6811`
// Minimum execution time: 44_768_000 picoseconds.
Weight::from_parts(33_662_218, 0)
.saturating_add(Weight::from_parts(0, 6811))
// Standard Error: 1_633
.saturating_add(Weight::from_parts(128_927, 0).saturating_mul(s.into()))
// Standard Error: 16
.saturating_add(Weight::from_parts(1_543, 0).saturating_mul(z.into()))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `Multisig::Multisigs` (r:1 w:1)
/// Proof: `Multisig::Multisigs` (`max_values`: None, `max_size`: Some(3346), added: 5821, mode: `MaxEncodedLen`)
/// The range of component `s` is `[3, 100]`.
/// The range of component `z` is `[0, 10000]`.
fn as_multi_approve(s: u32, z: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `282`
// Estimated: `6811`
// Minimum execution time: 29_745_000 picoseconds.
Weight::from_parts(20_559_891, 0)
.saturating_add(Weight::from_parts(0, 6811))
// Standard Error: 914
.saturating_add(Weight::from_parts(103_601, 0).saturating_mul(s.into()))
// Standard Error: 8
.saturating_add(Weight::from_parts(1_504, 0).saturating_mul(z.into()))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `Multisig::Multisigs` (r:1 w:1)
/// Proof: `Multisig::Multisigs` (`max_values`: None, `max_size`: Some(3346), added: 5821, mode: `MaxEncodedLen`)
/// Storage: `System::Account` (r:1 w:1)
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
/// The range of component `s` is `[2, 100]`.
/// The range of component `z` is `[0, 10000]`.
fn as_multi_complete(s: u32, z: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `385 + s * (33 ±0)`
// Estimated: `6811`
// Minimum execution time: 51_506_000 picoseconds.
Weight::from_parts(36_510_777, 0)
.saturating_add(Weight::from_parts(0, 6811))
// Standard Error: 2_183
.saturating_add(Weight::from_parts(183_764, 0).saturating_mul(s.into()))
// Standard Error: 21
.saturating_add(Weight::from_parts(1_653, 0).saturating_mul(z.into()))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(2))
}
/// Storage: `Multisig::Multisigs` (r:1 w:1)
/// Proof: `Multisig::Multisigs` (`max_values`: None, `max_size`: Some(3346), added: 5821, mode: `MaxEncodedLen`)
/// The range of component `s` is `[2, 100]`.
fn approve_as_multi_create(s: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `263 + s * (2 ±0)`
// Estimated: `6811`
// Minimum execution time: 31_072_000 picoseconds.
Weight::from_parts(32_408_621, 0)
.saturating_add(Weight::from_parts(0, 6811))
// Standard Error: 913
.saturating_add(Weight::from_parts(121_410, 0).saturating_mul(s.into()))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `Multisig::Multisigs` (r:1 w:1)
/// Proof: `Multisig::Multisigs` (`max_values`: None, `max_size`: Some(3346), added: 5821, mode: `MaxEncodedLen`)
/// The range of component `s` is `[2, 100]`.
fn approve_as_multi_approve(s: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `282`
// Estimated: `6811`
// Minimum execution time: 18_301_000 picoseconds.
Weight::from_parts(18_223_547, 0)
.saturating_add(Weight::from_parts(0, 6811))
// Standard Error: 747
.saturating_add(Weight::from_parts(114_584, 0).saturating_mul(s.into()))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `Multisig::Multisigs` (r:1 w:1)
/// Proof: `Multisig::Multisigs` (`max_values`: None, `max_size`: Some(3346), added: 5821, mode: `MaxEncodedLen`)
/// The range of component `s` is `[2, 100]`.
fn cancel_as_multi(s: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `454 + s * (1 ±0)`
// Estimated: `6811`
// Minimum execution time: 32_107_000 picoseconds.
Weight::from_parts(33_674_827, 0)
.saturating_add(Weight::from_parts(0, 6811))
// Standard Error: 1_220
.saturating_add(Weight::from_parts(122_011, 0).saturating_mul(s.into()))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
}
@@ -0,0 +1,115 @@
// Copyright (C) Parity Technologies (UK) Ltd.
// This file is part of Cumulus.
// Cumulus is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Cumulus is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
//! Autogenerated weights for `pallet_nft_fractionalization`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
//! DATE: 2023-07-31, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `runner-ynta1nyy-project-238-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz`
//! EXECUTION: ``, WASM-EXECUTION: `Compiled`, CHAIN: `Some("asset-hub-rococo-dev")`, DB CACHE: 1024
// Executed Command:
// ./target/production/polkadot-parachain
// benchmark
// pallet
// --chain=asset-hub-rococo-dev
// --wasm-execution=compiled
// --pallet=pallet_nft_fractionalization
// --no-storage-info
// --no-median-slopes
// --no-min-squares
// --extrinsic=*
// --steps=50
// --repeat=20
// --json
// --header=./file_header.txt
// --output=./parachains/runtimes/assets/asset-hub-rococo/src/weights/
#![cfg_attr(rustfmt, rustfmt_skip)]
#![allow(unused_parens)]
#![allow(unused_imports)]
#![allow(missing_docs)]
use frame_support::{traits::Get, weights::Weight};
use core::marker::PhantomData;
/// Weight functions for `pallet_nft_fractionalization`.
pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Config> pallet_nft_fractionalization::WeightInfo for WeightInfo<T> {
/// Storage: `Nfts::Item` (r:1 w:0)
/// Proof: `Nfts::Item` (`max_values`: None, `max_size`: Some(861), added: 3336, mode: `MaxEncodedLen`)
/// Storage: `Balances::Holds` (r:1 w:1)
/// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(67), added: 2542, mode: `MaxEncodedLen`)
/// Storage: `Nfts::Attribute` (r:1 w:1)
/// Proof: `Nfts::Attribute` (`max_values`: None, `max_size`: Some(479), added: 2954, mode: `MaxEncodedLen`)
/// Storage: `Nfts::Collection` (r:1 w:1)
/// Proof: `Nfts::Collection` (`max_values`: None, `max_size`: Some(84), added: 2559, mode: `MaxEncodedLen`)
/// Storage: `Assets::Asset` (r:1 w:1)
/// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
/// Storage: `Assets::Account` (r:1 w:1)
/// Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`)
/// Storage: `System::Account` (r:1 w:1)
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
/// Storage: `Assets::Metadata` (r:1 w:1)
/// Proof: `Assets::Metadata` (`max_values`: None, `max_size`: Some(140), added: 2615, mode: `MaxEncodedLen`)
/// Storage: `NftFractionalization::NftToAsset` (r:0 w:1)
/// Proof: `NftFractionalization::NftToAsset` (`max_values`: None, `max_size`: Some(92), added: 2567, mode: `MaxEncodedLen`)
fn fractionalize() -> Weight {
// Proof Size summary in bytes:
// Measured: `462`
// Estimated: `4326`
// Minimum execution time: 178_501_000 picoseconds.
Weight::from_parts(180_912_000, 0)
.saturating_add(Weight::from_parts(0, 4326))
.saturating_add(T::DbWeight::get().reads(8))
.saturating_add(T::DbWeight::get().writes(8))
}
/// Storage: `NftFractionalization::NftToAsset` (r:1 w:1)
/// Proof: `NftFractionalization::NftToAsset` (`max_values`: None, `max_size`: Some(92), added: 2567, mode: `MaxEncodedLen`)
/// Storage: `Assets::Asset` (r:1 w:1)
/// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
/// Storage: `Assets::Account` (r:1 w:1)
/// Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`)
/// Storage: `Nfts::Attribute` (r:1 w:1)
/// Proof: `Nfts::Attribute` (`max_values`: None, `max_size`: Some(479), added: 2954, mode: `MaxEncodedLen`)
/// Storage: `Nfts::Collection` (r:1 w:1)
/// Proof: `Nfts::Collection` (`max_values`: None, `max_size`: Some(84), added: 2559, mode: `MaxEncodedLen`)
/// Storage: `Nfts::CollectionConfigOf` (r:1 w:0)
/// Proof: `Nfts::CollectionConfigOf` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`)
/// Storage: `Nfts::ItemConfigOf` (r:1 w:0)
/// Proof: `Nfts::ItemConfigOf` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`)
/// Storage: `Nfts::Item` (r:1 w:1)
/// Proof: `Nfts::Item` (`max_values`: None, `max_size`: Some(861), added: 3336, mode: `MaxEncodedLen`)
/// Storage: `Balances::Holds` (r:1 w:1)
/// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(67), added: 2542, mode: `MaxEncodedLen`)
/// Storage: `Nfts::Account` (r:0 w:1)
/// Proof: `Nfts::Account` (`max_values`: None, `max_size`: Some(88), added: 2563, mode: `MaxEncodedLen`)
/// Storage: `Nfts::ItemPriceOf` (r:0 w:1)
/// Proof: `Nfts::ItemPriceOf` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)
/// Storage: `Nfts::PendingSwapOf` (r:0 w:1)
/// Proof: `Nfts::PendingSwapOf` (`max_values`: None, `max_size`: Some(71), added: 2546, mode: `MaxEncodedLen`)
fn unify() -> Weight {
// Proof Size summary in bytes:
// Measured: `1275`
// Estimated: `4326`
// Minimum execution time: 125_253_000 picoseconds.
Weight::from_parts(128_238_000, 0)
.saturating_add(Weight::from_parts(0, 4326))
.saturating_add(T::DbWeight::get().reads(9))
.saturating_add(T::DbWeight::get().writes(10))
}
}
@@ -0,0 +1,773 @@
// Copyright (C) Parity Technologies (UK) Ltd.
// This file is part of Cumulus.
// Cumulus is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Cumulus is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
//! Autogenerated weights for `pallet_nfts`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
//! DATE: 2023-07-31, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `runner-ynta1nyy-project-238-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz`
//! EXECUTION: ``, WASM-EXECUTION: `Compiled`, CHAIN: `Some("asset-hub-rococo-dev")`, DB CACHE: 1024
// Executed Command:
// ./target/production/polkadot-parachain
// benchmark
// pallet
// --chain=asset-hub-rococo-dev
// --wasm-execution=compiled
// --pallet=pallet_nfts
// --no-storage-info
// --no-median-slopes
// --no-min-squares
// --extrinsic=*
// --steps=50
// --repeat=20
// --json
// --header=./file_header.txt
// --output=./parachains/runtimes/assets/asset-hub-rococo/src/weights/
#![cfg_attr(rustfmt, rustfmt_skip)]
#![allow(unused_parens)]
#![allow(unused_imports)]
#![allow(missing_docs)]
use frame_support::{traits::Get, weights::Weight};
use core::marker::PhantomData;
/// Weight functions for `pallet_nfts`.
pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Config> pallet_nfts::WeightInfo for WeightInfo<T> {
/// Storage: `Nfts::NextCollectionId` (r:1 w:1)
/// Proof: `Nfts::NextCollectionId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
/// Storage: `Nfts::Collection` (r:1 w:1)
/// Proof: `Nfts::Collection` (`max_values`: None, `max_size`: Some(84), added: 2559, mode: `MaxEncodedLen`)
/// Storage: `Nfts::CollectionRoleOf` (r:0 w:1)
/// Proof: `Nfts::CollectionRoleOf` (`max_values`: None, `max_size`: Some(69), added: 2544, mode: `MaxEncodedLen`)
/// Storage: `Nfts::CollectionConfigOf` (r:0 w:1)
/// Proof: `Nfts::CollectionConfigOf` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`)
/// Storage: `Nfts::CollectionAccount` (r:0 w:1)
/// Proof: `Nfts::CollectionAccount` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`)
fn create() -> Weight {
// Proof Size summary in bytes:
// Measured: `179`
// Estimated: `3549`
// Minimum execution time: 39_124_000 picoseconds.
Weight::from_parts(39_975_000, 0)
.saturating_add(Weight::from_parts(0, 3549))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(5))
}
/// Storage: `Nfts::NextCollectionId` (r:1 w:1)
/// Proof: `Nfts::NextCollectionId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
/// Storage: `Nfts::Collection` (r:1 w:1)
/// Proof: `Nfts::Collection` (`max_values`: None, `max_size`: Some(84), added: 2559, mode: `MaxEncodedLen`)
/// Storage: `Nfts::CollectionRoleOf` (r:0 w:1)
/// Proof: `Nfts::CollectionRoleOf` (`max_values`: None, `max_size`: Some(69), added: 2544, mode: `MaxEncodedLen`)
/// Storage: `Nfts::CollectionConfigOf` (r:0 w:1)
/// Proof: `Nfts::CollectionConfigOf` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`)
/// Storage: `Nfts::CollectionAccount` (r:0 w:1)
/// Proof: `Nfts::CollectionAccount` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`)
fn force_create() -> Weight {
// Proof Size summary in bytes:
// Measured: `76`
// Estimated: `3549`
// Minimum execution time: 23_444_000 picoseconds.
Weight::from_parts(23_857_000, 0)
.saturating_add(Weight::from_parts(0, 3549))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(5))
}
/// Storage: `Nfts::Collection` (r:1 w:1)
/// Proof: `Nfts::Collection` (`max_values`: None, `max_size`: Some(84), added: 2559, mode: `MaxEncodedLen`)
/// Storage: `Nfts::ItemMetadataOf` (r:1 w:0)
/// Proof: `Nfts::ItemMetadataOf` (`max_values`: None, `max_size`: Some(347), added: 2822, mode: `MaxEncodedLen`)
/// Storage: `Nfts::CollectionRoleOf` (r:1 w:1)
/// Proof: `Nfts::CollectionRoleOf` (`max_values`: None, `max_size`: Some(69), added: 2544, mode: `MaxEncodedLen`)
/// Storage: `Nfts::Attribute` (r:1001 w:1000)
/// Proof: `Nfts::Attribute` (`max_values`: None, `max_size`: Some(479), added: 2954, mode: `MaxEncodedLen`)
/// Storage: `Nfts::ItemConfigOf` (r:1000 w:1000)
/// Proof: `Nfts::ItemConfigOf` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`)
/// Storage: `Nfts::CollectionMetadataOf` (r:0 w:1)
/// Proof: `Nfts::CollectionMetadataOf` (`max_values`: None, `max_size`: Some(294), added: 2769, mode: `MaxEncodedLen`)
/// Storage: `Nfts::CollectionConfigOf` (r:0 w:1)
/// Proof: `Nfts::CollectionConfigOf` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`)
/// Storage: `Nfts::CollectionAccount` (r:0 w:1)
/// Proof: `Nfts::CollectionAccount` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`)
/// The range of component `m` is `[0, 1000]`.
/// The range of component `c` is `[0, 1000]`.
/// The range of component `a` is `[0, 1000]`.
fn destroy(_m: u32, _c: u32, a: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `32204 + a * (366 ±0)`
// Estimated: `2523990 + a * (2954 ±0)`
// Minimum execution time: 1_224_365_000 picoseconds.
Weight::from_parts(1_281_136_346, 0)
.saturating_add(Weight::from_parts(0, 2523990))
// Standard Error: 10_484
.saturating_add(Weight::from_parts(6_910_740, 0).saturating_mul(a.into()))
.saturating_add(T::DbWeight::get().reads(1004))
.saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(a.into())))
.saturating_add(T::DbWeight::get().writes(1005))
.saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(a.into())))
.saturating_add(Weight::from_parts(0, 2954).saturating_mul(a.into()))
}
/// Storage: `Nfts::CollectionConfigOf` (r:1 w:0)
/// Proof: `Nfts::CollectionConfigOf` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`)
/// Storage: `Nfts::Item` (r:1 w:1)
/// Proof: `Nfts::Item` (`max_values`: None, `max_size`: Some(861), added: 3336, mode: `MaxEncodedLen`)
/// Storage: `Nfts::Collection` (r:1 w:1)
/// Proof: `Nfts::Collection` (`max_values`: None, `max_size`: Some(84), added: 2559, mode: `MaxEncodedLen`)
/// Storage: `Nfts::CollectionRoleOf` (r:1 w:0)
/// Proof: `Nfts::CollectionRoleOf` (`max_values`: None, `max_size`: Some(69), added: 2544, mode: `MaxEncodedLen`)
/// Storage: `Nfts::ItemConfigOf` (r:1 w:1)
/// Proof: `Nfts::ItemConfigOf` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`)
/// Storage: `Nfts::Account` (r:0 w:1)
/// Proof: `Nfts::Account` (`max_values`: None, `max_size`: Some(88), added: 2563, mode: `MaxEncodedLen`)
fn mint() -> Weight {
// Proof Size summary in bytes:
// Measured: `455`
// Estimated: `4326`
// Minimum execution time: 50_489_000 picoseconds.
Weight::from_parts(51_045_000, 0)
.saturating_add(Weight::from_parts(0, 4326))
.saturating_add(T::DbWeight::get().reads(5))
.saturating_add(T::DbWeight::get().writes(4))
}
/// Storage: `Nfts::CollectionRoleOf` (r:1 w:0)
/// Proof: `Nfts::CollectionRoleOf` (`max_values`: None, `max_size`: Some(69), added: 2544, mode: `MaxEncodedLen`)
/// Storage: `Nfts::Item` (r:1 w:1)
/// Proof: `Nfts::Item` (`max_values`: None, `max_size`: Some(861), added: 3336, mode: `MaxEncodedLen`)
/// Storage: `Nfts::Collection` (r:1 w:1)
/// Proof: `Nfts::Collection` (`max_values`: None, `max_size`: Some(84), added: 2559, mode: `MaxEncodedLen`)
/// Storage: `Nfts::CollectionConfigOf` (r:1 w:0)
/// Proof: `Nfts::CollectionConfigOf` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`)
/// Storage: `Nfts::ItemConfigOf` (r:1 w:1)
/// Proof: `Nfts::ItemConfigOf` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`)
/// Storage: `Nfts::Account` (r:0 w:1)
/// Proof: `Nfts::Account` (`max_values`: None, `max_size`: Some(88), added: 2563, mode: `MaxEncodedLen`)
fn force_mint() -> Weight {
// Proof Size summary in bytes:
// Measured: `455`
// Estimated: `4326`
// Minimum execution time: 49_146_000 picoseconds.
Weight::from_parts(49_756_000, 0)
.saturating_add(Weight::from_parts(0, 4326))
.saturating_add(T::DbWeight::get().reads(5))
.saturating_add(T::DbWeight::get().writes(4))
}
/// Storage: `Nfts::Attribute` (r:1 w:0)
/// Proof: `Nfts::Attribute` (`max_values`: None, `max_size`: Some(479), added: 2954, mode: `MaxEncodedLen`)
/// Storage: `Nfts::ItemConfigOf` (r:1 w:1)
/// Proof: `Nfts::ItemConfigOf` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`)
/// Storage: `Nfts::Collection` (r:1 w:1)
/// Proof: `Nfts::Collection` (`max_values`: None, `max_size`: Some(84), added: 2559, mode: `MaxEncodedLen`)
/// Storage: `Nfts::Item` (r:1 w:1)
/// Proof: `Nfts::Item` (`max_values`: None, `max_size`: Some(861), added: 3336, mode: `MaxEncodedLen`)
/// Storage: `Nfts::ItemMetadataOf` (r:1 w:0)
/// Proof: `Nfts::ItemMetadataOf` (`max_values`: None, `max_size`: Some(347), added: 2822, mode: `MaxEncodedLen`)
/// Storage: `Nfts::Account` (r:0 w:1)
/// Proof: `Nfts::Account` (`max_values`: None, `max_size`: Some(88), added: 2563, mode: `MaxEncodedLen`)
/// Storage: `Nfts::ItemPriceOf` (r:0 w:1)
/// Proof: `Nfts::ItemPriceOf` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)
/// Storage: `Nfts::ItemAttributesApprovalsOf` (r:0 w:1)
/// Proof: `Nfts::ItemAttributesApprovalsOf` (`max_values`: None, `max_size`: Some(1001), added: 3476, mode: `MaxEncodedLen`)
/// Storage: `Nfts::PendingSwapOf` (r:0 w:1)
/// Proof: `Nfts::PendingSwapOf` (`max_values`: None, `max_size`: Some(71), added: 2546, mode: `MaxEncodedLen`)
fn burn() -> Weight {
// Proof Size summary in bytes:
// Measured: `564`
// Estimated: `4326`
// Minimum execution time: 56_059_000 picoseconds.
Weight::from_parts(57_162_000, 0)
.saturating_add(Weight::from_parts(0, 4326))
.saturating_add(T::DbWeight::get().reads(5))
.saturating_add(T::DbWeight::get().writes(7))
}
/// Storage: `Nfts::Collection` (r:1 w:0)
/// Proof: `Nfts::Collection` (`max_values`: None, `max_size`: Some(84), added: 2559, mode: `MaxEncodedLen`)
/// Storage: `Nfts::Attribute` (r:1 w:0)
/// Proof: `Nfts::Attribute` (`max_values`: None, `max_size`: Some(479), added: 2954, mode: `MaxEncodedLen`)
/// Storage: `Nfts::CollectionConfigOf` (r:1 w:0)
/// Proof: `Nfts::CollectionConfigOf` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`)
/// Storage: `Nfts::ItemConfigOf` (r:1 w:0)
/// Proof: `Nfts::ItemConfigOf` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`)
/// Storage: `Nfts::Item` (r:1 w:1)
/// Proof: `Nfts::Item` (`max_values`: None, `max_size`: Some(861), added: 3336, mode: `MaxEncodedLen`)
/// Storage: `Nfts::Account` (r:0 w:2)
/// Proof: `Nfts::Account` (`max_values`: None, `max_size`: Some(88), added: 2563, mode: `MaxEncodedLen`)
/// Storage: `Nfts::ItemPriceOf` (r:0 w:1)
/// Proof: `Nfts::ItemPriceOf` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)
/// Storage: `Nfts::PendingSwapOf` (r:0 w:1)
/// Proof: `Nfts::PendingSwapOf` (`max_values`: None, `max_size`: Some(71), added: 2546, mode: `MaxEncodedLen`)
fn transfer() -> Weight {
// Proof Size summary in bytes:
// Measured: `593`
// Estimated: `4326`
// Minimum execution time: 42_406_000 picoseconds.
Weight::from_parts(43_187_000, 0)
.saturating_add(Weight::from_parts(0, 4326))
.saturating_add(T::DbWeight::get().reads(5))
.saturating_add(T::DbWeight::get().writes(5))
}
/// Storage: `Nfts::Collection` (r:1 w:0)
/// Proof: `Nfts::Collection` (`max_values`: None, `max_size`: Some(84), added: 2559, mode: `MaxEncodedLen`)
/// Storage: `Nfts::CollectionConfigOf` (r:1 w:0)
/// Proof: `Nfts::CollectionConfigOf` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`)
/// Storage: `Nfts::Item` (r:5000 w:5000)
/// Proof: `Nfts::Item` (`max_values`: None, `max_size`: Some(861), added: 3336, mode: `MaxEncodedLen`)
/// The range of component `i` is `[0, 5000]`.
fn redeposit(i: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `763 + i * (108 ±0)`
// Estimated: `3549 + i * (3336 ±0)`
// Minimum execution time: 16_960_000 picoseconds.
Weight::from_parts(17_167_000, 0)
.saturating_add(Weight::from_parts(0, 3549))
// Standard Error: 24_110
.saturating_add(Weight::from_parts(18_046_970, 0).saturating_mul(i.into()))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(i.into())))
.saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into())))
.saturating_add(Weight::from_parts(0, 3336).saturating_mul(i.into()))
}
/// Storage: `Nfts::CollectionRoleOf` (r:1 w:0)
/// Proof: `Nfts::CollectionRoleOf` (`max_values`: None, `max_size`: Some(69), added: 2544, mode: `MaxEncodedLen`)
/// Storage: `Nfts::ItemConfigOf` (r:1 w:1)
/// Proof: `Nfts::ItemConfigOf` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`)
fn lock_item_transfer() -> Weight {
// Proof Size summary in bytes:
// Measured: `435`
// Estimated: `3534`
// Minimum execution time: 21_023_000 picoseconds.
Weight::from_parts(21_409_000, 0)
.saturating_add(Weight::from_parts(0, 3534))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `Nfts::CollectionRoleOf` (r:1 w:0)
/// Proof: `Nfts::CollectionRoleOf` (`max_values`: None, `max_size`: Some(69), added: 2544, mode: `MaxEncodedLen`)
/// Storage: `Nfts::ItemConfigOf` (r:1 w:1)
/// Proof: `Nfts::ItemConfigOf` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`)
fn unlock_item_transfer() -> Weight {
// Proof Size summary in bytes:
// Measured: `435`
// Estimated: `3534`
// Minimum execution time: 20_706_000 picoseconds.
Weight::from_parts(21_030_000, 0)
.saturating_add(Weight::from_parts(0, 3534))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `Nfts::Collection` (r:1 w:0)
/// Proof: `Nfts::Collection` (`max_values`: None, `max_size`: Some(84), added: 2559, mode: `MaxEncodedLen`)
/// Storage: `Nfts::CollectionConfigOf` (r:1 w:1)
/// Proof: `Nfts::CollectionConfigOf` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`)
fn lock_collection() -> Weight {
// Proof Size summary in bytes:
// Measured: `340`
// Estimated: `3549`
// Minimum execution time: 17_449_000 picoseconds.
Weight::from_parts(17_804_000, 0)
.saturating_add(Weight::from_parts(0, 3549))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `Nfts::OwnershipAcceptance` (r:1 w:1)
/// Proof: `Nfts::OwnershipAcceptance` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`)
/// Storage: `Nfts::Collection` (r:1 w:1)
/// Proof: `Nfts::Collection` (`max_values`: None, `max_size`: Some(84), added: 2559, mode: `MaxEncodedLen`)
/// Storage: `Nfts::CollectionAccount` (r:0 w:2)
/// Proof: `Nfts::CollectionAccount` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`)
fn transfer_ownership() -> Weight {
// Proof Size summary in bytes:
// Measured: `388`
// Estimated: `3549`
// Minimum execution time: 22_958_000 picoseconds.
Weight::from_parts(23_499_000, 0)
.saturating_add(Weight::from_parts(0, 3549))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(4))
}
/// Storage: `Nfts::Collection` (r:1 w:1)
/// Proof: `Nfts::Collection` (`max_values`: None, `max_size`: Some(84), added: 2559, mode: `MaxEncodedLen`)
/// Storage: `Nfts::CollectionRoleOf` (r:2 w:4)
/// Proof: `Nfts::CollectionRoleOf` (`max_values`: None, `max_size`: Some(69), added: 2544, mode: `MaxEncodedLen`)
fn set_team() -> Weight {
// Proof Size summary in bytes:
// Measured: `369`
// Estimated: `6078`
// Minimum execution time: 40_105_000 picoseconds.
Weight::from_parts(40_800_000, 0)
.saturating_add(Weight::from_parts(0, 6078))
.saturating_add(T::DbWeight::get().reads(3))
.saturating_add(T::DbWeight::get().writes(5))
}
/// Storage: `Nfts::Collection` (r:1 w:1)
/// Proof: `Nfts::Collection` (`max_values`: None, `max_size`: Some(84), added: 2559, mode: `MaxEncodedLen`)
/// Storage: `Nfts::CollectionAccount` (r:0 w:2)
/// Proof: `Nfts::CollectionAccount` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`)
fn force_collection_owner() -> Weight {
// Proof Size summary in bytes:
// Measured: `311`
// Estimated: `3549`
// Minimum execution time: 17_832_000 picoseconds.
Weight::from_parts(18_297_000, 0)
.saturating_add(Weight::from_parts(0, 3549))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(3))
}
/// Storage: `Nfts::Collection` (r:1 w:0)
/// Proof: `Nfts::Collection` (`max_values`: None, `max_size`: Some(84), added: 2559, mode: `MaxEncodedLen`)
/// Storage: `Nfts::CollectionConfigOf` (r:0 w:1)
/// Proof: `Nfts::CollectionConfigOf` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`)
fn force_collection_config() -> Weight {
// Proof Size summary in bytes:
// Measured: `276`
// Estimated: `3549`
// Minimum execution time: 15_027_000 picoseconds.
Weight::from_parts(15_370_000, 0)
.saturating_add(Weight::from_parts(0, 3549))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `Nfts::CollectionRoleOf` (r:1 w:0)
/// Proof: `Nfts::CollectionRoleOf` (`max_values`: None, `max_size`: Some(69), added: 2544, mode: `MaxEncodedLen`)
/// Storage: `Nfts::ItemConfigOf` (r:1 w:1)
/// Proof: `Nfts::ItemConfigOf` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`)
fn lock_item_properties() -> Weight {
// Proof Size summary in bytes:
// Measured: `435`
// Estimated: `3534`
// Minimum execution time: 19_912_000 picoseconds.
Weight::from_parts(20_258_000, 0)
.saturating_add(Weight::from_parts(0, 3534))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `Nfts::Collection` (r:1 w:1)
/// Proof: `Nfts::Collection` (`max_values`: None, `max_size`: Some(84), added: 2559, mode: `MaxEncodedLen`)
/// Storage: `Nfts::CollectionRoleOf` (r:1 w:0)
/// Proof: `Nfts::CollectionRoleOf` (`max_values`: None, `max_size`: Some(69), added: 2544, mode: `MaxEncodedLen`)
/// Storage: `Nfts::CollectionConfigOf` (r:1 w:0)
/// Proof: `Nfts::CollectionConfigOf` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`)
/// Storage: `Nfts::ItemConfigOf` (r:1 w:0)
/// Proof: `Nfts::ItemConfigOf` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`)
/// Storage: `Nfts::Attribute` (r:1 w:1)
/// Proof: `Nfts::Attribute` (`max_values`: None, `max_size`: Some(479), added: 2954, mode: `MaxEncodedLen`)
fn set_attribute() -> Weight {
// Proof Size summary in bytes:
// Measured: `539`
// Estimated: `3944`
// Minimum execution time: 50_138_000 picoseconds.
Weight::from_parts(50_971_000, 0)
.saturating_add(Weight::from_parts(0, 3944))
.saturating_add(T::DbWeight::get().reads(5))
.saturating_add(T::DbWeight::get().writes(2))
}
/// Storage: `Nfts::Collection` (r:1 w:1)
/// Proof: `Nfts::Collection` (`max_values`: None, `max_size`: Some(84), added: 2559, mode: `MaxEncodedLen`)
/// Storage: `Nfts::Attribute` (r:1 w:1)
/// Proof: `Nfts::Attribute` (`max_values`: None, `max_size`: Some(479), added: 2954, mode: `MaxEncodedLen`)
fn force_set_attribute() -> Weight {
// Proof Size summary in bytes:
// Measured: `344`
// Estimated: `3944`
// Minimum execution time: 26_385_000 picoseconds.
Weight::from_parts(27_086_000, 0)
.saturating_add(Weight::from_parts(0, 3944))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(2))
}
/// Storage: `Nfts::Attribute` (r:1 w:1)
/// Proof: `Nfts::Attribute` (`max_values`: None, `max_size`: Some(479), added: 2954, mode: `MaxEncodedLen`)
/// Storage: `Nfts::CollectionRoleOf` (r:1 w:0)
/// Proof: `Nfts::CollectionRoleOf` (`max_values`: None, `max_size`: Some(69), added: 2544, mode: `MaxEncodedLen`)
/// Storage: `Nfts::ItemConfigOf` (r:1 w:0)
/// Proof: `Nfts::ItemConfigOf` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`)
/// Storage: `Nfts::Collection` (r:1 w:1)
/// Proof: `Nfts::Collection` (`max_values`: None, `max_size`: Some(84), added: 2559, mode: `MaxEncodedLen`)
fn clear_attribute() -> Weight {
// Proof Size summary in bytes:
// Measured: `983`
// Estimated: `3944`
// Minimum execution time: 45_687_000 picoseconds.
Weight::from_parts(47_107_000, 0)
.saturating_add(Weight::from_parts(0, 3944))
.saturating_add(T::DbWeight::get().reads(4))
.saturating_add(T::DbWeight::get().writes(2))
}
/// Storage: `Nfts::Item` (r:1 w:0)
/// Proof: `Nfts::Item` (`max_values`: None, `max_size`: Some(861), added: 3336, mode: `MaxEncodedLen`)
/// Storage: `Nfts::ItemAttributesApprovalsOf` (r:1 w:1)
/// Proof: `Nfts::ItemAttributesApprovalsOf` (`max_values`: None, `max_size`: Some(1001), added: 3476, mode: `MaxEncodedLen`)
fn approve_item_attributes() -> Weight {
// Proof Size summary in bytes:
// Measured: `381`
// Estimated: `4466`
// Minimum execution time: 18_065_000 picoseconds.
Weight::from_parts(18_371_000, 0)
.saturating_add(Weight::from_parts(0, 4466))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `Nfts::Item` (r:1 w:0)
/// Proof: `Nfts::Item` (`max_values`: None, `max_size`: Some(861), added: 3336, mode: `MaxEncodedLen`)
/// Storage: `Nfts::ItemAttributesApprovalsOf` (r:1 w:1)
/// Proof: `Nfts::ItemAttributesApprovalsOf` (`max_values`: None, `max_size`: Some(1001), added: 3476, mode: `MaxEncodedLen`)
/// Storage: `Nfts::Attribute` (r:1001 w:1000)
/// Proof: `Nfts::Attribute` (`max_values`: None, `max_size`: Some(479), added: 2954, mode: `MaxEncodedLen`)
/// Storage: `System::Account` (r:1 w:1)
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
/// The range of component `n` is `[0, 1000]`.
fn cancel_item_attributes_approval(n: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `760 + n * (398 ±0)`
// Estimated: `4466 + n * (2954 ±0)`
// Minimum execution time: 26_680_000 picoseconds.
Weight::from_parts(27_010_000, 0)
.saturating_add(Weight::from_parts(0, 4466))
// Standard Error: 6_351
.saturating_add(Weight::from_parts(6_584_290, 0).saturating_mul(n.into()))
.saturating_add(T::DbWeight::get().reads(4))
.saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into())))
.saturating_add(T::DbWeight::get().writes(2))
.saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into())))
.saturating_add(Weight::from_parts(0, 2954).saturating_mul(n.into()))
}
/// Storage: `Nfts::CollectionRoleOf` (r:1 w:0)
/// Proof: `Nfts::CollectionRoleOf` (`max_values`: None, `max_size`: Some(69), added: 2544, mode: `MaxEncodedLen`)
/// Storage: `Nfts::Collection` (r:1 w:1)
/// Proof: `Nfts::Collection` (`max_values`: None, `max_size`: Some(84), added: 2559, mode: `MaxEncodedLen`)
/// Storage: `Nfts::ItemConfigOf` (r:1 w:0)
/// Proof: `Nfts::ItemConfigOf` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`)
/// Storage: `Nfts::CollectionConfigOf` (r:1 w:0)
/// Proof: `Nfts::CollectionConfigOf` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`)
/// Storage: `Nfts::ItemMetadataOf` (r:1 w:1)
/// Proof: `Nfts::ItemMetadataOf` (`max_values`: None, `max_size`: Some(347), added: 2822, mode: `MaxEncodedLen`)
fn set_metadata() -> Weight {
// Proof Size summary in bytes:
// Measured: `539`
// Estimated: `3812`
// Minimum execution time: 42_038_000 picoseconds.
Weight::from_parts(42_758_000, 0)
.saturating_add(Weight::from_parts(0, 3812))
.saturating_add(T::DbWeight::get().reads(5))
.saturating_add(T::DbWeight::get().writes(2))
}
/// Storage: `Nfts::CollectionRoleOf` (r:1 w:0)
/// Proof: `Nfts::CollectionRoleOf` (`max_values`: None, `max_size`: Some(69), added: 2544, mode: `MaxEncodedLen`)
/// Storage: `Nfts::ItemMetadataOf` (r:1 w:1)
/// Proof: `Nfts::ItemMetadataOf` (`max_values`: None, `max_size`: Some(347), added: 2822, mode: `MaxEncodedLen`)
/// Storage: `Nfts::Collection` (r:1 w:1)
/// Proof: `Nfts::Collection` (`max_values`: None, `max_size`: Some(84), added: 2559, mode: `MaxEncodedLen`)
/// Storage: `Nfts::ItemConfigOf` (r:1 w:0)
/// Proof: `Nfts::ItemConfigOf` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`)
fn clear_metadata() -> Weight {
// Proof Size summary in bytes:
// Measured: `849`
// Estimated: `3812`
// Minimum execution time: 40_220_000 picoseconds.
Weight::from_parts(41_026_000, 0)
.saturating_add(Weight::from_parts(0, 3812))
.saturating_add(T::DbWeight::get().reads(4))
.saturating_add(T::DbWeight::get().writes(2))
}
/// Storage: `Nfts::CollectionRoleOf` (r:1 w:0)
/// Proof: `Nfts::CollectionRoleOf` (`max_values`: None, `max_size`: Some(69), added: 2544, mode: `MaxEncodedLen`)
/// Storage: `Nfts::CollectionConfigOf` (r:1 w:0)
/// Proof: `Nfts::CollectionConfigOf` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`)
/// Storage: `Nfts::Collection` (r:1 w:1)
/// Proof: `Nfts::Collection` (`max_values`: None, `max_size`: Some(84), added: 2559, mode: `MaxEncodedLen`)
/// Storage: `Nfts::CollectionMetadataOf` (r:1 w:1)
/// Proof: `Nfts::CollectionMetadataOf` (`max_values`: None, `max_size`: Some(294), added: 2769, mode: `MaxEncodedLen`)
fn set_collection_metadata() -> Weight {
// Proof Size summary in bytes:
// Measured: `398`
// Estimated: `3759`
// Minimum execution time: 38_135_000 picoseconds.
Weight::from_parts(38_561_000, 0)
.saturating_add(Weight::from_parts(0, 3759))
.saturating_add(T::DbWeight::get().reads(4))
.saturating_add(T::DbWeight::get().writes(2))
}
/// Storage: `Nfts::CollectionRoleOf` (r:1 w:0)
/// Proof: `Nfts::CollectionRoleOf` (`max_values`: None, `max_size`: Some(69), added: 2544, mode: `MaxEncodedLen`)
/// Storage: `Nfts::Collection` (r:1 w:0)
/// Proof: `Nfts::Collection` (`max_values`: None, `max_size`: Some(84), added: 2559, mode: `MaxEncodedLen`)
/// Storage: `Nfts::CollectionConfigOf` (r:1 w:0)
/// Proof: `Nfts::CollectionConfigOf` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`)
/// Storage: `Nfts::CollectionMetadataOf` (r:1 w:1)
/// Proof: `Nfts::CollectionMetadataOf` (`max_values`: None, `max_size`: Some(294), added: 2769, mode: `MaxEncodedLen`)
fn clear_collection_metadata() -> Weight {
// Proof Size summary in bytes:
// Measured: `716`
// Estimated: `3759`
// Minimum execution time: 37_583_000 picoseconds.
Weight::from_parts(38_215_000, 0)
.saturating_add(Weight::from_parts(0, 3759))
.saturating_add(T::DbWeight::get().reads(4))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `Nfts::Item` (r:1 w:1)
/// Proof: `Nfts::Item` (`max_values`: None, `max_size`: Some(861), added: 3336, mode: `MaxEncodedLen`)
/// Storage: `Nfts::CollectionConfigOf` (r:1 w:0)
/// Proof: `Nfts::CollectionConfigOf` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`)
fn approve_transfer() -> Weight {
// Proof Size summary in bytes:
// Measured: `410`
// Estimated: `4326`
// Minimum execution time: 21_405_000 picoseconds.
Weight::from_parts(21_803_000, 0)
.saturating_add(Weight::from_parts(0, 4326))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `Nfts::Item` (r:1 w:1)
/// Proof: `Nfts::Item` (`max_values`: None, `max_size`: Some(861), added: 3336, mode: `MaxEncodedLen`)
fn cancel_approval() -> Weight {
// Proof Size summary in bytes:
// Measured: `418`
// Estimated: `4326`
// Minimum execution time: 18_713_000 picoseconds.
Weight::from_parts(19_185_000, 0)
.saturating_add(Weight::from_parts(0, 4326))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `Nfts::Item` (r:1 w:1)
/// Proof: `Nfts::Item` (`max_values`: None, `max_size`: Some(861), added: 3336, mode: `MaxEncodedLen`)
fn clear_all_transfer_approvals() -> Weight {
// Proof Size summary in bytes:
// Measured: `418`
// Estimated: `4326`
// Minimum execution time: 17_803_000 picoseconds.
Weight::from_parts(18_270_000, 0)
.saturating_add(Weight::from_parts(0, 4326))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `Nfts::OwnershipAcceptance` (r:1 w:1)
/// Proof: `Nfts::OwnershipAcceptance` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`)
fn set_accept_ownership() -> Weight {
// Proof Size summary in bytes:
// Measured: `76`
// Estimated: `3517`
// Minimum execution time: 15_982_000 picoseconds.
Weight::from_parts(16_700_000, 0)
.saturating_add(Weight::from_parts(0, 3517))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `Nfts::CollectionConfigOf` (r:1 w:1)
/// Proof: `Nfts::CollectionConfigOf` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`)
/// Storage: `Nfts::Collection` (r:1 w:0)
/// Proof: `Nfts::Collection` (`max_values`: None, `max_size`: Some(84), added: 2559, mode: `MaxEncodedLen`)
fn set_collection_max_supply() -> Weight {
// Proof Size summary in bytes:
// Measured: `340`
// Estimated: `3549`
// Minimum execution time: 19_501_000 picoseconds.
Weight::from_parts(19_785_000, 0)
.saturating_add(Weight::from_parts(0, 3549))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `Nfts::CollectionRoleOf` (r:1 w:0)
/// Proof: `Nfts::CollectionRoleOf` (`max_values`: None, `max_size`: Some(69), added: 2544, mode: `MaxEncodedLen`)
/// Storage: `Nfts::CollectionConfigOf` (r:1 w:1)
/// Proof: `Nfts::CollectionConfigOf` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`)
fn update_mint_settings() -> Weight {
// Proof Size summary in bytes:
// Measured: `323`
// Estimated: `3538`
// Minimum execution time: 18_914_000 picoseconds.
Weight::from_parts(19_292_000, 0)
.saturating_add(Weight::from_parts(0, 3538))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `Nfts::Item` (r:1 w:0)
/// Proof: `Nfts::Item` (`max_values`: None, `max_size`: Some(861), added: 3336, mode: `MaxEncodedLen`)
/// Storage: `Nfts::CollectionConfigOf` (r:1 w:0)
/// Proof: `Nfts::CollectionConfigOf` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`)
/// Storage: `Nfts::ItemConfigOf` (r:1 w:0)
/// Proof: `Nfts::ItemConfigOf` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`)
/// Storage: `Nfts::ItemPriceOf` (r:0 w:1)
/// Proof: `Nfts::ItemPriceOf` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)
fn set_price() -> Weight {
// Proof Size summary in bytes:
// Measured: `518`
// Estimated: `4326`
// Minimum execution time: 24_625_000 picoseconds.
Weight::from_parts(25_257_000, 0)
.saturating_add(Weight::from_parts(0, 4326))
.saturating_add(T::DbWeight::get().reads(3))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `Nfts::Item` (r:1 w:1)
/// Proof: `Nfts::Item` (`max_values`: None, `max_size`: Some(861), added: 3336, mode: `MaxEncodedLen`)
/// Storage: `Nfts::ItemPriceOf` (r:1 w:1)
/// Proof: `Nfts::ItemPriceOf` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)
/// Storage: `Nfts::Collection` (r:1 w:0)
/// Proof: `Nfts::Collection` (`max_values`: None, `max_size`: Some(84), added: 2559, mode: `MaxEncodedLen`)
/// Storage: `Nfts::Attribute` (r:1 w:0)
/// Proof: `Nfts::Attribute` (`max_values`: None, `max_size`: Some(479), added: 2954, mode: `MaxEncodedLen`)
/// Storage: `Nfts::CollectionConfigOf` (r:1 w:0)
/// Proof: `Nfts::CollectionConfigOf` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`)
/// Storage: `Nfts::ItemConfigOf` (r:1 w:0)
/// Proof: `Nfts::ItemConfigOf` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`)
/// Storage: `Nfts::Account` (r:0 w:2)
/// Proof: `Nfts::Account` (`max_values`: None, `max_size`: Some(88), added: 2563, mode: `MaxEncodedLen`)
/// Storage: `Nfts::PendingSwapOf` (r:0 w:1)
/// Proof: `Nfts::PendingSwapOf` (`max_values`: None, `max_size`: Some(71), added: 2546, mode: `MaxEncodedLen`)
fn buy_item() -> Weight {
// Proof Size summary in bytes:
// Measured: `705`
// Estimated: `4326`
// Minimum execution time: 50_833_000 picoseconds.
Weight::from_parts(52_161_000, 0)
.saturating_add(Weight::from_parts(0, 4326))
.saturating_add(T::DbWeight::get().reads(6))
.saturating_add(T::DbWeight::get().writes(5))
}
/// The range of component `n` is `[0, 10]`.
fn pay_tips(n: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 2_220_000 picoseconds.
Weight::from_parts(3_476_001, 0)
.saturating_add(Weight::from_parts(0, 0))
// Standard Error: 7_084
.saturating_add(Weight::from_parts(3_844_820, 0).saturating_mul(n.into()))
}
/// Storage: `Nfts::Item` (r:2 w:0)
/// Proof: `Nfts::Item` (`max_values`: None, `max_size`: Some(861), added: 3336, mode: `MaxEncodedLen`)
/// Storage: `Nfts::PendingSwapOf` (r:0 w:1)
/// Proof: `Nfts::PendingSwapOf` (`max_values`: None, `max_size`: Some(71), added: 2546, mode: `MaxEncodedLen`)
fn create_swap() -> Weight {
// Proof Size summary in bytes:
// Measured: `494`
// Estimated: `7662`
// Minimum execution time: 21_983_000 picoseconds.
Weight::from_parts(22_746_000, 0)
.saturating_add(Weight::from_parts(0, 7662))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `Nfts::PendingSwapOf` (r:1 w:1)
/// Proof: `Nfts::PendingSwapOf` (`max_values`: None, `max_size`: Some(71), added: 2546, mode: `MaxEncodedLen`)
/// Storage: `Nfts::Item` (r:1 w:0)
/// Proof: `Nfts::Item` (`max_values`: None, `max_size`: Some(861), added: 3336, mode: `MaxEncodedLen`)
fn cancel_swap() -> Weight {
// Proof Size summary in bytes:
// Measured: `513`
// Estimated: `4326`
// Minimum execution time: 20_875_000 picoseconds.
Weight::from_parts(21_465_000, 0)
.saturating_add(Weight::from_parts(0, 4326))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `Nfts::Item` (r:2 w:2)
/// Proof: `Nfts::Item` (`max_values`: None, `max_size`: Some(861), added: 3336, mode: `MaxEncodedLen`)
/// Storage: `Nfts::PendingSwapOf` (r:1 w:2)
/// Proof: `Nfts::PendingSwapOf` (`max_values`: None, `max_size`: Some(71), added: 2546, mode: `MaxEncodedLen`)
/// Storage: `Nfts::Collection` (r:1 w:0)
/// Proof: `Nfts::Collection` (`max_values`: None, `max_size`: Some(84), added: 2559, mode: `MaxEncodedLen`)
/// Storage: `Nfts::Attribute` (r:2 w:0)
/// Proof: `Nfts::Attribute` (`max_values`: None, `max_size`: Some(479), added: 2954, mode: `MaxEncodedLen`)
/// Storage: `Nfts::CollectionConfigOf` (r:1 w:0)
/// Proof: `Nfts::CollectionConfigOf` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`)
/// Storage: `Nfts::ItemConfigOf` (r:2 w:0)
/// Proof: `Nfts::ItemConfigOf` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`)
/// Storage: `Nfts::Account` (r:0 w:4)
/// Proof: `Nfts::Account` (`max_values`: None, `max_size`: Some(88), added: 2563, mode: `MaxEncodedLen`)
/// Storage: `Nfts::ItemPriceOf` (r:0 w:2)
/// Proof: `Nfts::ItemPriceOf` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)
fn claim_swap() -> Weight {
// Proof Size summary in bytes:
// Measured: `834`
// Estimated: `7662`
// Minimum execution time: 84_771_000 picoseconds.
Weight::from_parts(86_078_000, 0)
.saturating_add(Weight::from_parts(0, 7662))
.saturating_add(T::DbWeight::get().reads(9))
.saturating_add(T::DbWeight::get().writes(10))
}
/// Storage: `Nfts::CollectionRoleOf` (r:2 w:0)
/// Proof: `Nfts::CollectionRoleOf` (`max_values`: None, `max_size`: Some(69), added: 2544, mode: `MaxEncodedLen`)
/// Storage: `Nfts::CollectionConfigOf` (r:1 w:0)
/// Proof: `Nfts::CollectionConfigOf` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`)
/// Storage: `Nfts::Item` (r:1 w:1)
/// Proof: `Nfts::Item` (`max_values`: None, `max_size`: Some(861), added: 3336, mode: `MaxEncodedLen`)
/// Storage: `Nfts::Collection` (r:1 w:1)
/// Proof: `Nfts::Collection` (`max_values`: None, `max_size`: Some(84), added: 2559, mode: `MaxEncodedLen`)
/// Storage: `Nfts::ItemConfigOf` (r:1 w:1)
/// Proof: `Nfts::ItemConfigOf` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`)
/// Storage: `System::Account` (r:1 w:1)
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
/// Storage: `Nfts::Attribute` (r:10 w:10)
/// Proof: `Nfts::Attribute` (`max_values`: None, `max_size`: Some(479), added: 2954, mode: `MaxEncodedLen`)
/// Storage: `Nfts::ItemMetadataOf` (r:1 w:1)
/// Proof: `Nfts::ItemMetadataOf` (`max_values`: None, `max_size`: Some(347), added: 2822, mode: `MaxEncodedLen`)
/// Storage: `Nfts::Account` (r:0 w:1)
/// Proof: `Nfts::Account` (`max_values`: None, `max_size`: Some(88), added: 2563, mode: `MaxEncodedLen`)
/// The range of component `n` is `[0, 10]`.
fn mint_pre_signed(n: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `558`
// Estimated: `6078 + n * (2954 ±0)`
// Minimum execution time: 143_265_000 picoseconds.
Weight::from_parts(150_978_773, 0)
.saturating_add(Weight::from_parts(0, 6078))
// Standard Error: 49_443
.saturating_add(Weight::from_parts(31_888_255, 0).saturating_mul(n.into()))
.saturating_add(T::DbWeight::get().reads(8))
.saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into())))
.saturating_add(T::DbWeight::get().writes(6))
.saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into())))
.saturating_add(Weight::from_parts(0, 2954).saturating_mul(n.into()))
}
/// Storage: `Nfts::Item` (r:1 w:0)
/// Proof: `Nfts::Item` (`max_values`: None, `max_size`: Some(861), added: 3336, mode: `MaxEncodedLen`)
/// Storage: `Nfts::ItemAttributesApprovalsOf` (r:1 w:1)
/// Proof: `Nfts::ItemAttributesApprovalsOf` (`max_values`: None, `max_size`: Some(1001), added: 3476, mode: `MaxEncodedLen`)
/// Storage: `Nfts::CollectionConfigOf` (r:1 w:0)
/// Proof: `Nfts::CollectionConfigOf` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`)
/// Storage: `Nfts::Collection` (r:1 w:1)
/// Proof: `Nfts::Collection` (`max_values`: None, `max_size`: Some(84), added: 2559, mode: `MaxEncodedLen`)
/// Storage: `Nfts::Attribute` (r:10 w:10)
/// Proof: `Nfts::Attribute` (`max_values`: None, `max_size`: Some(479), added: 2954, mode: `MaxEncodedLen`)
/// Storage: `System::Account` (r:1 w:1)
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
/// The range of component `n` is `[0, 10]`.
fn set_attributes_pre_signed(n: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `588`
// Estimated: `4466 + n * (2954 ±0)`
// Minimum execution time: 83_754_000 picoseconds.
Weight::from_parts(96_685_026, 0)
.saturating_add(Weight::from_parts(0, 4466))
// Standard Error: 72_592
.saturating_add(Weight::from_parts(30_914_858, 0).saturating_mul(n.into()))
.saturating_add(T::DbWeight::get().reads(4))
.saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into())))
.saturating_add(T::DbWeight::get().writes(2))
.saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into())))
.saturating_add(Weight::from_parts(0, 2954).saturating_mul(n.into()))
}
}
@@ -0,0 +1,226 @@
// Copyright (C) Parity Technologies (UK) Ltd.
// This file is part of Cumulus.
// Cumulus is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Cumulus is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
//! Autogenerated weights for `pallet_proxy`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
//! DATE: 2023-07-31, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `runner-ynta1nyy-project-238-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz`
//! EXECUTION: ``, WASM-EXECUTION: `Compiled`, CHAIN: `Some("asset-hub-rococo-dev")`, DB CACHE: 1024
// Executed Command:
// ./target/production/polkadot-parachain
// benchmark
// pallet
// --chain=asset-hub-rococo-dev
// --wasm-execution=compiled
// --pallet=pallet_proxy
// --no-storage-info
// --no-median-slopes
// --no-min-squares
// --extrinsic=*
// --steps=50
// --repeat=20
// --json
// --header=./file_header.txt
// --output=./parachains/runtimes/assets/asset-hub-rococo/src/weights/
#![cfg_attr(rustfmt, rustfmt_skip)]
#![allow(unused_parens)]
#![allow(unused_imports)]
#![allow(missing_docs)]
use frame_support::{traits::Get, weights::Weight};
use core::marker::PhantomData;
/// Weight functions for `pallet_proxy`.
pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Config> pallet_proxy::WeightInfo for WeightInfo<T> {
/// Storage: `Proxy::Proxies` (r:1 w:0)
/// Proof: `Proxy::Proxies` (`max_values`: None, `max_size`: Some(1241), added: 3716, mode: `MaxEncodedLen`)
/// The range of component `p` is `[1, 31]`.
fn proxy(p: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `127 + p * (37 ±0)`
// Estimated: `4706`
// Minimum execution time: 16_417_000 picoseconds.
Weight::from_parts(17_283_443, 0)
.saturating_add(Weight::from_parts(0, 4706))
// Standard Error: 2_409
.saturating_add(Weight::from_parts(32_123, 0).saturating_mul(p.into()))
.saturating_add(T::DbWeight::get().reads(1))
}
/// Storage: `Proxy::Proxies` (r:1 w:0)
/// Proof: `Proxy::Proxies` (`max_values`: None, `max_size`: Some(1241), added: 3716, mode: `MaxEncodedLen`)
/// Storage: `Proxy::Announcements` (r:1 w:1)
/// Proof: `Proxy::Announcements` (`max_values`: None, `max_size`: Some(2233), added: 4708, mode: `MaxEncodedLen`)
/// Storage: `System::Account` (r:1 w:1)
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
/// The range of component `a` is `[0, 31]`.
/// The range of component `p` is `[1, 31]`.
fn proxy_announced(a: u32, p: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `454 + a * (68 ±0) + p * (37 ±0)`
// Estimated: `5698`
// Minimum execution time: 37_572_000 picoseconds.
Weight::from_parts(37_045_756, 0)
.saturating_add(Weight::from_parts(0, 5698))
// Standard Error: 2_896
.saturating_add(Weight::from_parts(139_561, 0).saturating_mul(a.into()))
// Standard Error: 2_993
.saturating_add(Weight::from_parts(73_270, 0).saturating_mul(p.into()))
.saturating_add(T::DbWeight::get().reads(3))
.saturating_add(T::DbWeight::get().writes(2))
}
/// Storage: `Proxy::Announcements` (r:1 w:1)
/// Proof: `Proxy::Announcements` (`max_values`: None, `max_size`: Some(2233), added: 4708, mode: `MaxEncodedLen`)
/// Storage: `System::Account` (r:1 w:1)
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
/// The range of component `a` is `[0, 31]`.
/// The range of component `p` is `[1, 31]`.
fn remove_announcement(a: u32, p: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `369 + a * (68 ±0)`
// Estimated: `5698`
// Minimum execution time: 24_066_000 picoseconds.
Weight::from_parts(24_711_403, 0)
.saturating_add(Weight::from_parts(0, 5698))
// Standard Error: 1_626
.saturating_add(Weight::from_parts(128_391, 0).saturating_mul(a.into()))
// Standard Error: 1_680
.saturating_add(Weight::from_parts(23_124, 0).saturating_mul(p.into()))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(2))
}
/// Storage: `Proxy::Announcements` (r:1 w:1)
/// Proof: `Proxy::Announcements` (`max_values`: None, `max_size`: Some(2233), added: 4708, mode: `MaxEncodedLen`)
/// Storage: `System::Account` (r:1 w:1)
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
/// The range of component `a` is `[0, 31]`.
/// The range of component `p` is `[1, 31]`.
fn reject_announcement(a: u32, p: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `369 + a * (68 ±0)`
// Estimated: `5698`
// Minimum execution time: 24_162_000 picoseconds.
Weight::from_parts(23_928_058, 0)
.saturating_add(Weight::from_parts(0, 5698))
// Standard Error: 2_072
.saturating_add(Weight::from_parts(152_299, 0).saturating_mul(a.into()))
// Standard Error: 2_141
.saturating_add(Weight::from_parts(39_775, 0).saturating_mul(p.into()))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(2))
}
/// Storage: `Proxy::Proxies` (r:1 w:0)
/// Proof: `Proxy::Proxies` (`max_values`: None, `max_size`: Some(1241), added: 3716, mode: `MaxEncodedLen`)
/// Storage: `Proxy::Announcements` (r:1 w:1)
/// Proof: `Proxy::Announcements` (`max_values`: None, `max_size`: Some(2233), added: 4708, mode: `MaxEncodedLen`)
/// Storage: `System::Account` (r:1 w:1)
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
/// The range of component `a` is `[0, 31]`.
/// The range of component `p` is `[1, 31]`.
fn announce(a: u32, p: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `386 + a * (68 ±0) + p * (37 ±0)`
// Estimated: `5698`
// Minimum execution time: 33_858_000 picoseconds.
Weight::from_parts(33_568_059, 0)
.saturating_add(Weight::from_parts(0, 5698))
// Standard Error: 1_816
.saturating_add(Weight::from_parts(134_400, 0).saturating_mul(a.into()))
// Standard Error: 1_876
.saturating_add(Weight::from_parts(57_028, 0).saturating_mul(p.into()))
.saturating_add(T::DbWeight::get().reads(3))
.saturating_add(T::DbWeight::get().writes(2))
}
/// Storage: `Proxy::Proxies` (r:1 w:1)
/// Proof: `Proxy::Proxies` (`max_values`: None, `max_size`: Some(1241), added: 3716, mode: `MaxEncodedLen`)
/// The range of component `p` is `[1, 31]`.
fn add_proxy(p: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `127 + p * (37 ±0)`
// Estimated: `4706`
// Minimum execution time: 24_947_000 picoseconds.
Weight::from_parts(26_235_199, 0)
.saturating_add(Weight::from_parts(0, 4706))
// Standard Error: 1_363
.saturating_add(Weight::from_parts(41_435, 0).saturating_mul(p.into()))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `Proxy::Proxies` (r:1 w:1)
/// Proof: `Proxy::Proxies` (`max_values`: None, `max_size`: Some(1241), added: 3716, mode: `MaxEncodedLen`)
/// The range of component `p` is `[1, 31]`.
fn remove_proxy(p: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `127 + p * (37 ±0)`
// Estimated: `4706`
// Minimum execution time: 25_186_000 picoseconds.
Weight::from_parts(26_823_133, 0)
.saturating_add(Weight::from_parts(0, 4706))
// Standard Error: 2_259
.saturating_add(Weight::from_parts(34_224, 0).saturating_mul(p.into()))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `Proxy::Proxies` (r:1 w:1)
/// Proof: `Proxy::Proxies` (`max_values`: None, `max_size`: Some(1241), added: 3716, mode: `MaxEncodedLen`)
/// The range of component `p` is `[1, 31]`.
fn remove_proxies(p: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `127 + p * (37 ±0)`
// Estimated: `4706`
// Minimum execution time: 22_156_000 picoseconds.
Weight::from_parts(23_304_060, 0)
.saturating_add(Weight::from_parts(0, 4706))
// Standard Error: 1_738
.saturating_add(Weight::from_parts(39_612, 0).saturating_mul(p.into()))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `Proxy::Proxies` (r:1 w:1)
/// Proof: `Proxy::Proxies` (`max_values`: None, `max_size`: Some(1241), added: 3716, mode: `MaxEncodedLen`)
/// The range of component `p` is `[1, 31]`.
fn create_pure(p: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `139`
// Estimated: `4706`
// Minimum execution time: 26_914_000 picoseconds.
Weight::from_parts(28_009_062, 0)
.saturating_add(Weight::from_parts(0, 4706))
// Standard Error: 1_978
.saturating_add(Weight::from_parts(12_255, 0).saturating_mul(p.into()))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `Proxy::Proxies` (r:1 w:1)
/// Proof: `Proxy::Proxies` (`max_values`: None, `max_size`: Some(1241), added: 3716, mode: `MaxEncodedLen`)
/// The range of component `p` is `[0, 30]`.
fn kill_pure(p: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `164 + p * (37 ±0)`
// Estimated: `4706`
// Minimum execution time: 23_281_000 picoseconds.
Weight::from_parts(24_392_989, 0)
.saturating_add(Weight::from_parts(0, 4706))
// Standard Error: 2_943
.saturating_add(Weight::from_parts(30_287, 0).saturating_mul(p.into()))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
}
@@ -0,0 +1,81 @@
// Copyright (C) Parity Technologies (UK) Ltd.
// This file is part of Cumulus.
// Cumulus is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Cumulus is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
//! Autogenerated weights for `pallet_session`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
//! DATE: 2023-07-31, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `runner-ynta1nyy-project-238-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz`
//! EXECUTION: ``, WASM-EXECUTION: `Compiled`, CHAIN: `Some("asset-hub-rococo-dev")`, DB CACHE: 1024
// Executed Command:
// ./target/production/polkadot-parachain
// benchmark
// pallet
// --chain=asset-hub-rococo-dev
// --wasm-execution=compiled
// --pallet=pallet_session
// --no-storage-info
// --no-median-slopes
// --no-min-squares
// --extrinsic=*
// --steps=50
// --repeat=20
// --json
// --header=./file_header.txt
// --output=./parachains/runtimes/assets/asset-hub-rococo/src/weights/
#![cfg_attr(rustfmt, rustfmt_skip)]
#![allow(unused_parens)]
#![allow(unused_imports)]
#![allow(missing_docs)]
use frame_support::{traits::Get, weights::Weight};
use core::marker::PhantomData;
/// Weight functions for `pallet_session`.
pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Config> pallet_session::WeightInfo for WeightInfo<T> {
/// Storage: `Session::NextKeys` (r:1 w:1)
/// Proof: `Session::NextKeys` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `Session::KeyOwner` (r:1 w:1)
/// Proof: `Session::KeyOwner` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn set_keys() -> Weight {
// Proof Size summary in bytes:
// Measured: `270`
// Estimated: `3735`
// Minimum execution time: 16_932_000 picoseconds.
Weight::from_parts(17_357_000, 0)
.saturating_add(Weight::from_parts(0, 3735))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(2))
}
/// Storage: `Session::NextKeys` (r:1 w:1)
/// Proof: `Session::NextKeys` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `Session::KeyOwner` (r:0 w:1)
/// Proof: `Session::KeyOwner` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn purge_keys() -> Weight {
// Proof Size summary in bytes:
// Measured: `242`
// Estimated: `3707`
// Minimum execution time: 12_157_000 picoseconds.
Weight::from_parts(12_770_000, 0)
.saturating_add(Weight::from_parts(0, 3707))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(2))
}
}
@@ -0,0 +1,75 @@
// Copyright (C) Parity Technologies (UK) Ltd.
// This file is part of Cumulus.
// Cumulus is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Cumulus is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
//! Autogenerated weights for `pallet_timestamp`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
//! DATE: 2023-07-31, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `runner-ynta1nyy-project-238-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz`
//! EXECUTION: ``, WASM-EXECUTION: `Compiled`, CHAIN: `Some("asset-hub-rococo-dev")`, DB CACHE: 1024
// Executed Command:
// ./target/production/polkadot-parachain
// benchmark
// pallet
// --chain=asset-hub-rococo-dev
// --wasm-execution=compiled
// --pallet=pallet_timestamp
// --no-storage-info
// --no-median-slopes
// --no-min-squares
// --extrinsic=*
// --steps=50
// --repeat=20
// --json
// --header=./file_header.txt
// --output=./parachains/runtimes/assets/asset-hub-rococo/src/weights/
#![cfg_attr(rustfmt, rustfmt_skip)]
#![allow(unused_parens)]
#![allow(unused_imports)]
#![allow(missing_docs)]
use frame_support::{traits::Get, weights::Weight};
use core::marker::PhantomData;
/// Weight functions for `pallet_timestamp`.
pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Config> pallet_timestamp::WeightInfo for WeightInfo<T> {
/// Storage: `Timestamp::Now` (r:1 w:1)
/// Proof: `Timestamp::Now` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`)
/// Storage: `Aura::CurrentSlot` (r:1 w:0)
/// Proof: `Aura::CurrentSlot` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`)
fn set() -> Weight {
// Proof Size summary in bytes:
// Measured: `86`
// Estimated: `1493`
// Minimum execution time: 9_313_000 picoseconds.
Weight::from_parts(9_775_000, 0)
.saturating_add(Weight::from_parts(0, 1493))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(1))
}
fn on_finalize() -> Weight {
// Proof Size summary in bytes:
// Measured: `57`
// Estimated: `0`
// Minimum execution time: 3_322_000 picoseconds.
Weight::from_parts(3_577_000, 0)
.saturating_add(Weight::from_parts(0, 0))
}
}
@@ -0,0 +1,467 @@
// Copyright (C) Parity Technologies (UK) Ltd.
// This file is part of Cumulus.
// Cumulus is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Cumulus is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
//! Autogenerated weights for `pallet_uniques`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
//! DATE: 2023-07-31, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `runner-ynta1nyy-project-238-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz`
//! EXECUTION: ``, WASM-EXECUTION: `Compiled`, CHAIN: `Some("asset-hub-rococo-dev")`, DB CACHE: 1024
// Executed Command:
// ./target/production/polkadot-parachain
// benchmark
// pallet
// --chain=asset-hub-rococo-dev
// --wasm-execution=compiled
// --pallet=pallet_uniques
// --no-storage-info
// --no-median-slopes
// --no-min-squares
// --extrinsic=*
// --steps=50
// --repeat=20
// --json
// --header=./file_header.txt
// --output=./parachains/runtimes/assets/asset-hub-rococo/src/weights/
#![cfg_attr(rustfmt, rustfmt_skip)]
#![allow(unused_parens)]
#![allow(unused_imports)]
#![allow(missing_docs)]
use frame_support::{traits::Get, weights::Weight};
use core::marker::PhantomData;
/// Weight functions for `pallet_uniques`.
pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Config> pallet_uniques::WeightInfo for WeightInfo<T> {
/// Storage: `Uniques::Class` (r:1 w:1)
/// Proof: `Uniques::Class` (`max_values`: None, `max_size`: Some(178), added: 2653, mode: `MaxEncodedLen`)
/// Storage: `Uniques::ClassAccount` (r:0 w:1)
/// Proof: `Uniques::ClassAccount` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`)
fn create() -> Weight {
// Proof Size summary in bytes:
// Measured: `145`
// Estimated: `3643`
// Minimum execution time: 28_845_000 picoseconds.
Weight::from_parts(29_675_000, 0)
.saturating_add(Weight::from_parts(0, 3643))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(2))
}
/// Storage: `Uniques::Class` (r:1 w:1)
/// Proof: `Uniques::Class` (`max_values`: None, `max_size`: Some(178), added: 2653, mode: `MaxEncodedLen`)
/// Storage: `Uniques::ClassAccount` (r:0 w:1)
/// Proof: `Uniques::ClassAccount` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`)
fn force_create() -> Weight {
// Proof Size summary in bytes:
// Measured: `42`
// Estimated: `3643`
// Minimum execution time: 13_492_000 picoseconds.
Weight::from_parts(14_049_000, 0)
.saturating_add(Weight::from_parts(0, 3643))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(2))
}
/// Storage: `Uniques::Class` (r:1 w:1)
/// Proof: `Uniques::Class` (`max_values`: None, `max_size`: Some(178), added: 2653, mode: `MaxEncodedLen`)
/// Storage: `Uniques::Asset` (r:1001 w:1000)
/// Proof: `Uniques::Asset` (`max_values`: None, `max_size`: Some(122), added: 2597, mode: `MaxEncodedLen`)
/// Storage: `Uniques::InstanceMetadataOf` (r:1000 w:1000)
/// Proof: `Uniques::InstanceMetadataOf` (`max_values`: None, `max_size`: Some(187), added: 2662, mode: `MaxEncodedLen`)
/// Storage: `Uniques::Attribute` (r:1000 w:1000)
/// Proof: `Uniques::Attribute` (`max_values`: None, `max_size`: Some(172), added: 2647, mode: `MaxEncodedLen`)
/// Storage: `Uniques::ClassAccount` (r:0 w:1)
/// Proof: `Uniques::ClassAccount` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`)
/// Storage: `Uniques::ClassMetadataOf` (r:0 w:1)
/// Proof: `Uniques::ClassMetadataOf` (`max_values`: None, `max_size`: Some(167), added: 2642, mode: `MaxEncodedLen`)
/// Storage: `Uniques::Account` (r:0 w:1000)
/// Proof: `Uniques::Account` (`max_values`: None, `max_size`: Some(88), added: 2563, mode: `MaxEncodedLen`)
/// Storage: `Uniques::CollectionMaxSupply` (r:0 w:1)
/// Proof: `Uniques::CollectionMaxSupply` (`max_values`: None, `max_size`: Some(24), added: 2499, mode: `MaxEncodedLen`)
/// The range of component `n` is `[0, 1000]`.
/// The range of component `m` is `[0, 1000]`.
/// The range of component `a` is `[0, 1000]`.
fn destroy(n: u32, m: u32, a: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `257 + a * (107 ±0) + m * (56 ±0) + n * (76 ±0)`
// Estimated: `3643 + a * (2647 ±0) + m * (2662 ±0) + n * (2597 ±0)`
// Minimum execution time: 2_920_070_000 picoseconds.
Weight::from_parts(2_983_862_000, 0)
.saturating_add(Weight::from_parts(0, 3643))
// Standard Error: 36_415
.saturating_add(Weight::from_parts(7_589_778, 0).saturating_mul(n.into()))
// Standard Error: 36_415
.saturating_add(Weight::from_parts(479_496, 0).saturating_mul(m.into()))
// Standard Error: 36_415
.saturating_add(Weight::from_parts(562_056, 0).saturating_mul(a.into()))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into())))
.saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(m.into())))
.saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(a.into())))
.saturating_add(T::DbWeight::get().writes(4))
.saturating_add(T::DbWeight::get().writes((2_u64).saturating_mul(n.into())))
.saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(m.into())))
.saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(a.into())))
.saturating_add(Weight::from_parts(0, 2647).saturating_mul(a.into()))
.saturating_add(Weight::from_parts(0, 2662).saturating_mul(m.into()))
.saturating_add(Weight::from_parts(0, 2597).saturating_mul(n.into()))
}
/// Storage: `Uniques::Asset` (r:1 w:1)
/// Proof: `Uniques::Asset` (`max_values`: None, `max_size`: Some(122), added: 2597, mode: `MaxEncodedLen`)
/// Storage: `Uniques::Class` (r:1 w:1)
/// Proof: `Uniques::Class` (`max_values`: None, `max_size`: Some(178), added: 2653, mode: `MaxEncodedLen`)
/// Storage: `Uniques::CollectionMaxSupply` (r:1 w:0)
/// Proof: `Uniques::CollectionMaxSupply` (`max_values`: None, `max_size`: Some(24), added: 2499, mode: `MaxEncodedLen`)
/// Storage: `Uniques::Account` (r:0 w:1)
/// Proof: `Uniques::Account` (`max_values`: None, `max_size`: Some(88), added: 2563, mode: `MaxEncodedLen`)
fn mint() -> Weight {
// Proof Size summary in bytes:
// Measured: `282`
// Estimated: `3643`
// Minimum execution time: 35_329_000 picoseconds.
Weight::from_parts(36_019_000, 0)
.saturating_add(Weight::from_parts(0, 3643))
.saturating_add(T::DbWeight::get().reads(3))
.saturating_add(T::DbWeight::get().writes(3))
}
/// Storage: `Uniques::Class` (r:1 w:1)
/// Proof: `Uniques::Class` (`max_values`: None, `max_size`: Some(178), added: 2653, mode: `MaxEncodedLen`)
/// Storage: `Uniques::Asset` (r:1 w:1)
/// Proof: `Uniques::Asset` (`max_values`: None, `max_size`: Some(122), added: 2597, mode: `MaxEncodedLen`)
/// Storage: `Uniques::Account` (r:0 w:1)
/// Proof: `Uniques::Account` (`max_values`: None, `max_size`: Some(88), added: 2563, mode: `MaxEncodedLen`)
/// Storage: `Uniques::ItemPriceOf` (r:0 w:1)
/// Proof: `Uniques::ItemPriceOf` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)
fn burn() -> Weight {
// Proof Size summary in bytes:
// Measured: `428`
// Estimated: `3643`
// Minimum execution time: 36_474_000 picoseconds.
Weight::from_parts(37_190_000, 0)
.saturating_add(Weight::from_parts(0, 3643))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(4))
}
/// Storage: `Uniques::Class` (r:1 w:0)
/// Proof: `Uniques::Class` (`max_values`: None, `max_size`: Some(178), added: 2653, mode: `MaxEncodedLen`)
/// Storage: `Uniques::Asset` (r:1 w:1)
/// Proof: `Uniques::Asset` (`max_values`: None, `max_size`: Some(122), added: 2597, mode: `MaxEncodedLen`)
/// Storage: `Uniques::Account` (r:0 w:2)
/// Proof: `Uniques::Account` (`max_values`: None, `max_size`: Some(88), added: 2563, mode: `MaxEncodedLen`)
/// Storage: `Uniques::ItemPriceOf` (r:0 w:1)
/// Proof: `Uniques::ItemPriceOf` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)
fn transfer() -> Weight {
// Proof Size summary in bytes:
// Measured: `428`
// Estimated: `3643`
// Minimum execution time: 26_786_000 picoseconds.
Weight::from_parts(27_400_000, 0)
.saturating_add(Weight::from_parts(0, 3643))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(4))
}
/// Storage: `Uniques::Class` (r:1 w:1)
/// Proof: `Uniques::Class` (`max_values`: None, `max_size`: Some(178), added: 2653, mode: `MaxEncodedLen`)
/// Storage: `Uniques::Asset` (r:5000 w:5000)
/// Proof: `Uniques::Asset` (`max_values`: None, `max_size`: Some(122), added: 2597, mode: `MaxEncodedLen`)
/// The range of component `i` is `[0, 5000]`.
fn redeposit(i: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `738 + i * (76 ±0)`
// Estimated: `3643 + i * (2597 ±0)`
// Minimum execution time: 14_546_000 picoseconds.
Weight::from_parts(14_831_000, 0)
.saturating_add(Weight::from_parts(0, 3643))
// Standard Error: 24_362
.saturating_add(Weight::from_parts(17_972_938, 0).saturating_mul(i.into()))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(i.into())))
.saturating_add(T::DbWeight::get().writes(1))
.saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into())))
.saturating_add(Weight::from_parts(0, 2597).saturating_mul(i.into()))
}
/// Storage: `Uniques::Asset` (r:1 w:1)
/// Proof: `Uniques::Asset` (`max_values`: None, `max_size`: Some(122), added: 2597, mode: `MaxEncodedLen`)
/// Storage: `Uniques::Class` (r:1 w:0)
/// Proof: `Uniques::Class` (`max_values`: None, `max_size`: Some(178), added: 2653, mode: `MaxEncodedLen`)
fn freeze() -> Weight {
// Proof Size summary in bytes:
// Measured: `428`
// Estimated: `3643`
// Minimum execution time: 18_919_000 picoseconds.
Weight::from_parts(19_547_000, 0)
.saturating_add(Weight::from_parts(0, 3643))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `Uniques::Asset` (r:1 w:1)
/// Proof: `Uniques::Asset` (`max_values`: None, `max_size`: Some(122), added: 2597, mode: `MaxEncodedLen`)
/// Storage: `Uniques::Class` (r:1 w:0)
/// Proof: `Uniques::Class` (`max_values`: None, `max_size`: Some(178), added: 2653, mode: `MaxEncodedLen`)
fn thaw() -> Weight {
// Proof Size summary in bytes:
// Measured: `428`
// Estimated: `3643`
// Minimum execution time: 18_643_000 picoseconds.
Weight::from_parts(19_000_000, 0)
.saturating_add(Weight::from_parts(0, 3643))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `Uniques::Class` (r:1 w:1)
/// Proof: `Uniques::Class` (`max_values`: None, `max_size`: Some(178), added: 2653, mode: `MaxEncodedLen`)
fn freeze_collection() -> Weight {
// Proof Size summary in bytes:
// Measured: `282`
// Estimated: `3643`
// Minimum execution time: 13_530_000 picoseconds.
Weight::from_parts(14_165_000, 0)
.saturating_add(Weight::from_parts(0, 3643))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `Uniques::Class` (r:1 w:1)
/// Proof: `Uniques::Class` (`max_values`: None, `max_size`: Some(178), added: 2653, mode: `MaxEncodedLen`)
fn thaw_collection() -> Weight {
// Proof Size summary in bytes:
// Measured: `282`
// Estimated: `3643`
// Minimum execution time: 13_523_000 picoseconds.
Weight::from_parts(14_055_000, 0)
.saturating_add(Weight::from_parts(0, 3643))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `Uniques::OwnershipAcceptance` (r:1 w:1)
/// Proof: `Uniques::OwnershipAcceptance` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`)
/// Storage: `Uniques::Class` (r:1 w:1)
/// Proof: `Uniques::Class` (`max_values`: None, `max_size`: Some(178), added: 2653, mode: `MaxEncodedLen`)
/// Storage: `Uniques::ClassAccount` (r:0 w:2)
/// Proof: `Uniques::ClassAccount` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`)
fn transfer_ownership() -> Weight {
// Proof Size summary in bytes:
// Measured: `356`
// Estimated: `3643`
// Minimum execution time: 22_131_000 picoseconds.
Weight::from_parts(22_628_000, 0)
.saturating_add(Weight::from_parts(0, 3643))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(4))
}
/// Storage: `Uniques::Class` (r:1 w:1)
/// Proof: `Uniques::Class` (`max_values`: None, `max_size`: Some(178), added: 2653, mode: `MaxEncodedLen`)
fn set_team() -> Weight {
// Proof Size summary in bytes:
// Measured: `282`
// Estimated: `3643`
// Minimum execution time: 13_841_000 picoseconds.
Weight::from_parts(14_408_000, 0)
.saturating_add(Weight::from_parts(0, 3643))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `Uniques::Class` (r:1 w:1)
/// Proof: `Uniques::Class` (`max_values`: None, `max_size`: Some(178), added: 2653, mode: `MaxEncodedLen`)
/// Storage: `Uniques::ClassAccount` (r:0 w:1)
/// Proof: `Uniques::ClassAccount` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`)
fn force_item_status() -> Weight {
// Proof Size summary in bytes:
// Measured: `282`
// Estimated: `3643`
// Minimum execution time: 16_954_000 picoseconds.
Weight::from_parts(17_482_000, 0)
.saturating_add(Weight::from_parts(0, 3643))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(2))
}
/// Storage: `Uniques::Class` (r:1 w:1)
/// Proof: `Uniques::Class` (`max_values`: None, `max_size`: Some(178), added: 2653, mode: `MaxEncodedLen`)
/// Storage: `Uniques::InstanceMetadataOf` (r:1 w:0)
/// Proof: `Uniques::InstanceMetadataOf` (`max_values`: None, `max_size`: Some(187), added: 2662, mode: `MaxEncodedLen`)
/// Storage: `Uniques::Attribute` (r:1 w:1)
/// Proof: `Uniques::Attribute` (`max_values`: None, `max_size`: Some(172), added: 2647, mode: `MaxEncodedLen`)
fn set_attribute() -> Weight {
// Proof Size summary in bytes:
// Measured: `559`
// Estimated: `3652`
// Minimum execution time: 38_493_000 picoseconds.
Weight::from_parts(39_513_000, 0)
.saturating_add(Weight::from_parts(0, 3652))
.saturating_add(T::DbWeight::get().reads(3))
.saturating_add(T::DbWeight::get().writes(2))
}
/// Storage: `Uniques::Class` (r:1 w:1)
/// Proof: `Uniques::Class` (`max_values`: None, `max_size`: Some(178), added: 2653, mode: `MaxEncodedLen`)
/// Storage: `Uniques::InstanceMetadataOf` (r:1 w:0)
/// Proof: `Uniques::InstanceMetadataOf` (`max_values`: None, `max_size`: Some(187), added: 2662, mode: `MaxEncodedLen`)
/// Storage: `Uniques::Attribute` (r:1 w:1)
/// Proof: `Uniques::Attribute` (`max_values`: None, `max_size`: Some(172), added: 2647, mode: `MaxEncodedLen`)
fn clear_attribute() -> Weight {
// Proof Size summary in bytes:
// Measured: `756`
// Estimated: `3652`
// Minimum execution time: 37_918_000 picoseconds.
Weight::from_parts(38_666_000, 0)
.saturating_add(Weight::from_parts(0, 3652))
.saturating_add(T::DbWeight::get().reads(3))
.saturating_add(T::DbWeight::get().writes(2))
}
/// Storage: `Uniques::Class` (r:1 w:1)
/// Proof: `Uniques::Class` (`max_values`: None, `max_size`: Some(178), added: 2653, mode: `MaxEncodedLen`)
/// Storage: `Uniques::InstanceMetadataOf` (r:1 w:1)
/// Proof: `Uniques::InstanceMetadataOf` (`max_values`: None, `max_size`: Some(187), added: 2662, mode: `MaxEncodedLen`)
fn set_metadata() -> Weight {
// Proof Size summary in bytes:
// Measured: `348`
// Estimated: `3652`
// Minimum execution time: 29_810_000 picoseconds.
Weight::from_parts(30_363_000, 0)
.saturating_add(Weight::from_parts(0, 3652))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(2))
}
/// Storage: `Uniques::Class` (r:1 w:1)
/// Proof: `Uniques::Class` (`max_values`: None, `max_size`: Some(178), added: 2653, mode: `MaxEncodedLen`)
/// Storage: `Uniques::InstanceMetadataOf` (r:1 w:1)
/// Proof: `Uniques::InstanceMetadataOf` (`max_values`: None, `max_size`: Some(187), added: 2662, mode: `MaxEncodedLen`)
fn clear_metadata() -> Weight {
// Proof Size summary in bytes:
// Measured: `559`
// Estimated: `3652`
// Minimum execution time: 30_877_000 picoseconds.
Weight::from_parts(31_430_000, 0)
.saturating_add(Weight::from_parts(0, 3652))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(2))
}
/// Storage: `Uniques::Class` (r:1 w:1)
/// Proof: `Uniques::Class` (`max_values`: None, `max_size`: Some(178), added: 2653, mode: `MaxEncodedLen`)
/// Storage: `Uniques::ClassMetadataOf` (r:1 w:1)
/// Proof: `Uniques::ClassMetadataOf` (`max_values`: None, `max_size`: Some(167), added: 2642, mode: `MaxEncodedLen`)
fn set_collection_metadata() -> Weight {
// Proof Size summary in bytes:
// Measured: `282`
// Estimated: `3643`
// Minimum execution time: 30_478_000 picoseconds.
Weight::from_parts(31_065_000, 0)
.saturating_add(Weight::from_parts(0, 3643))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(2))
}
/// Storage: `Uniques::Class` (r:1 w:0)
/// Proof: `Uniques::Class` (`max_values`: None, `max_size`: Some(178), added: 2653, mode: `MaxEncodedLen`)
/// Storage: `Uniques::ClassMetadataOf` (r:1 w:1)
/// Proof: `Uniques::ClassMetadataOf` (`max_values`: None, `max_size`: Some(167), added: 2642, mode: `MaxEncodedLen`)
fn clear_collection_metadata() -> Weight {
// Proof Size summary in bytes:
// Measured: `473`
// Estimated: `3643`
// Minimum execution time: 29_582_000 picoseconds.
Weight::from_parts(30_160_000, 0)
.saturating_add(Weight::from_parts(0, 3643))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `Uniques::Class` (r:1 w:0)
/// Proof: `Uniques::Class` (`max_values`: None, `max_size`: Some(178), added: 2653, mode: `MaxEncodedLen`)
/// Storage: `Uniques::Asset` (r:1 w:1)
/// Proof: `Uniques::Asset` (`max_values`: None, `max_size`: Some(122), added: 2597, mode: `MaxEncodedLen`)
fn approve_transfer() -> Weight {
// Proof Size summary in bytes:
// Measured: `428`
// Estimated: `3643`
// Minimum execution time: 19_328_000 picoseconds.
Weight::from_parts(19_866_000, 0)
.saturating_add(Weight::from_parts(0, 3643))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `Uniques::Class` (r:1 w:0)
/// Proof: `Uniques::Class` (`max_values`: None, `max_size`: Some(178), added: 2653, mode: `MaxEncodedLen`)
/// Storage: `Uniques::Asset` (r:1 w:1)
/// Proof: `Uniques::Asset` (`max_values`: None, `max_size`: Some(122), added: 2597, mode: `MaxEncodedLen`)
fn cancel_approval() -> Weight {
// Proof Size summary in bytes:
// Measured: `461`
// Estimated: `3643`
// Minimum execution time: 19_131_000 picoseconds.
Weight::from_parts(19_569_000, 0)
.saturating_add(Weight::from_parts(0, 3643))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `Uniques::OwnershipAcceptance` (r:1 w:1)
/// Proof: `Uniques::OwnershipAcceptance` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`)
fn set_accept_ownership() -> Weight {
// Proof Size summary in bytes:
// Measured: `42`
// Estimated: `3517`
// Minimum execution time: 15_212_000 picoseconds.
Weight::from_parts(15_691_000, 0)
.saturating_add(Weight::from_parts(0, 3517))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `Uniques::CollectionMaxSupply` (r:1 w:1)
/// Proof: `Uniques::CollectionMaxSupply` (`max_values`: None, `max_size`: Some(24), added: 2499, mode: `MaxEncodedLen`)
/// Storage: `Uniques::Class` (r:1 w:0)
/// Proof: `Uniques::Class` (`max_values`: None, `max_size`: Some(178), added: 2653, mode: `MaxEncodedLen`)
fn set_collection_max_supply() -> Weight {
// Proof Size summary in bytes:
// Measured: `282`
// Estimated: `3643`
// Minimum execution time: 16_290_000 picoseconds.
Weight::from_parts(16_654_000, 0)
.saturating_add(Weight::from_parts(0, 3643))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `Uniques::Asset` (r:1 w:0)
/// Proof: `Uniques::Asset` (`max_values`: None, `max_size`: Some(122), added: 2597, mode: `MaxEncodedLen`)
/// Storage: `Uniques::ItemPriceOf` (r:0 w:1)
/// Proof: `Uniques::ItemPriceOf` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)
fn set_price() -> Weight {
// Proof Size summary in bytes:
// Measured: `259`
// Estimated: `3587`
// Minimum execution time: 16_095_000 picoseconds.
Weight::from_parts(16_555_000, 0)
.saturating_add(Weight::from_parts(0, 3587))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `Uniques::Asset` (r:1 w:1)
/// Proof: `Uniques::Asset` (`max_values`: None, `max_size`: Some(122), added: 2597, mode: `MaxEncodedLen`)
/// Storage: `Uniques::ItemPriceOf` (r:1 w:1)
/// Proof: `Uniques::ItemPriceOf` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)
/// Storage: `Uniques::Class` (r:1 w:0)
/// Proof: `Uniques::Class` (`max_values`: None, `max_size`: Some(178), added: 2653, mode: `MaxEncodedLen`)
/// Storage: `Uniques::Account` (r:0 w:2)
/// Proof: `Uniques::Account` (`max_values`: None, `max_size`: Some(88), added: 2563, mode: `MaxEncodedLen`)
fn buy_item() -> Weight {
// Proof Size summary in bytes:
// Measured: `540`
// Estimated: `3643`
// Minimum execution time: 35_506_000 picoseconds.
Weight::from_parts(36_305_000, 0)
.saturating_add(Weight::from_parts(0, 3643))
.saturating_add(T::DbWeight::get().reads(3))
.saturating_add(T::DbWeight::get().writes(4))
}
}
@@ -0,0 +1,102 @@
// Copyright (C) Parity Technologies (UK) Ltd.
// This file is part of Cumulus.
// Cumulus is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Cumulus is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
//! Autogenerated weights for `pallet_utility`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
//! DATE: 2023-07-31, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `runner-ynta1nyy-project-238-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz`
//! EXECUTION: ``, WASM-EXECUTION: `Compiled`, CHAIN: `Some("asset-hub-rococo-dev")`, DB CACHE: 1024
// Executed Command:
// ./target/production/polkadot-parachain
// benchmark
// pallet
// --chain=asset-hub-rococo-dev
// --wasm-execution=compiled
// --pallet=pallet_utility
// --no-storage-info
// --no-median-slopes
// --no-min-squares
// --extrinsic=*
// --steps=50
// --repeat=20
// --json
// --header=./file_header.txt
// --output=./parachains/runtimes/assets/asset-hub-rococo/src/weights/
#![cfg_attr(rustfmt, rustfmt_skip)]
#![allow(unused_parens)]
#![allow(unused_imports)]
#![allow(missing_docs)]
use frame_support::{traits::Get, weights::Weight};
use core::marker::PhantomData;
/// Weight functions for `pallet_utility`.
pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Config> pallet_utility::WeightInfo for WeightInfo<T> {
/// The range of component `c` is `[0, 1000]`.
fn batch(c: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 7_103_000 picoseconds.
Weight::from_parts(7_226_000, 0)
.saturating_add(Weight::from_parts(0, 0))
// Standard Error: 2_732
.saturating_add(Weight::from_parts(6_560_347, 0).saturating_mul(c.into()))
}
fn as_derivative() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 5_208_000 picoseconds.
Weight::from_parts(5_480_000, 0)
.saturating_add(Weight::from_parts(0, 0))
}
/// The range of component `c` is `[0, 1000]`.
fn batch_all(c: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 7_070_000 picoseconds.
Weight::from_parts(1_321_270, 0)
.saturating_add(Weight::from_parts(0, 0))
// Standard Error: 3_454
.saturating_add(Weight::from_parts(6_864_640, 0).saturating_mul(c.into()))
}
fn dispatch_as() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 9_255_000 picoseconds.
Weight::from_parts(9_683_000, 0)
.saturating_add(Weight::from_parts(0, 0))
}
/// The range of component `c` is `[0, 1000]`.
fn force_batch(c: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 6_852_000 picoseconds.
Weight::from_parts(7_007_000, 0)
.saturating_add(Weight::from_parts(0, 0))
// Standard Error: 1_745
.saturating_add(Weight::from_parts(6_562_902, 0).saturating_mul(c.into()))
}
}
@@ -0,0 +1,290 @@
// Copyright (C) Parity Technologies (UK) Ltd.
// This file is part of Cumulus.
// Cumulus is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Cumulus is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
//! Autogenerated weights for `pallet_xcm`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
//! DATE: 2023-07-31, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `runner-ynta1nyy-project-238-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz`
//! EXECUTION: ``, WASM-EXECUTION: `Compiled`, CHAIN: `Some("asset-hub-rococo-dev")`, DB CACHE: 1024
// Executed Command:
// ./target/production/polkadot-parachain
// benchmark
// pallet
// --chain=asset-hub-rococo-dev
// --wasm-execution=compiled
// --pallet=pallet_xcm
// --no-storage-info
// --no-median-slopes
// --no-min-squares
// --extrinsic=*
// --steps=50
// --repeat=20
// --json
// --header=./file_header.txt
// --output=./parachains/runtimes/assets/asset-hub-rococo/src/weights/
#![cfg_attr(rustfmt, rustfmt_skip)]
#![allow(unused_parens)]
#![allow(unused_imports)]
#![allow(missing_docs)]
use frame_support::{traits::Get, weights::Weight};
use core::marker::PhantomData;
/// Weight functions for `pallet_xcm`.
pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Config> pallet_xcm::WeightInfo for WeightInfo<T> {
/// Storage: `PolkadotXcm::SupportedVersion` (r:1 w:0)
/// Proof: `PolkadotXcm::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `PolkadotXcm::VersionDiscoveryQueue` (r:1 w:1)
/// Proof: `PolkadotXcm::VersionDiscoveryQueue` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `PolkadotXcm::SafeXcmVersion` (r:1 w:0)
/// Proof: `PolkadotXcm::SafeXcmVersion` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `ParachainSystem::HostConfiguration` (r:1 w:0)
/// Proof: `ParachainSystem::HostConfiguration` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `ParachainSystem::PendingUpwardMessages` (r:1 w:1)
/// Proof: `ParachainSystem::PendingUpwardMessages` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
fn send() -> Weight {
// Proof Size summary in bytes:
// Measured: `109`
// Estimated: `3574`
// Minimum execution time: 30_015_000 picoseconds.
Weight::from_parts(30_576_000, 0)
.saturating_add(Weight::from_parts(0, 3574))
.saturating_add(T::DbWeight::get().reads(5))
.saturating_add(T::DbWeight::get().writes(2))
}
/// Storage: `ParachainInfo::ParachainId` (r:1 w:0)
/// Proof: `ParachainInfo::ParachainId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
fn teleport_assets() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `1489`
// Minimum execution time: 24_785_000 picoseconds.
Weight::from_parts(25_097_000, 0)
.saturating_add(Weight::from_parts(0, 1489))
.saturating_add(T::DbWeight::get().reads(1))
}
/// Storage: `ParachainInfo::ParachainId` (r:1 w:0)
/// Proof: `ParachainInfo::ParachainId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
fn reserve_transfer_assets() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `1489`
// Minimum execution time: 18_561_000 picoseconds.
Weight::from_parts(19_121_000, 0)
.saturating_add(Weight::from_parts(0, 1489))
.saturating_add(T::DbWeight::get().reads(1))
}
/// Storage: `Benchmark::Override` (r:0 w:0)
/// Proof: `Benchmark::Override` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn execute() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 18_446_744_073_709_551_000 picoseconds.
Weight::from_parts(18_446_744_073_709_551_000, 0)
.saturating_add(Weight::from_parts(0, 0))
}
/// Storage: `PolkadotXcm::SupportedVersion` (r:0 w:1)
/// Proof: `PolkadotXcm::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn force_xcm_version() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 9_298_000 picoseconds.
Weight::from_parts(9_721_000, 0)
.saturating_add(Weight::from_parts(0, 0))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `PolkadotXcm::SafeXcmVersion` (r:0 w:1)
/// Proof: `PolkadotXcm::SafeXcmVersion` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
fn force_default_xcm_version() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 2_912_000 picoseconds.
Weight::from_parts(3_262_000, 0)
.saturating_add(Weight::from_parts(0, 0))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `PolkadotXcm::VersionNotifiers` (r:1 w:1)
/// Proof: `PolkadotXcm::VersionNotifiers` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `PolkadotXcm::QueryCounter` (r:1 w:1)
/// Proof: `PolkadotXcm::QueryCounter` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `PolkadotXcm::SupportedVersion` (r:1 w:0)
/// Proof: `PolkadotXcm::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `PolkadotXcm::VersionDiscoveryQueue` (r:1 w:1)
/// Proof: `PolkadotXcm::VersionDiscoveryQueue` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `PolkadotXcm::SafeXcmVersion` (r:1 w:0)
/// Proof: `PolkadotXcm::SafeXcmVersion` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `ParachainSystem::HostConfiguration` (r:1 w:0)
/// Proof: `ParachainSystem::HostConfiguration` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `ParachainSystem::PendingUpwardMessages` (r:1 w:1)
/// Proof: `ParachainSystem::PendingUpwardMessages` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `PolkadotXcm::Queries` (r:0 w:1)
/// Proof: `PolkadotXcm::Queries` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn force_subscribe_version_notify() -> Weight {
// Proof Size summary in bytes:
// Measured: `109`
// Estimated: `3574`
// Minimum execution time: 35_127_000 picoseconds.
Weight::from_parts(36_317_000, 0)
.saturating_add(Weight::from_parts(0, 3574))
.saturating_add(T::DbWeight::get().reads(7))
.saturating_add(T::DbWeight::get().writes(5))
}
/// Storage: `PolkadotXcm::VersionNotifiers` (r:1 w:1)
/// Proof: `PolkadotXcm::VersionNotifiers` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `PolkadotXcm::SupportedVersion` (r:1 w:0)
/// Proof: `PolkadotXcm::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `PolkadotXcm::VersionDiscoveryQueue` (r:1 w:1)
/// Proof: `PolkadotXcm::VersionDiscoveryQueue` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `PolkadotXcm::SafeXcmVersion` (r:1 w:0)
/// Proof: `PolkadotXcm::SafeXcmVersion` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `ParachainSystem::HostConfiguration` (r:1 w:0)
/// Proof: `ParachainSystem::HostConfiguration` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `ParachainSystem::PendingUpwardMessages` (r:1 w:1)
/// Proof: `ParachainSystem::PendingUpwardMessages` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `PolkadotXcm::Queries` (r:0 w:1)
/// Proof: `PolkadotXcm::Queries` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn force_unsubscribe_version_notify() -> Weight {
// Proof Size summary in bytes:
// Measured: `326`
// Estimated: `3791`
// Minimum execution time: 36_634_000 picoseconds.
Weight::from_parts(37_983_000, 0)
.saturating_add(Weight::from_parts(0, 3791))
.saturating_add(T::DbWeight::get().reads(6))
.saturating_add(T::DbWeight::get().writes(4))
}
/// Storage: `PolkadotXcm::XcmExecutionSuspended` (r:0 w:1)
/// Proof: `PolkadotXcm::XcmExecutionSuspended` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
fn force_suspension() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 2_940_000 picoseconds.
Weight::from_parts(3_085_000, 0)
.saturating_add(Weight::from_parts(0, 0))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `PolkadotXcm::SupportedVersion` (r:4 w:2)
/// Proof: `PolkadotXcm::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn migrate_supported_version() -> Weight {
// Proof Size summary in bytes:
// Measured: `162`
// Estimated: `11052`
// Minimum execution time: 17_400_000 picoseconds.
Weight::from_parts(17_759_000, 0)
.saturating_add(Weight::from_parts(0, 11052))
.saturating_add(T::DbWeight::get().reads(4))
.saturating_add(T::DbWeight::get().writes(2))
}
/// Storage: `PolkadotXcm::VersionNotifiers` (r:4 w:2)
/// Proof: `PolkadotXcm::VersionNotifiers` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn migrate_version_notifiers() -> Weight {
// Proof Size summary in bytes:
// Measured: `166`
// Estimated: `11056`
// Minimum execution time: 17_287_000 picoseconds.
Weight::from_parts(17_678_000, 0)
.saturating_add(Weight::from_parts(0, 11056))
.saturating_add(T::DbWeight::get().reads(4))
.saturating_add(T::DbWeight::get().writes(2))
}
/// Storage: `PolkadotXcm::VersionNotifyTargets` (r:5 w:0)
/// Proof: `PolkadotXcm::VersionNotifyTargets` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn already_notified_target() -> Weight {
// Proof Size summary in bytes:
// Measured: `173`
// Estimated: `13538`
// Minimum execution time: 18_941_000 picoseconds.
Weight::from_parts(19_285_000, 0)
.saturating_add(Weight::from_parts(0, 13538))
.saturating_add(T::DbWeight::get().reads(5))
}
/// Storage: `PolkadotXcm::VersionNotifyTargets` (r:2 w:1)
/// Proof: `PolkadotXcm::VersionNotifyTargets` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `PolkadotXcm::SupportedVersion` (r:1 w:0)
/// Proof: `PolkadotXcm::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `PolkadotXcm::VersionDiscoveryQueue` (r:1 w:1)
/// Proof: `PolkadotXcm::VersionDiscoveryQueue` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `PolkadotXcm::SafeXcmVersion` (r:1 w:0)
/// Proof: `PolkadotXcm::SafeXcmVersion` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `ParachainSystem::HostConfiguration` (r:1 w:0)
/// Proof: `ParachainSystem::HostConfiguration` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `ParachainSystem::PendingUpwardMessages` (r:1 w:1)
/// Proof: `ParachainSystem::PendingUpwardMessages` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
fn notify_current_targets() -> Weight {
// Proof Size summary in bytes:
// Measured: `176`
// Estimated: `6116`
// Minimum execution time: 32_668_000 picoseconds.
Weight::from_parts(33_533_000, 0)
.saturating_add(Weight::from_parts(0, 6116))
.saturating_add(T::DbWeight::get().reads(7))
.saturating_add(T::DbWeight::get().writes(3))
}
/// Storage: `PolkadotXcm::VersionNotifyTargets` (r:3 w:0)
/// Proof: `PolkadotXcm::VersionNotifyTargets` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn notify_target_migration_fail() -> Weight {
// Proof Size summary in bytes:
// Measured: `206`
// Estimated: `8621`
// Minimum execution time: 9_182_000 picoseconds.
Weight::from_parts(9_498_000, 0)
.saturating_add(Weight::from_parts(0, 8621))
.saturating_add(T::DbWeight::get().reads(3))
}
/// Storage: `PolkadotXcm::VersionNotifyTargets` (r:4 w:2)
/// Proof: `PolkadotXcm::VersionNotifyTargets` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn migrate_version_notify_targets() -> Weight {
// Proof Size summary in bytes:
// Measured: `173`
// Estimated: `11063`
// Minimum execution time: 17_519_000 picoseconds.
Weight::from_parts(17_943_000, 0)
.saturating_add(Weight::from_parts(0, 11063))
.saturating_add(T::DbWeight::get().reads(4))
.saturating_add(T::DbWeight::get().writes(2))
}
/// Storage: `PolkadotXcm::VersionNotifyTargets` (r:4 w:2)
/// Proof: `PolkadotXcm::VersionNotifyTargets` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `PolkadotXcm::SupportedVersion` (r:1 w:0)
/// Proof: `PolkadotXcm::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `PolkadotXcm::VersionDiscoveryQueue` (r:1 w:1)
/// Proof: `PolkadotXcm::VersionDiscoveryQueue` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `PolkadotXcm::SafeXcmVersion` (r:1 w:0)
/// Proof: `PolkadotXcm::SafeXcmVersion` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `ParachainSystem::HostConfiguration` (r:1 w:0)
/// Proof: `ParachainSystem::HostConfiguration` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `ParachainSystem::PendingUpwardMessages` (r:1 w:1)
/// Proof: `ParachainSystem::PendingUpwardMessages` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
fn migrate_and_notify_old_targets() -> Weight {
// Proof Size summary in bytes:
// Measured: `179`
// Estimated: `11069`
// Minimum execution time: 38_680_000 picoseconds.
Weight::from_parts(39_984_000, 0)
.saturating_add(Weight::from_parts(0, 11069))
.saturating_add(T::DbWeight::get().reads(9))
.saturating_add(T::DbWeight::get().writes(4))
}
}
@@ -0,0 +1,124 @@
// Copyright (C) Parity Technologies (UK) Ltd.
// This file is part of Cumulus.
// Cumulus is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Cumulus is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
//! Autogenerated weights for `pallet_xcm_bridge_hub_router`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
//! DATE: 2023-09-19, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `runner-guclnr1q-project-674-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz`
//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("asset-hub-rococo-dev")`, DB CACHE: 1024
// Executed Command:
// target/production/polkadot-parachain
// benchmark
// pallet
// --steps=50
// --repeat=20
// --extrinsic=*
// --wasm-execution=compiled
// --heap-pages=4096
// --json-file=/builds/parity/mirrors/polkadot-sdk/.git/.artifacts/bench.json
// --pallet=pallet_xcm_bridge_hub_router
// --chain=asset-hub-rococo-dev
// --header=./cumulus/file_header.txt
// --output=./cumulus/parachains/runtimes/assets/asset-hub-rococo/src/weights/
#![cfg_attr(rustfmt, rustfmt_skip)]
#![allow(unused_parens)]
#![allow(unused_imports)]
#![allow(missing_docs)]
use frame_support::{traits::Get, weights::Weight};
use core::marker::PhantomData;
/// Weight functions for `pallet_xcm_bridge_hub_router`.
pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Config> pallet_xcm_bridge_hub_router::WeightInfo for WeightInfo<T> {
/// Storage: UNKNOWN KEY `0x48297505634037ef48c848c99c0b1f1b` (r:1 w:0)
/// Proof: UNKNOWN KEY `0x48297505634037ef48c848c99c0b1f1b` (r:1 w:0)
/// Storage: `XcmpQueue::OutboundXcmpStatus` (r:1 w:0)
/// Proof: `XcmpQueue::OutboundXcmpStatus` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `XcmpQueue::InboundXcmpStatus` (r:1 w:0)
/// Proof: `XcmpQueue::InboundXcmpStatus` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `ToRococoXcmRouter::Bridge` (r:1 w:1)
/// Proof: `ToRococoXcmRouter::Bridge` (`max_values`: Some(1), `max_size`: Some(17), added: 512, mode: `MaxEncodedLen`)
fn on_initialize_when_non_congested() -> Weight {
// Proof Size summary in bytes:
// Measured: `232`
// Estimated: `3697`
// Minimum execution time: 10_861_000 picoseconds.
Weight::from_parts(11_253_000, 0)
.saturating_add(Weight::from_parts(0, 3697))
.saturating_add(T::DbWeight::get().reads(4))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: UNKNOWN KEY `0x48297505634037ef48c848c99c0b1f1b` (r:1 w:0)
/// Proof: UNKNOWN KEY `0x48297505634037ef48c848c99c0b1f1b` (r:1 w:0)
/// Storage: `XcmpQueue::OutboundXcmpStatus` (r:1 w:0)
/// Proof: `XcmpQueue::OutboundXcmpStatus` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
fn on_initialize_when_congested() -> Weight {
// Proof Size summary in bytes:
// Measured: `169`
// Estimated: `3634`
// Minimum execution time: 5_807_000 picoseconds.
Weight::from_parts(6_018_000, 0)
.saturating_add(Weight::from_parts(0, 3634))
.saturating_add(T::DbWeight::get().reads(2))
}
/// Storage: `ToRococoXcmRouter::Bridge` (r:1 w:1)
/// Proof: `ToRococoXcmRouter::Bridge` (`max_values`: Some(1), `max_size`: Some(17), added: 512, mode: `MaxEncodedLen`)
fn report_bridge_status() -> Weight {
// Proof Size summary in bytes:
// Measured: `117`
// Estimated: `1502`
// Minimum execution time: 11_479_000 picoseconds.
Weight::from_parts(11_831_000, 0)
.saturating_add(Weight::from_parts(0, 1502))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: UNKNOWN KEY `0x48297505634037ef48c848c99c0b1f1b` (r:1 w:0)
/// Proof: UNKNOWN KEY `0x48297505634037ef48c848c99c0b1f1b` (r:1 w:0)
/// Storage: `ParachainInfo::ParachainId` (r:1 w:0)
/// Proof: `ParachainInfo::ParachainId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
/// Storage: UNKNOWN KEY `0x0973fe64c85043ba1c965cbc38eb63c7` (r:1 w:0)
/// Proof: UNKNOWN KEY `0x0973fe64c85043ba1c965cbc38eb63c7` (r:1 w:0)
/// Storage: `ToRococoXcmRouter::Bridge` (r:1 w:1)
/// Proof: `ToRococoXcmRouter::Bridge` (`max_values`: Some(1), `max_size`: Some(17), added: 512, mode: `MaxEncodedLen`)
/// Storage: `PolkadotXcm::SupportedVersion` (r:1 w:0)
/// Proof: `PolkadotXcm::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `PolkadotXcm::VersionDiscoveryQueue` (r:1 w:1)
/// Proof: `PolkadotXcm::VersionDiscoveryQueue` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `PolkadotXcm::SafeXcmVersion` (r:1 w:0)
/// Proof: `PolkadotXcm::SafeXcmVersion` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `ParachainSystem::RelevantMessagingState` (r:1 w:0)
/// Proof: `ParachainSystem::RelevantMessagingState` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `XcmpQueue::OutboundXcmpStatus` (r:1 w:1)
/// Proof: `XcmpQueue::OutboundXcmpStatus` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `XcmpQueue::OutboundXcmpMessages` (r:0 w:1)
/// Proof: `XcmpQueue::OutboundXcmpMessages` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn send_message() -> Weight {
// Proof Size summary in bytes:
// Measured: `445`
// Estimated: `3910`
// Minimum execution time: 52_670_000 picoseconds.
Weight::from_parts(54_368_000, 0)
.saturating_add(Weight::from_parts(0, 3910))
.saturating_add(T::DbWeight::get().reads(9))
.saturating_add(T::DbWeight::get().writes(4))
}
}
@@ -0,0 +1,124 @@
// Copyright (C) Parity Technologies (UK) Ltd.
// This file is part of Cumulus.
// Cumulus is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Cumulus is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
//! Autogenerated weights for `pallet_xcm_bridge_hub_router`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
//! DATE: 2023-09-19, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `runner-guclnr1q-project-674-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz`
//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("asset-hub-rococo-dev")`, DB CACHE: 1024
// Executed Command:
// target/production/polkadot-parachain
// benchmark
// pallet
// --steps=50
// --repeat=20
// --extrinsic=*
// --wasm-execution=compiled
// --heap-pages=4096
// --json-file=/builds/parity/mirrors/polkadot-sdk/.git/.artifacts/bench.json
// --pallet=pallet_xcm_bridge_hub_router
// --chain=asset-hub-rococo-dev
// --header=./cumulus/file_header.txt
// --output=./cumulus/parachains/runtimes/assets/asset-hub-rococo/src/weights/
#![cfg_attr(rustfmt, rustfmt_skip)]
#![allow(unused_parens)]
#![allow(unused_imports)]
#![allow(missing_docs)]
use frame_support::{traits::Get, weights::Weight};
use core::marker::PhantomData;
/// Weight functions for `pallet_xcm_bridge_hub_router`.
pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Config> pallet_xcm_bridge_hub_router::WeightInfo for WeightInfo<T> {
/// Storage: UNKNOWN KEY `0x48297505634037ef48c848c99c0b1f1b` (r:1 w:0)
/// Proof: UNKNOWN KEY `0x48297505634037ef48c848c99c0b1f1b` (r:1 w:0)
/// Storage: `XcmpQueue::OutboundXcmpStatus` (r:1 w:0)
/// Proof: `XcmpQueue::OutboundXcmpStatus` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `XcmpQueue::InboundXcmpStatus` (r:1 w:0)
/// Proof: `XcmpQueue::InboundXcmpStatus` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `ToWococoXcmRouter::Bridge` (r:1 w:1)
/// Proof: `ToWococoXcmRouter::Bridge` (`max_values`: Some(1), `max_size`: Some(17), added: 512, mode: `MaxEncodedLen`)
fn on_initialize_when_non_congested() -> Weight {
// Proof Size summary in bytes:
// Measured: `198`
// Estimated: `3663`
// Minimum execution time: 10_936_000 picoseconds.
Weight::from_parts(11_432_000, 0)
.saturating_add(Weight::from_parts(0, 3663))
.saturating_add(T::DbWeight::get().reads(4))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: UNKNOWN KEY `0x48297505634037ef48c848c99c0b1f1b` (r:1 w:0)
/// Proof: UNKNOWN KEY `0x48297505634037ef48c848c99c0b1f1b` (r:1 w:0)
/// Storage: `XcmpQueue::OutboundXcmpStatus` (r:1 w:0)
/// Proof: `XcmpQueue::OutboundXcmpStatus` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
fn on_initialize_when_congested() -> Weight {
// Proof Size summary in bytes:
// Measured: `150`
// Estimated: `3615`
// Minimum execution time: 5_165_000 picoseconds.
Weight::from_parts(5_356_000, 0)
.saturating_add(Weight::from_parts(0, 3615))
.saturating_add(T::DbWeight::get().reads(2))
}
/// Storage: `ToWococoXcmRouter::Bridge` (r:1 w:1)
/// Proof: `ToWococoXcmRouter::Bridge` (`max_values`: Some(1), `max_size`: Some(17), added: 512, mode: `MaxEncodedLen`)
fn report_bridge_status() -> Weight {
// Proof Size summary in bytes:
// Measured: `83`
// Estimated: `1502`
// Minimum execution time: 11_420_000 picoseconds.
Weight::from_parts(11_946_000, 0)
.saturating_add(Weight::from_parts(0, 1502))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: UNKNOWN KEY `0x48297505634037ef48c848c99c0b1f1b` (r:1 w:0)
/// Proof: UNKNOWN KEY `0x48297505634037ef48c848c99c0b1f1b` (r:1 w:0)
/// Storage: `ParachainInfo::ParachainId` (r:1 w:0)
/// Proof: `ParachainInfo::ParachainId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
/// Storage: UNKNOWN KEY `0x0973fe64c85043ba1c965cbc38eb63c7` (r:1 w:0)
/// Proof: UNKNOWN KEY `0x0973fe64c85043ba1c965cbc38eb63c7` (r:1 w:0)
/// Storage: `ToWococoXcmRouter::Bridge` (r:1 w:1)
/// Proof: `ToWococoXcmRouter::Bridge` (`max_values`: Some(1), `max_size`: Some(17), added: 512, mode: `MaxEncodedLen`)
/// Storage: `PolkadotXcm::SupportedVersion` (r:1 w:0)
/// Proof: `PolkadotXcm::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `PolkadotXcm::VersionDiscoveryQueue` (r:1 w:1)
/// Proof: `PolkadotXcm::VersionDiscoveryQueue` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `PolkadotXcm::SafeXcmVersion` (r:1 w:0)
/// Proof: `PolkadotXcm::SafeXcmVersion` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `ParachainSystem::RelevantMessagingState` (r:1 w:0)
/// Proof: `ParachainSystem::RelevantMessagingState` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `XcmpQueue::OutboundXcmpStatus` (r:1 w:1)
/// Proof: `XcmpQueue::OutboundXcmpStatus` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `XcmpQueue::OutboundXcmpMessages` (r:0 w:1)
/// Proof: `XcmpQueue::OutboundXcmpMessages` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn send_message() -> Weight {
// Proof Size summary in bytes:
// Measured: `392`
// Estimated: `3857`
// Minimum execution time: 52_129_000 picoseconds.
Weight::from_parts(53_552_000, 0)
.saturating_add(Weight::from_parts(0, 3857))
.saturating_add(T::DbWeight::get().reads(9))
.saturating_add(T::DbWeight::get().writes(4))
}
}
@@ -0,0 +1,63 @@
// This file is part of Substrate.
// Copyright (C) Parity Technologies (UK) Ltd.
// 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.
pub mod constants {
use frame_support::{
parameter_types,
weights::{constants, RuntimeDbWeight},
};
parameter_types! {
/// `ParityDB` can be enabled with a feature flag, but is still experimental. These weights
/// are available for brave runtime engineers who may want to try this out as default.
pub const ParityDbWeight: RuntimeDbWeight = RuntimeDbWeight {
read: 8_000 * constants::WEIGHT_REF_TIME_PER_NANOS,
write: 50_000 * constants::WEIGHT_REF_TIME_PER_NANOS,
};
}
#[cfg(test)]
mod test_db_weights {
use super::constants::ParityDbWeight as W;
use frame_support::weights::constants;
/// Checks that all weights exist and have sane values.
// NOTE: If this test fails but you are sure that the generated values are fine,
// you can delete it.
#[test]
fn sane() {
// At least 1 µs.
assert!(
W::get().reads(1).ref_time() >= constants::WEIGHT_REF_TIME_PER_MICROS,
"Read weight should be at least 1 µs."
);
assert!(
W::get().writes(1).ref_time() >= constants::WEIGHT_REF_TIME_PER_MICROS,
"Write weight should be at least 1 µs."
);
// At most 1 ms.
assert!(
W::get().reads(1).ref_time() <= constants::WEIGHT_REF_TIME_PER_MILLIS,
"Read weight should be at most 1 ms."
);
assert!(
W::get().writes(1).ref_time() <= constants::WEIGHT_REF_TIME_PER_MILLIS,
"Write weight should be at most 1 ms."
);
}
}
}
@@ -0,0 +1,63 @@
// This file is part of Substrate.
// Copyright (C) Parity Technologies (UK) Ltd.
// 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.
pub mod constants {
use frame_support::{
parameter_types,
weights::{constants, RuntimeDbWeight},
};
parameter_types! {
/// By default, Substrate uses `RocksDB`, so this will be the weight used throughout
/// the runtime.
pub const RocksDbWeight: RuntimeDbWeight = RuntimeDbWeight {
read: 25_000 * constants::WEIGHT_REF_TIME_PER_NANOS,
write: 100_000 * constants::WEIGHT_REF_TIME_PER_NANOS,
};
}
#[cfg(test)]
mod test_db_weights {
use super::constants::RocksDbWeight as W;
use frame_support::weights::constants;
/// Checks that all weights exist and have sane values.
// NOTE: If this test fails but you are sure that the generated values are fine,
// you can delete it.
#[test]
fn sane() {
// At least 1 µs.
assert!(
W::get().reads(1).ref_time() >= constants::WEIGHT_REF_TIME_PER_MICROS,
"Read weight should be at least 1 µs."
);
assert!(
W::get().writes(1).ref_time() >= constants::WEIGHT_REF_TIME_PER_MICROS,
"Write weight should be at least 1 µs."
);
// At most 1 ms.
assert!(
W::get().reads(1).ref_time() <= constants::WEIGHT_REF_TIME_PER_MILLIS,
"Read weight should be at most 1 ms."
);
assert!(
W::get().writes(1).ref_time() <= constants::WEIGHT_REF_TIME_PER_MILLIS,
"Write weight should be at most 1 ms."
);
}
}
}
@@ -0,0 +1,256 @@
// Copyright (C) Parity Technologies (UK) Ltd.
// This file is part of Cumulus.
// Cumulus is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Cumulus is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
mod pallet_xcm_benchmarks_fungible;
mod pallet_xcm_benchmarks_generic;
use crate::{xcm_config::MaxAssetsIntoHolding, Runtime};
use frame_support::weights::Weight;
use pallet_xcm_benchmarks_fungible::WeightInfo as XcmFungibleWeight;
use pallet_xcm_benchmarks_generic::WeightInfo as XcmGeneric;
use sp_std::prelude::*;
use xcm::{latest::prelude::*, DoubleEncoded};
trait WeighMultiAssets {
fn weigh_multi_assets(&self, weight: Weight) -> Weight;
}
const MAX_ASSETS: u64 = 100;
impl WeighMultiAssets for MultiAssetFilter {
fn weigh_multi_assets(&self, weight: Weight) -> Weight {
match self {
Self::Definite(assets) => weight.saturating_mul(assets.inner().iter().count() as u64),
Self::Wild(asset) => match asset {
All => weight.saturating_mul(MAX_ASSETS),
AllOf { fun, .. } => match fun {
WildFungibility::Fungible => weight,
// Magic number 2 has to do with the fact that we could have up to 2 times
// MaxAssetsIntoHolding in the worst-case scenario.
WildFungibility::NonFungible =>
weight.saturating_mul((MaxAssetsIntoHolding::get() * 2) as u64),
},
AllCounted(count) => weight.saturating_mul(MAX_ASSETS.min(*count as u64)),
AllOfCounted { count, .. } => weight.saturating_mul(MAX_ASSETS.min(*count as u64)),
},
}
}
}
impl WeighMultiAssets for MultiAssets {
fn weigh_multi_assets(&self, weight: Weight) -> Weight {
weight.saturating_mul(self.inner().iter().count() as u64)
}
}
pub struct AssetHubRococoXcmWeight<Call>(core::marker::PhantomData<Call>);
impl<Call> XcmWeightInfo<Call> for AssetHubRococoXcmWeight<Call> {
fn withdraw_asset(assets: &MultiAssets) -> Weight {
assets.weigh_multi_assets(XcmFungibleWeight::<Runtime>::withdraw_asset())
}
// Currently there is no trusted reserve (`IsReserve = ()`),
// but we need this hack for `pallet_xcm::reserve_transfer_assets`
// (TODO) fix https://github.com/paritytech/polkadot/pull/7424
// (TODO) fix https://github.com/paritytech/polkadot/pull/7546
fn reserve_asset_deposited(_assets: &MultiAssets) -> Weight {
// TODO: if we change `IsReserve = ...` then use this line...
// TODO: or if remote weight estimation is fixed, then remove
// TODO: hardcoded - fix https://github.com/paritytech/cumulus/issues/1974
let hardcoded_weight = Weight::from_parts(1_000_000_000_u64, 0);
hardcoded_weight.min(XcmFungibleWeight::<Runtime>::reserve_asset_deposited())
}
fn receive_teleported_asset(assets: &MultiAssets) -> Weight {
assets.weigh_multi_assets(XcmFungibleWeight::<Runtime>::receive_teleported_asset())
}
fn query_response(
_query_id: &u64,
_response: &Response,
_max_weight: &Weight,
_querier: &Option<MultiLocation>,
) -> Weight {
XcmGeneric::<Runtime>::query_response()
}
fn transfer_asset(assets: &MultiAssets, _dest: &MultiLocation) -> Weight {
assets.weigh_multi_assets(XcmFungibleWeight::<Runtime>::transfer_asset())
}
fn transfer_reserve_asset(
assets: &MultiAssets,
_dest: &MultiLocation,
_xcm: &Xcm<()>,
) -> Weight {
assets.weigh_multi_assets(XcmFungibleWeight::<Runtime>::transfer_reserve_asset())
}
fn transact(
_origin_type: &OriginKind,
_require_weight_at_most: &Weight,
_call: &DoubleEncoded<Call>,
) -> Weight {
XcmGeneric::<Runtime>::transact()
}
fn hrmp_new_channel_open_request(
_sender: &u32,
_max_message_size: &u32,
_max_capacity: &u32,
) -> Weight {
// XCM Executor does not currently support HRMP channel operations
Weight::MAX
}
fn hrmp_channel_accepted(_recipient: &u32) -> Weight {
// XCM Executor does not currently support HRMP channel operations
Weight::MAX
}
fn hrmp_channel_closing(_initiator: &u32, _sender: &u32, _recipient: &u32) -> Weight {
// XCM Executor does not currently support HRMP channel operations
Weight::MAX
}
fn clear_origin() -> Weight {
XcmGeneric::<Runtime>::clear_origin()
}
fn descend_origin(_who: &InteriorMultiLocation) -> Weight {
XcmGeneric::<Runtime>::descend_origin()
}
fn report_error(_query_response_info: &QueryResponseInfo) -> Weight {
XcmGeneric::<Runtime>::report_error()
}
fn deposit_asset(assets: &MultiAssetFilter, _dest: &MultiLocation) -> Weight {
// Hardcoded till the XCM pallet is fixed
let hardcoded_weight = Weight::from_parts(1_000_000_000_u64, 0);
let weight = assets.weigh_multi_assets(XcmFungibleWeight::<Runtime>::deposit_asset());
hardcoded_weight.min(weight)
}
fn deposit_reserve_asset(
assets: &MultiAssetFilter,
_dest: &MultiLocation,
_xcm: &Xcm<()>,
) -> Weight {
assets.weigh_multi_assets(XcmFungibleWeight::<Runtime>::deposit_reserve_asset())
}
fn exchange_asset(_give: &MultiAssetFilter, _receive: &MultiAssets, _maximal: &bool) -> Weight {
Weight::MAX
}
fn initiate_reserve_withdraw(
assets: &MultiAssetFilter,
_reserve: &MultiLocation,
_xcm: &Xcm<()>,
) -> Weight {
assets.weigh_multi_assets(XcmFungibleWeight::<Runtime>::initiate_reserve_withdraw())
}
fn initiate_teleport(
assets: &MultiAssetFilter,
_dest: &MultiLocation,
_xcm: &Xcm<()>,
) -> Weight {
assets.weigh_multi_assets(XcmFungibleWeight::<Runtime>::initiate_teleport())
}
fn report_holding(_response_info: &QueryResponseInfo, _assets: &MultiAssetFilter) -> Weight {
XcmGeneric::<Runtime>::report_holding()
}
fn buy_execution(_fees: &MultiAsset, _weight_limit: &WeightLimit) -> Weight {
XcmGeneric::<Runtime>::buy_execution()
}
fn refund_surplus() -> Weight {
XcmGeneric::<Runtime>::refund_surplus()
}
fn set_error_handler(_xcm: &Xcm<Call>) -> Weight {
XcmGeneric::<Runtime>::set_error_handler()
}
fn set_appendix(_xcm: &Xcm<Call>) -> Weight {
XcmGeneric::<Runtime>::set_appendix()
}
fn clear_error() -> Weight {
XcmGeneric::<Runtime>::clear_error()
}
fn claim_asset(_assets: &MultiAssets, _ticket: &MultiLocation) -> Weight {
XcmGeneric::<Runtime>::claim_asset()
}
fn trap(_code: &u64) -> Weight {
XcmGeneric::<Runtime>::trap()
}
fn subscribe_version(_query_id: &QueryId, _max_response_weight: &Weight) -> Weight {
XcmGeneric::<Runtime>::subscribe_version()
}
fn unsubscribe_version() -> Weight {
XcmGeneric::<Runtime>::unsubscribe_version()
}
fn burn_asset(assets: &MultiAssets) -> Weight {
assets.weigh_multi_assets(XcmGeneric::<Runtime>::burn_asset())
}
fn expect_asset(assets: &MultiAssets) -> Weight {
assets.weigh_multi_assets(XcmGeneric::<Runtime>::expect_asset())
}
fn expect_origin(_origin: &Option<MultiLocation>) -> Weight {
XcmGeneric::<Runtime>::expect_origin()
}
fn expect_error(_error: &Option<(u32, XcmError)>) -> Weight {
XcmGeneric::<Runtime>::expect_error()
}
fn expect_transact_status(_transact_status: &MaybeErrorCode) -> Weight {
XcmGeneric::<Runtime>::expect_transact_status()
}
fn query_pallet(_module_name: &Vec<u8>, _response_info: &QueryResponseInfo) -> Weight {
XcmGeneric::<Runtime>::query_pallet()
}
fn expect_pallet(
_index: &u32,
_name: &Vec<u8>,
_module_name: &Vec<u8>,
_crate_major: &u32,
_min_crate_minor: &u32,
) -> Weight {
XcmGeneric::<Runtime>::expect_pallet()
}
fn report_transact_status(_response_info: &QueryResponseInfo) -> Weight {
XcmGeneric::<Runtime>::report_transact_status()
}
fn clear_transact_status() -> Weight {
XcmGeneric::<Runtime>::clear_transact_status()
}
fn universal_origin(_: &Junction) -> Weight {
XcmGeneric::<Runtime>::universal_origin()
}
fn export_message(_: &NetworkId, _: &Junctions, _: &Xcm<()>) -> Weight {
Weight::MAX
}
fn lock_asset(_: &MultiAsset, _: &MultiLocation) -> Weight {
Weight::MAX
}
fn unlock_asset(_: &MultiAsset, _: &MultiLocation) -> Weight {
Weight::MAX
}
fn note_unlockable(_: &MultiAsset, _: &MultiLocation) -> Weight {
Weight::MAX
}
fn request_unlock(_: &MultiAsset, _: &MultiLocation) -> Weight {
Weight::MAX
}
fn set_fees_mode(_: &bool) -> Weight {
XcmGeneric::<Runtime>::set_fees_mode()
}
fn set_topic(_topic: &[u8; 32]) -> Weight {
XcmGeneric::<Runtime>::set_topic()
}
fn clear_topic() -> Weight {
XcmGeneric::<Runtime>::clear_topic()
}
fn alias_origin(_: &MultiLocation) -> Weight {
// XCM Executor does not currently support alias origin operations
Weight::MAX
}
fn unpaid_execution(_: &WeightLimit, _: &Option<MultiLocation>) -> Weight {
XcmGeneric::<Runtime>::unpaid_execution()
}
}
@@ -0,0 +1,190 @@
// Copyright (C) Parity Technologies (UK) Ltd.
// This file is part of Cumulus.
// Cumulus is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Cumulus is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
//! Autogenerated weights for `pallet_xcm_benchmarks::fungible`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
//! DATE: 2023-07-31, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `runner-ynta1nyy-project-238-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz`
//! EXECUTION: , WASM-EXECUTION: Compiled, CHAIN: Some("asset-hub-rococo-dev"), DB CACHE: 1024
// Executed Command:
// ./target/production/polkadot-parachain
// benchmark
// pallet
// --template=./templates/xcm-bench-template.hbs
// --chain=asset-hub-rococo-dev
// --wasm-execution=compiled
// --pallet=pallet_xcm_benchmarks::fungible
// --no-storage-info
// --no-median-slopes
// --no-min-squares
// --extrinsic=*
// --steps=50
// --repeat=20
// --json
// --header=./file_header.txt
// --output=./parachains/runtimes/assets/asset-hub-rococo/src/weights/xcm/pallet_xcm_benchmarks_fungible.rs
#![cfg_attr(rustfmt, rustfmt_skip)]
#![allow(unused_parens)]
#![allow(unused_imports)]
use frame_support::{traits::Get, weights::Weight};
use sp_std::marker::PhantomData;
/// Weights for `pallet_xcm_benchmarks::fungible`.
pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Config> WeightInfo<T> {
// Storage: `System::Account` (r:1 w:1)
// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
pub fn withdraw_asset() -> Weight {
// Proof Size summary in bytes:
// Measured: `101`
// Estimated: `3593`
// Minimum execution time: 26_104_000 picoseconds.
Weight::from_parts(26_722_000, 3593)
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
// Storage: `System::Account` (r:2 w:2)
// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
pub fn transfer_asset() -> Weight {
// Proof Size summary in bytes:
// Measured: `101`
// Estimated: `6196`
// Minimum execution time: 52_259_000 picoseconds.
Weight::from_parts(53_854_000, 6196)
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(2))
}
// Storage: `System::Account` (r:2 w:2)
// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
// Storage: `ParachainInfo::ParachainId` (r:1 w:0)
// Proof: `ParachainInfo::ParachainId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
// Storage: `PolkadotXcm::SupportedVersion` (r:1 w:0)
// Proof: `PolkadotXcm::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`)
// Storage: `PolkadotXcm::VersionDiscoveryQueue` (r:1 w:1)
// Proof: `PolkadotXcm::VersionDiscoveryQueue` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
// Storage: `PolkadotXcm::SafeXcmVersion` (r:1 w:0)
// Proof: `PolkadotXcm::SafeXcmVersion` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
// Storage: `ParachainSystem::HostConfiguration` (r:1 w:0)
// Proof: `ParachainSystem::HostConfiguration` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
// Storage: `ParachainSystem::PendingUpwardMessages` (r:1 w:1)
// Proof: `ParachainSystem::PendingUpwardMessages` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
pub fn transfer_reserve_asset() -> Weight {
// Proof Size summary in bytes:
// Measured: `210`
// Estimated: `6196`
// Minimum execution time: 77_248_000 picoseconds.
Weight::from_parts(80_354_000, 6196)
.saturating_add(T::DbWeight::get().reads(8))
.saturating_add(T::DbWeight::get().writes(4))
}
// Storage: `Benchmark::Override` (r:0 w:0)
// Proof: `Benchmark::Override` (`max_values`: None, `max_size`: None, mode: `Measured`)
pub fn reserve_asset_deposited() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 500_000_000_000 picoseconds.
Weight::from_parts(500_000_000_000, 0)
}
// Storage: `ParachainInfo::ParachainId` (r:1 w:0)
// Proof: `ParachainInfo::ParachainId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
// Storage: `PolkadotXcm::SupportedVersion` (r:1 w:0)
// Proof: `PolkadotXcm::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`)
// Storage: `PolkadotXcm::VersionDiscoveryQueue` (r:1 w:1)
// Proof: `PolkadotXcm::VersionDiscoveryQueue` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
// Storage: `PolkadotXcm::SafeXcmVersion` (r:1 w:0)
// Proof: `PolkadotXcm::SafeXcmVersion` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
// Storage: `ParachainSystem::HostConfiguration` (r:1 w:0)
// Proof: `ParachainSystem::HostConfiguration` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
// Storage: `ParachainSystem::PendingUpwardMessages` (r:1 w:1)
// Proof: `ParachainSystem::PendingUpwardMessages` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
pub fn initiate_reserve_withdraw() -> Weight {
// Proof Size summary in bytes:
// Measured: `109`
// Estimated: `3574`
// Minimum execution time: 482_070_000 picoseconds.
Weight::from_parts(490_269_000, 3574)
.saturating_add(T::DbWeight::get().reads(6))
.saturating_add(T::DbWeight::get().writes(2))
}
pub fn receive_teleported_asset() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 3_970_000 picoseconds.
Weight::from_parts(4_056_000, 0)
}
// Storage: `System::Account` (r:1 w:1)
// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
pub fn deposit_asset() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `3593`
// Minimum execution time: 26_324_000 picoseconds.
Weight::from_parts(26_985_000, 3593)
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
// Storage: `System::Account` (r:1 w:1)
// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
// Storage: `ParachainInfo::ParachainId` (r:1 w:0)
// Proof: `ParachainInfo::ParachainId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
// Storage: `PolkadotXcm::SupportedVersion` (r:1 w:0)
// Proof: `PolkadotXcm::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`)
// Storage: `PolkadotXcm::VersionDiscoveryQueue` (r:1 w:1)
// Proof: `PolkadotXcm::VersionDiscoveryQueue` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
// Storage: `PolkadotXcm::SafeXcmVersion` (r:1 w:0)
// Proof: `PolkadotXcm::SafeXcmVersion` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
// Storage: `ParachainSystem::HostConfiguration` (r:1 w:0)
// Proof: `ParachainSystem::HostConfiguration` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
// Storage: `ParachainSystem::PendingUpwardMessages` (r:1 w:1)
// Proof: `ParachainSystem::PendingUpwardMessages` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
pub fn deposit_reserve_asset() -> Weight {
// Proof Size summary in bytes:
// Measured: `109`
// Estimated: `3593`
// Minimum execution time: 52_814_000 picoseconds.
Weight::from_parts(54_666_000, 3593)
.saturating_add(T::DbWeight::get().reads(7))
.saturating_add(T::DbWeight::get().writes(3))
}
// Storage: `ParachainInfo::ParachainId` (r:1 w:0)
// Proof: `ParachainInfo::ParachainId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
// Storage: `PolkadotXcm::SupportedVersion` (r:1 w:0)
// Proof: `PolkadotXcm::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`)
// Storage: `PolkadotXcm::VersionDiscoveryQueue` (r:1 w:1)
// Proof: `PolkadotXcm::VersionDiscoveryQueue` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
// Storage: `PolkadotXcm::SafeXcmVersion` (r:1 w:0)
// Proof: `PolkadotXcm::SafeXcmVersion` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
// Storage: `ParachainSystem::HostConfiguration` (r:1 w:0)
// Proof: `ParachainSystem::HostConfiguration` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
// Storage: `ParachainSystem::PendingUpwardMessages` (r:1 w:1)
// Proof: `ParachainSystem::PendingUpwardMessages` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
pub fn initiate_teleport() -> Weight {
// Proof Size summary in bytes:
// Measured: `109`
// Estimated: `3574`
// Minimum execution time: 33_044_000 picoseconds.
Weight::from_parts(33_849_000, 3574)
.saturating_add(T::DbWeight::get().reads(6))
.saturating_add(T::DbWeight::get().writes(2))
}
}
@@ -0,0 +1,339 @@
// Copyright (C) Parity Technologies (UK) Ltd.
// This file is part of Cumulus.
// Cumulus is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Cumulus is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
//! Autogenerated weights for `pallet_xcm_benchmarks::generic`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
//! DATE: 2023-07-31, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `runner-ynta1nyy-project-238-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz`
//! EXECUTION: , WASM-EXECUTION: Compiled, CHAIN: Some("asset-hub-rococo-dev"), DB CACHE: 1024
// Executed Command:
// ./target/production/polkadot-parachain
// benchmark
// pallet
// --template=./templates/xcm-bench-template.hbs
// --chain=asset-hub-rococo-dev
// --wasm-execution=compiled
// --pallet=pallet_xcm_benchmarks::generic
// --no-storage-info
// --no-median-slopes
// --no-min-squares
// --extrinsic=*
// --steps=50
// --repeat=20
// --json
// --header=./file_header.txt
// --output=./parachains/runtimes/assets/asset-hub-rococo/src/weights/xcm/pallet_xcm_benchmarks_generic.rs
#![cfg_attr(rustfmt, rustfmt_skip)]
#![allow(unused_parens)]
#![allow(unused_imports)]
use frame_support::{traits::Get, weights::Weight};
use sp_std::marker::PhantomData;
/// Weights for `pallet_xcm_benchmarks::generic`.
pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Config> WeightInfo<T> {
// Storage: `ParachainInfo::ParachainId` (r:1 w:0)
// Proof: `ParachainInfo::ParachainId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
// Storage: `PolkadotXcm::SupportedVersion` (r:1 w:0)
// Proof: `PolkadotXcm::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`)
// Storage: `PolkadotXcm::VersionDiscoveryQueue` (r:1 w:1)
// Proof: `PolkadotXcm::VersionDiscoveryQueue` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
// Storage: `PolkadotXcm::SafeXcmVersion` (r:1 w:0)
// Proof: `PolkadotXcm::SafeXcmVersion` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
// Storage: `ParachainSystem::HostConfiguration` (r:1 w:0)
// Proof: `ParachainSystem::HostConfiguration` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
// Storage: `ParachainSystem::PendingUpwardMessages` (r:1 w:1)
// Proof: `ParachainSystem::PendingUpwardMessages` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
pub fn report_holding() -> Weight {
// Proof Size summary in bytes:
// Measured: `109`
// Estimated: `3574`
// Minimum execution time: 432_196_000 picoseconds.
Weight::from_parts(438_017_000, 3574)
.saturating_add(T::DbWeight::get().reads(6))
.saturating_add(T::DbWeight::get().writes(2))
}
pub fn buy_execution() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 4_223_000 picoseconds.
Weight::from_parts(4_412_000, 0)
}
// Storage: `PolkadotXcm::Queries` (r:1 w:0)
// Proof: `PolkadotXcm::Queries` (`max_values`: None, `max_size`: None, mode: `Measured`)
pub fn query_response() -> Weight {
// Proof Size summary in bytes:
// Measured: `103`
// Estimated: `3568`
// Minimum execution time: 11_582_000 picoseconds.
Weight::from_parts(11_830_000, 3568)
.saturating_add(T::DbWeight::get().reads(1))
}
pub fn transact() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 13_955_000 picoseconds.
Weight::from_parts(14_320_000, 0)
}
pub fn refund_surplus() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 4_423_000 picoseconds.
Weight::from_parts(4_709_000, 0)
}
pub fn set_error_handler() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 3_028_000 picoseconds.
Weight::from_parts(3_151_000, 0)
}
pub fn set_appendix() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 2_966_000 picoseconds.
Weight::from_parts(3_076_000, 0)
}
pub fn clear_error() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 2_971_000 picoseconds.
Weight::from_parts(3_119_000, 0)
}
pub fn descend_origin() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 3_772_000 picoseconds.
Weight::from_parts(3_853_000, 0)
}
pub fn clear_origin() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 2_940_000 picoseconds.
Weight::from_parts(3_050_000, 0)
}
// Storage: `ParachainInfo::ParachainId` (r:1 w:0)
// Proof: `ParachainInfo::ParachainId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
// Storage: `PolkadotXcm::SupportedVersion` (r:1 w:0)
// Proof: `PolkadotXcm::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`)
// Storage: `PolkadotXcm::VersionDiscoveryQueue` (r:1 w:1)
// Proof: `PolkadotXcm::VersionDiscoveryQueue` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
// Storage: `PolkadotXcm::SafeXcmVersion` (r:1 w:0)
// Proof: `PolkadotXcm::SafeXcmVersion` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
// Storage: `ParachainSystem::HostConfiguration` (r:1 w:0)
// Proof: `ParachainSystem::HostConfiguration` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
// Storage: `ParachainSystem::PendingUpwardMessages` (r:1 w:1)
// Proof: `ParachainSystem::PendingUpwardMessages` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
pub fn report_error() -> Weight {
// Proof Size summary in bytes:
// Measured: `109`
// Estimated: `3574`
// Minimum execution time: 27_734_000 picoseconds.
Weight::from_parts(28_351_000, 3574)
.saturating_add(T::DbWeight::get().reads(6))
.saturating_add(T::DbWeight::get().writes(2))
}
// Storage: `PolkadotXcm::AssetTraps` (r:1 w:1)
// Proof: `PolkadotXcm::AssetTraps` (`max_values`: None, `max_size`: None, mode: `Measured`)
pub fn claim_asset() -> Weight {
// Proof Size summary in bytes:
// Measured: `160`
// Estimated: `3625`
// Minimum execution time: 16_456_000 picoseconds.
Weight::from_parts(16_846_000, 3625)
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
pub fn trap() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 2_974_000 picoseconds.
Weight::from_parts(3_108_000, 0)
}
// Storage: `PolkadotXcm::VersionNotifyTargets` (r:1 w:1)
// Proof: `PolkadotXcm::VersionNotifyTargets` (`max_values`: None, `max_size`: None, mode: `Measured`)
// Storage: `PolkadotXcm::SupportedVersion` (r:1 w:0)
// Proof: `PolkadotXcm::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`)
// Storage: `PolkadotXcm::VersionDiscoveryQueue` (r:1 w:1)
// Proof: `PolkadotXcm::VersionDiscoveryQueue` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
// Storage: `PolkadotXcm::SafeXcmVersion` (r:1 w:0)
// Proof: `PolkadotXcm::SafeXcmVersion` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
// Storage: `ParachainSystem::HostConfiguration` (r:1 w:0)
// Proof: `ParachainSystem::HostConfiguration` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
// Storage: `ParachainSystem::PendingUpwardMessages` (r:1 w:1)
// Proof: `ParachainSystem::PendingUpwardMessages` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
pub fn subscribe_version() -> Weight {
// Proof Size summary in bytes:
// Measured: `109`
// Estimated: `3574`
// Minimum execution time: 29_823_000 picoseconds.
Weight::from_parts(30_776_000, 3574)
.saturating_add(T::DbWeight::get().reads(6))
.saturating_add(T::DbWeight::get().writes(3))
}
// Storage: `PolkadotXcm::VersionNotifyTargets` (r:0 w:1)
// Proof: `PolkadotXcm::VersionNotifyTargets` (`max_values`: None, `max_size`: None, mode: `Measured`)
pub fn unsubscribe_version() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 4_966_000 picoseconds.
Weight::from_parts(5_157_000, 0)
.saturating_add(T::DbWeight::get().writes(1))
}
pub fn burn_asset() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 141_875_000 picoseconds.
Weight::from_parts(144_925_000, 0)
}
pub fn expect_asset() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 13_147_000 picoseconds.
Weight::from_parts(13_420_000, 0)
}
pub fn expect_origin() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 3_050_000 picoseconds.
Weight::from_parts(3_161_000, 0)
}
pub fn expect_error() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 2_930_000 picoseconds.
Weight::from_parts(3_077_000, 0)
}
pub fn expect_transact_status() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 3_188_000 picoseconds.
Weight::from_parts(3_299_000, 0)
}
// Storage: `ParachainInfo::ParachainId` (r:1 w:0)
// Proof: `ParachainInfo::ParachainId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
// Storage: `PolkadotXcm::SupportedVersion` (r:1 w:0)
// Proof: `PolkadotXcm::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`)
// Storage: `PolkadotXcm::VersionDiscoveryQueue` (r:1 w:1)
// Proof: `PolkadotXcm::VersionDiscoveryQueue` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
// Storage: `PolkadotXcm::SafeXcmVersion` (r:1 w:0)
// Proof: `PolkadotXcm::SafeXcmVersion` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
// Storage: `ParachainSystem::HostConfiguration` (r:1 w:0)
// Proof: `ParachainSystem::HostConfiguration` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
// Storage: `ParachainSystem::PendingUpwardMessages` (r:1 w:1)
// Proof: `ParachainSystem::PendingUpwardMessages` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
pub fn query_pallet() -> Weight {
// Proof Size summary in bytes:
// Measured: `109`
// Estimated: `3574`
// Minimum execution time: 31_678_000 picoseconds.
Weight::from_parts(32_462_000, 3574)
.saturating_add(T::DbWeight::get().reads(6))
.saturating_add(T::DbWeight::get().writes(2))
}
pub fn expect_pallet() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 5_638_000 picoseconds.
Weight::from_parts(5_756_000, 0)
}
// Storage: `ParachainInfo::ParachainId` (r:1 w:0)
// Proof: `ParachainInfo::ParachainId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
// Storage: `PolkadotXcm::SupportedVersion` (r:1 w:0)
// Proof: `PolkadotXcm::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`)
// Storage: `PolkadotXcm::VersionDiscoveryQueue` (r:1 w:1)
// Proof: `PolkadotXcm::VersionDiscoveryQueue` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
// Storage: `PolkadotXcm::SafeXcmVersion` (r:1 w:0)
// Proof: `PolkadotXcm::SafeXcmVersion` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
// Storage: `ParachainSystem::HostConfiguration` (r:1 w:0)
// Proof: `ParachainSystem::HostConfiguration` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
// Storage: `ParachainSystem::PendingUpwardMessages` (r:1 w:1)
// Proof: `ParachainSystem::PendingUpwardMessages` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
pub fn report_transact_status() -> Weight {
// Proof Size summary in bytes:
// Measured: `109`
// Estimated: `3574`
// Minimum execution time: 27_556_000 picoseconds.
Weight::from_parts(28_240_000, 3574)
.saturating_add(T::DbWeight::get().reads(6))
.saturating_add(T::DbWeight::get().writes(2))
}
pub fn clear_transact_status() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 2_932_000 picoseconds.
Weight::from_parts(3_097_000, 0)
}
pub fn set_topic() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 2_860_000 picoseconds.
Weight::from_parts(2_957_000, 0)
}
pub fn clear_topic() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 2_886_000 picoseconds.
Weight::from_parts(3_015_000, 0)
}
// Storage: `ParachainInfo::ParachainId` (r:1 w:0)
// Proof: `ParachainInfo::ParachainId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
pub fn universal_origin() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `1489`
// Minimum execution time: 5_088_000 picoseconds.
Weight::from_parts(5_253_000, 1489)
.saturating_add(T::DbWeight::get().reads(1))
}
pub fn set_fees_mode() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 2_874_000 picoseconds.
Weight::from_parts(3_060_000, 0)
}
pub fn unpaid_execution() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 3_029_000 picoseconds.
Weight::from_parts(3_158_000, 0)
}
}
@@ -0,0 +1,942 @@
// Copyright (C) Parity Technologies (UK) Ltd.
// 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.
use super::{
AccountId, AllPalletsWithSystem, Assets, Authorship, Balance, Balances, ForeignAssets,
ForeignAssetsInstance, ParachainInfo, ParachainSystem, PolkadotXcm, PoolAssets, Runtime,
RuntimeCall, RuntimeEvent, RuntimeFlavor, RuntimeOrigin, ToRococoXcmRouter, ToWococoXcmRouter,
TransactionByteFee, TrustBackedAssetsInstance, WeightToFee, XcmpQueue,
};
use assets_common::{
local_and_foreign_assets::MatchesLocalAndForeignAssetsMultiLocation,
matching::{FromSiblingParachain, IsForeignConcreteAsset},
};
use frame_support::{
match_types, parameter_types,
traits::{ConstU32, Contains, Equals, Everything, Get, Nothing, PalletInfoAccess},
};
use frame_system::EnsureRoot;
use pallet_xcm::XcmPassthrough;
use parachains_common::{
impls::ToStakingPot,
xcm_config::{AssetFeeAsExistentialDepositMultiplier, ConcreteAssetFromSystem},
};
use polkadot_parachain_primitives::primitives::Sibling;
use sp_runtime::traits::ConvertInto;
use xcm::latest::prelude::*;
use xcm_builder::{
AccountId32Aliases, AllAssets, AllowExplicitUnpaidExecutionFrom, AllowKnownQueryResponses,
AllowSubscriptionsFrom, AllowTopLevelPaidExecutionFrom, CurrencyAdapter,
DenyReserveTransferToRelayChain, DenyThenTry, DescribeAllTerminal, DescribeFamily,
EnsureXcmOrigin, FungiblesAdapter, GlobalConsensusParachainConvertsFor, HashedDescription,
IsConcrete, LocalMint, LocationWithAssetFilters, NetworkExportTableItem, NoChecking,
ParentAsSuperuser, ParentIsPreset, RelayChainAsNative, SiblingParachainAsNative,
SiblingParachainConvertsVia, SignedAccountId32AsNative, SignedToAccountId32,
SovereignSignedViaLocation, StartsWith, StartsWithExplicitGlobalConsensus, TakeWeightCredit,
TrailingSetTopicAsId, UsingComponents, WeightInfoBounds, WithComputedOrigin, WithUniqueTopic,
};
use xcm_executor::{traits::WithOriginFilter, XcmExecutor};
#[cfg(feature = "runtime-benchmarks")]
use cumulus_primitives_core::ParaId;
parameter_types! {
pub storage Flavor: RuntimeFlavor = RuntimeFlavor::default();
pub const TokenLocation: MultiLocation = MultiLocation::parent();
pub RelayChainOrigin: RuntimeOrigin = cumulus_pallet_xcm::Origin::Relay.into();
pub UniversalLocation: InteriorMultiLocation =
X2(GlobalConsensus(RelayNetwork::get()), Parachain(ParachainInfo::parachain_id().into()));
pub UniversalLocationNetworkId: NetworkId = UniversalLocation::get().global_consensus().unwrap();
pub TrustBackedAssetsPalletLocation: MultiLocation =
PalletInstance(<Assets as PalletInfoAccess>::index() as u8).into();
pub ForeignAssetsPalletLocation: MultiLocation =
PalletInstance(<ForeignAssets as PalletInfoAccess>::index() as u8).into();
pub PoolAssetsPalletLocation: MultiLocation =
PalletInstance(<PoolAssets as PalletInfoAccess>::index() as u8).into();
pub CheckingAccount: AccountId = PolkadotXcm::check_account();
pub const GovernanceLocation: MultiLocation = MultiLocation::parent();
}
/// Adapter for resolving `NetworkId` based on `pub storage Flavor: RuntimeFlavor`.
pub struct RelayNetwork;
impl Get<Option<NetworkId>> for RelayNetwork {
fn get() -> Option<NetworkId> {
Some(Self::get())
}
}
impl Get<NetworkId> for RelayNetwork {
fn get() -> NetworkId {
match Flavor::get() {
RuntimeFlavor::Rococo => NetworkId::Rococo,
RuntimeFlavor::Wococo => NetworkId::Wococo,
}
}
}
/// Type for specifying how a `MultiLocation` can be converted into an `AccountId`. This is used
/// when determining ownership of accounts for asset transacting and when attempting to use XCM
/// `Transact` in order to determine the dispatch Origin.
pub type LocationToAccountId = (
// The parent (Relay-chain) origin converts to the parent `AccountId`.
ParentIsPreset<AccountId>,
// Sibling parachain origins convert to AccountId via the `ParaId::into`.
SiblingParachainConvertsVia<Sibling, AccountId>,
// Straight up local `AccountId32` origins just alias directly to `AccountId`.
AccountId32Aliases<RelayNetwork, AccountId>,
// Foreign locations alias into accounts according to a hash of their standard description.
HashedDescription<AccountId, DescribeFamily<DescribeAllTerminal>>,
// Different global consensus parachain sovereign account.
// (Used for over-bridge transfers and reserve processing)
GlobalConsensusParachainConvertsFor<UniversalLocation, AccountId>,
);
/// Means for transacting the native currency on this chain.
pub type CurrencyTransactor = CurrencyAdapter<
// Use this currency:
Balances,
// Use this currency when it is a fungible asset matching the given location or name:
IsConcrete<TokenLocation>,
// Convert an XCM MultiLocation into a local account id:
LocationToAccountId,
// Our chain's account ID type (we can't get away without mentioning it explicitly):
AccountId,
// We don't track any teleports of `Balances`.
(),
>;
/// `AssetId`/`Balance` converter for `PoolAssets`.
pub type TrustBackedAssetsConvertedConcreteId =
assets_common::TrustBackedAssetsConvertedConcreteId<TrustBackedAssetsPalletLocation, Balance>;
/// Means for transacting assets besides the native currency on this chain.
pub type FungiblesTransactor = FungiblesAdapter<
// Use this fungibles implementation:
Assets,
// Use this currency when it is a fungible asset matching the given location or name:
TrustBackedAssetsConvertedConcreteId,
// Convert an XCM MultiLocation into a local account id:
LocationToAccountId,
// Our chain's account ID type (we can't get away without mentioning it explicitly):
AccountId,
// We only want to allow teleports of known assets. We use non-zero issuance as an indication
// that this asset is known.
LocalMint<parachains_common::impls::NonZeroIssuance<AccountId, Assets>>,
// The account to use for tracking teleports.
CheckingAccount,
>;
/// `AssetId/Balance` converter for `TrustBackedAssets`
pub type ForeignAssetsConvertedConcreteId = assets_common::ForeignAssetsConvertedConcreteId<
(
// Ignore `TrustBackedAssets` explicitly
StartsWith<TrustBackedAssetsPalletLocation>,
// Ignore assets that start explicitly with our `GlobalConsensus(NetworkId)`, means:
// - foreign assets from our consensus should be: `MultiLocation {parents: 1,
// X*(Parachain(xyz), ..)}`
// - foreign assets outside our consensus with the same `GlobalConsensus(NetworkId)` won't
// be accepted here
StartsWithExplicitGlobalConsensus<UniversalLocationNetworkId>,
),
Balance,
>;
/// Means for transacting foreign assets from different global consensus.
pub type ForeignFungiblesTransactor = FungiblesAdapter<
// Use this fungibles implementation:
ForeignAssets,
// Use this currency when it is a fungible asset matching the given location or name:
ForeignAssetsConvertedConcreteId,
// Convert an XCM MultiLocation into a local account id:
LocationToAccountId,
// Our chain's account ID type (we can't get away without mentioning it explicitly):
AccountId,
// We dont need to check teleports here.
NoChecking,
// The account to use for tracking teleports.
CheckingAccount,
>;
/// `AssetId`/`Balance` converter for `PoolAssets`.
pub type PoolAssetsConvertedConcreteId =
assets_common::PoolAssetsConvertedConcreteId<PoolAssetsPalletLocation, Balance>;
/// Means for transacting asset conversion pool assets on this chain.
pub type PoolFungiblesTransactor = FungiblesAdapter<
// Use this fungibles implementation:
PoolAssets,
// Use this currency when it is a fungible asset matching the given location or name:
PoolAssetsConvertedConcreteId,
// Convert an XCM MultiLocation into a local account id:
LocationToAccountId,
// Our chain's account ID type (we can't get away without mentioning it explicitly):
AccountId,
// We only want to allow teleports of known assets. We use non-zero issuance as an indication
// that this asset is known.
LocalMint<parachains_common::impls::NonZeroIssuance<AccountId, PoolAssets>>,
// The account to use for tracking teleports.
CheckingAccount,
>;
/// Means for transacting assets on this chain.
pub type AssetTransactors =
(CurrencyTransactor, FungiblesTransactor, ForeignFungiblesTransactor, PoolFungiblesTransactor);
/// Simple `MultiLocation` matcher for Local and Foreign asset `MultiLocation`.
pub struct LocalAndForeignAssetsMultiLocationMatcher;
impl MatchesLocalAndForeignAssetsMultiLocation for LocalAndForeignAssetsMultiLocationMatcher {
fn is_local(location: &MultiLocation) -> bool {
use assets_common::fungible_conversion::MatchesMultiLocation;
TrustBackedAssetsConvertedConcreteId::contains(location)
}
fn is_foreign(location: &MultiLocation) -> bool {
use assets_common::fungible_conversion::MatchesMultiLocation;
ForeignAssetsConvertedConcreteId::contains(location)
}
}
impl Contains<MultiLocation> for LocalAndForeignAssetsMultiLocationMatcher {
fn contains(location: &MultiLocation) -> bool {
Self::is_local(location) || Self::is_foreign(location)
}
}
/// This is the type we use to convert an (incoming) XCM origin into a local `Origin` instance,
/// ready for dispatching a transaction with Xcm's `Transact`. There is an `OriginKind` which can
/// biases the kind of local `Origin` it will become.
pub type XcmOriginToTransactDispatchOrigin = (
// Sovereign account converter; this attempts to derive an `AccountId` from the origin location
// using `LocationToAccountId` and then turn that into the usual `Signed` origin. Useful for
// foreign chains who want to have a local sovereign account on this chain which they control.
SovereignSignedViaLocation<LocationToAccountId, RuntimeOrigin>,
// Native converter for Relay-chain (Parent) location; will convert to a `Relay` origin when
// recognised.
RelayChainAsNative<RelayChainOrigin, RuntimeOrigin>,
// Native converter for sibling Parachains; will convert to a `SiblingPara` origin when
// recognised.
SiblingParachainAsNative<cumulus_pallet_xcm::Origin, RuntimeOrigin>,
// Superuser converter for the Relay-chain (Parent) location. This will allow it to issue a
// transaction from the Root origin.
ParentAsSuperuser<RuntimeOrigin>,
// Native signed account converter; this just converts an `AccountId32` origin into a normal
// `RuntimeOrigin::Signed` origin of the same 32-byte value.
SignedAccountId32AsNative<RelayNetwork, RuntimeOrigin>,
// Xcm origins can be represented natively under the Xcm pallet's Xcm origin.
XcmPassthrough<RuntimeOrigin>,
);
parameter_types! {
pub const MaxInstructions: u32 = 100;
pub const MaxAssetsIntoHolding: u32 = 64;
pub XcmAssetFeesReceiver: Option<AccountId> = Authorship::author();
}
match_types! {
pub type ParentOrParentsPlurality: impl Contains<MultiLocation> = {
MultiLocation { parents: 1, interior: Here } |
MultiLocation { parents: 1, interior: X1(Plurality { .. }) }
};
pub type ParentOrSiblings: impl Contains<MultiLocation> = {
MultiLocation { parents: 1, interior: Here } |
MultiLocation { parents: 1, interior: X1(_) }
};
pub type WithParentsZeroOrOne: impl Contains<MultiLocation> = {
MultiLocation { parents: 0, .. } |
MultiLocation { parents: 1, .. }
};
}
/// A call filter for the XCM Transact instruction. This is a temporary measure until we properly
/// account for proof size weights.
///
/// Calls that are allowed through this filter must:
/// 1. Have a fixed weight;
/// 2. Cannot lead to another call being made;
/// 3. Have a defined proof size weight, e.g. no unbounded vecs in call parameters.
pub struct SafeCallFilter;
impl Contains<RuntimeCall> for SafeCallFilter {
fn contains(call: &RuntimeCall) -> bool {
#[cfg(feature = "runtime-benchmarks")]
{
if matches!(call, RuntimeCall::System(frame_system::Call::remark_with_event { .. })) {
return true
}
}
// Allow to change dedicated storage items (called by governance-like)
match call {
RuntimeCall::System(frame_system::Call::set_storage { items })
if items.iter().all(|(k, _)| k.eq(&bridging::XcmBridgeHubRouterByteFee::key())) ||
items.iter().all(|(k, _)| k.eq(&Flavor::key())) =>
return true,
_ => (),
};
matches!(
call,
RuntimeCall::PolkadotXcm(pallet_xcm::Call::force_xcm_version { .. }) |
RuntimeCall::System(
frame_system::Call::set_heap_pages { .. } |
frame_system::Call::set_code { .. } |
frame_system::Call::set_code_without_checks { .. } |
frame_system::Call::kill_prefix { .. },
) | RuntimeCall::ParachainSystem(..) |
RuntimeCall::Timestamp(..) |
RuntimeCall::Balances(..) |
RuntimeCall::CollatorSelection(
pallet_collator_selection::Call::set_desired_candidates { .. } |
pallet_collator_selection::Call::set_candidacy_bond { .. } |
pallet_collator_selection::Call::register_as_candidate { .. } |
pallet_collator_selection::Call::leave_intent { .. } |
pallet_collator_selection::Call::set_invulnerables { .. } |
pallet_collator_selection::Call::add_invulnerable { .. } |
pallet_collator_selection::Call::remove_invulnerable { .. },
) | RuntimeCall::Session(pallet_session::Call::purge_keys { .. }) |
RuntimeCall::XcmpQueue(..) |
RuntimeCall::DmpQueue(..) |
RuntimeCall::Assets(
pallet_assets::Call::create { .. } |
pallet_assets::Call::force_create { .. } |
pallet_assets::Call::start_destroy { .. } |
pallet_assets::Call::destroy_accounts { .. } |
pallet_assets::Call::destroy_approvals { .. } |
pallet_assets::Call::finish_destroy { .. } |
pallet_assets::Call::block { .. } |
pallet_assets::Call::mint { .. } |
pallet_assets::Call::burn { .. } |
pallet_assets::Call::transfer { .. } |
pallet_assets::Call::transfer_keep_alive { .. } |
pallet_assets::Call::force_transfer { .. } |
pallet_assets::Call::freeze { .. } |
pallet_assets::Call::thaw { .. } |
pallet_assets::Call::freeze_asset { .. } |
pallet_assets::Call::thaw_asset { .. } |
pallet_assets::Call::transfer_ownership { .. } |
pallet_assets::Call::set_team { .. } |
pallet_assets::Call::set_metadata { .. } |
pallet_assets::Call::clear_metadata { .. } |
pallet_assets::Call::force_set_metadata { .. } |
pallet_assets::Call::force_clear_metadata { .. } |
pallet_assets::Call::force_asset_status { .. } |
pallet_assets::Call::approve_transfer { .. } |
pallet_assets::Call::cancel_approval { .. } |
pallet_assets::Call::force_cancel_approval { .. } |
pallet_assets::Call::transfer_approved { .. } |
pallet_assets::Call::touch { .. } |
pallet_assets::Call::touch_other { .. } |
pallet_assets::Call::refund { .. } |
pallet_assets::Call::refund_other { .. },
) | RuntimeCall::ForeignAssets(
pallet_assets::Call::create { .. } |
pallet_assets::Call::force_create { .. } |
pallet_assets::Call::start_destroy { .. } |
pallet_assets::Call::destroy_accounts { .. } |
pallet_assets::Call::destroy_approvals { .. } |
pallet_assets::Call::finish_destroy { .. } |
pallet_assets::Call::block { .. } |
pallet_assets::Call::mint { .. } |
pallet_assets::Call::burn { .. } |
pallet_assets::Call::transfer { .. } |
pallet_assets::Call::transfer_keep_alive { .. } |
pallet_assets::Call::force_transfer { .. } |
pallet_assets::Call::freeze { .. } |
pallet_assets::Call::thaw { .. } |
pallet_assets::Call::freeze_asset { .. } |
pallet_assets::Call::thaw_asset { .. } |
pallet_assets::Call::transfer_ownership { .. } |
pallet_assets::Call::set_team { .. } |
pallet_assets::Call::set_metadata { .. } |
pallet_assets::Call::clear_metadata { .. } |
pallet_assets::Call::force_set_metadata { .. } |
pallet_assets::Call::force_clear_metadata { .. } |
pallet_assets::Call::force_asset_status { .. } |
pallet_assets::Call::approve_transfer { .. } |
pallet_assets::Call::cancel_approval { .. } |
pallet_assets::Call::force_cancel_approval { .. } |
pallet_assets::Call::transfer_approved { .. } |
pallet_assets::Call::touch { .. } |
pallet_assets::Call::touch_other { .. } |
pallet_assets::Call::refund { .. } |
pallet_assets::Call::refund_other { .. },
) | RuntimeCall::PoolAssets(
pallet_assets::Call::force_create { .. } |
pallet_assets::Call::block { .. } |
pallet_assets::Call::burn { .. } |
pallet_assets::Call::transfer { .. } |
pallet_assets::Call::transfer_keep_alive { .. } |
pallet_assets::Call::force_transfer { .. } |
pallet_assets::Call::freeze { .. } |
pallet_assets::Call::thaw { .. } |
pallet_assets::Call::freeze_asset { .. } |
pallet_assets::Call::thaw_asset { .. } |
pallet_assets::Call::transfer_ownership { .. } |
pallet_assets::Call::set_team { .. } |
pallet_assets::Call::set_metadata { .. } |
pallet_assets::Call::clear_metadata { .. } |
pallet_assets::Call::force_set_metadata { .. } |
pallet_assets::Call::force_clear_metadata { .. } |
pallet_assets::Call::force_asset_status { .. } |
pallet_assets::Call::approve_transfer { .. } |
pallet_assets::Call::cancel_approval { .. } |
pallet_assets::Call::force_cancel_approval { .. } |
pallet_assets::Call::transfer_approved { .. } |
pallet_assets::Call::touch { .. } |
pallet_assets::Call::touch_other { .. } |
pallet_assets::Call::refund { .. } |
pallet_assets::Call::refund_other { .. },
) | RuntimeCall::AssetConversion(
pallet_asset_conversion::Call::create_pool { .. } |
pallet_asset_conversion::Call::add_liquidity { .. } |
pallet_asset_conversion::Call::remove_liquidity { .. } |
pallet_asset_conversion::Call::swap_tokens_for_exact_tokens { .. } |
pallet_asset_conversion::Call::swap_exact_tokens_for_tokens { .. },
) | RuntimeCall::NftFractionalization(
pallet_nft_fractionalization::Call::fractionalize { .. } |
pallet_nft_fractionalization::Call::unify { .. },
) | RuntimeCall::Nfts(
pallet_nfts::Call::create { .. } |
pallet_nfts::Call::force_create { .. } |
pallet_nfts::Call::destroy { .. } |
pallet_nfts::Call::mint { .. } |
pallet_nfts::Call::force_mint { .. } |
pallet_nfts::Call::burn { .. } |
pallet_nfts::Call::transfer { .. } |
pallet_nfts::Call::lock_item_transfer { .. } |
pallet_nfts::Call::unlock_item_transfer { .. } |
pallet_nfts::Call::lock_collection { .. } |
pallet_nfts::Call::transfer_ownership { .. } |
pallet_nfts::Call::set_team { .. } |
pallet_nfts::Call::force_collection_owner { .. } |
pallet_nfts::Call::force_collection_config { .. } |
pallet_nfts::Call::approve_transfer { .. } |
pallet_nfts::Call::cancel_approval { .. } |
pallet_nfts::Call::clear_all_transfer_approvals { .. } |
pallet_nfts::Call::lock_item_properties { .. } |
pallet_nfts::Call::set_attribute { .. } |
pallet_nfts::Call::force_set_attribute { .. } |
pallet_nfts::Call::clear_attribute { .. } |
pallet_nfts::Call::approve_item_attributes { .. } |
pallet_nfts::Call::cancel_item_attributes_approval { .. } |
pallet_nfts::Call::set_metadata { .. } |
pallet_nfts::Call::clear_metadata { .. } |
pallet_nfts::Call::set_collection_metadata { .. } |
pallet_nfts::Call::clear_collection_metadata { .. } |
pallet_nfts::Call::set_accept_ownership { .. } |
pallet_nfts::Call::set_collection_max_supply { .. } |
pallet_nfts::Call::update_mint_settings { .. } |
pallet_nfts::Call::set_price { .. } |
pallet_nfts::Call::buy_item { .. } |
pallet_nfts::Call::pay_tips { .. } |
pallet_nfts::Call::create_swap { .. } |
pallet_nfts::Call::cancel_swap { .. } |
pallet_nfts::Call::claim_swap { .. },
) | RuntimeCall::Uniques(
pallet_uniques::Call::create { .. } |
pallet_uniques::Call::force_create { .. } |
pallet_uniques::Call::destroy { .. } |
pallet_uniques::Call::mint { .. } |
pallet_uniques::Call::burn { .. } |
pallet_uniques::Call::transfer { .. } |
pallet_uniques::Call::freeze { .. } |
pallet_uniques::Call::thaw { .. } |
pallet_uniques::Call::freeze_collection { .. } |
pallet_uniques::Call::thaw_collection { .. } |
pallet_uniques::Call::transfer_ownership { .. } |
pallet_uniques::Call::set_team { .. } |
pallet_uniques::Call::approve_transfer { .. } |
pallet_uniques::Call::cancel_approval { .. } |
pallet_uniques::Call::force_item_status { .. } |
pallet_uniques::Call::set_attribute { .. } |
pallet_uniques::Call::clear_attribute { .. } |
pallet_uniques::Call::set_metadata { .. } |
pallet_uniques::Call::clear_metadata { .. } |
pallet_uniques::Call::set_collection_metadata { .. } |
pallet_uniques::Call::clear_collection_metadata { .. } |
pallet_uniques::Call::set_accept_ownership { .. } |
pallet_uniques::Call::set_collection_max_supply { .. } |
pallet_uniques::Call::set_price { .. } |
pallet_uniques::Call::buy_item { .. }
) | RuntimeCall::ToWococoXcmRouter(
pallet_xcm_bridge_hub_router::Call::report_bridge_status { .. }
) | RuntimeCall::ToRococoXcmRouter(
pallet_xcm_bridge_hub_router::Call::report_bridge_status { .. }
)
)
}
}
pub type Barrier = TrailingSetTopicAsId<
DenyThenTry<
DenyReserveTransferToRelayChain,
(
TakeWeightCredit,
// Expected responses are OK.
AllowKnownQueryResponses<PolkadotXcm>,
// Allow XCMs with some computed origins to pass through.
WithComputedOrigin<
(
// If the message is one that immediately attempts to pay for execution, then
// allow it.
AllowTopLevelPaidExecutionFrom<Everything>,
// Parent, its pluralities (i.e. governance bodies) and BridgeHub get free
// execution.
AllowExplicitUnpaidExecutionFrom<(
ParentOrParentsPlurality,
Equals<bridging::SiblingBridgeHub>,
)>,
// Subscriptions for version tracking are OK.
AllowSubscriptionsFrom<ParentOrSiblings>,
),
UniversalLocation,
ConstU32<8>,
>,
),
>,
>;
/// Multiplier used for dedicated `TakeFirstAssetTrader` with `Assets` instance.
pub type AssetFeeAsExistentialDepositMultiplierFeeCharger = AssetFeeAsExistentialDepositMultiplier<
Runtime,
WeightToFee,
pallet_assets::BalanceToAssetBalance<Balances, Runtime, ConvertInto, TrustBackedAssetsInstance>,
TrustBackedAssetsInstance,
>;
/// Multiplier used for dedicated `TakeFirstAssetTrader` with `ForeignAssets` instance.
pub type ForeignAssetFeeAsExistentialDepositMultiplierFeeCharger =
AssetFeeAsExistentialDepositMultiplier<
Runtime,
WeightToFee,
pallet_assets::BalanceToAssetBalance<Balances, Runtime, ConvertInto, ForeignAssetsInstance>,
ForeignAssetsInstance,
>;
/// Cases where a remote origin is accepted as trusted Teleporter for a given asset:
///
/// - ROC with the parent Relay Chain and sibling system parachains; and
/// - Sibling parachains' assets from where they originate (as `ForeignCreators`).
pub type TrustedTeleporters = (
ConcreteAssetFromSystem<TokenLocation>,
IsForeignConcreteAsset<FromSiblingParachain<parachain_info::Pallet<Runtime>>>,
);
pub struct XcmConfig;
impl xcm_executor::Config for XcmConfig {
type RuntimeCall = RuntimeCall;
type XcmSender = XcmRouter;
type AssetTransactor = AssetTransactors;
type OriginConverter = XcmOriginToTransactDispatchOrigin;
// Asset Hub trusts only particular configured bridge locations as reserve locations.
// Asset Hub may _act_ as a reserve location for ROC and assets created under `pallet-assets`.
// Users must use teleport where allowed (e.g. ROC with the Relay Chain).
type IsReserve = (
bridging::to_wococo::IsTrustedBridgedReserveLocationForConcreteAsset,
bridging::to_rococo::IsTrustedBridgedReserveLocationForConcreteAsset,
);
type IsTeleporter = TrustedTeleporters;
type UniversalLocation = UniversalLocation;
type Barrier = Barrier;
type Weigher = WeightInfoBounds<
crate::weights::xcm::AssetHubRococoXcmWeight<RuntimeCall>,
RuntimeCall,
MaxInstructions,
>;
type Trader = (
UsingComponents<WeightToFee, TokenLocation, AccountId, Balances, ToStakingPot<Runtime>>,
// This trader allows to pay with `is_sufficient=true` "Trust Backed" assets from dedicated
// `pallet_assets` instance - `Assets`.
cumulus_primitives_utility::TakeFirstAssetTrader<
AccountId,
AssetFeeAsExistentialDepositMultiplierFeeCharger,
TrustBackedAssetsConvertedConcreteId,
Assets,
cumulus_primitives_utility::XcmFeesTo32ByteAccount<
FungiblesTransactor,
AccountId,
XcmAssetFeesReceiver,
>,
>,
// This trader allows to pay with `is_sufficient=true` "Foreign" assets from dedicated
// `pallet_assets` instance - `ForeignAssets`.
cumulus_primitives_utility::TakeFirstAssetTrader<
AccountId,
ForeignAssetFeeAsExistentialDepositMultiplierFeeCharger,
ForeignAssetsConvertedConcreteId,
ForeignAssets,
cumulus_primitives_utility::XcmFeesTo32ByteAccount<
ForeignFungiblesTransactor,
AccountId,
XcmAssetFeesReceiver,
>,
>,
);
type ResponseHandler = PolkadotXcm;
type AssetTrap = PolkadotXcm;
type AssetClaims = PolkadotXcm;
type SubscriptionService = PolkadotXcm;
type PalletInstancesInfo = AllPalletsWithSystem;
type MaxAssetsIntoHolding = MaxAssetsIntoHolding;
type AssetLocker = ();
type AssetExchanger = ();
// TODO:check-parameter: change and assert in tests when (https://github.com/paritytech/polkadot-sdk/pull/1234) merged
type FeeManager = ();
type MessageExporter = ();
type UniversalAliases =
(bridging::to_wococo::UniversalAliases, bridging::to_rococo::UniversalAliases);
type CallDispatcher = WithOriginFilter<SafeCallFilter>;
type SafeCallFilter = SafeCallFilter;
type Aliasers = Nothing;
}
/// Converts a local signed origin into an XCM multilocation.
/// Forms the basis for local origins sending/executing XCMs.
pub type LocalOriginToLocation = SignedToAccountId32<RuntimeOrigin, AccountId, RelayNetwork>;
/// For routing XCM messages which do not cross local consensus boundary.
type LocalXcmRouter = (
// Two routers - use UMP to communicate with the relay chain:
cumulus_primitives_utility::ParentAsUmp<ParachainSystem, PolkadotXcm, ()>,
// ..and XCMP to communicate with the sibling chains.
XcmpQueue,
);
/// The means for routing XCM messages which are not for local execution into the right message
/// queues.
pub type XcmRouter = WithUniqueTopic<(
LocalXcmRouter,
// Router which wraps and sends xcm to BridgeHub to be delivered to the Wococo
// GlobalConsensus
ToWococoXcmRouter,
// Router which wraps and sends xcm to BridgeHub to be delivered to the Rococo
// GlobalConsensus
ToRococoXcmRouter,
)>;
#[cfg(feature = "runtime-benchmarks")]
parameter_types! {
pub ReachableDest: Option<MultiLocation> = Some(Parent.into());
}
impl pallet_xcm::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
// We want to disallow users sending (arbitrary) XCMs from this chain.
type SendXcmOrigin = EnsureXcmOrigin<RuntimeOrigin, ()>;
type XcmRouter = XcmRouter;
// We support local origins dispatching XCM executions in principle...
type ExecuteXcmOrigin = EnsureXcmOrigin<RuntimeOrigin, LocalOriginToLocation>;
// ... but disallow generic XCM execution. As a result only teleports and reserve transfers are
// allowed.
type XcmExecuteFilter = Nothing;
type XcmExecutor = XcmExecutor<XcmConfig>;
type XcmTeleportFilter = Everything;
// Allow reserve based transfer to everywhere except for bridging, here we strictly check what
// assets are allowed.
type XcmReserveTransferFilter = (
LocationWithAssetFilters<WithParentsZeroOrOne, AllAssets>,
bridging::to_rococo::AllowedReserveTransferAssets,
bridging::to_wococo::AllowedReserveTransferAssets,
);
type Weigher = WeightInfoBounds<
crate::weights::xcm::AssetHubRococoXcmWeight<RuntimeCall>,
RuntimeCall,
MaxInstructions,
>;
type UniversalLocation = UniversalLocation;
type RuntimeOrigin = RuntimeOrigin;
type RuntimeCall = RuntimeCall;
const VERSION_DISCOVERY_QUEUE_SIZE: u32 = 100;
type AdvertisedXcmVersion = pallet_xcm::CurrentXcmVersion;
type Currency = Balances;
type CurrencyMatcher = ();
type TrustedLockers = ();
type SovereignAccountOf = LocationToAccountId;
type MaxLockers = ConstU32<8>;
type WeightInfo = crate::weights::pallet_xcm::WeightInfo<Runtime>;
#[cfg(feature = "runtime-benchmarks")]
type ReachableDest = ReachableDest;
type AdminOrigin = EnsureRoot<AccountId>;
type MaxRemoteLockConsumers = ConstU32<0>;
type RemoteLockConsumerIdentifier = ();
}
impl cumulus_pallet_xcm::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type XcmExecutor = XcmExecutor<XcmConfig>;
}
pub type ForeignCreatorsSovereignAccountOf = (
SiblingParachainConvertsVia<Sibling, AccountId>,
AccountId32Aliases<RelayNetwork, AccountId>,
ParentIsPreset<AccountId>,
);
/// Simple conversion of `u32` into an `AssetId` for use in benchmarking.
pub struct XcmBenchmarkHelper;
#[cfg(feature = "runtime-benchmarks")]
impl pallet_assets::BenchmarkHelper<MultiLocation> for XcmBenchmarkHelper {
fn create_asset_id_parameter(id: u32) -> MultiLocation {
MultiLocation { parents: 1, interior: X1(Parachain(id)) }
}
}
#[cfg(feature = "runtime-benchmarks")]
pub struct BenchmarkMultiLocationConverter<SelfParaId> {
_phantom: sp_std::marker::PhantomData<SelfParaId>,
}
#[cfg(feature = "runtime-benchmarks")]
impl<SelfParaId>
pallet_asset_conversion::BenchmarkHelper<MultiLocation, sp_std::boxed::Box<MultiLocation>>
for BenchmarkMultiLocationConverter<SelfParaId>
where
SelfParaId: Get<ParaId>,
{
fn asset_id(asset_id: u32) -> MultiLocation {
MultiLocation {
parents: 1,
interior: X3(
Parachain(SelfParaId::get().into()),
PalletInstance(<Assets as PalletInfoAccess>::index() as u8),
GeneralIndex(asset_id.into()),
),
}
}
fn multiasset_id(asset_id: u32) -> sp_std::boxed::Box<MultiLocation> {
sp_std::boxed::Box::new(Self::asset_id(asset_id))
}
}
/// All configuration related to bridging
pub mod bridging {
use super::*;
use assets_common::matching;
use sp_std::collections::btree_set::BTreeSet;
// common/shared parameters for Wococo/Rococo
parameter_types! {
pub SiblingBridgeHubParaId: u32 = match Flavor::get() {
RuntimeFlavor::Rococo => bp_bridge_hub_rococo::BRIDGE_HUB_ROCOCO_PARACHAIN_ID,
RuntimeFlavor::Wococo => bp_bridge_hub_wococo::BRIDGE_HUB_WOCOCO_PARACHAIN_ID,
};
pub SiblingBridgeHub: MultiLocation = MultiLocation::new(1, X1(Parachain(SiblingBridgeHubParaId::get())));
/// Router expects payment with this `AssetId`.
/// (`AssetId` has to be aligned with `BridgeTable`)
pub XcmBridgeHubRouterFeeAssetId: AssetId = TokenLocation::get().into();
/// Price per byte - can be adjusted via governance `set_storage` call.
pub storage XcmBridgeHubRouterByteFee: Balance = TransactionByteFee::get();
}
pub mod to_wococo {
use super::*;
parameter_types! {
pub SiblingBridgeHubWithBridgeHubWococoInstance: MultiLocation = MultiLocation::new(
1,
X2(
Parachain(SiblingBridgeHubParaId::get()),
PalletInstance(bp_bridge_hub_rococo::WITH_BRIDGE_WOCOCO_MESSAGES_PALLET_INDEX)
)
);
pub const WococoNetwork: NetworkId = NetworkId::Wococo;
pub AssetHubWococo: MultiLocation = MultiLocation::new(2, X2(GlobalConsensus(WococoNetwork::get()), Parachain(bp_asset_hub_wococo::ASSET_HUB_WOCOCO_PARACHAIN_ID)));
pub WocLocation: MultiLocation = MultiLocation::new(2, X1(GlobalConsensus(WococoNetwork::get())));
pub WocFromAssetHubWococo: (MultiAssetFilter, MultiLocation) = (
Wild(AllOf { fun: WildFungible, id: Concrete(WocLocation::get()) }),
AssetHubWococo::get()
);
/// Set up exporters configuration.
/// `Option<MultiAsset>` represents static "base fee" which is used for total delivery fee calculation.
pub BridgeTable: sp_std::vec::Vec<NetworkExportTableItem> = sp_std::vec![
NetworkExportTableItem::new(
WococoNetwork::get(),
Some(sp_std::vec![
AssetHubWococo::get().interior.split_global().expect("invalid configuration for AssetHubWococo").1,
]),
SiblingBridgeHub::get(),
// base delivery fee to local `BridgeHub`
Some((
XcmBridgeHubRouterFeeAssetId::get(),
bp_asset_hub_rococo::BridgeHubRococoBaseFeeInRocs::get(),
).into())
)
];
/// Allowed assets for reserve transfer to `AssetHubWococo`.
pub AllowedReserveTransferAssetsToAssetHubWococo: sp_std::vec::Vec<MultiAssetFilter> = sp_std::vec![
// allow send only ROC
Wild(AllOf { fun: WildFungible, id: Concrete(TokenLocation::get()) }),
// and nothing else
];
/// Universal aliases
pub UniversalAliases: BTreeSet<(MultiLocation, Junction)> = BTreeSet::from_iter(
sp_std::vec![
(SiblingBridgeHubWithBridgeHubWococoInstance::get(), GlobalConsensus(WococoNetwork::get()))
]
);
}
impl Contains<(MultiLocation, Junction)> for UniversalAliases {
fn contains(alias: &(MultiLocation, Junction)) -> bool {
UniversalAliases::get().contains(alias)
}
}
pub type NetworkExportTable = xcm_builder::NetworkExportTable<BridgeTable>;
/// Trusted reserve locations filter for `xcm_executor::Config::IsReserve`.
/// Locations from which the runtime accepts reserved assets.
pub type IsTrustedBridgedReserveLocationForConcreteAsset =
matching::IsTrustedBridgedReserveLocationForConcreteAsset<
UniversalLocation,
(
// allow receive WOC from AssetHubWococo
xcm_builder::Case<WocFromAssetHubWococo>,
// and nothing else
),
>;
/// Allows to reserve transfer assets to `AssetHubWococo`.
pub type AllowedReserveTransferAssets = LocationWithAssetFilters<
Equals<AssetHubWococo>,
AllowedReserveTransferAssetsToAssetHubWococo,
>;
impl Contains<RuntimeCall> for ToWococoXcmRouter {
fn contains(call: &RuntimeCall) -> bool {
matches!(
call,
RuntimeCall::ToWococoXcmRouter(
pallet_xcm_bridge_hub_router::Call::report_bridge_status { .. }
)
)
}
}
}
pub mod to_rococo {
use super::*;
parameter_types! {
pub SiblingBridgeHubWithBridgeHubRococoInstance: MultiLocation = MultiLocation::new(
1,
X2(
Parachain(SiblingBridgeHubParaId::get()),
PalletInstance(bp_bridge_hub_wococo::WITH_BRIDGE_ROCOCO_MESSAGES_PALLET_INDEX)
)
);
pub const RococoNetwork: NetworkId = NetworkId::Rococo;
pub AssetHubRococo: MultiLocation = MultiLocation::new(2, X2(GlobalConsensus(RococoNetwork::get()), Parachain(bp_asset_hub_rococo::ASSET_HUB_ROCOCO_PARACHAIN_ID)));
pub RocLocation: MultiLocation = MultiLocation::new(2, X1(GlobalConsensus(RococoNetwork::get())));
pub RocFromAssetHubRococo: (MultiAssetFilter, MultiLocation) = (
Wild(AllOf { fun: WildFungible, id: Concrete(RocLocation::get()) }),
AssetHubRococo::get()
);
/// Set up exporters configuration.
/// `Option<MultiAsset>` represents static "base fee" which is used for total delivery fee calculation.
pub BridgeTable: sp_std::vec::Vec<NetworkExportTableItem> = sp_std::vec![
NetworkExportTableItem::new(
RococoNetwork::get(),
Some(sp_std::vec![
AssetHubRococo::get().interior.split_global().expect("invalid configuration for AssetHubRococo").1,
]),
SiblingBridgeHub::get(),
// base delivery fee to local `BridgeHub`
Some((
XcmBridgeHubRouterFeeAssetId::get(),
bp_asset_hub_wococo::BridgeHubWococoBaseFeeInWocs::get(),
).into())
)
];
/// Allowed assets for reserve transfer to `AssetHubWococo`.
pub AllowedReserveTransferAssetsToAssetHubRococo: sp_std::vec::Vec<MultiAssetFilter> = sp_std::vec![
// allow send only WOC
Wild(AllOf { fun: WildFungible, id: Concrete(TokenLocation::get()) }),
// and nothing else
];
/// Universal aliases
pub UniversalAliases: BTreeSet<(MultiLocation, Junction)> = BTreeSet::from_iter(
sp_std::vec![
(SiblingBridgeHubWithBridgeHubRococoInstance::get(), GlobalConsensus(RococoNetwork::get()))
]
);
}
impl Contains<(MultiLocation, Junction)> for UniversalAliases {
fn contains(alias: &(MultiLocation, Junction)) -> bool {
UniversalAliases::get().contains(alias)
}
}
pub type NetworkExportTable = xcm_builder::NetworkExportTable<BridgeTable>;
/// Reserve locations filter for `xcm_executor::Config::IsReserve`.
/// Locations from which the runtime accepts reserved assets.
pub type IsTrustedBridgedReserveLocationForConcreteAsset =
matching::IsTrustedBridgedReserveLocationForConcreteAsset<
UniversalLocation,
(
// allow receive ROC from AssetHubRococo
xcm_builder::Case<RocFromAssetHubRococo>,
// and nothing else
),
>;
/// Allows to reserve transfer assets to `AssetHubRococo`.
pub type AllowedReserveTransferAssets = LocationWithAssetFilters<
Equals<AssetHubRococo>,
AllowedReserveTransferAssetsToAssetHubRococo,
>;
impl Contains<RuntimeCall> for ToRococoXcmRouter {
fn contains(call: &RuntimeCall) -> bool {
matches!(
call,
RuntimeCall::ToRococoXcmRouter(
pallet_xcm_bridge_hub_router::Call::report_bridge_status { .. }
)
)
}
}
}
/// Benchmarks helper for bridging configuration.
#[cfg(feature = "runtime-benchmarks")]
pub struct BridgingBenchmarksHelper;
#[cfg(feature = "runtime-benchmarks")]
impl BridgingBenchmarksHelper {
pub fn prepare_universal_alias() -> Option<(MultiLocation, Junction)> {
let alias =
to_wococo::UniversalAliases::get().into_iter().find_map(|(location, junction)| {
match to_wococo::SiblingBridgeHubWithBridgeHubWococoInstance::get()
.eq(&location)
{
true => Some((location, junction)),
false => None,
}
});
assert!(alias.is_some(), "we expect here BridgeHubRococo to Polkadot mapping at least");
Some(alias.unwrap())
}
}
}
File diff suppressed because it is too large Load Diff
@@ -454,7 +454,7 @@ pub type Barrier = TrailingSetTopicAsId<
// Allow XCMs with some computed origins to pass through.
WithComputedOrigin<
(
// If the message is one that immediately attemps to pay for execution, then
// If the message is one that immediately attempts to pay for execution, then
// allow it.
AllowTopLevelPaidExecutionFrom<Everything>,
// Parent, its pluralities (i.e. governance bodies) and treasury pallet get
@@ -19,6 +19,7 @@ use xcm::{
latest::prelude::{MultiAsset, MultiLocation},
prelude::*,
};
use xcm_builder::ensure_is_remote;
frame_support::parameter_types! {
pub LocalMultiLocationPattern: MultiLocation = MultiLocation::new(0, Here);
@@ -56,3 +57,41 @@ impl<SelfParaId: Get<ParaId>> ContainsPair<MultiLocation, MultiLocation>
}
}
}
/// Adapter verifies if it is allowed to receive `MultiAsset` from `MultiLocation`.
///
/// Note: `MultiLocation` has to be from a different global consensus.
pub struct IsTrustedBridgedReserveLocationForConcreteAsset<UniversalLocation, Reserves>(
sp_std::marker::PhantomData<(UniversalLocation, Reserves)>,
);
impl<
UniversalLocation: Get<InteriorMultiLocation>,
Reserves: ContainsPair<MultiAsset, MultiLocation>,
> ContainsPair<MultiAsset, MultiLocation>
for IsTrustedBridgedReserveLocationForConcreteAsset<UniversalLocation, Reserves>
{
fn contains(asset: &MultiAsset, origin: &MultiLocation) -> bool {
let universal_source = UniversalLocation::get();
log::trace!(
target: "xcm::contains",
"IsTrustedBridgedReserveLocationForConcreteAsset asset: {:?}, origin: {:?}, universal_source: {:?}",
asset, origin, universal_source
);
// check remote origin
let _ = match ensure_is_remote(universal_source, *origin) {
Ok(devolved) => devolved,
Err(_) => {
log::trace!(
target: "xcm::contains",
"IsTrustedBridgedReserveLocationForConcreteAsset origin: {:?} is not remote to the universal_source: {:?}",
origin, universal_source
);
return false
},
};
// check asset according to the configured reserve locations
Reserves::contains(asset, origin)
}
}
@@ -35,10 +35,14 @@ parachains-runtimes-test-utils = { path = "../../test-utils", default-features =
# Polkadot
xcm = { package = "staging-xcm", path = "../../../../../polkadot/xcm", default-features = false}
xcm-builder = { package = "staging-xcm-builder", path = "../../../../../polkadot/xcm/xcm-builder", default-features = false}
xcm-executor = { package = "staging-xcm-executor", path = "../../../../../polkadot/xcm/xcm-executor", default-features = false}
pallet-xcm = { path = "../../../../../polkadot/xcm/pallet-xcm", default-features = false}
polkadot-parachain-primitives = { path = "../../../../../polkadot/parachain", default-features = false}
# Bridges
pallet-xcm-bridge-hub-router = { path = "../../../../../bridges/modules/xcm-bridge-hub-router", default-features = false }
[dev-dependencies]
hex-literal = "0.4.1"
@@ -61,6 +65,7 @@ std = [
"pallet-balances/std",
"pallet-collator-selection/std",
"pallet-session/std",
"pallet-xcm-bridge-hub-router/std",
"pallet-xcm/std",
"parachain-info/std",
"parachains-common/std",
@@ -71,6 +76,7 @@ std = [
"sp-io/std",
"sp-runtime/std",
"sp-std/std",
"xcm-builder/std",
"xcm-executor/std",
"xcm/std",
]
@@ -17,4 +17,5 @@
//! Module contains predefined test-case scenarios for `Runtime` with various assets.
pub mod test_cases;
pub mod test_cases_over_bridge;
pub use parachains_runtimes_test_utils::*;
@@ -78,6 +78,7 @@ pub fn teleports_for_native_asset_works<
Into<<<Runtime as frame_system::Config>::RuntimeOrigin as OriginTrait>::AccountId>,
<<Runtime as frame_system::Config>::Lookup as StaticLookup>::Source:
From<<Runtime as frame_system::Config>::AccountId>,
<Runtime as frame_system::Config>::AccountId: From<AccountId>,
XcmConfig: xcm_executor::Config,
CheckingAccount: Get<AccountIdOf<Runtime>>,
HrmpChannelOpener: frame_support::inherent::ProvideInherent<
@@ -96,7 +97,7 @@ pub fn teleports_for_native_asset_works<
let included_head = RuntimeHelper::<Runtime, AllPalletsWithoutSystem>::run_to_block(
2,
AccountId::from(alice),
AccountId::from(alice).into(),
);
// check Balances before
assert_eq!(<pallet_balances::Pallet<Runtime>>::free_balance(&target_account), 0.into());
@@ -346,6 +347,7 @@ pub fn teleports_for_foreign_assets_works<
Into<<<Runtime as frame_system::Config>::RuntimeOrigin as OriginTrait>::AccountId>,
<<Runtime as frame_system::Config>::Lookup as StaticLookup>::Source:
From<<Runtime as frame_system::Config>::AccountId>,
<Runtime as frame_system::Config>::AccountId: From<AccountId>,
ForeignAssetsPalletInstance: 'static,
{
// foreign parachain with the same consenus currency as asset
@@ -391,7 +393,7 @@ pub fn teleports_for_foreign_assets_works<
let included_head = RuntimeHelper::<Runtime, AllPalletsWithoutSystem>::run_to_block(
2,
AccountId::from(alice),
AccountId::from(alice).into(),
);
// checks target_account before
assert_eq!(
@@ -1005,6 +1007,7 @@ macro_rules! include_asset_transactor_transfer_with_pallet_assets_instance_works
}
);
/// Test-case makes sure that `Runtime` can create and manage `ForeignAssets`
pub fn create_and_manage_foreign_assets_for_local_consensus_parachain_assets_works<
Runtime,
XcmConfig,
@@ -0,0 +1,621 @@
// Copyright (C) 2023 Parity Technologies (UK) Ltd.
// 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.
//! Module contains predefined test-case scenarios for `Runtime` with various assets transferred
//! over a bridge.
use codec::Encode;
use cumulus_primitives_core::XcmpMessageSource;
use frame_support::{
assert_ok,
traits::{Currency, OnFinalize, OnInitialize, OriginTrait, ProcessMessageError},
};
use frame_system::pallet_prelude::BlockNumberFor;
use parachains_common::{AccountId, Balance};
use parachains_runtimes_test_utils::{
mock_open_hrmp_channel, AccountIdOf, BalanceOf, CollatorSessionKeys, ExtBuilder, RuntimeHelper,
ValidatorIdOf, XcmReceivedFrom,
};
use sp_runtime::traits::StaticLookup;
use xcm::{latest::prelude::*, VersionedMultiAssets};
use xcm_builder::{CreateMatcher, MatchXcm};
use xcm_executor::{traits::ConvertLocation, XcmExecutor};
pub struct TestBridgingConfig {
pub bridged_network: NetworkId,
pub local_bridge_hub_para_id: u32,
pub local_bridge_hub_location: MultiLocation,
pub bridged_target_location: MultiLocation,
}
/// Test-case makes sure that `Runtime` can initiate **reserve transfer assets** over bridge.
pub fn limited_reserve_transfer_assets_for_native_asset_works<
Runtime,
AllPalletsWithoutSystem,
XcmConfig,
HrmpChannelOpener,
HrmpChannelSource,
LocationToAccountId,
>(
collator_session_keys: CollatorSessionKeys<Runtime>,
existential_deposit: BalanceOf<Runtime>,
alice_account: AccountIdOf<Runtime>,
unwrap_pallet_xcm_event: Box<dyn Fn(Vec<u8>) -> Option<pallet_xcm::Event<Runtime>>>,
unwrap_xcmp_queue_event: Box<
dyn Fn(Vec<u8>) -> Option<cumulus_pallet_xcmp_queue::Event<Runtime>>,
>,
prepare_configuration: fn() -> TestBridgingConfig,
weight_limit: WeightLimit,
maybe_paid_export_message: Option<AssetId>,
) where
Runtime: frame_system::Config
+ pallet_balances::Config
+ pallet_session::Config
+ pallet_xcm::Config
+ parachain_info::Config
+ pallet_collator_selection::Config
+ cumulus_pallet_parachain_system::Config
+ cumulus_pallet_xcmp_queue::Config,
AllPalletsWithoutSystem:
OnInitialize<BlockNumberFor<Runtime>> + OnFinalize<BlockNumberFor<Runtime>>,
AccountIdOf<Runtime>: Into<[u8; 32]>,
ValidatorIdOf<Runtime>: From<AccountIdOf<Runtime>>,
BalanceOf<Runtime>: From<Balance>,
<Runtime as pallet_balances::Config>::Balance: From<Balance> + Into<u128>,
XcmConfig: xcm_executor::Config,
LocationToAccountId: ConvertLocation<AccountIdOf<Runtime>>,
<Runtime as frame_system::Config>::AccountId:
Into<<<Runtime as frame_system::Config>::RuntimeOrigin as OriginTrait>::AccountId>,
<<Runtime as frame_system::Config>::Lookup as StaticLookup>::Source:
From<<Runtime as frame_system::Config>::AccountId>,
<Runtime as frame_system::Config>::AccountId: From<AccountId>,
HrmpChannelOpener: frame_support::inherent::ProvideInherent<
Call = cumulus_pallet_parachain_system::Call<Runtime>,
>,
HrmpChannelSource: XcmpMessageSource,
{
let runtime_para_id = 1000;
ExtBuilder::<Runtime>::default()
.with_collators(collator_session_keys.collators())
.with_session_keys(collator_session_keys.session_keys())
.with_tracing()
.with_safe_xcm_version(3)
.with_para_id(runtime_para_id.into())
.build()
.execute_with(|| {
let mut alice = [0u8; 32];
alice[0] = 1;
let included_head = RuntimeHelper::<Runtime, AllPalletsWithoutSystem>::run_to_block(
2,
AccountId::from(alice).into(),
);
// prepare bridge config
let TestBridgingConfig {
bridged_network,
local_bridge_hub_para_id,
bridged_target_location: target_location_from_different_consensus,
..
} = prepare_configuration();
let reserve_account =
LocationToAccountId::convert_location(&target_location_from_different_consensus)
.expect("Sovereign account for reserves");
let balance_to_transfer = 1_000_000_000_000_u128;
let native_asset = MultiLocation::parent();
// open HRMP to bridge hub
mock_open_hrmp_channel::<Runtime, HrmpChannelOpener>(
runtime_para_id.into(),
local_bridge_hub_para_id.into(),
included_head,
&alice,
);
// drip ED to account
let alice_account_init_balance = existential_deposit + balance_to_transfer.into();
let _ = <pallet_balances::Pallet<Runtime>>::deposit_creating(
&alice_account,
alice_account_init_balance,
);
// SA of target location needs to have at least ED, otherwise making reserve fails
let _ = <pallet_balances::Pallet<Runtime>>::deposit_creating(
&reserve_account,
existential_deposit,
);
// we just check here, that user retains enough balance after withdrawal
// and also we check if `balance_to_transfer` is more than `existential_deposit`,
assert!(
(<pallet_balances::Pallet<Runtime>>::free_balance(&alice_account) -
balance_to_transfer.into()) >=
existential_deposit
);
// SA has just ED
assert_eq!(
<pallet_balances::Pallet<Runtime>>::free_balance(&reserve_account),
existential_deposit
);
// local native asset (pallet_balances)
let asset_to_transfer = MultiAsset {
fun: Fungible(balance_to_transfer.into()),
id: Concrete(native_asset),
};
// destination is (some) account relative to the destination different consensus
let target_destination_account = MultiLocation {
parents: 0,
interior: X1(AccountId32 {
network: Some(bridged_network),
id: sp_runtime::AccountId32::new([3; 32]).into(),
}),
};
// do pallet_xcm call reserve transfer
assert_ok!(<pallet_xcm::Pallet<Runtime>>::limited_reserve_transfer_assets(
RuntimeHelper::<Runtime, AllPalletsWithoutSystem>::origin_of(alice_account.clone()),
Box::new(target_location_from_different_consensus.into_versioned()),
Box::new(target_destination_account.into_versioned()),
Box::new(VersionedMultiAssets::from(MultiAssets::from(asset_to_transfer))),
0,
weight_limit,
));
// check alice account decreased by balance_to_transfer
// TODO:check-parameter: change and assert in tests when (https://github.com/paritytech/polkadot-sdk/pull/1234) merged
assert_eq!(
<pallet_balances::Pallet<Runtime>>::free_balance(&alice_account),
alice_account_init_balance - balance_to_transfer.into()
);
// check reserve account
// check reserve account increased by balance_to_transfer
assert_eq!(
<pallet_balances::Pallet<Runtime>>::free_balance(&reserve_account),
existential_deposit + balance_to_transfer.into()
);
// check events
// check pallet_xcm attempted
RuntimeHelper::<Runtime, AllPalletsWithoutSystem>::assert_pallet_xcm_event_outcome(
&unwrap_pallet_xcm_event,
|outcome| {
assert_ok!(outcome.ensure_complete());
},
);
// check that xcm was sent
let xcm_sent_message_hash = <frame_system::Pallet<Runtime>>::events()
.into_iter()
.filter_map(|e| unwrap_xcmp_queue_event(e.event.encode()))
.find_map(|e| match e {
cumulus_pallet_xcmp_queue::Event::XcmpMessageSent { message_hash } =>
Some(message_hash),
_ => None,
});
// read xcm
let xcm_sent = RuntimeHelper::<HrmpChannelSource, AllPalletsWithoutSystem>::take_xcm(
local_bridge_hub_para_id.into(),
)
.unwrap();
assert_eq!(
xcm_sent_message_hash,
Some(xcm_sent.using_encoded(sp_io::hashing::blake2_256))
);
let mut xcm_sent: Xcm<()> = xcm_sent.try_into().expect("versioned xcm");
// check sent XCM ExportMessage to BridgeHub
// 1. check paid or unpaid
if let Some(expected_fee_asset_id) = maybe_paid_export_message {
xcm_sent
.0
.matcher()
.match_next_inst(|instr| match instr {
WithdrawAsset(_) => Ok(()),
_ => Err(ProcessMessageError::BadFormat),
})
.expect("contains WithdrawAsset")
.match_next_inst(|instr| match instr {
BuyExecution { fees, .. } if fees.id.eq(&expected_fee_asset_id) => Ok(()),
_ => Err(ProcessMessageError::BadFormat),
})
.expect("contains BuyExecution")
} else {
xcm_sent
.0
.matcher()
.match_next_inst(|instr| match instr {
// first instruction could be UnpaidExecution (because we could have
// explicit unpaid execution on BridgeHub)
UnpaidExecution { weight_limit, check_origin }
if weight_limit == &Unlimited && check_origin.is_none() =>
Ok(()),
_ => Err(ProcessMessageError::BadFormat),
})
.expect("contains UnpaidExecution")
}
// 2. check ExportMessage
.match_next_inst(|instr| match instr {
// next instruction is ExportMessage
ExportMessage { network, destination, xcm: inner_xcm } => {
assert_eq!(network, &bridged_network);
let (_, target_location_junctions_without_global_consensus) =
target_location_from_different_consensus
.interior
.split_global()
.expect("split works");
assert_eq!(destination, &target_location_junctions_without_global_consensus);
assert_matches_pallet_xcm_reserve_transfer_assets_instructions(inner_xcm);
Ok(())
},
_ => Err(ProcessMessageError::BadFormat),
})
.expect("contains ExportMessage");
})
}
pub fn receive_reserve_asset_deposited_from_different_consensus_works<
Runtime,
AllPalletsWithoutSystem,
XcmConfig,
LocationToAccountId,
ForeignAssetsPalletInstance,
>(
collator_session_keys: CollatorSessionKeys<Runtime>,
existential_deposit: BalanceOf<Runtime>,
target_account: AccountIdOf<Runtime>,
block_author_account: AccountIdOf<Runtime>,
(
foreign_asset_id_multilocation,
transfered_foreign_asset_id_amount,
foreign_asset_id_minimum_balance,
): (MultiLocation, u128, u128),
prepare_configuration: fn() -> TestBridgingConfig,
(bridge_instance, universal_origin, descend_origin): (Junctions, Junction, Junctions), /* bridge adds origin manipulation on the way */
) where
Runtime: frame_system::Config
+ pallet_balances::Config
+ pallet_session::Config
+ pallet_xcm::Config
+ parachain_info::Config
+ pallet_collator_selection::Config
+ cumulus_pallet_parachain_system::Config
+ cumulus_pallet_xcmp_queue::Config
+ pallet_assets::Config<ForeignAssetsPalletInstance>,
AllPalletsWithoutSystem:
OnInitialize<BlockNumberFor<Runtime>> + OnFinalize<BlockNumberFor<Runtime>>,
AccountIdOf<Runtime>: Into<[u8; 32]>,
ValidatorIdOf<Runtime>: From<AccountIdOf<Runtime>>,
BalanceOf<Runtime>: From<Balance>,
XcmConfig: xcm_executor::Config,
LocationToAccountId: ConvertLocation<AccountIdOf<Runtime>>,
<Runtime as pallet_assets::Config<ForeignAssetsPalletInstance>>::AssetId:
From<MultiLocation> + Into<MultiLocation>,
<Runtime as pallet_assets::Config<ForeignAssetsPalletInstance>>::AssetIdParameter:
From<MultiLocation> + Into<MultiLocation>,
<Runtime as pallet_assets::Config<ForeignAssetsPalletInstance>>::Balance:
From<Balance> + Into<u128> + From<u128>,
<Runtime as frame_system::Config>::AccountId: Into<<<Runtime as frame_system::Config>::RuntimeOrigin as OriginTrait>::AccountId>
+ Into<AccountId>,
<<Runtime as frame_system::Config>::Lookup as StaticLookup>::Source:
From<<Runtime as frame_system::Config>::AccountId>,
ForeignAssetsPalletInstance: 'static,
{
ExtBuilder::<Runtime>::default()
.with_collators(collator_session_keys.collators())
.with_session_keys(collator_session_keys.session_keys())
.with_tracing()
.build()
.execute_with(|| {
// Set account as block author, who will receive fees
RuntimeHelper::<Runtime, AllPalletsWithoutSystem>::run_to_block(
2,
block_author_account.clone().into(),
);
// prepare bridge config
let TestBridgingConfig { local_bridge_hub_location, .. } = prepare_configuration();
// drip 'ED' user target account
let _ = <pallet_balances::Pallet<Runtime>>::deposit_creating(
&target_account,
existential_deposit,
);
// sovereign account as foreign asset owner (can be whoever for this scenario, doesnt
// matter)
let sovereign_account_as_owner_of_foreign_asset =
LocationToAccountId::convert_location(&MultiLocation::parent()).unwrap();
// staking pot account for collecting local native fees from `BuyExecution`
let staking_pot = <pallet_collator_selection::Pallet<Runtime>>::account_id();
let _ = <pallet_balances::Pallet<Runtime>>::deposit_creating(
&staking_pot,
existential_deposit,
);
// create foreign asset for wrapped/derivated representation
assert_ok!(
<pallet_assets::Pallet<Runtime, ForeignAssetsPalletInstance>>::force_create(
RuntimeHelper::<Runtime, AllPalletsWithoutSystem>::root_origin(),
foreign_asset_id_multilocation.into(),
sovereign_account_as_owner_of_foreign_asset.clone().into(),
true, // is_sufficient=true
foreign_asset_id_minimum_balance.into()
)
);
// Balances before
assert_eq!(
<pallet_balances::Pallet<Runtime>>::free_balance(&target_account),
existential_deposit.clone()
);
assert_eq!(
<pallet_balances::Pallet<Runtime>>::free_balance(&block_author_account),
0.into()
);
assert_eq!(
<pallet_balances::Pallet<Runtime>>::free_balance(&staking_pot),
existential_deposit.clone()
);
// ForeignAssets balances before
assert_eq!(
<pallet_assets::Pallet<Runtime, ForeignAssetsPalletInstance>>::balance(
foreign_asset_id_multilocation.into(),
&target_account
),
0.into()
);
assert_eq!(
<pallet_assets::Pallet<Runtime, ForeignAssetsPalletInstance>>::balance(
foreign_asset_id_multilocation.into(),
&block_author_account
),
0.into()
);
assert_eq!(
<pallet_assets::Pallet<Runtime, ForeignAssetsPalletInstance>>::balance(
foreign_asset_id_multilocation.into(),
&staking_pot
),
0.into()
);
// Call received XCM execution
let xcm = Xcm(vec![
DescendOrigin(bridge_instance),
UniversalOrigin(universal_origin),
DescendOrigin(descend_origin),
ReserveAssetDeposited(MultiAssets::from(vec![MultiAsset {
id: Concrete(foreign_asset_id_multilocation),
fun: Fungible(transfered_foreign_asset_id_amount),
}])),
ClearOrigin,
BuyExecution {
fees: MultiAsset {
id: Concrete(foreign_asset_id_multilocation),
fun: Fungible(transfered_foreign_asset_id_amount),
},
weight_limit: Unlimited,
},
DepositAsset {
assets: Wild(AllCounted(1)),
beneficiary: MultiLocation {
parents: 0,
interior: X1(AccountId32 {
network: None,
id: target_account.clone().into(),
}),
},
},
SetTopic([
220, 188, 144, 32, 213, 83, 111, 175, 44, 210, 111, 19, 90, 165, 191, 112, 140,
247, 192, 124, 42, 17, 153, 141, 114, 34, 189, 20, 83, 69, 237, 173,
]),
]);
assert_matches_pallet_xcm_reserve_transfer_assets_instructions(&mut xcm.clone());
let hash = xcm.using_encoded(sp_io::hashing::blake2_256);
// execute xcm as XcmpQueue would do
let outcome = XcmExecutor::<XcmConfig>::execute_xcm(
local_bridge_hub_location,
xcm,
hash,
RuntimeHelper::<Runtime, AllPalletsWithoutSystem>::xcm_max_weight(
XcmReceivedFrom::Sibling,
),
);
assert_eq!(outcome.ensure_complete(), Ok(()));
// author actual balance after (received fees from Trader for ForeignAssets)
let author_received_fees =
<pallet_assets::Pallet<Runtime, ForeignAssetsPalletInstance>>::balance(
foreign_asset_id_multilocation.into(),
&block_author_account,
);
// Balances after (untouched)
assert_eq!(
<pallet_balances::Pallet<Runtime>>::free_balance(&target_account),
existential_deposit.clone()
);
assert_eq!(
<pallet_balances::Pallet<Runtime>>::free_balance(&block_author_account),
0.into()
);
assert_eq!(
<pallet_balances::Pallet<Runtime>>::free_balance(&staking_pot),
existential_deposit.clone()
);
// ForeignAssets balances after
assert_eq!(
<pallet_assets::Pallet<Runtime, ForeignAssetsPalletInstance>>::balance(
foreign_asset_id_multilocation.into(),
&target_account
),
(transfered_foreign_asset_id_amount - author_received_fees.into()).into()
);
assert_eq!(
<pallet_assets::Pallet<Runtime, ForeignAssetsPalletInstance>>::balance(
foreign_asset_id_multilocation.into(),
&block_author_account
),
author_received_fees
);
assert_eq!(
<pallet_assets::Pallet<Runtime, ForeignAssetsPalletInstance>>::balance(
foreign_asset_id_multilocation.into(),
&staking_pot
),
0.into()
);
})
}
fn assert_matches_pallet_xcm_reserve_transfer_assets_instructions<RuntimeCall>(
xcm: &mut Xcm<RuntimeCall>,
) {
let _ = xcm
.0
.matcher()
.skip_inst_while(|inst| !matches!(inst, ReserveAssetDeposited(..)))
.expect("no instruction ReserveAssetDeposited?")
.match_next_inst(|instr| match instr {
ReserveAssetDeposited(..) => Ok(()),
_ => Err(ProcessMessageError::BadFormat),
})
.expect("expected instruction ReserveAssetDeposited")
.match_next_inst(|instr| match instr {
ClearOrigin => Ok(()),
_ => Err(ProcessMessageError::BadFormat),
})
.expect("expected instruction ClearOrigin")
.match_next_inst(|instr| match instr {
BuyExecution { .. } => Ok(()),
_ => Err(ProcessMessageError::BadFormat),
})
.expect("expected instruction BuyExecution")
.match_next_inst(|instr| match instr {
DepositAsset { .. } => Ok(()),
_ => Err(ProcessMessageError::BadFormat),
})
.expect("expected instruction DepositAsset");
}
pub fn report_bridge_status_from_xcm_bridge_router_works<
Runtime,
AllPalletsWithoutSystem,
XcmConfig,
HrmpChannelOpener,
HrmpChannelSource,
LocationToAccountId,
XcmBridgeHubRouterInstance,
>(
collator_session_keys: CollatorSessionKeys<Runtime>,
existential_deposit: BalanceOf<Runtime>,
alice_account: AccountIdOf<Runtime>,
unwrap_pallet_xcm_event: Box<dyn Fn(Vec<u8>) -> Option<pallet_xcm::Event<Runtime>>>,
unwrap_xcmp_queue_event: Box<
dyn Fn(Vec<u8>) -> Option<cumulus_pallet_xcmp_queue::Event<Runtime>>,
>,
prepare_configuration: fn() -> TestBridgingConfig,
weight_limit: WeightLimit,
maybe_paid_export_message: Option<AssetId>,
congested_message: fn() -> Xcm<XcmConfig::RuntimeCall>,
uncongested_message: fn() -> Xcm<XcmConfig::RuntimeCall>,
) where
Runtime: frame_system::Config
+ pallet_balances::Config
+ pallet_session::Config
+ pallet_xcm::Config
+ parachain_info::Config
+ pallet_collator_selection::Config
+ cumulus_pallet_parachain_system::Config
+ cumulus_pallet_xcmp_queue::Config
+ pallet_xcm_bridge_hub_router::Config<XcmBridgeHubRouterInstance>,
AllPalletsWithoutSystem:
OnInitialize<BlockNumberFor<Runtime>> + OnFinalize<BlockNumberFor<Runtime>>,
AccountIdOf<Runtime>: Into<[u8; 32]>,
ValidatorIdOf<Runtime>: From<AccountIdOf<Runtime>>,
BalanceOf<Runtime>: From<Balance>,
<Runtime as pallet_balances::Config>::Balance: From<Balance> + Into<u128>,
XcmConfig: xcm_executor::Config,
LocationToAccountId: ConvertLocation<AccountIdOf<Runtime>>,
<Runtime as frame_system::Config>::AccountId:
Into<<<Runtime as frame_system::Config>::RuntimeOrigin as OriginTrait>::AccountId>,
<<Runtime as frame_system::Config>::Lookup as StaticLookup>::Source:
From<<Runtime as frame_system::Config>::AccountId>,
<Runtime as frame_system::Config>::AccountId: From<AccountId>,
HrmpChannelOpener: frame_support::inherent::ProvideInherent<
Call = cumulus_pallet_parachain_system::Call<Runtime>,
>,
HrmpChannelSource: XcmpMessageSource,
XcmBridgeHubRouterInstance: 'static,
{
ExtBuilder::<Runtime>::default()
.with_collators(collator_session_keys.collators())
.with_session_keys(collator_session_keys.session_keys())
.with_tracing()
.build()
.execute_with(|| {
// check transfer works
limited_reserve_transfer_assets_for_native_asset_works::<
Runtime,
AllPalletsWithoutSystem,
XcmConfig,
HrmpChannelOpener,
HrmpChannelSource,
LocationToAccountId,
>(
collator_session_keys,
existential_deposit,
alice_account,
unwrap_pallet_xcm_event,
unwrap_xcmp_queue_event,
prepare_configuration,
weight_limit,
maybe_paid_export_message,
);
let report_bridge_status = |is_congested: bool| {
// prepare bridge config
let TestBridgingConfig { local_bridge_hub_location, .. } = prepare_configuration();
// Call received XCM execution
let xcm = if is_congested { congested_message() } else { uncongested_message() };
let hash = xcm.using_encoded(sp_io::hashing::blake2_256);
// execute xcm as XcmpQueue would do
let outcome = XcmExecutor::<XcmConfig>::execute_xcm(
local_bridge_hub_location,
xcm,
hash,
RuntimeHelper::<Runtime, AllPalletsWithoutSystem>::xcm_max_weight(XcmReceivedFrom::Sibling),
);
assert_eq!(outcome.ensure_complete(), Ok(()));
assert_eq!(is_congested, pallet_xcm_bridge_hub_router::Pallet::<Runtime, XcmBridgeHubRouterInstance>::bridge().is_congested);
};
report_bridge_status(true);
report_bridge_status(false);
})
}
+95 -126
View File
@@ -1,13 +1,14 @@
- [Bridge-hub Parachains](#bridge-hub-parachains)
- [Requirements for local run/testing](#requirements-for-local-runtesting)
- [How to test local Rococo <-> Wococo bridge](#how-to-test-local-rococo---wococo-bridge)
- [Run chains (Rococo + BridgeHub, Wococo + BridgeHub) with
zombienet](#run-chains-rococo--bridgehub-wococo--bridgehub-with-zombienet)
- [Run relayer (BridgeHubRococo, BridgeHubWococo)](#run-relayer-bridgehubrococo-bridgehubwococo)
- [Run with script (alternative 1)](#run-with-script-alternative-1)
- [Run with binary (alternative 2)](#run-with-binary-alternative-2)
- [Send messages - transfer asset over bridge](#send-messages---transfer-asset-over-bridge)
- [How to test live BridgeHubRococo/BridgeHubWococo](#how-to-test-live-bridgehubrococobridgehubwococo)
- [Run Rococo/Wococo chains with zombienet](#run-rococowococo-chains-with-zombienet)
- [Init bridge and run relayer between BridgeHubRococo and
BridgeHubWococo](#init-bridge-and-run-relayer-between-bridgehubrococo-and-bridgehubwococo)
- [Initialize configuration for transfer asset over bridge
(ROCs/WOCs)](#initialize-configuration-for-transfer-asset-over-bridge-rocswocs)
- [Send messages - transfer asset over bridge (ROCs/WOCs)](#send-messages---transfer-asset-over-bridge-rocswocs)
- [Claim relayer's rewards on BridgeHubRococo and
BridgeHubWococo](#claim-relayers-rewards-on-bridgehubrococo-and-bridgehubwococo)
- [How to test local BridgeHubKusama/BridgeHubPolkadot](#how-to-test-local-bridgehubkusamabridgehubpolkadot)
# Bridge-hub Parachains
@@ -42,17 +43,29 @@ Copy the apropriate binary (zombienet-linux) from the latest release to ~/local_
---
# 2. Build polkadot binary
git clone https://github.com/paritytech/polkadot.git
cd polkadot
# if you want to test Kusama/Polkadot bridge, we need "sudo pallet + fast-runtime",
# so please, find the latest polkadot's repository branch `it/release-vX.Y.Z-fast-sudo`
# e.g:
# git checkout -b it/release-v0.9.43-fast-sudo --track origin/it/release-v0.9.43-fast-sudo
# If you want to test Kusama/Polkadot bridge, we need "sudo pallet + fast-runtime",
# so we need to use sudofi in polkadot directory.
#
# Install sudofi: (skip if already installed)
# cd <somewhere-outside-polkadot-sdk-git-repo-dir>
# git clone https://github.com/paritytech/parachain-utils.git
# cd parachain-utils # -> this is <parachain-utils-git-repo-dir>
# cargo build --release --bin sudofi
#
# cd <polkadot-sdk-git-repo-dir>/polkadot
# <parachain-utils-git-repo-dir>/target/release/sudofi
cargo build --release --features fast-runtime
cd <polkadot-sdk-git-repo-dir>
cargo build --release --features fast-runtime --bin polkadot
cp target/release/polkadot ~/local_bridge_testing/bin/polkadot
cargo build --release --features fast-runtime --bin polkadot-prepare-worker
cp target/release/polkadot-prepare-worker ~/local_bridge_testing/bin/polkadot-prepare-worker
cargo build --release --features fast-runtime --bin polkadot-execute-worker
cp target/release/polkadot-execute-worker ~/local_bridge_testing/bin/polkadot-execute-worker
---
# 3. Build substrate-relay binary
@@ -71,124 +84,48 @@ cp target/release/substrate-relay ~/local_bridge_testing/bin/substrate-relay
---
# 4. Build cumulus polkadot-parachain binary
cd <cumulus-git-repo-dir>
cd <polkadot-sdk-git-repo-dir>
# checkout desired branch or use master:
# git checkout -b master --track origin/master
cargo build --release --locked --bin polkadot-parachain
cargo build --release -p polkadot-parachain-bin
cp target/release/polkadot-parachain ~/local_bridge_testing/bin/polkadot-parachain
cp target/release/polkadot-parachain ~/local_bridge_testing/bin/polkadot-parachain-asset-hub
# !!! READ HERE (TODO remove once all mentioned branches bellow are merged)
# The use case "moving assets over bridge" is not merged yet and is implemented in separate branches.
# So, if you want to try it, you need to checkout different branch and continue with these instructions there.
# For Kusama/Polkadot local bridge testing:
#
# build BridgeHubs (polkadot-parachain) from branch:
# git checkout -b bridge-hub-kusama-polkadot --track origin/bridge-hub-kusama-polkadot
# cargo build --release --locked --bin polkadot-parachain
# cp target/release/polkadot-parachain ~/local_bridge_testing/bin/polkadot-parachain
#
# build AssetHubs (polkadot-parachain-asset-hub) from branch:
# git checkout -b bko-transfer-asset-via-bridge-pallet-xcm --track origin/bko-transfer-asset-via-bridge-pallet-xcm
# cargo build --release --locked --bin polkadot-parachain
# cp target/release/polkadot-parachain ~/local_bridge_testing/bin/polkadot-parachain-asset-hub
# For Rococo/Wococo local bridge testing:
#
# build AssetHubs (polkadot-parachain-asset-hub) from branch:
# git checkout -b bko-transfer-asset-via-bridge-pallet-xcm-ro-wo --track origin/bko-transfer-asset-via-bridge-pallet-xcm-ro-wo
# cargo build --release --locked --bin polkadot-parachain
# cp target/release/polkadot-parachain ~/local_bridge_testing/bin/polkadot-parachain-asset-hub
```
## How to test local Rococo <-> Wococo bridge
### Run chains (Rococo + BridgeHub + AssetHub, Wococo + BridgeHub + AssetHub) with zombienet
### Run Rococo/Wococo chains with zombienet
```
cd <polkadot-sdk-git-repo-dir>
# Rococo + BridgeHubRococo + AssetHub for Rococo (mirroring Kusama)
POLKADOT_BINARY_PATH=~/local_bridge_testing/bin/polkadot \
POLKADOT_PARACHAIN_BINARY_PATH=~/local_bridge_testing/bin/polkadot-parachain \
POLKADOT_PARACHAIN_BINARY_PATH_FOR_ASSET_HUB_ROCOCO=~/local_bridge_testing/bin/polkadot-parachain-asset-hub \
~/local_bridge_testing/bin/zombienet-linux --provider native spawn ./zombienet/bridge-hubs/bridge_hub_rococo_local_network.toml
~/local_bridge_testing/bin/zombienet-linux --provider native spawn ./cumulus/zombienet/bridge-hubs/bridge_hub_rococo_local_network.toml
```
```
cd <polkadot-sdk-git-repo-dir>
# Wococo + BridgeHubWococo + AssetHub for Wococo (mirroring Polkadot)
POLKADOT_BINARY_PATH=~/local_bridge_testing/bin/polkadot \
POLKADOT_PARACHAIN_BINARY_PATH=~/local_bridge_testing/bin/polkadot-parachain \
POLKADOT_PARACHAIN_BINARY_PATH_FOR_ASSET_HUB_WOCOCO=~/local_bridge_testing/bin/polkadot-parachain-asset-hub \
~/local_bridge_testing/bin/zombienet-linux --provider native spawn ./zombienet/bridge-hubs/bridge_hub_wococo_local_network.toml
~/local_bridge_testing/bin/zombienet-linux --provider native spawn ./cumulus/zombienet/bridge-hubs/bridge_hub_wococo_local_network.toml
```
### Run relayer (BridgeHubRococo, BridgeHubWococo)
### Init bridge and run relayer between BridgeHubRococo and BridgeHubWococo
**Accounts of BridgeHub parachains:**
- `Bob` is pallet owner of all bridge pallets
#### Run with script (alternative 1)
```
cd <cumulus-git-repo-dir>
./scripts/bridges_rococo_wococo.sh run-relay
#### Run with script
```
cd <polkadot-sdk-git-repo-dir>
#### Run with binary (alternative 2)
Need to wait for parachain activation (start producing blocks), then run:
```
# 1. Init bridges:
# Rococo -> Wococo
RUST_LOG=runtime=trace,rpc=trace,bridge=trace \
~/local_bridge_testing/bin/substrate-relay init-bridge rococo-to-bridge-hub-wococo \
--source-host localhost \
--source-port 9942 \
--source-version-mode Auto \
--target-host localhost \
--target-port 8945 \
--target-version-mode Auto \
--target-signer //Bob
# Wococo -> Rococo
RUST_LOG=runtime=trace,rpc=trace,bridge=trace \
~/local_bridge_testing/bin/substrate-relay init-bridge wococo-to-bridge-hub-rococo \
--source-host localhost \
--source-port 9945 \
--source-version-mode Auto \
--target-host localhost \
--target-port 8943 \
--target-version-mode Auto \
--target-signer //Bob
# 2. Relay relay-chain headers, parachain headers and messages**
RUST_LOG=runtime=trace,rpc=trace,bridge=trace \
~/local_bridge_testing/bin/substrate-relay relay-headers-and-messages bridge-hub-rococo-bridge-hub-wococo \
--rococo-host localhost \
--rococo-port 9942 \
--rococo-version-mode Auto \
--bridge-hub-rococo-host localhost \
--bridge-hub-rococo-port 8943 \
--bridge-hub-rococo-version-mode Auto \
--bridge-hub-rococo-signer //Charlie \
--wococo-headers-to-bridge-hub-rococo-signer //Bob \
--wococo-parachains-to-bridge-hub-rococo-signer //Bob \
--bridge-hub-rococo-transactions-mortality 4 \
--wococo-host localhost \
--wococo-port 9945 \
--wococo-version-mode Auto \
--bridge-hub-wococo-host localhost \
--bridge-hub-wococo-port 8945 \
--bridge-hub-wococo-version-mode Auto \
--bridge-hub-wococo-signer //Charlie \
--rococo-headers-to-bridge-hub-wococo-signer //Bob \
--rococo-parachains-to-bridge-hub-wococo-signer //Bob \
--bridge-hub-wococo-transactions-mortality 4 \
--lane 00000001
./cumulus/scripts/bridges_rococo_wococo.sh run-relay
```
**Check relay-chain headers relaying:**
@@ -199,34 +136,66 @@ RUST_LOG=runtime=trace,rpc=trace,bridge=trace \
**Check parachain headers relaying:**
- Rococo parachain: - https://polkadot.js.org/apps/?rpc=ws%3A%2F%2F127.0.0.1%3A8943#/chainstate - Pallet:
**bridgeWococoParachain** - Keys: **bestParaHeads()**
**bridgeWococoParachain** - Keys: **parasInfo(None)**
- Wococo parachain: - https://polkadot.js.org/apps/?rpc=ws%3A%2F%2F127.0.0.1%3A8945#/chainstate - Pallet:
**bridgeRococoParachain** - Keys: **bestParaHeads()**
**bridgeRococoParachain** - Keys: **parasInfo(None)**
### Send messages - transfer asset over bridge
### Initialize configuration for transfer asset over bridge (ROCs/WOCs)
TODO: see `# !!! READ HERE` above
This initialization does several things:
- creates `ForeignAssets` for wrappedROCs/wrappedWOCs
- drips SA for AssetHubRococo on AssetHubWococo (and vice versa) which holds reserved assets on source chains
```
cd <polkadot-sdk-git-repo-dir>
## How to test live BridgeHubRococo/BridgeHubWococo
(here is still deployed older PoC from branch `origin/bko-transfer-asset-via-bridge`, which uses custom extrinsic, which
is going to be replaced by `pallet_xcm` usage)
- uses account seed on Live Rococo:Rockmine2
```
cd <cumulus-git-repo-dir>
./scripts/bridges_rococo_wococo.sh transfer-asset-from-asset-hub-rococo
```
./cumulus/scripts/bridges_rococo_wococo.sh init-asset-hub-rococo-local
./cumulus/scripts/bridges_rococo_wococo.sh init-bridge-hub-rococo-local
./cumulus/scripts/bridges_rococo_wococo.sh init-asset-hub-wococo-local
./cumulus/scripts/bridges_rococo_wococo.sh init-bridge-hub-wococo-local
```
- open explorers: - Rockmine2 (see events `xcmpQueue.XcmpMessageSent`, `bridgeTransfer.ReserveAssetsDeposited`,
`bridgeTransfer.TransferInitiated`)
https://polkadot.js.org/apps/?rpc=wss%3A%2F%2Fws-rococo-rockmine2-collator-node-0.parity-testnet.parity.io#/explorer
- BridgeHubRococo (see `bridgeWococoMessages.MessageAccepted`)
https://polkadot.js.org/apps/?rpc=wss%3A%2F%2Frococo-bridge-hub-rpc.polkadot.io#/explorer - BridgeHubWococo (see
`bridgeRococoMessages.MessagesReceived`)
https://polkadot.js.org/apps/?rpc=wss%3A%2F%2Fwococo-bridge-hub-rpc.polkadot.io#/explorer - Wockmint (see
`xcmpQueue.Success` for `transfer-asset` and `xcmpQueue.Fail` for `ping-via-bridge`)
https://polkadot.js.org/apps/?rpc=wss%3A%2F%2Fwococo-wockmint-rpc.polkadot.io#/explorer - BridgeHubRococo (see
`bridgeWococoMessages.MessagesDelivered`)
### Send messages - transfer asset over bridge (ROCs/WOCs)
Do (asset) transfers:
```
cd <polkadot-sdk-git-repo-dir>
# ROCs from Rococo's Asset Hub to Wococo's.
./cumulus/scripts/bridges_rococo_wococo.sh reserve-transfer-assets-from-asset-hub-rococo-local
```
```
cd <polkadot-sdk-git-repo-dir>
# WOCs from Wococo's Asset Hub to Rococo's.
./cumulus/scripts/bridges_rococo_wococo.sh reserve-transfer-assets-from-asset-hub-wococo-local
```
- open explorers: (see zombienets)
- AssetHubRococo (see events `xcmpQueue.XcmpMessageSent`, `polkadotXcm.Attempted`) https://polkadot.js.org/apps/?rpc=ws://127.0.0.1:9910#/explorer
- BridgeHubRococo (see `bridgeWococoMessages.MessageAccepted`) https://polkadot.js.org/apps/?rpc=ws://127.0.0.1:8943#/explorer
- BridgeHubWococo (see `bridgeRococoMessages.MessagesReceived`, `xcmpQueue.XcmpMessageSent`) https://polkadot.js.org/apps/?rpc=ws://127.0.0.1:8945#/explorer
- AssetHubWococo (see `foreignAssets.Issued`, `xcmpQueue.Success`) https://polkadot.js.org/apps/?rpc=ws://127.0.0.1:9010#/explorer
- BridgeHubRocococ (see `bridgeWococoMessages.MessagesDelivered`) https://polkadot.js.org/apps/?rpc=ws://127.0.0.1:8943#/explorer
### Claim relayer's rewards on BridgeHubRococo and BridgeHubWococo
**Accounts of BridgeHub parachains:**
- `//Charlie` is relayer account on BridgeHubRococo
- `//Charlie` is relayer account on BridgeHubWococo
```
cd <polkadot-sdk-git-repo-dir>
# Claim rewards on BridgeHubWococo:
./cumulus/scripts/bridges_rococo_wococo.sh claim-rewards-bridge-hub-rococo-local
# Claim rewards on BridgeHubWococo:
./cumulus/scripts/bridges_rococo_wococo.sh claim-rewards-bridge-hub-wococo-local
```
- open explorers: (see zombienets)
- BridgeHubRococo (see 2x `bridgeRelayers.RewardPaid`) https://polkadot.js.org/apps/?rpc=ws://127.0.0.1:8943#/explorer
- BridgeHubWococo (see 2x `bridgeRelayers.RewardPaid`) https://polkadot.js.org/apps/?rpc=ws://127.0.0.1:8945#/explorer
## How to test local BridgeHubKusama/BridgeHubPolkadot
@@ -162,7 +162,7 @@ pub type Barrier = TrailingSetTopicAsId<
AllowKnownQueryResponses<PolkadotXcm>,
WithComputedOrigin<
(
// If the message is one that immediately attemps to pay for execution, then
// If the message is one that immediately attempts to pay for execution, then
// allow it.
AllowTopLevelPaidExecutionFrom<Everything>,
// Parent and its pluralities (i.e. governance bodies) get free execution.
@@ -165,7 +165,7 @@ pub type Barrier = TrailingSetTopicAsId<
AllowKnownQueryResponses<PolkadotXcm>,
WithComputedOrigin<
(
// If the message is one that immediately attemps to pay for execution, then
// If the message is one that immediately attempts to pay for execution, then
// allow it.
AllowTopLevelPaidExecutionFrom<Everything>,
// Parent, its pluralities (i.e. governance bodies), and the Fellows plurality
@@ -65,7 +65,7 @@ cumulus-pallet-dmp-queue = { path = "../../../../pallets/dmp-queue", default-fea
cumulus-pallet-parachain-system = { path = "../../../../pallets/parachain-system", default-features = false, features = ["parameterized-consensus-hook",] }
cumulus-pallet-session-benchmarking = { path = "../../../../pallets/session-benchmarking", default-features = false}
cumulus-pallet-xcm = { path = "../../../../pallets/xcm", default-features = false }
cumulus-pallet-xcmp-queue = { path = "../../../../pallets/xcmp-queue", default-features = false }
cumulus-pallet-xcmp-queue = { path = "../../../../pallets/xcmp-queue", default-features = false, features = ["bridging"] }
cumulus-primitives-core = { path = "../../../../primitives/core", default-features = false }
cumulus-primitives-utility = { path = "../../../../primitives/utility", default-features = false }
pallet-collator-selection = { path = "../../../../pallets/collator-selection", default-features = false }
@@ -73,6 +73,8 @@ parachain-info = { path = "../../../pallets/parachain-info", default-features =
parachains-common = { path = "../../../common", default-features = false }
# Bridges
bp-asset-hub-rococo = { path = "../../../../../bridges/primitives/chain-asset-hub-rococo", default-features = false }
bp-asset-hub-wococo = { path = "../../../../../bridges/primitives/chain-asset-hub-wococo", default-features = false }
bp-bridge-hub-rococo = { path = "../../../../../bridges/primitives/chain-bridge-hub-rococo", default-features = false }
bp-bridge-hub-wococo = { path = "../../../../../bridges/primitives/chain-bridge-hub-wococo", default-features = false }
bp-header-chain = { path = "../../../../../bridges/primitives/header-chain", default-features = false }
@@ -98,6 +100,8 @@ sp-keyring = { path = "../../../../../substrate/primitives/keyring" }
[features]
default = [ "std" ]
std = [
"bp-asset-hub-rococo/std",
"bp-asset-hub-wococo/std",
"bp-bridge-hub-rococo/std",
"bp-bridge-hub-wococo/std",
"bp-header-chain/std",
@@ -33,6 +33,7 @@ use bridge_runtime_common::{
RefundableMessagesLane, RefundableParachain,
},
};
use codec::Encode;
use frame_support::{parameter_types, traits::PalletInfoAccess};
use sp_runtime::RuntimeDebug;
use xcm::{
@@ -51,12 +52,38 @@ parameter_types! {
pub BridgeHubRococoUniversalLocation: InteriorMultiLocation = X2(GlobalConsensus(Rococo), Parachain(ParachainInfo::parachain_id().into()));
pub WococoGlobalConsensusNetwork: NetworkId = NetworkId::Wococo;
pub ActiveOutboundLanesToBridgeHubWococo: &'static [bp_messages::LaneId] = &[DEFAULT_XCM_LANE_TO_BRIDGE_HUB_WOCOCO];
pub PriorityBoostPerMessage: u64 = 921_900_294;
// see the `FEE_BOOST_PER_MESSAGE` constant to get the meaning of this value
pub PriorityBoostPerMessage: u64 = 182_044_444_444_444;
pub AssetHubRococoParaId: cumulus_primitives_core::ParaId = bp_asset_hub_rococo::ASSET_HUB_ROCOCO_PARACHAIN_ID.into();
pub FromAssetHubRococoToAssetHubWococoRoute: SenderAndLane = SenderAndLane::new(
ParentThen(X1(Parachain(1000))).into(),
ParentThen(X1(Parachain(AssetHubRococoParaId::get().into()))).into(),
DEFAULT_XCM_LANE_TO_BRIDGE_HUB_WOCOCO,
);
pub CongestedMessage: Xcm<()> = build_congestion_message(true).into();
pub UncongestedMessage: Xcm<()> = build_congestion_message(false).into();
}
fn build_congestion_message<Call>(is_congested: bool) -> sp_std::vec::Vec<Instruction<Call>> {
sp_std::vec![
UnpaidExecution { weight_limit: Unlimited, check_origin: None },
Transact {
origin_kind: OriginKind::Xcm,
require_weight_at_most:
bp_asset_hub_rococo::XcmBridgeHubRouterTransactCallMaxWeight::get(),
call: bp_asset_hub_rococo::Call::ToWococoXcmRouter(
bp_asset_hub_rococo::XcmBridgeHubRouterCall::report_bridge_status {
bridge_id: Default::default(),
is_congested,
}
)
.encode()
.into(),
}
]
}
/// Proof of messages, coming from Wococo.
@@ -73,7 +100,7 @@ pub type OnBridgeHubRococoBlobDispatcher = BridgeBlobDispatcher<
BridgeWococoMessagesPalletInstance,
>;
/// Export XCM messages to be relayed to the otherside
/// Export XCM messages to be relayed to the other side
pub type ToBridgeHubWococoHaulBlobExporter = HaulBlobExporter<
XcmBlobHaulerAdapter<ToBridgeHubWococoXcmBlobHauler>,
WococoGlobalConsensusNetwork,
@@ -86,11 +113,14 @@ impl XcmBlobHauler for ToBridgeHubWococoXcmBlobHauler {
type SenderAndLane = FromAssetHubRococoToAssetHubWococoRoute;
type ToSourceChainSender = crate::XcmRouter;
type CongestedMessage = ();
type UncongestedMessage = ();
type CongestedMessage = CongestedMessage;
type UncongestedMessage = UncongestedMessage;
}
pub const DEFAULT_XCM_LANE_TO_BRIDGE_HUB_WOCOCO: LaneId = LaneId([0, 0, 0, 1]);
/// On messages delivered callback.
pub type OnMessagesDelivered = XcmBlobHaulerAdapter<ToBridgeHubWococoXcmBlobHauler>;
/// Messaging Bridge configuration for BridgeHubRococo -> BridgeHubWococo
pub struct WithBridgeHubWococoMessageBridge;
impl MessageBridge for WithBridgeHubWococoMessageBridge {
@@ -164,6 +194,18 @@ mod tests {
AssertCompleteBridgeConstants,
},
};
use parachains_common::{rococo, Balance};
/// Every additional message in the message delivery transaction boosts its priority.
/// So the priority of transaction with `N+1` messages is larger than priority of
/// transaction with `N` messages by the `PriorityBoostPerMessage`.
///
/// Economically, it is an equivalent of adding tip to the transaction with `N` messages.
/// The `FEE_BOOST_PER_MESSAGE` constant is the value of this tip.
///
/// We want this tip to be large enough (delivery transactions with more messages = less
/// operational costs and a faster bridge), so this value should be significant.
const FEE_BOOST_PER_MESSAGE: Balance = 2 * rococo::currency::UNITS;
#[test]
fn ensure_bridge_hub_rococo_message_lane_weights_are_correct() {
@@ -215,5 +257,16 @@ mod tests {
bp_bridge_hub_wococo::WITH_BRIDGE_HUB_WOCOCO_MESSAGES_PALLET_NAME,
},
});
bridge_runtime_common::priority_calculator::ensure_priority_boost_is_sane::<
Runtime,
WithBridgeHubWococoMessagesInstance,
PriorityBoostPerMessage,
>(FEE_BOOST_PER_MESSAGE);
assert_eq!(
BridgeWococoMessagesPalletInstance::get(),
X1(PalletInstance(bp_bridge_hub_rococo::WITH_BRIDGE_WOCOCO_MESSAGES_PALLET_INDEX))
);
}
}
@@ -33,6 +33,7 @@ use bridge_runtime_common::{
RefundableMessagesLane, RefundableParachain,
},
};
use codec::Encode;
use frame_support::{parameter_types, traits::PalletInfoAccess};
use sp_runtime::RuntimeDebug;
use xcm::{
@@ -51,18 +52,44 @@ parameter_types! {
pub BridgeRococoMessagesPalletInstance: InteriorMultiLocation = X1(PalletInstance(<BridgeRococoMessages as PalletInfoAccess>::index() as u8));
pub RococoGlobalConsensusNetwork: NetworkId = NetworkId::Rococo;
pub ActiveOutboundLanesToBridgeHubRococo: &'static [bp_messages::LaneId] = &[DEFAULT_XCM_LANE_TO_BRIDGE_HUB_ROCOCO];
pub PriorityBoostPerMessage: u64 = 921_900_294;
// see the `FEE_BOOST_PER_MESSAGE` constant to get the meaning of this value
pub PriorityBoostPerMessage: u64 = 182_044_444_444_444;
pub AssetHubWococoParaId: cumulus_primitives_core::ParaId = bp_asset_hub_wococo::ASSET_HUB_WOCOCO_PARACHAIN_ID.into();
pub FromAssetHubWococoToAssetHubRococoRoute: SenderAndLane = SenderAndLane::new(
ParentThen(X1(Parachain(1000))).into(),
ParentThen(X1(Parachain(AssetHubWococoParaId::get().into()))).into(),
DEFAULT_XCM_LANE_TO_BRIDGE_HUB_ROCOCO,
);
pub CongestedMessage: Xcm<()> = build_congestion_message(true).into();
pub UncongestedMessage: Xcm<()> = build_congestion_message(false).into();
}
fn build_congestion_message<Call>(is_congested: bool) -> sp_std::vec::Vec<Instruction<Call>> {
sp_std::vec![
UnpaidExecution { weight_limit: Unlimited, check_origin: None },
Transact {
origin_kind: OriginKind::Xcm,
require_weight_at_most:
bp_asset_hub_wococo::XcmBridgeHubRouterTransactCallMaxWeight::get(),
call: bp_asset_hub_wococo::Call::ToRococoXcmRouter(
bp_asset_hub_wococo::XcmBridgeHubRouterCall::report_bridge_status {
bridge_id: Default::default(),
is_congested,
}
)
.encode()
.into(),
}
]
}
/// Proof of messages, coming from Rococo.
pub type FromRococoBridgeHubMessagesProof =
FromBridgedChainMessagesProof<bp_bridge_hub_rococo::Hash>;
/// Messages delivery proof for Rococo Bridge Hub -> Wococo Bridge Hub messages.
/// Messages delivery proof for RococoBridge Hub -> Wococo BridgeHub messages.
pub type ToRococoBridgeHubMessagesDeliveryProof =
FromBridgedChainMessagesDeliveryProof<bp_bridge_hub_rococo::Hash>;
@@ -73,7 +100,7 @@ pub type OnBridgeHubWococoBlobDispatcher = BridgeBlobDispatcher<
BridgeRococoMessagesPalletInstance,
>;
/// Export XCM messages to be relayed to the otherside
/// Export XCM messages to be relayed to the other side
pub type ToBridgeHubRococoHaulBlobExporter = HaulBlobExporter<
XcmBlobHaulerAdapter<ToBridgeHubRococoXcmBlobHauler>,
RococoGlobalConsensusNetwork,
@@ -86,11 +113,14 @@ impl XcmBlobHauler for ToBridgeHubRococoXcmBlobHauler {
type SenderAndLane = FromAssetHubWococoToAssetHubRococoRoute;
type ToSourceChainSender = crate::XcmRouter;
type CongestedMessage = ();
type UncongestedMessage = ();
type CongestedMessage = CongestedMessage;
type UncongestedMessage = UncongestedMessage;
}
pub const DEFAULT_XCM_LANE_TO_BRIDGE_HUB_ROCOCO: LaneId = LaneId([0, 0, 0, 1]);
/// On messages delivered callback.
pub type OnMessagesDelivered = XcmBlobHaulerAdapter<ToBridgeHubRococoXcmBlobHauler>;
/// Messaging Bridge configuration for BridgeHubWococo -> BridgeHubRococo
pub struct WithBridgeHubRococoMessageBridge;
impl MessageBridge for WithBridgeHubRococoMessageBridge {
@@ -164,6 +194,18 @@ mod tests {
AssertCompleteBridgeConstants,
},
};
use parachains_common::{wococo, Balance};
/// Every additional message in the message delivery transaction boosts its priority.
/// So the priority of transaction with `N+1` messages is larger than priority of
/// transaction with `N` messages by the `PriorityBoostPerMessage`.
///
/// Economically, it is an equivalent of adding tip to the transaction with `N` messages.
/// The `FEE_BOOST_PER_MESSAGE` constant is the value of this tip.
///
/// We want this tip to be large enough (delivery transactions with more messages = less
/// operational costs and a faster bridge), so this value should be significant.
const FEE_BOOST_PER_MESSAGE: Balance = 2 * wococo::currency::UNITS;
#[test]
fn ensure_bridge_hub_wococo_message_lane_weights_are_correct() {
@@ -215,5 +257,16 @@ mod tests {
bp_bridge_hub_rococo::WITH_BRIDGE_HUB_ROCOCO_MESSAGES_PALLET_NAME,
},
});
bridge_runtime_common::priority_calculator::ensure_priority_boost_is_sane::<
Runtime,
WithBridgeHubRococoMessagesInstance,
PriorityBoostPerMessage,
>(FEE_BOOST_PER_MESSAGE);
assert_eq!(
BridgeRococoMessagesPalletInstance::get(),
X1(PalletInstance(bp_bridge_hub_wococo::WITH_BRIDGE_ROCOCO_MESSAGES_PALLET_INDEX))
);
}
}
@@ -14,6 +14,14 @@
// You should have received a copy of the GNU General Public License
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
//! # Bridge Hub Rococo Runtime
//!
//! This runtime is also used for Bridge Hub Wococo. But we dont want to create another exact copy
//! of Bridge Hub Rococo, so we injected some tweaks backed by `RuntimeFlavor` and `pub storage
//! Flavor: RuntimeFlavor`. (For example this is needed for successful asset transfer between Asset
//! Hub Rococo and Asset Hub Wococo, where we need to have correct `xcm_config::UniversalLocation`
//! with correct `GlobalConsensus`.
#![cfg_attr(not(feature = "std"), no_std)]
// `construct_runtime!` does a lot of recursion and requires us to increase the limit to 256.
#![recursion_limit = "256"]
@@ -27,6 +35,7 @@ pub mod bridge_hub_wococo_config;
mod weights;
pub mod xcm_config;
use codec::{Decode, Encode};
use cumulus_pallet_parachain_system::RelayNumberStrictlyIncreases;
use sp_api::impl_runtime_apis;
use sp_core::{crypto::KeyTypeId, OpaqueMetadata};
@@ -92,6 +101,15 @@ use parachains_common::{
};
use xcm_executor::XcmExecutor;
/// Enum for handling differences in the runtime configuration for BridgeHubRococo vs
/// BridgeHubWococo.
#[derive(Default, Eq, PartialEq, Debug, Clone, Copy, Decode, Encode)]
pub enum RuntimeFlavor {
#[default]
Rococo,
Wococo,
}
/// The address format for describing accounts.
pub type Address = MultiAddress<AccountId, ()>;
@@ -473,7 +491,7 @@ parameter_types! {
pub const RelayerStakeReserveId: [u8; 8] = *b"brdgrlrs";
}
/// Add parachain bridge pallet to track Wococo bridge hub parachain
/// Add parachain bridge pallet to track Wococo BridgeHub parachain
pub type BridgeParachainWococoInstance = pallet_bridge_parachains::Instance1;
impl pallet_bridge_parachains::Config<BridgeParachainWococoInstance> for Runtime {
type RuntimeEvent = RuntimeEvent;
@@ -486,7 +504,7 @@ impl pallet_bridge_parachains::Config<BridgeParachainWococoInstance> for Runtime
type MaxParaHeadDataSize = MaxWococoParaHeadDataSize;
}
/// Add parachain bridge pallet to track Rococo bridge hub parachain
/// Add parachain bridge pallet to track Rococo BridgeHub parachain
pub type BridgeParachainRococoInstance = pallet_bridge_parachains::Instance2;
impl pallet_bridge_parachains::Config<BridgeParachainRococoInstance> for Runtime {
type RuntimeEvent = RuntimeEvent;
@@ -528,9 +546,15 @@ impl pallet_bridge_messages::Config<WithBridgeHubWococoMessagesInstance> for Run
>;
type SourceHeaderChain = SourceHeaderChainAdapter<WithBridgeHubWococoMessageBridge>;
type MessageDispatch =
XcmBlobMessageDispatch<OnBridgeHubRococoBlobDispatcher, Self::WeightInfo, ()>;
type OnMessagesDelivered = ();
type MessageDispatch = XcmBlobMessageDispatch<
OnBridgeHubRococoBlobDispatcher,
Self::WeightInfo,
cumulus_pallet_xcmp_queue::bridging::OutXcmpChannelStatusProvider<
bridge_hub_rococo_config::AssetHubRococoParaId,
Runtime,
>,
>;
type OnMessagesDelivered = bridge_hub_rococo_config::OnMessagesDelivered;
}
/// Add XCM messages support for BridgeHubWococo to support Wococo->Rococo XCM messages
@@ -562,9 +586,15 @@ impl pallet_bridge_messages::Config<WithBridgeHubRococoMessagesInstance> for Run
>;
type SourceHeaderChain = SourceHeaderChainAdapter<WithBridgeHubRococoMessageBridge>;
type MessageDispatch =
XcmBlobMessageDispatch<OnBridgeHubWococoBlobDispatcher, Self::WeightInfo, ()>;
type OnMessagesDelivered = ();
type MessageDispatch = XcmBlobMessageDispatch<
OnBridgeHubWococoBlobDispatcher,
Self::WeightInfo,
cumulus_pallet_xcmp_queue::bridging::OutXcmpChannelStatusProvider<
bridge_hub_wococo_config::AssetHubWococoParaId,
Runtime,
>,
>;
type OnMessagesDelivered = bridge_hub_wococo_config::OnMessagesDelivered;
}
/// Allows collect and claim rewards for relayers
@@ -617,16 +647,16 @@ construct_runtime!(
Utility: pallet_utility::{Pallet, Call, Event} = 40,
Multisig: pallet_multisig::{Pallet, Call, Storage, Event<T>} = 36,
// Rococo and Wococo Bridge Hubs are sharing the runtime, so this runtime has two sets of
// Rococo and Wococo BridgeHubs are sharing the runtime, so this runtime has two sets of
// bridge pallets. Both are deployed at both runtimes, but only one set is actually used
// at particular runtime.
// With-Wococo bridge modules that are active (used) at Rococo Bridge Hub runtime.
// With-Wococo bridge modules that are active (used) at Rococo BridgeHub runtime.
BridgeWococoGrandpa: pallet_bridge_grandpa::<Instance1>::{Pallet, Call, Storage, Event<T>, Config<T>} = 41,
BridgeWococoParachain: pallet_bridge_parachains::<Instance1>::{Pallet, Call, Storage, Event<T>} = 42,
BridgeWococoMessages: pallet_bridge_messages::<Instance1>::{Pallet, Call, Storage, Event<T>, Config<T>} = 46,
// With-Rococo bridge modules that are active (used) at Wococo Bridge Hub runtime.
// With-Rococo bridge modules that are active (used) at Wococo BridgeHub runtime.
BridgeRococoGrandpa: pallet_bridge_grandpa::<Instance2>::{Pallet, Call, Storage, Event<T>, Config<T>} = 43,
BridgeRococoParachain: pallet_bridge_parachains::<Instance2>::{Pallet, Call, Storage, Event<T>} = 44,
BridgeRococoMessages: pallet_bridge_messages::<Instance2>::{Pallet, Call, Storage, Event<T>, Config<T>} = 45,
@@ -982,19 +1012,19 @@ impl_runtime_apis! {
impl cumulus_pallet_session_benchmarking::Config for Runtime {}
use xcm::latest::prelude::*;
use xcm_config::RelayLocation;
use xcm_config::TokenLocation;
impl pallet_xcm_benchmarks::Config for Runtime {
type XcmConfig = xcm_config::XcmConfig;
type AccountIdConverter = xcm_config::LocationToAccountId;
fn valid_destination() -> Result<MultiLocation, BenchmarkError> {
Ok(RelayLocation::get())
Ok(TokenLocation::get())
}
fn worst_case_holding(_depositable_count: u32) -> MultiAssets {
// just concrete assets according to relay chain.
let assets: Vec<MultiAsset> = vec![
MultiAsset {
id: Concrete(RelayLocation::get()),
id: Concrete(TokenLocation::get()),
fun: Fungible(1_000_000 * UNITS),
}
];
@@ -1004,8 +1034,8 @@ impl_runtime_apis! {
parameter_types! {
pub const TrustedTeleporter: Option<(MultiLocation, MultiAsset)> = Some((
RelayLocation::get(),
MultiAsset { fun: Fungible(UNITS), id: Concrete(RelayLocation::get()) },
TokenLocation::get(),
MultiAsset { fun: Fungible(UNITS), id: Concrete(TokenLocation::get()) },
));
pub const CheckedAccount: Option<(AccountId, xcm_builder::MintLocation)> = None;
pub const TrustedReserve: Option<(MultiLocation, MultiAsset)> = None;
@@ -1020,7 +1050,7 @@ impl_runtime_apis! {
fn get_multi_asset() -> MultiAsset {
MultiAsset {
id: Concrete(RelayLocation::get()),
id: Concrete(TokenLocation::get()),
fun: Fungible(UNITS),
}
}
@@ -1042,16 +1072,16 @@ impl_runtime_apis! {
}
fn transact_origin_and_runtime_call() -> Result<(MultiLocation, RuntimeCall), BenchmarkError> {
Ok((RelayLocation::get(), frame_system::Call::remark_with_event { remark: vec![] }.into()))
Ok((TokenLocation::get(), frame_system::Call::remark_with_event { remark: vec![] }.into()))
}
fn subscribe_origin() -> Result<MultiLocation, BenchmarkError> {
Ok(RelayLocation::get())
Ok(TokenLocation::get())
}
fn claimable_asset() -> Result<(MultiLocation, MultiLocation, MultiAssets), BenchmarkError> {
let origin = RelayLocation::get();
let assets: MultiAssets = (Concrete(RelayLocation::get()), 1_000 * UNITS).into();
let origin = TokenLocation::get();
let assets: MultiAssets = (Concrete(TokenLocation::get()), 1_000 * UNITS).into();
let ticket = MultiLocation { parents: 0, interior: Here };
Ok((origin, ticket, assets))
}
@@ -1062,7 +1092,7 @@ impl_runtime_apis! {
fn export_message_origin_and_destination(
) -> Result<(MultiLocation, NetworkId, InteriorMultiLocation), BenchmarkError> {
Ok((RelayLocation::get(), NetworkId::Wococo, X1(Parachain(100))))
Ok((TokenLocation::get(), NetworkId::Wococo, X1(Parachain(100))))
}
fn alias_origin() -> Result<(MultiLocation, MultiLocation), BenchmarkError> {
@@ -17,8 +17,8 @@
use super::{
AccountId, AllPalletsWithSystem, Balances, BridgeGrandpaRococoInstance,
BridgeGrandpaWococoInstance, DeliveryRewardInBalance, ParachainInfo, ParachainSystem,
PolkadotXcm, RequiredStakeForStakeAndSlash, Runtime, RuntimeCall, RuntimeEvent, RuntimeOrigin,
WeightToFee, XcmpQueue,
PolkadotXcm, RequiredStakeForStakeAndSlash, Runtime, RuntimeCall, RuntimeEvent, RuntimeFlavor,
RuntimeOrigin, WeightToFee, XcmpQueue,
};
use crate::{
bridge_hub_rococo_config::ToBridgeHubWococoHaulBlobExporter,
@@ -36,12 +36,11 @@ use sp_core::Get;
use xcm::latest::prelude::*;
use xcm_builder::{
AccountId32Aliases, AllowExplicitUnpaidExecutionFrom, AllowKnownQueryResponses,
AllowSubscriptionsFrom, AllowTopLevelPaidExecutionFrom, AllowUnpaidExecutionFrom,
CurrencyAdapter, DenyReserveTransferToRelayChain, DenyThenTry, EnsureXcmOrigin, IsConcrete,
ParentAsSuperuser, ParentIsPreset, RelayChainAsNative, SiblingParachainAsNative,
SiblingParachainConvertsVia, SignedAccountId32AsNative, SignedToAccountId32,
SovereignSignedViaLocation, TakeWeightCredit, TrailingSetTopicAsId, UsingComponents,
WeightInfoBounds, WithComputedOrigin, WithUniqueTopic,
AllowSubscriptionsFrom, AllowTopLevelPaidExecutionFrom, CurrencyAdapter,
DenyReserveTransferToRelayChain, DenyThenTry, EnsureXcmOrigin, IsConcrete, ParentAsSuperuser,
ParentIsPreset, RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia,
SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit,
TrailingSetTopicAsId, UsingComponents, WeightInfoBounds, WithComputedOrigin, WithUniqueTopic,
};
use xcm_executor::{
traits::{ExportXcm, WithOriginFilter},
@@ -49,7 +48,8 @@ use xcm_executor::{
};
parameter_types! {
pub const RelayLocation: MultiLocation = MultiLocation::parent();
pub storage Flavor: RuntimeFlavor = RuntimeFlavor::default();
pub const TokenLocation: MultiLocation = MultiLocation::parent();
pub RelayChainOrigin: RuntimeOrigin = cumulus_pallet_xcm::Origin::Relay.into();
pub UniversalLocation: InteriorMultiLocation =
X2(GlobalConsensus(RelayNetwork::get()), Parachain(ParachainInfo::parachain_id().into()));
@@ -57,6 +57,7 @@ parameter_types! {
pub const MaxAssetsIntoHolding: u32 = 64;
}
/// Adapter for resolving `NetworkId` based on `pub storage Flavor: RuntimeFlavor`.
pub struct RelayNetwork;
impl Get<Option<NetworkId>> for RelayNetwork {
fn get() -> Option<NetworkId> {
@@ -65,10 +66,9 @@ impl Get<Option<NetworkId>> for RelayNetwork {
}
impl Get<NetworkId> for RelayNetwork {
fn get() -> NetworkId {
match u32::from(ParachainInfo::parachain_id()) {
bp_bridge_hub_rococo::BRIDGE_HUB_ROCOCO_PARACHAIN_ID => NetworkId::Rococo,
bp_bridge_hub_wococo::BRIDGE_HUB_WOCOCO_PARACHAIN_ID => NetworkId::Wococo,
para_id => unreachable!("Not supported for para_id: {}", para_id),
match Flavor::get() {
RuntimeFlavor::Rococo => NetworkId::Rococo,
RuntimeFlavor::Wococo => NetworkId::Wococo,
}
}
}
@@ -90,7 +90,7 @@ pub type CurrencyTransactor = CurrencyAdapter<
// Use this currency:
Balances,
// Use this currency when it is a fungible asset matching the given location or name:
IsConcrete<RelayLocation>,
IsConcrete<TokenLocation>,
// Do a simple punn to convert an AccountId32 MultiLocation into a native chain account ID:
LocationToAccountId,
// Our chain's account ID type (we can't get away without mentioning it explicitly):
@@ -154,9 +154,10 @@ impl Contains<RuntimeCall> for SafeCallFilter {
// Allow to change dedicated storage items (called by governance-like)
match call {
RuntimeCall::System(frame_system::Call::set_storage { items })
if items.iter().any(|(k, _)| {
if items.iter().all(|(k, _)| {
k.eq(&DeliveryRewardInBalance::key()) |
k.eq(&RequiredStakeForStakeAndSlash::key())
k.eq(&RequiredStakeForStakeAndSlash::key()) |
k.eq(&Flavor::key())
}) =>
return true,
_ => (),
@@ -206,7 +207,7 @@ pub type Barrier = TrailingSetTopicAsId<
AllowKnownQueryResponses<PolkadotXcm>,
WithComputedOrigin<
(
// If the message is one that immediately attemps to pay for execution, then
// If the message is one that immediately attempts to pay for execution, then
// allow it.
AllowTopLevelPaidExecutionFrom<Everything>,
// Parent and its pluralities (i.e. governance bodies) get free execution.
@@ -217,16 +218,13 @@ pub type Barrier = TrailingSetTopicAsId<
UniversalLocation,
ConstU32<8>,
>,
// TODO:check-parameter - (https://github.com/paritytech/parity-bridges-common/issues/2084)
// remove this and extend `AllowExplicitUnpaidExecutionFrom` with "or SystemParachains" once merged https://github.com/paritytech/polkadot/pull/7005
AllowUnpaidExecutionFrom<Everything>,
),
>,
>;
/// Cases where a remote origin is accepted as trusted Teleporter for a given asset:
/// - NativeToken with the parent Relay Chain and sibling parachains.
pub type TrustedTeleporters = ConcreteAssetFromSystem<RelayLocation>;
pub type TrustedTeleporters = ConcreteAssetFromSystem<TokenLocation>;
pub struct XcmConfig;
impl xcm_executor::Config for XcmConfig {
@@ -246,7 +244,7 @@ impl xcm_executor::Config for XcmConfig {
MaxInstructions,
>;
type Trader =
UsingComponents<WeightToFee, RelayLocation, AccountId, Balances, ToStakingPot<Runtime>>;
UsingComponents<WeightToFee, TokenLocation, AccountId, Balances, ToStakingPot<Runtime>>;
type ResponseHandler = PolkadotXcm;
type AssetTrap = PolkadotXcm;
type AssetLocker = ();
@@ -19,7 +19,7 @@
use bp_polkadot_core::Signature;
use bridge_hub_rococo_runtime::{
bridge_hub_rococo_config, bridge_hub_wococo_config,
xcm_config::{RelayNetwork, XcmConfig},
xcm_config::{RelayNetwork, TokenLocation, XcmConfig},
AllPalletsWithoutSystem, BridgeRejectObsoleteHeadersAndMessages, DeliveryRewardInBalance,
Executive, ExistentialDeposit, ParachainSystem, PolkadotXcm, RequiredStakeForStakeAndSlash,
Runtime, RuntimeCall, RuntimeEvent, SessionKeys, SignedExtra, UncheckedExtrinsic,
@@ -35,7 +35,7 @@ use sp_runtime::{
};
use xcm::latest::prelude::*;
// Para id of sibling chain (Rockmine/Wockmint) used in tests.
// Para id of sibling chain used in tests.
pub const SIBLING_PARACHAIN_ID: u32 = 1000;
parameter_types! {
@@ -55,7 +55,7 @@ fn construct_extrinsic(
frame_system::CheckNonce::<Runtime>::from(0),
frame_system::CheckWeight::<Runtime>::new(),
pallet_transaction_payment::ChargeTransactionPayment::<Runtime>::from(0),
BridgeRejectObsoleteHeadersAndMessages {},
BridgeRejectObsoleteHeadersAndMessages::default(),
(
bridge_hub_wococo_config::BridgeRefundBridgeHubRococoMessages::default(),
bridge_hub_rococo_config::BridgeRefundBridgeHubWococoMessages::default(),
@@ -191,7 +191,11 @@ mod bridge_hub_rococo_tests {
}
}),
|| ExportMessage { network: Wococo, destination: X1(Parachain(1234)), xcm: Xcm(vec![]) },
bridge_hub_rococo_config::DEFAULT_XCM_LANE_TO_BRIDGE_HUB_WOCOCO
bridge_hub_rococo_config::DEFAULT_XCM_LANE_TO_BRIDGE_HUB_WOCOCO,
Some((TokenLocation::get(), ExistentialDeposit::get()).into()),
// value should be >= than value generated by `can_calculate_weight_for_paid_export_message_with_reserve_transfer`
Some((TokenLocation::get(), bp_asset_hub_rococo::BridgeHubRococoBaseFeeInRocs::get()).into()),
|| (),
)
}
@@ -222,6 +226,7 @@ mod bridge_hub_rococo_tests {
}
}),
bridge_hub_rococo_config::DEFAULT_XCM_LANE_TO_BRIDGE_HUB_WOCOCO,
|| (),
)
}
@@ -243,6 +248,7 @@ mod bridge_hub_rococo_tests {
SIBLING_PARACHAIN_ID,
Rococo,
DEFAULT_XCM_LANE_TO_BRIDGE_HUB_WOCOCO,
|| (),
)
}
@@ -268,6 +274,25 @@ mod bridge_hub_rococo_tests {
ExistentialDeposit::get(),
executive_init_block,
construct_and_apply_extrinsic,
|| (),
);
}
#[test]
pub fn can_calculate_weight_for_paid_export_message_with_reserve_transfer() {
let estimated = bridge_hub_test_utils::test_cases::can_calculate_weight_for_paid_export_message_with_reserve_transfer::<
Runtime,
XcmConfig,
WeightToFee,
>();
// check if estimated value is sane
let max_expected = bp_asset_hub_rococo::BridgeHubRococoBaseFeeInRocs::get();
assert!(
estimated <= max_expected,
"calculated: {:?}, max_expected: {:?}, please adjust `bp_asset_hub_rococo::BridgeHubRococoBaseFeeInRocs` value",
estimated,
max_expected
);
}
}
@@ -275,12 +300,38 @@ mod bridge_hub_rococo_tests {
mod bridge_hub_wococo_tests {
use super::*;
use bridge_hub_rococo_runtime::{
BridgeGrandpaRococoInstance, BridgeParachainRococoInstance,
WithBridgeHubRococoMessagesInstance,
xcm_config, AllPalletsWithoutSystem, BridgeGrandpaRococoInstance,
BridgeParachainRococoInstance, RuntimeFlavor, WithBridgeHubRococoMessagesInstance,
};
use bridge_hub_wococo_config::{
WithBridgeHubRococoMessageBridge, DEFAULT_XCM_LANE_TO_BRIDGE_HUB_ROCOCO,
};
use frame_support::assert_ok;
type RuntimeHelper = bridge_hub_test_utils::RuntimeHelper<Runtime, AllPalletsWithoutSystem>;
pub(crate) fn set_wococo_flavor() {
let flavor_key = xcm_config::Flavor::key().to_vec();
let flavor = RuntimeFlavor::Wococo;
// encode `set_storage` call
let set_storage_call = RuntimeCall::System(frame_system::Call::<Runtime>::set_storage {
items: vec![(flavor_key, flavor.encode())],
})
.encode();
// estimate - storing just 1 value
use frame_system::WeightInfo;
let require_weight_at_most =
<Runtime as frame_system::Config>::SystemWeightInfo::set_storage(1);
// execute XCM with Transact to `set_storage` as governance does
assert_ok!(RuntimeHelper::execute_as_governance(set_storage_call, require_weight_at_most)
.ensure_complete());
// check if stored
assert_eq!(flavor, xcm_config::Flavor::get());
}
bridge_hub_test_utils::test_cases::include_teleports_for_native_asset_works!(
Runtime,
@@ -370,7 +421,11 @@ mod bridge_hub_wococo_tests {
}
}),
|| ExportMessage { network: Rococo, destination: X1(Parachain(4321)), xcm: Xcm(vec![]) },
bridge_hub_wococo_config::DEFAULT_XCM_LANE_TO_BRIDGE_HUB_ROCOCO
bridge_hub_wococo_config::DEFAULT_XCM_LANE_TO_BRIDGE_HUB_ROCOCO,
Some((TokenLocation::get(), ExistentialDeposit::get()).into()),
// value should be >= than value generated by `can_calculate_weight_for_paid_export_message_with_reserve_transfer`
Some((TokenLocation::get(), bp_asset_hub_wococo::BridgeHubWococoBaseFeeInWocs::get()).into()),
set_wococo_flavor,
)
}
@@ -401,6 +456,7 @@ mod bridge_hub_wococo_tests {
}
}),
bridge_hub_wococo_config::DEFAULT_XCM_LANE_TO_BRIDGE_HUB_ROCOCO,
set_wococo_flavor,
)
}
@@ -422,6 +478,7 @@ mod bridge_hub_wococo_tests {
SIBLING_PARACHAIN_ID,
Wococo,
DEFAULT_XCM_LANE_TO_BRIDGE_HUB_ROCOCO,
set_wococo_flavor,
)
}
@@ -447,6 +504,25 @@ mod bridge_hub_wococo_tests {
ExistentialDeposit::get(),
executive_init_block,
construct_and_apply_extrinsic,
set_wococo_flavor,
);
}
#[test]
pub fn can_calculate_weight_for_paid_export_message_with_reserve_transfer() {
let estimated = bridge_hub_test_utils::test_cases::can_calculate_weight_for_paid_export_message_with_reserve_transfer::<
Runtime,
XcmConfig,
WeightToFee,
>();
// check if estimated value is sane
let max_expected = bp_asset_hub_wococo::BridgeHubWococoBaseFeeInWocs::get();
assert!(
estimated <= max_expected,
"calculated: {:?}, max_expected: {:?}, please adjust `bp_asset_hub_wococo::BridgeHubWococoBaseFeeInWocs` value",
estimated,
max_expected
);
}
}
@@ -8,7 +8,6 @@ description = "Utils for BridgeHub testing"
[dependencies]
codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive", "max-encoded-len"] }
log = { version = "0.4.20", default-features = false }
assert_matches = "1.4.0"
# Substrate
frame-benchmarking = { path = "../../../../../substrate/frame/benchmarking", default-features = false, optional = true }
@@ -19,6 +18,7 @@ sp-core = { path = "../../../../../substrate/primitives/core", default-features
sp-io = { path = "../../../../../substrate/primitives/io", default-features = false}
sp-keyring = { path = "../../../../../substrate/primitives/keyring" }
sp-runtime = { path = "../../../../../substrate/primitives/runtime", default-features = false}
sp-tracing = { path = "../../../../../substrate/primitives/tracing" }
pallet-balances = { path = "../../../../../substrate/frame/balances", default-features = false}
pallet-utility = { path = "../../../../../substrate/frame/utility", default-features = false}
pallet-session = { path = "../../../../../substrate/frame/session", default-features = false}
@@ -16,7 +16,6 @@
//! Module contains predefined test-case scenarios for `Runtime` with bridging capabilities.
use assert_matches::assert_matches;
use bp_messages::{
target_chain::{DispatchMessage, DispatchMessageData, MessageDispatch, SourceHeaderChain},
LaneId, MessageKey, OutboundLaneData, Weight,
@@ -47,10 +46,16 @@ use parachains_runtimes_test_utils::{
};
use sp_core::H256;
use sp_keyring::AccountKeyring::*;
use sp_runtime::{traits::Header as HeaderT, AccountId32};
use sp_runtime::{
traits::{Header as HeaderT, Zero},
AccountId32,
};
use xcm::latest::prelude::*;
use xcm_builder::DispatchBlobError;
use xcm_executor::XcmExecutor;
use xcm_executor::{
traits::{TransactAsset, WeightBounds},
XcmExecutor,
};
// Re-export test_case from assets
pub use asset_test_utils::include_teleports_for_native_asset_works;
@@ -137,6 +142,9 @@ pub fn handle_export_message_from_system_parachain_to_outbound_queue_works<
>,
export_message_instruction: fn() -> Instruction<XcmConfig::RuntimeCall>,
expected_lane_id: LaneId,
existential_deposit: Option<MultiAsset>,
maybe_paid_export_message: Option<MultiAsset>,
prepare_configuration: impl Fn(),
) where
Runtime: frame_system::Config
+ pallet_balances::Config
@@ -161,6 +169,8 @@ pub fn handle_export_message_from_system_parachain_to_outbound_queue_works<
.with_tracing()
.build()
.execute_with(|| {
prepare_configuration();
// check queue before
assert_eq!(
pallet_bridge_messages::OutboundLanes::<Runtime, MessagesPalletInstance>::try_get(
@@ -170,10 +180,35 @@ pub fn handle_export_message_from_system_parachain_to_outbound_queue_works<
);
// prepare `ExportMessage`
let xcm = Xcm(vec![
UnpaidExecution { weight_limit: Unlimited, check_origin: None },
export_message_instruction(),
]);
let xcm = if let Some(fee) = maybe_paid_export_message {
// deposit ED to origin (if needed)
if let Some(ed) = existential_deposit {
XcmConfig::AssetTransactor::deposit_asset(
&ed,
&sibling_parachain_location,
&XcmContext::with_message_id([0; 32]),
)
.expect("deposited ed");
}
// deposit fee to origin
XcmConfig::AssetTransactor::deposit_asset(
&fee,
&sibling_parachain_location,
&XcmContext::with_message_id([0; 32]),
)
.expect("deposited fee");
Xcm(vec![
WithdrawAsset(MultiAssets::from(vec![fee.clone()])),
BuyExecution { fees: fee, weight_limit: Unlimited },
export_message_instruction(),
])
} else {
Xcm(vec![
UnpaidExecution { weight_limit: Unlimited, check_origin: None },
export_message_instruction(),
])
};
// execute XCM
let hash = xcm.using_encoded(sp_io::hashing::blake2_256);
@@ -231,6 +266,7 @@ pub fn message_dispatch_routing_works<
dyn Fn(Vec<u8>) -> Option<cumulus_pallet_xcmp_queue::Event<Runtime>>,
>,
expected_lane_id: LaneId,
prepare_configuration: impl Fn(),
) where
Runtime: frame_system::Config
+ pallet_balances::Config
@@ -249,6 +285,7 @@ pub fn message_dispatch_routing_works<
XcmConfig: xcm_executor::Config,
MessagesPalletInstance: 'static,
ValidatorIdOf<Runtime>: From<AccountIdOf<Runtime>>,
<Runtime as frame_system::Config>::AccountId: From<AccountId32>,
HrmpChannelOpener: frame_support::inherent::ProvideInherent<
Call = cumulus_pallet_parachain_system::Call<Runtime>,
>,
@@ -267,12 +304,14 @@ pub fn message_dispatch_routing_works<
.with_tracing()
.build()
.execute_with(|| {
prepare_configuration();
let mut alice = [0u8; 32];
alice[0] = 1;
let included_head = RuntimeHelper::<Runtime, AllPalletsWithoutSystem>::run_to_block(
2,
AccountId::from(alice),
AccountId::from(alice).into(),
);
// 1. this message is sent from other global consensus with destination of this Runtime relay chain (UMP)
let bridging_message =
@@ -343,6 +382,7 @@ pub fn relayed_incoming_message_works<Runtime, AllPalletsWithoutSystem, XcmConfi
sibling_parachain_id: u32,
local_relay_chain_id: NetworkId,
lane_id: LaneId,
prepare_configuration: impl Fn(),
) where
Runtime: frame_system::Config
+ pallet_balances::Config
@@ -374,11 +414,11 @@ pub fn relayed_incoming_message_works<Runtime, AllPalletsWithoutSystem, XcmConfi
ParaHash: From<<<Runtime as pallet_bridge_grandpa::Config<GPI>>::BridgedChain as bp_runtime::Chain>::Hash>,
<Runtime as frame_system::Config>::AccountId:
Into<<<Runtime as frame_system::Config>::RuntimeOrigin as OriginTrait>::AccountId>,
<Runtime as frame_system::Config>::AccountId: From<AccountId32>,
AccountIdOf<Runtime>: From<sp_core::sr25519::Public>,
<Runtime as pallet_bridge_messages::Config<MPI>>::InboundRelayer: From<AccountId32>,
{
assert_ne!(runtime_para_id, sibling_parachain_id);
assert_ne!(runtime_para_id, bridged_para_id);
ExtBuilder::<Runtime>::default()
.with_collators(collator_session_key.collators())
@@ -388,12 +428,14 @@ pub fn relayed_incoming_message_works<Runtime, AllPalletsWithoutSystem, XcmConfi
.with_tracing()
.build()
.execute_with(|| {
prepare_configuration();
let mut alice = [0u8; 32];
alice[0] = 1;
let included_head = RuntimeHelper::<Runtime, AllPalletsWithoutSystem>::run_to_block(
2,
AccountId::from(alice),
AccountId::from(alice).into(),
);
mock_open_hrmp_channel::<Runtime, HrmpChannelOpener>(
runtime_para_id.into(),
@@ -528,15 +570,24 @@ pub fn relayed_incoming_message_works<Runtime, AllPalletsWithoutSystem, XcmConfi
.last_delivered_nonce(),
1,
);
// verify relayed bridged XCM message is dispatched to destination sibling para
let dispatched = RuntimeHelper::<cumulus_pallet_xcmp_queue::Pallet<Runtime>>::take_xcm(
sibling_parachain_id.into(),
)
.unwrap();
let mut dispatched = xcm::latest::Xcm::<()>::try_from(dispatched).unwrap();
// We use `WithUniqueTopic`, so expect a trailing `SetTopic`.
assert_matches!(dispatched.0.pop(), Some(SetTopic(..)));
assert_eq!(dispatched, expected_dispatch);
// verify contains original message
let dispatched = xcm::latest::Xcm::<()>::try_from(dispatched).unwrap();
let mut dispatched_clone = dispatched.clone();
for (idx, expected_instr) in expected_dispatch.0.iter().enumerate() {
assert_eq!(expected_instr, &dispatched.0[idx]);
assert_eq!(expected_instr, &dispatched_clone.0.remove(0));
}
match dispatched_clone.0.len() {
0 => (),
1 => assert!(matches!(dispatched_clone.0[0], SetTopic(_))),
count => assert!(false, "Unexpected messages count: {:?}", count),
}
})
}
@@ -557,6 +608,7 @@ pub fn complex_relay_extrinsic_works<Runtime, AllPalletsWithoutSystem, XcmConfig
sp_keyring::AccountKeyring,
pallet_utility::Call::<Runtime>
) -> sp_runtime::DispatchOutcome,
prepare_configuration: impl Fn(),
) where
Runtime: frame_system::Config
+ pallet_balances::Config
@@ -591,6 +643,7 @@ pub fn complex_relay_extrinsic_works<Runtime, AllPalletsWithoutSystem, XcmConfig
<Runtime as frame_system::Config>::AccountId:
Into<<<Runtime as frame_system::Config>::RuntimeOrigin as OriginTrait>::AccountId>,
AccountIdOf<Runtime>: From<sp_core::sr25519::Public>,
<Runtime as frame_system::Config>::AccountId: From<AccountId32>,
<Runtime as pallet_bridge_messages::Config<MPI>>::InboundRelayer: From<AccountId32>,
<Runtime as pallet_utility::Config>::RuntimeCall:
From<pallet_bridge_grandpa::Call<Runtime, GPI>>
@@ -598,7 +651,6 @@ pub fn complex_relay_extrinsic_works<Runtime, AllPalletsWithoutSystem, XcmConfig
+ From<pallet_bridge_messages::Call<Runtime, MPI>>
{
assert_ne!(runtime_para_id, sibling_parachain_id);
assert_ne!(runtime_para_id, bridged_para_id);
// Relayer account at local/this BH.
let relayer_at_target = Bob;
@@ -617,12 +669,14 @@ pub fn complex_relay_extrinsic_works<Runtime, AllPalletsWithoutSystem, XcmConfig
.with_tracing()
.build()
.execute_with(|| {
prepare_configuration();
let mut alice = [0u8; 32];
alice[0] = 1;
let included_head = RuntimeHelper::<Runtime, AllPalletsWithoutSystem>::run_to_block(
2,
AccountId::from(alice),
AccountId::from(alice).into(),
);
let zero: BlockNumberFor<Runtime> = 0u32.into();
let genesis_hash = frame_system::Pallet::<Runtime>::block_hash(zero);
@@ -678,7 +732,7 @@ pub fn complex_relay_extrinsic_works<Runtime, AllPalletsWithoutSystem, XcmConfig
message_proof,
) = test_data::make_complex_relayer_proofs::<BridgedHeader<Runtime, GPI>, MB, ()>(
lane_id,
xcm.into(),
xcm.clone().into(),
message_nonce,
message_destination,
para_header_number,
@@ -769,18 +823,133 @@ pub fn complex_relay_extrinsic_works<Runtime, AllPalletsWithoutSystem, XcmConfig
msg_proofs_rewards_account
)
.is_some());
// verify relayed bridged XCM message is dispatched to destination sibling para
let dispatched = RuntimeHelper::<cumulus_pallet_xcmp_queue::Pallet<Runtime>>::take_xcm(
sibling_parachain_id.into(),
)
.unwrap();
let mut dispatched = xcm::latest::Xcm::<()>::try_from(dispatched).unwrap();
// We use `WithUniqueTopic`, so expect a trailing `SetTopic`.
assert_matches!(dispatched.0.pop(), Some(SetTopic(..)));
assert_eq!(dispatched, expected_dispatch);
// verify contains original message
let dispatched = xcm::latest::Xcm::<()>::try_from(dispatched).unwrap();
let mut dispatched_clone = dispatched.clone();
for (idx, expected_instr) in expected_dispatch.0.iter().enumerate() {
assert_eq!(expected_instr, &dispatched.0[idx]);
assert_eq!(expected_instr, &dispatched_clone.0.remove(0));
}
match dispatched_clone.0.len() {
0 => (),
1 => assert!(matches!(dispatched_clone.0[0], SetTopic(_))),
count => assert!(false, "Unexpected messages count: {:?}", count),
}
})
}
/// Estimates fee for paid `ExportMessage` processing.
pub fn can_calculate_weight_for_paid_export_message_with_reserve_transfer<
Runtime,
XcmConfig,
WeightToFee,
>() -> u128
where
Runtime: frame_system::Config + pallet_balances::Config,
XcmConfig: xcm_executor::Config,
WeightToFee: frame_support::weights::WeightToFee<Balance = BalanceOf<Runtime>>,
<WeightToFee as frame_support::weights::WeightToFee>::Balance: From<u128> + Into<u128>,
{
// data here are not relevant for weighing
let mut xcm = Xcm(vec![
WithdrawAsset(MultiAssets::from(vec![MultiAsset {
id: Concrete(MultiLocation { parents: 1, interior: Here }),
fun: Fungible(34333299),
}])),
BuyExecution {
fees: MultiAsset {
id: Concrete(MultiLocation { parents: 1, interior: Here }),
fun: Fungible(34333299),
},
weight_limit: Unlimited,
},
ExportMessage {
network: Polkadot,
destination: X1(Parachain(1000)),
xcm: Xcm(vec![
ReserveAssetDeposited(MultiAssets::from(vec![MultiAsset {
id: Concrete(MultiLocation {
parents: 2,
interior: X1(GlobalConsensus(Kusama)),
}),
fun: Fungible(1000000000000),
}])),
ClearOrigin,
BuyExecution {
fees: MultiAsset {
id: Concrete(MultiLocation {
parents: 2,
interior: X1(GlobalConsensus(Kusama)),
}),
fun: Fungible(1000000000000),
},
weight_limit: Unlimited,
},
DepositAsset {
assets: Wild(AllCounted(1)),
beneficiary: MultiLocation {
parents: 0,
interior: X1(xcm::latest::prelude::AccountId32 {
network: None,
id: [
212, 53, 147, 199, 21, 253, 211, 28, 97, 20, 26, 189, 4, 169, 159,
214, 130, 44, 133, 88, 133, 76, 205, 227, 154, 86, 132, 231, 165,
109, 162, 125,
],
}),
},
},
SetTopic([
116, 82, 194, 132, 171, 114, 217, 165, 23, 37, 161, 177, 165, 179, 247, 114,
137, 101, 147, 70, 28, 157, 168, 32, 154, 63, 74, 228, 152, 180, 5, 63,
]),
]),
},
RefundSurplus,
DepositAsset {
assets: Wild(All),
beneficiary: MultiLocation { parents: 1, interior: X1(Parachain(1000)) },
},
SetTopic([
36, 224, 250, 165, 82, 195, 67, 110, 160, 170, 140, 87, 217, 62, 201, 164, 42, 98, 219,
157, 124, 105, 248, 25, 131, 218, 199, 36, 109, 173, 100, 122,
]),
]);
// get weight
let weight = XcmConfig::Weigher::weight(&mut xcm);
assert_ok!(weight);
let weight = weight.unwrap();
// check if sane
let max_expected = Runtime::BlockWeights::get().max_block / 10;
assert!(
weight.all_lte(max_expected),
"calculated weight: {:?}, max_expected: {:?}",
weight,
max_expected
);
// check fee, should not be 0
let estimated_fee = WeightToFee::weight_to_fee(&weight);
assert!(estimated_fee > BalanceOf::<Runtime>::zero());
sp_tracing::try_init_simple();
log::error!(
target: "bridges::estimate",
"Estimate fee: {:?} for `ExportMessage` for runtime: {:?}",
estimated_fee,
Runtime::Version::get(),
);
estimated_fee.into()
}
pub mod test_data {
use super::*;
use bp_header_chain::justification::GrandpaJustification;
@@ -928,7 +1097,7 @@ pub mod test_data {
);
/// Simulates `HaulBlobExporter` and all its wrapping and captures generated plain bytes,
/// which are transfered over bridge.
/// which are transferred over bridge.
pub(crate) fn simulate_message_exporter_on_bridged_chain<
SourceNetwork: Get<NetworkId>,
DestinationNetwork: Get<NetworkId>,
@@ -225,7 +225,7 @@ pub type Barrier = TrailingSetTopicAsId<
// Allow XCMs with some computed origins to pass through.
WithComputedOrigin<
(
// If the message is one that immediately attemps to pay for execution, then
// If the message is one that immediately attempts to pay for execution, then
// allow it.
AllowTopLevelPaidExecutionFrom<Everything>,
// Parent and its pluralities (i.e. governance bodies) get free execution.
@@ -130,7 +130,7 @@ pub type Barrier = TrailingSetTopicAsId<
// Allow XCMs with some computed origins to pass through.
WithComputedOrigin<
(
// If the message is one that immediately attemps to pay for execution, then
// If the message is one that immediately attempts to pay for execution, then
// allow it.
AllowTopLevelPaidExecutionFrom<Everything>,
// Parent and its pluralities (i.e. governance bodies) get free execution.
@@ -27,11 +27,11 @@ cumulus-pallet-xcmp-queue = { path = "../../../pallets/xcmp-queue", default-feat
cumulus-pallet-dmp-queue = { path = "../../../pallets/dmp-queue", default-features = false }
pallet-collator-selection = { path = "../../../pallets/collator-selection", default-features = false }
parachains-common = { path = "../../common", default-features = false }
parachain-info = { path = "../../pallets/parachain-info", default-features = false }
assets-common = { path = "../assets/common", default-features = false }
cumulus-primitives-core = { path = "../../../primitives/core", default-features = false }
cumulus-primitives-parachain-inherent = { path = "../../../primitives/parachain-inherent", default-features = false }
cumulus-test-relay-sproof-builder = { path = "../../../test/relay-sproof-builder", default-features = false }
parachain-info = { path = "../../pallets/parachain-info", default-features = false }
# Polkadot
xcm = { package = "staging-xcm", path = "../../../../polkadot/xcm", default-features = false}
@@ -24,11 +24,12 @@ use cumulus_test_relay_sproof_builder::RelayStateSproofBuilder;
use frame_support::{
dispatch::{DispatchResult, RawOrigin},
inherent::{InherentData, ProvideInherent},
pallet_prelude::Get,
traits::{OnFinalize, OnInitialize, OriginTrait, UnfilteredDispatchable},
weights::Weight,
};
use frame_system::pallet_prelude::{BlockNumberFor, HeaderFor};
use parachains_common::{AccountId, SLOT_DURATION};
use parachains_common::SLOT_DURATION;
use polkadot_parachain_primitives::primitives::{
HeadData, HrmpChannelId, RelayChainBlockNumber, XcmpMessageFormat,
};
@@ -49,7 +50,7 @@ pub type AccountIdOf<Runtime> = <Runtime as frame_system::Config>::AccountId;
pub type ValidatorIdOf<Runtime> = <Runtime as pallet_session::Config>::ValidatorId;
pub type SessionKeysOf<Runtime> = <Runtime as pallet_session::Config>::Keys;
pub struct CollatorSessionKeys<
pub struct CollatorSessionKey<
Runtime: frame_system::Config + pallet_balances::Config + pallet_session::Config,
> {
collator: AccountIdOf<Runtime>,
@@ -57,6 +58,32 @@ pub struct CollatorSessionKeys<
key: SessionKeysOf<Runtime>,
}
pub struct CollatorSessionKeys<
Runtime: frame_system::Config + pallet_balances::Config + pallet_session::Config,
> {
items: Vec<CollatorSessionKey<Runtime>>,
}
impl<Runtime: frame_system::Config + pallet_balances::Config + pallet_session::Config>
CollatorSessionKey<Runtime>
{
pub fn new(
collator: AccountIdOf<Runtime>,
validator: ValidatorIdOf<Runtime>,
key: SessionKeysOf<Runtime>,
) -> Self {
Self { collator, validator, key }
}
}
impl<Runtime: frame_system::Config + pallet_balances::Config + pallet_session::Config> Default
for CollatorSessionKeys<Runtime>
{
fn default() -> Self {
Self { items: vec![] }
}
}
impl<Runtime: frame_system::Config + pallet_balances::Config + pallet_session::Config>
CollatorSessionKeys<Runtime>
{
@@ -65,16 +92,25 @@ impl<Runtime: frame_system::Config + pallet_balances::Config + pallet_session::C
validator: ValidatorIdOf<Runtime>,
key: SessionKeysOf<Runtime>,
) -> Self {
Self { collator, validator, key }
Self { items: vec![CollatorSessionKey::new(collator, validator, key)] }
}
pub fn add(mut self, item: CollatorSessionKey<Runtime>) -> Self {
self.items.push(item);
self
}
pub fn collators(&self) -> Vec<AccountIdOf<Runtime>> {
vec![self.collator.clone()]
self.items.iter().map(|item| item.collator.clone()).collect::<Vec<_>>()
}
pub fn session_keys(
&self,
) -> Vec<(AccountIdOf<Runtime>, ValidatorIdOf<Runtime>, SessionKeysOf<Runtime>)> {
vec![(self.collator.clone(), self.validator.clone(), self.key.clone())]
self.items
.iter()
.map(|item| (item.collator.clone(), item.validator.clone(), item.key.clone()))
.collect::<Vec<_>>()
}
}
@@ -225,7 +261,7 @@ where
AllPalletsWithoutSystem:
OnInitialize<BlockNumberFor<Runtime>> + OnFinalize<BlockNumberFor<Runtime>>,
{
pub fn run_to_block(n: u32, author: AccountId) -> HeaderFor<Runtime> {
pub fn run_to_block(n: u32, author: AccountIdOf<Runtime>) -> HeaderFor<Runtime> {
let mut last_header = None;
loop {
let block_number = frame_system::Pallet::<Runtime>::block_number();
@@ -360,7 +396,6 @@ impl<ParachainSystem: cumulus_pallet_parachain_system::Config, AllPalletsWithout
RuntimeHelper<ParachainSystem, AllPalletsWithoutSystem>
{
pub fn xcm_max_weight(from: XcmReceivedFrom) -> Weight {
use frame_support::traits::Get;
match from {
XcmReceivedFrom::Parent => ParachainSystem::ReservedDmpWeight::get(),
XcmReceivedFrom::Sibling => ParachainSystem::ReservedXcmpWeight::get(),
@@ -375,16 +410,20 @@ impl<Runtime: frame_system::Config + pallet_xcm::Config, AllPalletsWithoutSystem
unwrap_pallet_xcm_event: &Box<dyn Fn(Vec<u8>) -> Option<pallet_xcm::Event<Runtime>>>,
assert_outcome: fn(Outcome),
) {
let outcome = <frame_system::Pallet<Runtime>>::events()
assert_outcome(Self::get_pallet_xcm_event_outcome(unwrap_pallet_xcm_event));
}
pub fn get_pallet_xcm_event_outcome(
unwrap_pallet_xcm_event: &Box<dyn Fn(Vec<u8>) -> Option<pallet_xcm::Event<Runtime>>>,
) -> Outcome {
<frame_system::Pallet<Runtime>>::events()
.into_iter()
.filter_map(|e| unwrap_pallet_xcm_event(e.event.encode()))
.find_map(|e| match e {
pallet_xcm::Event::Attempted { outcome } => Some(outcome),
_ => None,
})
.expect("No `pallet_xcm::Event::Attempted(outcome)` event found!");
assert_outcome(outcome);
.expect("No `pallet_xcm::Event::Attempted(outcome)` event found!")
}
}
@@ -160,7 +160,7 @@ pub type Barrier = TrailingSetTopicAsId<
// Allow XCMs with some computed origins to pass through.
WithComputedOrigin<
(
// If the message is one that immediately attemps to pay for execution, then
// If the message is one that immediately attempts to pay for execution, then
// allow it.
AllowTopLevelPaidExecutionFrom<Everything>,
// System Assets parachain, parent and its exec plurality get free
+3
View File
@@ -27,6 +27,7 @@ glutton-runtime = { path = "../parachains/runtimes/glutton/glutton-kusama" }
seedling-runtime = { path = "../parachains/runtimes/starters/seedling" }
asset-hub-polkadot-runtime = { path = "../parachains/runtimes/assets/asset-hub-polkadot" }
asset-hub-kusama-runtime = { path = "../parachains/runtimes/assets/asset-hub-kusama" }
asset-hub-rococo-runtime = { path = "../parachains/runtimes/assets/asset-hub-rococo" }
asset-hub-westend-runtime = { path = "../parachains/runtimes/assets/asset-hub-westend" }
collectives-polkadot-runtime = { path = "../parachains/runtimes/collectives/collectives-polkadot" }
contracts-rococo-runtime = { path = "../parachains/runtimes/contracts/contracts-rococo" }
@@ -108,6 +109,7 @@ default = []
runtime-benchmarks = [
"asset-hub-kusama-runtime/runtime-benchmarks",
"asset-hub-polkadot-runtime/runtime-benchmarks",
"asset-hub-rococo-runtime/runtime-benchmarks",
"asset-hub-westend-runtime/runtime-benchmarks",
"bridge-hub-kusama-runtime/runtime-benchmarks",
"bridge-hub-polkadot-runtime/runtime-benchmarks",
@@ -129,6 +131,7 @@ runtime-benchmarks = [
try-runtime = [
"asset-hub-kusama-runtime/try-runtime",
"asset-hub-polkadot-runtime/try-runtime",
"asset-hub-rococo-runtime/try-runtime",
"asset-hub-westend-runtime/try-runtime",
"bridge-hub-kusama-runtime/try-runtime",
"bridge-hub-polkadot-runtime/try-runtime",
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -30,6 +30,9 @@ pub type AssetHubKusamaChainSpec =
sc_service::GenericChainSpec<asset_hub_kusama_runtime::RuntimeGenesisConfig, Extensions>;
pub type AssetHubWestendChainSpec =
sc_service::GenericChainSpec<asset_hub_westend_runtime::RuntimeGenesisConfig, Extensions>;
pub type AssetHubRococoChainSpec =
sc_service::GenericChainSpec<asset_hub_rococo_runtime::RuntimeGenesisConfig, Extensions>;
pub type AssetHubWococoChainSpec = AssetHubRococoChainSpec;
const ASSET_HUB_POLKADOT_ED: AssetHubBalance =
parachains_common::polkadot::currency::EXISTENTIAL_DEPOSIT;
@@ -37,6 +40,8 @@ const ASSET_HUB_KUSAMA_ED: AssetHubBalance =
parachains_common::kusama::currency::EXISTENTIAL_DEPOSIT;
const ASSET_HUB_WESTEND_ED: AssetHubBalance =
parachains_common::westend::currency::EXISTENTIAL_DEPOSIT;
const ASSET_HUB_ROCOCO_ED: AssetHubBalance =
parachains_common::westend::currency::EXISTENTIAL_DEPOSIT;
/// Generate the session keys from individual elements.
///
@@ -54,6 +59,13 @@ pub fn asset_hub_kusama_session_keys(keys: AuraId) -> asset_hub_kusama_runtime::
asset_hub_kusama_runtime::SessionKeys { aura: keys }
}
/// Generate the session keys from individual elements.
///
/// The input must be a tuple of individual keys (a single arg for now since we have just one key).
pub fn asset_hub_rococo_session_keys(keys: AuraId) -> asset_hub_rococo_runtime::SessionKeys {
asset_hub_rococo_runtime::SessionKeys { aura: keys }
}
/// Generate the session keys from individual elements.
///
/// The input must be a tuple of individual keys (a single arg for now since we have just one key).
@@ -643,3 +655,240 @@ fn asset_hub_westend_genesis(
},
}
}
pub fn asset_hub_rococo_development_config() -> AssetHubRococoChainSpec {
let mut properties = sc_chain_spec::Properties::new();
properties.insert("ss58Format".into(), 42.into());
properties.insert("tokenSymbol".into(), "ROC".into());
properties.insert("tokenDecimals".into(), 12.into());
asset_hub_rococo_like_development_config(
properties,
"Rococo Asset Hub Development",
"asset-hub-rococo-dev",
1000,
)
}
pub fn asset_hub_wococo_development_config() -> AssetHubWococoChainSpec {
let mut properties = sc_chain_spec::Properties::new();
properties.insert("ss58Format".into(), 42.into());
properties.insert("tokenSymbol".into(), "WOC".into());
properties.insert("tokenDecimals".into(), 12.into());
asset_hub_rococo_like_development_config(
properties,
"Wococo Asset Hub Development",
"asset-hub-wococo-dev",
1000,
)
}
fn asset_hub_rococo_like_development_config(
properties: sc_chain_spec::Properties,
name: &str,
chain_id: &str,
para_id: u32,
) -> AssetHubRococoChainSpec {
AssetHubRococoChainSpec::from_genesis(
// Name
name,
// ID
chain_id,
ChainType::Local,
move || {
asset_hub_rococo_genesis(
// initial collators.
vec![(
get_account_id_from_seed::<sr25519::Public>("Alice"),
get_collator_keys_from_seed::<AuraId>("Alice"),
)],
vec![
get_account_id_from_seed::<sr25519::Public>("Alice"),
get_account_id_from_seed::<sr25519::Public>("Bob"),
get_account_id_from_seed::<sr25519::Public>("Alice//stash"),
get_account_id_from_seed::<sr25519::Public>("Bob//stash"),
],
para_id.into(),
)
},
Vec::new(),
None,
None,
None,
Some(properties),
Extensions { relay_chain: "rococo-dev".into(), para_id },
)
}
pub fn asset_hub_rococo_local_config() -> AssetHubRococoChainSpec {
let mut properties = sc_chain_spec::Properties::new();
properties.insert("ss58Format".into(), 42.into());
properties.insert("tokenSymbol".into(), "ROC".into());
properties.insert("tokenDecimals".into(), 12.into());
asset_hub_rococo_like_local_config(
properties,
"Rococo Asset Hub Local",
"asset-hub-rococo-local",
1000,
)
}
pub fn asset_hub_wococo_local_config() -> AssetHubWococoChainSpec {
let mut properties = sc_chain_spec::Properties::new();
properties.insert("ss58Format".into(), 42.into());
properties.insert("tokenSymbol".into(), "WOC".into());
properties.insert("tokenDecimals".into(), 12.into());
asset_hub_rococo_like_local_config(
properties,
"Wococo Asset Hub Local",
"asset-hub-wococo-local",
1000,
)
}
fn asset_hub_rococo_like_local_config(
properties: sc_chain_spec::Properties,
name: &str,
chain_id: &str,
para_id: u32,
) -> AssetHubRococoChainSpec {
AssetHubRococoChainSpec::from_genesis(
// Name
name,
// ID
chain_id,
ChainType::Local,
move || {
asset_hub_rococo_genesis(
// initial collators.
vec![
(
get_account_id_from_seed::<sr25519::Public>("Alice"),
get_collator_keys_from_seed::<AuraId>("Alice"),
),
(
get_account_id_from_seed::<sr25519::Public>("Bob"),
get_collator_keys_from_seed::<AuraId>("Bob"),
),
],
vec![
get_account_id_from_seed::<sr25519::Public>("Alice"),
get_account_id_from_seed::<sr25519::Public>("Bob"),
get_account_id_from_seed::<sr25519::Public>("Charlie"),
get_account_id_from_seed::<sr25519::Public>("Dave"),
get_account_id_from_seed::<sr25519::Public>("Eve"),
get_account_id_from_seed::<sr25519::Public>("Ferdie"),
get_account_id_from_seed::<sr25519::Public>("Alice//stash"),
get_account_id_from_seed::<sr25519::Public>("Bob//stash"),
get_account_id_from_seed::<sr25519::Public>("Charlie//stash"),
get_account_id_from_seed::<sr25519::Public>("Dave//stash"),
get_account_id_from_seed::<sr25519::Public>("Eve//stash"),
get_account_id_from_seed::<sr25519::Public>("Ferdie//stash"),
],
para_id.into(),
)
},
Vec::new(),
None,
None,
None,
Some(properties),
Extensions { relay_chain: "rococo-local".into(), para_id },
)
}
pub fn asset_hub_rococo_config() -> AssetHubRococoChainSpec {
let mut properties = sc_chain_spec::Properties::new();
properties.insert("ss58Format".into(), 42.into());
properties.insert("tokenSymbol".into(), "ROC".into());
properties.insert("tokenDecimals".into(), 12.into());
asset_hub_rococo_like_local_config(properties, "Rococo Asset Hub", "asset-hub-rococo", 1000)
}
pub fn asset_hub_wococo_config() -> AssetHubWococoChainSpec {
let mut properties = sc_chain_spec::Properties::new();
properties.insert("ss58Format".into(), 42.into());
properties.insert("tokenSymbol".into(), "WOC".into());
properties.insert("tokenDecimals".into(), 12.into());
asset_hub_rococo_like_config(properties, "Wococo Asset Hub", "asset-hub-wococo", 1000)
}
fn asset_hub_rococo_like_config(
properties: sc_chain_spec::Properties,
name: &str,
chain_id: &str,
para_id: u32,
) -> AssetHubRococoChainSpec {
AssetHubRococoChainSpec::from_genesis(
// Name
name,
// ID
chain_id,
ChainType::Live,
move || {
asset_hub_rococo_genesis(
// initial collators.
vec![
// TODO: add invulnerables? from Rockmine?
],
Vec::new(),
para_id.into(),
)
},
Vec::new(),
None,
None,
None,
Some(properties),
Extensions { relay_chain: "rococo".into(), para_id },
)
}
fn asset_hub_rococo_genesis(
invulnerables: Vec<(AccountId, AuraId)>,
endowed_accounts: Vec<AccountId>,
id: ParaId,
) -> asset_hub_rococo_runtime::RuntimeGenesisConfig {
asset_hub_rococo_runtime::RuntimeGenesisConfig {
system: asset_hub_rococo_runtime::SystemConfig {
code: asset_hub_rococo_runtime::WASM_BINARY
.expect("WASM binary was not build, please build it!")
.to_vec(),
..Default::default()
},
balances: asset_hub_rococo_runtime::BalancesConfig {
balances: endowed_accounts
.iter()
.cloned()
.map(|k| (k, ASSET_HUB_ROCOCO_ED * 524_288))
.collect(),
},
parachain_info: asset_hub_rococo_runtime::ParachainInfoConfig {
parachain_id: id,
..Default::default()
},
collator_selection: asset_hub_rococo_runtime::CollatorSelectionConfig {
invulnerables: invulnerables.iter().cloned().map(|(acc, _)| acc).collect(),
candidacy_bond: ASSET_HUB_ROCOCO_ED * 16,
..Default::default()
},
session: asset_hub_rococo_runtime::SessionConfig {
keys: invulnerables
.into_iter()
.map(|(acc, aura)| {
(
acc.clone(), // account id
acc, // validator id
asset_hub_rococo_session_keys(aura), // session keys
)
})
.collect(),
},
aura: Default::default(),
aura_ext: Default::default(),
parachain_system: Default::default(),
polkadot_xcm: asset_hub_rococo_runtime::PolkadotXcmConfig {
safe_xcm_version: Some(SAFE_XCM_VERSION),
..Default::default()
},
}
}
+59
View File
@@ -42,6 +42,8 @@ enum Runtime {
Seedling,
AssetHubPolkadot,
AssetHubKusama,
AssetHubRococo,
AssetHubWococo,
AssetHubWestend,
Penpal(ParaId),
ContractsRococo,
@@ -90,6 +92,10 @@ fn runtime(id: &str) -> Runtime {
Runtime::AssetHubPolkadot
} else if id.starts_with("asset-hub-kusama") | id.starts_with("statemine") {
Runtime::AssetHubKusama
} else if id.starts_with("asset-hub-rococo") {
Runtime::AssetHubRococo
} else if id.starts_with("asset-hub-wococo") {
Runtime::AssetHubWococo
} else if id.starts_with("asset-hub-westend") | id.starts_with("westmint") {
Runtime::AssetHubWestend
} else if id.starts_with("penpal") {
@@ -164,6 +170,31 @@ fn load_spec(id: &str) -> std::result::Result<Box<dyn ChainSpec>, String> {
&include_bytes!("../chain-specs/asset-hub-kusama.json")[..],
)?),
// -- Asset Hub Rococo
"asset-hub-rococo-dev" =>
Box::new(chain_spec::asset_hubs::asset_hub_rococo_development_config()),
"asset-hub-rococo-local" =>
Box::new(chain_spec::asset_hubs::asset_hub_rococo_local_config()),
// the chain spec as used for generating the upgrade genesis values
"asset-hub-rococo-genesis" => Box::new(chain_spec::asset_hubs::asset_hub_rococo_config()),
// the shell-based chain spec as used for syncing
"asset-hub-rococo" =>
Box::new(chain_spec::asset_hubs::AssetHubRococoChainSpec::from_json_bytes(
&include_bytes!("../chain-specs/asset-hub-rococo.json")[..],
)?),
// -- Asset Hub Wococo
"asset-hub-wococo-dev" =>
Box::new(chain_spec::asset_hubs::asset_hub_wococo_development_config()),
"asset-hub-wococo-local" =>
Box::new(chain_spec::asset_hubs::asset_hub_wococo_local_config()),
// the chain spec as used for generating the upgrade genesis values
"asset-hub-wococo-genesis" => Box::new(chain_spec::asset_hubs::asset_hub_wococo_config()),
"asset-hub-wococo" =>
Box::new(chain_spec::asset_hubs::AssetHubWococoChainSpec::from_json_bytes(
&include_bytes!("../chain-specs/asset-hub-wococo.json")[..],
)?),
// -- Asset Hub Westend
"asset-hub-westend-dev" | "westmint-dev" =>
Box::new(chain_spec::asset_hubs::asset_hub_westend_development_config()),
@@ -249,6 +280,10 @@ fn load_spec(id: &str) -> std::result::Result<Box<dyn ChainSpec>, String> {
),
Runtime::AssetHubKusama =>
Box::new(chain_spec::asset_hubs::AssetHubKusamaChainSpec::from_json_file(path)?),
Runtime::AssetHubRococo =>
Box::new(chain_spec::asset_hubs::AssetHubRococoChainSpec::from_json_file(path)?),
Runtime::AssetHubWococo =>
Box::new(chain_spec::asset_hubs::AssetHubWococoChainSpec::from_json_file(path)?),
Runtime::AssetHubWestend => Box::new(
chain_spec::asset_hubs::AssetHubWestendChainSpec::from_json_file(path)?,
),
@@ -391,6 +426,13 @@ macro_rules! construct_partials {
)?;
$code
},
Runtime::AssetHubRococo | Runtime::AssetHubWococo => {
let $partials = new_partial::<asset_hub_rococo_runtime::RuntimeApi, _>(
&$config,
crate::service::aura_build_import_queue::<_, AuraId>,
)?;
$code
},
Runtime::AssetHubWestend => {
let $partials = new_partial::<asset_hub_westend_runtime::RuntimeApi, _>(
&$config,
@@ -509,6 +551,16 @@ macro_rules! construct_async_run {
{ $( $code )* }.map(|v| (v, task_manager))
})
},
Runtime::AssetHubRococo | Runtime::AssetHubWococo => {
runner.async_run(|$config| {
let $components = new_partial::<asset_hub_rococo_runtime::RuntimeApi, _>(
&$config,
crate::service::aura_build_import_queue::<_, AuraId>,
)?;
let task_manager = $components.task_manager;
{ $( $code )* }.map(|v| (v, task_manager))
})
},
Runtime::AssetHubKusama => {
runner.async_run(|$config| {
let $components = new_partial::<asset_hub_kusama_runtime::RuntimeApi, _>(
@@ -850,6 +902,13 @@ pub fn run() -> Result<()> {
.await
.map(|r| r.0)
.map_err(Into::into),
Runtime::AssetHubRococo | Runtime::AssetHubWococo => crate::service::start_asset_hub_node::<
asset_hub_rococo_runtime::RuntimeApi,
AuraId,
>(config, polkadot_config, collator_options, id, hwbench)
.await
.map(|r| r.0)
.map_err(Into::into),
Runtime::AssetHubWestend => crate::service::start_asset_hub_node::<
asset_hub_westend_runtime::RuntimeApi,
AuraId,
+368 -378
View File
@@ -1,44 +1,129 @@
#!/bin/bash
# Address: 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY
# AccountId: [212, 53, 147, 199, 21, 253, 211, 28, 97, 20, 26, 189, 4, 169, 159, 214, 130, 44, 133, 88, 133, 76, 205, 227, 154, 86, 132, 231, 165, 109, 162, 125]
ASSET_HUB_KUSAMA_ACCOUNT_SEED_FOR_LOCAL="//Alice"
# Address: 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY
# AccountId: [212, 53, 147, 199, 21, 253, 211, 28, 97, 20, 26, 189, 4, 169, 159, 214, 130, 44, 133, 88, 133, 76, 205, 227, 154, 86, 132, 231, 165, 109, 162, 125]
ASSET_HUB_WOCOCO_ACCOUNT_SEED_FOR_LOCAL="5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY"
# SovereignAccount for `MultiLocation { parents: 2, interior: X2(GlobalConsensus(Rococo), Parachain(1000)) }` => 5CfNu7eH3SJvqqPt3aJh38T8dcFvhGzEohp9tsd41ANhXDnQ
# Expected sovereign accounts.
#
# use sp_core::crypto::Ss58Codec;
# println!("{}",
# frame_support::sp_runtime::AccountId32::new(
# GlobalConsensusParachainConvertsFor::<UniversalLocation, [u8; 32]>::convert_ref(
# MultiLocation { parents: 2, interior: X2(GlobalConsensus(Kusama), Parachain(1000)) }).unwrap()
# ).to_ss58check_with_version(42_u16.into())
# );
ASSET_HUB_ROCOCO_1000_SOVEREIGN_ACCOUNT="5CfNu7eH3SJvqqPt3aJh38T8dcFvhGzEohp9tsd41ANhXDnQ"
# Generated by:
#
# #[test]
# fn generate_sovereign_accounts() {
# use sp_core::crypto::Ss58Codec;
# use polkadot_parachain_primitives::primitives::Sibling;
#
# parameter_types! {
# pub UniversalLocationAHR: InteriorMultiLocation = X2(GlobalConsensus(Rococo), Parachain(1000));
# pub UniversalLocationAHW: InteriorMultiLocation = X2(GlobalConsensus(Wococo), Parachain(1000));
# }
#
# // SS58=42
# println!("GLOBAL_CONSENSUS_ROCOCO_SOVEREIGN_ACCOUNT=\"{}\"",
# frame_support::sp_runtime::AccountId32::new(
# GlobalConsensusConvertsFor::<UniversalLocationAHW, [u8; 32]>::convert_location(
# &MultiLocation { parents: 2, interior: X1(GlobalConsensus(Rococo)) }).unwrap()
# ).to_ss58check_with_version(42_u16.into())
# );
# println!("GLOBAL_CONSENSUS_ROCOCO_ASSET_HUB_ROCOCO_1000_SOVEREIGN_ACCOUNT=\"{}\"",
# frame_support::sp_runtime::AccountId32::new(
# GlobalConsensusParachainConvertsFor::<UniversalLocationAHW, [u8; 32]>::convert_location(
# &MultiLocation { parents: 2, interior: X2(GlobalConsensus(Rococo), Parachain(1000)) }).unwrap()
# ).to_ss58check_with_version(42_u16.into())
# );
# println!("ASSET_HUB_WOCOCO_SOVEREIGN_ACCOUNT_AT_BRIDGE_HUB_WOCOCO=\"{}\"",
# frame_support::sp_runtime::AccountId32::new(
# SiblingParachainConvertsVia::<Sibling, [u8; 32]>::convert_location(
# &MultiLocation { parents: 1, interior: X1(Parachain(1000)) }).unwrap()
# ).to_ss58check_with_version(42_u16.into())
# );
#
# // SS58=42
# println!("GLOBAL_CONSENSUS_WOCOCO_SOVEREIGN_ACCOUNT=\"{}\"",
# frame_support::sp_runtime::AccountId32::new(
# GlobalConsensusConvertsFor::<UniversalLocationAHR, [u8; 32]>::convert_location(
# &MultiLocation { parents: 2, interior: X1(GlobalConsensus(Wococo)) }).unwrap()
# ).to_ss58check_with_version(42_u16.into())
# );
# println!("GLOBAL_CONSENSUS_WOCOCO_ASSET_HUB_WOCOCO_1000_SOVEREIGN_ACCOUNT=\"{}\"",
# frame_support::sp_runtime::AccountId32::new(
# GlobalConsensusParachainConvertsFor::<UniversalLocationAHR, [u8; 32]>::convert_location(
# &MultiLocation { parents: 2, interior: X2(GlobalConsensus(Wococo), Parachain(1000)) }).unwrap()
# ).to_ss58check_with_version(42_u16.into())
# );
# println!("ASSET_HUB_ROCOCO_SOVEREIGN_ACCOUNT_AT_BRIDGE_HUB_ROCOCO=\"{}\"",
# frame_support::sp_runtime::AccountId32::new(
# SiblingParachainConvertsVia::<Sibling, [u8; 32]>::convert_location(
# &MultiLocation { parents: 1, interior: X1(Parachain(1000)) }).unwrap()
# ).to_ss58check_with_version(42_u16.into())
# );
# }
GLOBAL_CONSENSUS_ROCOCO_SOVEREIGN_ACCOUNT="5GxRGwT8bU1JeBPTUXc7LEjZMxNrK8MyL2NJnkWFQJTQ4sii"
GLOBAL_CONSENSUS_ROCOCO_ASSET_HUB_ROCOCO_1000_SOVEREIGN_ACCOUNT="5CfNu7eH3SJvqqPt3aJh38T8dcFvhGzEohp9tsd41ANhXDnQ"
ASSET_HUB_WOCOCO_SOVEREIGN_ACCOUNT_AT_BRIDGE_HUB_WOCOCO="5Eg2fntNprdN3FgH4sfEaaZhYtddZQSQUqvYJ1f2mLtinVhV"
GLOBAL_CONSENSUS_WOCOCO_SOVEREIGN_ACCOUNT="5EWw2NzfPr2DCahourp33cya6bGWEJViTnJN6Z2ruFevpJML"
GLOBAL_CONSENSUS_WOCOCO_ASSET_HUB_WOCOCO_1000_SOVEREIGN_ACCOUNT="5EJX8L4dwGyYnCsjZ91LfWAsm3rCN8vY2AYvT4mauMEjsrQz"
ASSET_HUB_ROCOCO_SOVEREIGN_ACCOUNT_AT_BRIDGE_HUB_ROCOCO="5Eg2fntNprdN3FgH4sfEaaZhYtddZQSQUqvYJ1f2mLtinVhV"
# Address: GegTpZJMyzkntLN7NJhRfHDk4GWukLbGSsag6PHrLSrCK4h
ASSET_HUB2_ROCOCO_1000_SOVEREIGN_ACCOUNT="scatter feed race company oxygen trip extra elbow slot bundle auto canoe"
# Expected sovereign accounts for rewards on BridgeHubs.
#
# Generated by:
#[test]
#fn generate_sovereign_accounts_for_rewards() {
# use sp_core::crypto::Ss58Codec;
#
# // SS58=42
# println!(
# "ON_BRIDGE_HUB_ROCOCO_SOVEREIGN_ACCOUNT_FOR_LANE_00000001_bhwo_ThisChain=\"{}\"",
# frame_support::sp_runtime::AccountId32::new(
# PayRewardFromAccount::<[u8; 32], [u8; 32]>::rewards_account(RewardsAccountParams::new(
# LaneId([0, 0, 0, 1]),
# *b"bhwo",
# RewardsAccountOwner::ThisChain
# ))
# )
# .to_ss58check_with_version(42_u16.into())
# );
# // SS58=42
# println!(
# "ON_BRIDGE_HUB_ROCOCO_SOVEREIGN_ACCOUNT_FOR_LANE_00000001_bhwo_BridgedChain=\"{}\"",
# frame_support::sp_runtime::AccountId32::new(
# PayRewardFromAccount::<[u8; 32], [u8; 32]>::rewards_account(RewardsAccountParams::new(
# LaneId([0, 0, 0, 1]),
# *b"bhwo",
# RewardsAccountOwner::BridgedChain
# ))
# )
# .to_ss58check_with_version(42_u16.into())
# );
#
# // SS58=42
# println!(
# "ON_BRIDGE_HUB_WOCOCO_SOVEREIGN_ACCOUNT_FOR_LANE_00000001_bhro_ThisChain=\"{}\"",
# frame_support::sp_runtime::AccountId32::new(
# PayRewardFromAccount::<[u8; 32], [u8; 32]>::rewards_account(RewardsAccountParams::new(
# LaneId([0, 0, 0, 1]),
# *b"bhro",
# RewardsAccountOwner::ThisChain
# ))
# )
# .to_ss58check_with_version(42_u16.into())
# );
# // SS58=42
# println!(
# "ON_BRIDGE_HUB_WOCOCO_SOVEREIGN_ACCOUNT_FOR_LANE_00000001_bhro_BridgedChain=\"{}\"",
# frame_support::sp_runtime::AccountId32::new(
# PayRewardFromAccount::<[u8; 32], [u8; 32]>::rewards_account(RewardsAccountParams::new(
# LaneId([0, 0, 0, 1]),
# *b"bhro",
# RewardsAccountOwner::BridgedChain
# ))
# )
# .to_ss58check_with_version(42_u16.into())
# );
#}
ON_BRIDGE_HUB_ROCOCO_SOVEREIGN_ACCOUNT_FOR_LANE_00000001_bhwo_ThisChain="5EHnXaT5BhiS8YRPMeHi97YHofTtNx4pLNb8wR8TwjVq1gzU"
ON_BRIDGE_HUB_ROCOCO_SOVEREIGN_ACCOUNT_FOR_LANE_00000001_bhwo_BridgedChain="5EHnXaT5BhiS8YRPMeHyt95svA95qWAh53XeVMpJQZNZHAzj"
ON_BRIDGE_HUB_WOCOCO_SOVEREIGN_ACCOUNT_FOR_LANE_00000001_bhro_ThisChain="5EHnXaT5BhiS8YRNuCukWXTQdAqARjjXmpjehjx1YZNE5keZ"
ON_BRIDGE_HUB_WOCOCO_SOVEREIGN_ACCOUNT_FOR_LANE_00000001_bhro_BridgedChain="5EHnXaT5BhiS8YRNuCv2FYzzjfWMtHqQWVgAFgdr1PExMN94"
# Adress: 5Ge7YcbctWCP1CccugzxWDn9hFnTxvTh3bL6PNy4ubNJmp7Y / H9jCvwVWsDJkrS4gPp1QB99qr4hmbGsVyAqn3F2PPaoWyU3
# AccountId: [202, 107, 198, 135, 15, 25, 193, 165, 172, 73, 137, 218, 115, 177, 204, 0, 5, 155, 215, 86, 208, 51, 50, 130, 190, 110, 184, 143, 124, 50, 160, 20]
ASSET_HUB_WOCOCO_ACCOUNT_ADDRESS_FOR_ROCOCO="5Ge7YcbctWCP1CccugzxWDn9hFnTxvTh3bL6PNy4ubNJmp7Y"
ASSET_HUB_WOCOCO_ACCOUNT_SEED_FOR_WOCOCO="tone spirit magnet sunset cannon poverty forget lock river east blouse random"
function address_to_account_id_bytes() {
local address=$1
local output=$2
echo "address_to_account_id_bytes - address: $address, output: $output"
if [ $address == "$ASSET_HUB_WOCOCO_ACCOUNT_SEED_FOR_LOCAL" ]; then
jq --null-input '[212, 53, 147, 199, 21, 253, 211, 28, 97, 20, 26, 189, 4, 169, 159, 214, 130, 44, 133, 88, 133, 76, 205, 227, 154, 86, 132, 231, 165, 109, 162, 125]' > $output
elif [ $address == "$ASSET_HUB_WOCOCO_ACCOUNT_ADDRESS_FOR_ROCOCO" ]; then
jq --null-input '[202, 107, 198, 135, 15, 25, 193, 165, 172, 73, 137, 218, 115, 177, 204, 0, 5, 155, 215, 86, 208, 51, 50, 130, 190, 110, 184, 143, 124, 50, 160, 20]' > $output
else
echo -n "Sorry, unknown address: $address - please, add bytes here or function for that!"
exit 1
fi
}
LANE_ID="00000001"
function ensure_binaries() {
if [[ ! -f ~/local_bridge_testing/bin/polkadot ]]; then
@@ -87,8 +172,8 @@ function ensure_polkadot_js_api() {
echo ""
echo ""
echo "-------------------"
echo "Installing (nodejs) sub module: ./scripts/generate_hex_encoded_call"
pushd ./scripts/generate_hex_encoded_call
echo "Installing (nodejs) sub module: $(dirname "$0")/generate_hex_encoded_call"
pushd $(dirname "$0")/generate_hex_encoded_call
npm install
popd
fi
@@ -103,7 +188,7 @@ function generate_hex_encoded_call_data() {
shift
echo "Input params: $@"
node ./scripts/generate_hex_encoded_call "$type" "$endpoint" "$output" "$@"
node $(dirname "$0")/generate_hex_encoded_call "$type" "$endpoint" "$output" "$@"
local retVal=$?
if [ $type != "check" ]; then
@@ -129,7 +214,7 @@ function transfer_balance() {
polkadot-js-api \
--ws "${runtime_para_endpoint}" \
--seed "${seed?}" \
tx.balances.transfer \
tx.balances.transferAllowDeath \
"${target_account}" \
"${amount}"
}
@@ -200,68 +285,53 @@ function send_governance_transact() {
"${message}"
}
function allow_assets_transfer_send() {
function open_hrmp_channels() {
local relay_url=$1
local relay_chain_seed=$2
local sender_para_id=$3
local recipient_para_id=$4
local max_capacity=$5
local max_message_size=$6
echo " calling open_hrmp_channels:"
echo " relay_url: ${relay_url}"
echo " relay_chain_seed: ${relay_chain_seed}"
echo " sender_para_id: ${sender_para_id}"
echo " recipient_para_id: ${recipient_para_id}"
echo " max_capacity: ${max_capacity}"
echo " max_message_size: ${max_message_size}"
echo " params:"
echo "--------------------------------------------------"
polkadot-js-api \
--ws "${relay_url?}" \
--seed "${relay_chain_seed?}" \
--sudo \
tx.hrmp.forceOpenHrmpChannel \
${sender_para_id} \
${recipient_para_id} \
${max_capacity} \
${max_message_size}
}
function set_storage() {
local relay_url=$1
local relay_chain_seed=$2
local runtime_para_id=$3
local runtime_para_endpoint=$4
local bridge_hub_para_id=$5
local bridged_para_network=$6
local bridged_para_para_id=$7
echo " calling allow_assets_transfer_send:"
local items=$5
echo " calling set_storage:"
echo " relay_url: ${relay_url}"
echo " relay_chain_seed: ${relay_chain_seed}"
echo " runtime_para_id: ${runtime_para_id}"
echo " runtime_para_endpoint: ${runtime_para_endpoint}"
echo " bridge_hub_para_id: ${bridge_hub_para_id}"
echo " bridged_para_network: ${bridged_para_network}"
echo " bridged_para_para_id: ${bridged_para_para_id}"
echo " items: ${items}"
echo " params:"
# 1. generate data for Transact (add_exporter_config)
local bridge_config=$(jq --null-input \
--arg bridge_hub_para_id "$bridge_hub_para_id" \
--arg bridged_para_network "$bridged_para_network" \
--arg bridged_para_para_id "$bridged_para_para_id" \
'
{
"bridgeLocation": {
"parents": 1,
"interior": {
"X1": { "Parachain": $bridge_hub_para_id }
}
},
"allowedTargetLocation": {
"parents": 2,
"interior": {
"X2": [
{
"GlobalConsensus": $bridged_para_network,
},
{
"Parachain": $bridged_para_para_id
}
]
}
},
"maxTargetLocationFee": {
"id": {
"Concrete": {
"parents": 1,
"interior": "Here"
}
},
"fun": {
"Fungible": 50000000000
}
}
}
'
)
# 1. generate data for Transact (System::set_storage)
local tmp_output_file=$(mktemp)
generate_hex_encoded_call_data "add-exporter-config" "${runtime_para_endpoint}" "${tmp_output_file}" $bridged_para_network "$bridge_config"
generate_hex_encoded_call_data "set-storage" "${runtime_para_endpoint}" "${tmp_output_file}" "$items"
local hex_encoded_data=$(cat $tmp_output_file)
# 2. trigger governance call
send_governance_transact "${relay_url}" "${relay_chain_seed}" "${runtime_para_id}" "${hex_encoded_data}" 200000000 12000
}
@@ -270,254 +340,93 @@ function force_create_foreign_asset() {
local relay_chain_seed=$2
local runtime_para_id=$3
local runtime_para_endpoint=$4
local global_consensus=$5
local asset_multilocation=$5
local asset_owner_account_id=$6
local min_balance=$7
local is_sufficient=$8
echo " calling force_create_foreign_asset:"
echo " relay_url: ${relay_url}"
echo " relay_chain_seed: ${relay_chain_seed}"
echo " runtime_para_id: ${runtime_para_id}"
echo " runtime_para_endpoint: ${runtime_para_endpoint}"
echo " global_consensus: ${global_consensus}"
echo " asset_multilocation: ${asset_multilocation}"
echo " asset_owner_account_id: ${asset_owner_account_id}"
echo " min_balance: ${min_balance}"
echo " is_sufficient: ${is_sufficient}"
echo " params:"
# 1. generate data for Transact (ForeignAssets::force_create)
local asset_id=$(jq --null-input \
--arg global_consensus "$global_consensus" \
'
{
"parents": 2,
"interior": {
"X1": {
"GlobalConsensus": $global_consensus,
}
}
}
'
)
local tmp_output_file=$(mktemp)
generate_hex_encoded_call_data "force-create-asset" "${runtime_para_endpoint}" "${tmp_output_file}" "$asset_id" "$asset_owner_account_id" false "1000"
generate_hex_encoded_call_data "force-create-asset" "${runtime_para_endpoint}" "${tmp_output_file}" "$asset_multilocation" "$asset_owner_account_id" $is_sufficient $min_balance
local hex_encoded_data=$(cat $tmp_output_file)
# 2. trigger governance call
send_governance_transact "${relay_url}" "${relay_chain_seed}" "${runtime_para_id}" "${hex_encoded_data}" 200000000 12000
}
function allow_assets_transfer_receive() {
local relay_url=$1
local relay_chain_seed=$2
local runtime_para_id=$3
local runtime_para_endpoint=$4
local bridge_hub_para_id=$5
local bridged_network=$6
local bridged_para_id=$7
echo " calling allow_assets_transfer_receive:"
echo " relay_url: ${relay_url}"
echo " relay_chain_seed: ${relay_chain_seed}"
echo " runtime_para_id: ${runtime_para_id}"
echo " runtime_para_endpoint: ${runtime_para_endpoint}"
echo " bridge_hub_para_id: ${bridge_hub_para_id}"
echo " bridged_network: ${bridged_network}"
echo " bridged_para_id: ${bridged_para_id}"
echo " params:"
# 1. generate data for Transact (add_universal_alias)
local location=$(jq --null-input \
--arg bridge_hub_para_id "$bridge_hub_para_id" \
'{ "V3": { "parents": 1, "interior": { "X1": { "Parachain": $bridge_hub_para_id } } } }')
local junction=$(jq --null-input \
--arg bridged_network "$bridged_network" \
'{ "GlobalConsensus": $bridged_network } ')
local tmp_output_file=$(mktemp)
generate_hex_encoded_call_data "add-universal-alias" "${runtime_para_endpoint}" "${tmp_output_file}" "$location" "$junction"
local hex_encoded_data=$(cat $tmp_output_file)
send_governance_transact "${relay_url}" "${relay_chain_seed}" "${runtime_para_id}" "${hex_encoded_data}" 200000000 12000
# 2. generate data for Transact (add_reserve_location)
local reserve_location=$(jq --null-input \
--arg bridged_network "$bridged_network" \
--arg bridged_para_id "$bridged_para_id" \
'{ "V3": {
"parents": 2,
"interior": {
"X2": [
{
"GlobalConsensus": $bridged_network,
},
{
"Parachain": $bridged_para_id
}
]
}
} }')
local tmp_output_file=$(mktemp)
generate_hex_encoded_call_data "add-reserve-location" "${runtime_para_endpoint}" "${tmp_output_file}" "$reserve_location"
local hex_encoded_data=$(cat $tmp_output_file)
send_governance_transact "${relay_url}" "${relay_chain_seed}" "${runtime_para_id}" "${hex_encoded_data}" 200000000 12000
}
function remove_assets_transfer_send() {
local relay_url=$1
local relay_chain_seed=$2
local runtime_para_id=$3
local runtime_para_endpoint=$4
local bridged_network=$5
echo " calling remove_assets_transfer_send:"
echo " relay_url: ${relay_url}"
echo " relay_chain_seed: ${relay_chain_seed}"
echo " runtime_para_id: ${runtime_para_id}"
echo " runtime_para_endpoint: ${runtime_para_endpoint}"
echo " bridged_network: ${bridged_network}"
echo " params:"
local tmp_output_file=$(mktemp)
generate_hex_encoded_call_data "remove-exporter-config" "${runtime_para_endpoint}" "${tmp_output_file}" $bridged_network
local hex_encoded_data=$(cat $tmp_output_file)
send_governance_transact "${relay_url}" "${relay_chain_seed}" "${runtime_para_id}" "${hex_encoded_data}" 200000000 12000
}
# TODO: we need to fill sovereign account for bridge-hub, because, small ammouts does not match ExistentialDeposit, so no reserve pass
# SA for BH: MultiLocation { parents: 1, interior: X1(Parachain(1013)) } - 5Eg2fntRRwLinojmk3sh5xscp7F3S6Zzm5oDVtoLTALKiypR on Kusama Asset Hub
function transfer_asset_via_bridge() {
function limited_reserve_transfer_assets() {
local url=$1
local seed=$2
local target_account=$3
local target_global_consensus=$4
echo " calling transfer_asset_via_bridge:"
local destination=$3
local beneficiary=$4
local assets=$5
local fee_asset_item=$6
local weight_limit=$7
echo " calling limited_reserve_transfer_assets:"
echo " url: ${url}"
echo " seed: ${seed}"
echo " target_account: ${target_account}"
echo " target_global_consensus: ${target_global_consensus}"
echo " params:"
local assets=$(jq --null-input \
'
{
"V3": [
{
"id": {
"Concrete": {
"parents": 1,
"interior": "Here"
}
},
"fun": {
"Fungible": 100000000
}
}
]
}
'
)
local tmp_output_file=$(mktemp)
address_to_account_id_bytes "$target_account" "${tmp_output_file}"
local hex_encoded_data=$(cat $tmp_output_file)
local destination=$(jq --null-input \
--arg target_global_consensus "$target_global_consensus" \
--argjson hex_encoded_data "$hex_encoded_data" \
'
{
"V3": {
"parents": 2,
"interior": {
"X3": [
{
"GlobalConsensus": $target_global_consensus
},
{
"Parachain": 1000
},
{
"AccountId32": {
"id": $hex_encoded_data
}
}
]
}
}
}
'
)
echo ""
echo " assets:"
echo "${assets}"
echo ""
echo " destination:"
echo "${destination}"
echo " destination: ${destination}"
echo " beneficiary: ${beneficiary}"
echo " assets: ${assets}"
echo " fee_asset_item: ${fee_asset_item}"
echo " weight_limit: ${weight_limit}"
echo ""
echo "--------------------------------------------------"
polkadot-js-api \
--ws "${url?}" \
--seed "${seed?}" \
tx.bridgeTransfer.transferAssetViaBridge \
tx.polkadotXcm.limitedReserveTransferAssets \
"${destination}" \
"${beneficiary}" \
"${assets}" \
"${destination}"
"${fee_asset_item}" \
"${weight_limit}"
}
function ping_via_bridge() {
local url=$1
function claim_rewards() {
local runtime_para_endpoint=$1
local seed=$2
local target_account=$3
local target_global_consensus=$4
echo " calling ping_via_bridge:"
echo " url: ${url}"
local lane_id=$3
local bridged_chain_id=$4
local owner=$5
echo " calling claim_rewards:"
echo " runtime_para_endpoint: ${runtime_para_endpoint}"
echo " seed: ${seed}"
echo " target_account: ${target_account}"
echo " target_global_consensus: ${target_global_consensus}"
echo " params:"
local tmp_output_file=$(mktemp)
address_to_account_id_bytes "$target_account" "${tmp_output_file}"
local hex_encoded_data=$(cat $tmp_output_file)
local destination=$(jq --null-input \
--arg target_global_consensus "$target_global_consensus" \
--argjson hex_encoded_data "$hex_encoded_data" \
'
{
"V3": {
"parents": 2,
"interior": {
"X3": [
{
"GlobalConsensus": $target_global_consensus
},
{
"Parachain": 1000
},
{
"AccountId32": {
"id": $hex_encoded_data
}
}
]
}
}
}
'
)
echo ""
echo " destination:"
echo "${destination}"
echo " lane_id: ${lane_id}"
echo " bridged_chain_id: ${bridged_chain_id}"
echo " owner: ${owner}"
echo ""
local rewards_account_params=$(jq --null-input \
--arg lane_id "$lane_id" \
--arg bridged_chain_id "$bridged_chain_id" \
--arg owner "$owner" \
'{
"laneId": $lane_id,
"bridgedChainId": $bridged_chain_id,
"owner": $owner
}')
echo " rewards_account_params:"
echo "${rewards_account_params}"
echo "--------------------------------------------------"
polkadot-js-api \
--ws "${url?}" \
--ws "${runtime_para_endpoint}" \
--seed "${seed?}" \
tx.bridgeTransfer.pingViaBridge \
"${destination}"
tx.bridgeRelayers.claimRewards \
"${rewards_account_params}"
}
function init_ro_wo() {
@@ -573,7 +482,7 @@ function run_relay() {
--rococo-headers-to-bridge-hub-wococo-signer //Bob \
--rococo-parachains-to-bridge-hub-wococo-signer //Bob \
--bridge-hub-wococo-transactions-mortality 4 \
--lane 00000001
--lane "${LANE_ID}"
}
case "$1" in
@@ -582,93 +491,175 @@ case "$1" in
init_wo_ro
run_relay
;;
allow-transfers-local)
# this allows send transfers on asset hub kusama local (by governance-like)
./$0 "allow-transfer-on-asset-hub-kusama-local"
# this allows receive transfers on asset hub westend local (by governance-like)
./$0 "allow-transfer-on-asset-hub-westend-local"
;;
allow-transfer-on-asset-hub-kusama-local)
init-asset-hub-rococo-local)
ensure_polkadot_js_api
allow_assets_transfer_send \
# create foreign assets for native Wococo token (governance call on Rococo)
force_create_foreign_asset \
"ws://127.0.0.1:9942" \
"//Alice" \
1000 \
"ws://127.0.0.1:9910" \
1013 \
"Wococo" 1000
"$(jq --null-input '{ "parents": 2, "interior": { "X1": { "GlobalConsensus": "Wococo" } } }')" \
"$GLOBAL_CONSENSUS_WOCOCO_SOVEREIGN_ACCOUNT" \
10000000000 \
true
# drip SA which holds reserves
transfer_balance \
"ws://127.0.0.1:9910" \
"//Alice" \
"$GLOBAL_CONSENSUS_WOCOCO_ASSET_HUB_WOCOCO_1000_SOVEREIGN_ACCOUNT" \
$((1000000000 + 50000000000 * 20))
# HRMP
open_hrmp_channels \
"ws://127.0.0.1:9942" \
"//Alice" \
1000 1013 4 524288
open_hrmp_channels \
"ws://127.0.0.1:9942" \
"//Alice" \
1013 1000 4 524288
;;
allow-transfer-on-asset-hub-westend-local)
init-bridge-hub-rococo-local)
ensure_polkadot_js_api
allow_assets_transfer_receive \
# SA of sibling asset hub pays for the execution
transfer_balance \
"ws://127.0.0.1:8943" \
"//Alice" \
"$ASSET_HUB_ROCOCO_SOVEREIGN_ACCOUNT_AT_BRIDGE_HUB_ROCOCO" \
$((1000000000 + 50000000000 * 20))
# drip SA of lane dedicated to asset hub for paying rewards for delivery
transfer_balance \
"ws://127.0.0.1:8943" \
"//Alice" \
"$ON_BRIDGE_HUB_ROCOCO_SOVEREIGN_ACCOUNT_FOR_LANE_00000001_bhwo_ThisChain" \
$((1000000000 + 2000000000000))
# drip SA of lane dedicated to asset hub for paying rewards for delivery confirmation
transfer_balance \
"ws://127.0.0.1:8943" \
"//Alice" \
"$ON_BRIDGE_HUB_ROCOCO_SOVEREIGN_ACCOUNT_FOR_LANE_00000001_bhwo_BridgedChain" \
$((1000000000 + 2000000000000))
;;
init-asset-hub-wococo-local)
ensure_polkadot_js_api
# set Wococo flavor - set_storage with:
# - `key` is `HexDisplay::from(&asset_hub_rococo_runtime::xcm_config::Flavor::key())`
# - `value` is `HexDisplay::from(&asset_hub_rococo_runtime::RuntimeFlavor::Wococo.encode())`
set_storage \
"ws://127.0.0.1:9945" \
"//Alice" \
1000 \
"ws://127.0.0.1:9010" \
1014 \
"Rococo" \
1000
transfer_balance \
"ws://127.0.0.1:9010" \
"//Alice" \
"$ASSET_HUB_ROCOCO_1000_SOVEREIGN_ACCOUNT" \
$((1000000000 + 50000000000 * 20)) # ExistentialDeposit + maxTargetLocationFee * 20
# create foreign assets for native Kusama token (yes, Kusama, because we are using Kusama Asset Hub runtime on rococo)
"$(jq --null-input '[["0x48297505634037ef48c848c99c0b1f1b", "0x01"]]')"
# create foreign assets for native Rococo token (governance call on Wococo)
force_create_foreign_asset \
"ws://127.0.0.1:9945" \
"//Alice" \
1000 \
"ws://127.0.0.1:9010" \
"Kusama" \
"$ASSET_HUB_ROCOCO_1000_SOVEREIGN_ACCOUNT"
;;
remove-assets-transfer-from-asset-hub-kusama-local)
ensure_polkadot_js_api
remove_assets_transfer_send \
"ws://127.0.0.1:9942" \
"//Alice" \
1000 \
"ws://127.0.0.1:9910" \
"Wococo"
;;
transfer-asset-from-asset-hub-kusama-local)
ensure_polkadot_js_api
transfer_asset_via_bridge \
"ws://127.0.0.1:9910" \
"$ASSET_HUB_KUSAMA_ACCOUNT_SEED_FOR_LOCAL" \
"$ASSET_HUB_WOCOCO_ACCOUNT_SEED_FOR_LOCAL" \
"Wococo"
;;
ping-via-bridge-from-asset-hub-kusama-local)
ensure_polkadot_js_api
ping_via_bridge \
"ws://127.0.0.1:9910" \
"$ASSET_HUB_KUSAMA_ACCOUNT_SEED_FOR_LOCAL" \
"$ASSET_HUB_WOCOCO_ACCOUNT_SEED_FOR_LOCAL" \
"Wococo"
;;
transfer-asset-from-asset-hub-rococo)
ensure_polkadot_js_api
transfer_asset_via_bridge \
"wss://ws-rococo-rockmine2-collator-node-0.parity-testnet.parity.io" \
"$ASSET_HUB2_ROCOCO_1000_SOVEREIGN_ACCOUNT" \
"$ASSET_HUB_WOCOCO_ACCOUNT_ADDRESS_FOR_ROCOCO" \
"Wococo"
;;
ping-via-bridge-from-asset-hub-rococo)
ensure_polkadot_js_api
ping_via_bridge \
"wss://ws-rococo-rockmine2-collator-node-0.parity-testnet.parity.io" \
"${ASSET_HUB2_ROCOCO_1000_SOVEREIGN_ACCOUNT}" \
"$ASSET_HUB_WOCOCO_ACCOUNT_ADDRESS_FOR_ROCOCO" \
"Wococo"
;;
drip)
"$(jq --null-input '{ "parents": 2, "interior": { "X1": { "GlobalConsensus": "Rococo" } } }')" \
"$GLOBAL_CONSENSUS_ROCOCO_SOVEREIGN_ACCOUNT" \
10000000000 \
true
# drip SA which holds reserves
transfer_balance \
"ws://127.0.0.1:9010" \
"//Alice" \
"$ASSET_HUB_ROCOCO_1000_SOVEREIGN_ACCOUNT" \
"$GLOBAL_CONSENSUS_ROCOCO_ASSET_HUB_ROCOCO_1000_SOVEREIGN_ACCOUNT" \
$((1000000000 + 50000000000 * 20))
# HRMP
open_hrmp_channels \
"ws://127.0.0.1:9945" \
"//Alice" \
1000 1014 4 524288
open_hrmp_channels \
"ws://127.0.0.1:9945" \
"//Alice" \
1014 1000 4 524288
;;
init-bridge-hub-wococo-local)
# set Wococo flavor - set_storage with:
# - `key` is `HexDisplay::from(&bridge_hub_rococo_runtime::xcm_config::Flavor::key())`
# - `value` is `HexDisplay::from(&bridge_hub_rococo_runtime::RuntimeFlavor::Wococo.encode())`
set_storage \
"ws://127.0.0.1:9945" \
"//Alice" \
1014 \
"ws://127.0.0.1:8945" \
"$(jq --null-input '[["0x48297505634037ef48c848c99c0b1f1b", "0x01"]]')"
# SA of sibling asset hub pays for the execution
transfer_balance \
"ws://127.0.0.1:8945" \
"//Alice" \
"$ASSET_HUB_WOCOCO_SOVEREIGN_ACCOUNT_AT_BRIDGE_HUB_WOCOCO" \
$((1000000000 + 50000000000 * 20))
# drip SA of lane dedicated to asset hub for paying rewards for delivery
transfer_balance \
"ws://127.0.0.1:8945" \
"//Alice" \
"$ON_BRIDGE_HUB_WOCOCO_SOVEREIGN_ACCOUNT_FOR_LANE_00000001_bhro_ThisChain" \
$((1000000000 + 2000000000000))
# drip SA of lane dedicated to asset hub for paying rewards for delivery confirmation
transfer_balance \
"ws://127.0.0.1:8945" \
"//Alice" \
"$ON_BRIDGE_HUB_WOCOCO_SOVEREIGN_ACCOUNT_FOR_LANE_00000001_bhro_BridgedChain" \
$((1000000000 + 2000000000000))
;;
reserve-transfer-assets-from-asset-hub-rococo-local)
ensure_polkadot_js_api
# send ROCs to Alice account on AHW
limited_reserve_transfer_assets \
"ws://127.0.0.1:9910" \
"//Alice" \
"$(jq --null-input '{ "V3": { "parents": 2, "interior": { "X2": [ { "GlobalConsensus": "Wococo" }, { "Parachain": 1000 } ] } } }')" \
"$(jq --null-input '{ "V3": { "parents": 0, "interior": { "X1": { "AccountId32": { "id": [212, 53, 147, 199, 21, 253, 211, 28, 97, 20, 26, 189, 4, 169, 159, 214, 130, 44, 133, 88, 133, 76, 205, 227, 154, 86, 132, 231, 165, 109, 162, 125] } } } } }')" \
"$(jq --null-input '{ "V3": [ { "id": { "Concrete": { "parents": 1, "interior": "Here" } }, "fun": { "Fungible": 200000000000 } } ] }')" \
0 \
"Unlimited"
;;
reserve-transfer-assets-from-asset-hub-wococo-local)
ensure_polkadot_js_api
# send WOCs to Alice account on AHR
limited_reserve_transfer_assets \
"ws://127.0.0.1:9010" \
"//Alice" \
"$(jq --null-input '{ "V3": { "parents": 2, "interior": { "X2": [ { "GlobalConsensus": "Rococo" }, { "Parachain": 1000 } ] } } }')" \
"$(jq --null-input '{ "V3": { "parents": 0, "interior": { "X1": { "AccountId32": { "id": [212, 53, 147, 199, 21, 253, 211, 28, 97, 20, 26, 189, 4, 169, 159, 214, 130, 44, 133, 88, 133, 76, 205, 227, 154, 86, 132, 231, 165, 109, 162, 125] } } } } }')" \
"$(jq --null-input '{ "V3": [ { "id": { "Concrete": { "parents": 1, "interior": "Here" } }, "fun": { "Fungible": 150000000000 } } ] }')" \
0 \
"Unlimited"
;;
claim-rewards-bridge-hub-rococo-local)
ensure_polkadot_js_api
# bhwo -> [62, 68, 77, 6f] -> 0x6268776f
claim_rewards \
"ws://127.0.0.1:8943" \
"//Charlie" \
"0x${LANE_ID}" \
"0x6268776f" \
"ThisChain"
claim_rewards \
"ws://127.0.0.1:8943" \
"//Charlie" \
"0x${LANE_ID}" \
"0x6268776f" \
"BridgedChain"
;;
claim-rewards-bridge-hub-wococo-local)
# bhro -> [62, 68, 72, 6f] -> 0x6268726f
claim_rewards \
"ws://127.0.0.1:8945" \
"//Charlie" \
"0x${LANE_ID}" \
"0x6268726f" \
"ThisChain"
claim_rewards \
"ws://127.0.0.1:8945" \
"//Charlie" \
"0x${LANE_ID}" \
"0x6268726f" \
"BridgedChain"
;;
stop)
pkill -f polkadot
@@ -681,15 +672,14 @@ case "$1" in
echo "A command is require. Supported commands for:
Local (zombienet) run:
- run-relay
- allow-transfers-local
- allow-transfer-on-asset-hub-kusama-local
- allow-transfer-on-asset-hub-westend-local
- remove-assets-transfer-from-asset-hub-kusama-local
- transfer-asset-from-asset-hub-kusama-local
- ping-via-bridge-from-asset-hub-kusama-local
Live Rococo/Wococo run:
- transfer-asset-from-asset-hub-rococo
- ping-via-bridge-from-asset-hub-rococo";
- init-asset-hub-rococo-local
- init-bridge-hub-rococo-local
- init-asset-hub-wococo-local
- init-bridge-hub-wococo-local
- reserve-transfer-assets-from-asset-hub-rococo-local
- reserve-transfer-assets-from-asset-hub-wococo-local
- claim-rewards-bridge-hub-rococo-local
- claim-rewards-bridge-hub-wococo-local";
exit 1
;;
esac
@@ -106,6 +106,20 @@ function forceCreateAsset(endpoint, outputFile, assetId, assetOwnerAccountId, is
});
}
function setStorage(endpoint, outputFile, items) {
console.log(`Generating setStorage from RPC endpoint: ${endpoint} to outputFile: ${outputFile}, items: ${items}`);
connect(endpoint)
.then((api) => {
const call = api.tx.system.setStorage(JSON.parse(items));
writeHexEncodedBytesToOutput(call.method, outputFile);
exit(0);
})
.catch((e) => {
console.error(e);
exit(1);
});
}
if (!process.argv[2] || !process.argv[3]) {
console.log("usage: node ./script/generate_hex_encoded_call <type> <endpoint> <output hex-encoded data file> <input message>");
exit(1);
@@ -140,6 +154,9 @@ switch (type) {
case 'force-create-asset':
forceCreateAsset(rpcEnpoint, output, inputArgs[0], inputArgs[1], inputArgs[2], inputArgs[3]);
break;
case 'set-storage':
setStorage(rpcEnpoint, output, inputArgs[0]);
break;
case 'check':
console.log(`Checking nodejs installation, if you see this everything is ready!`);
break;
@@ -7,25 +7,25 @@ default_args = [ "-lparachain=debug,xcm=trace" ]
chain = "rococo-local"
[[relaychain.nodes]]
name = "alice-validator"
name = "alice-rococo-validator"
validator = true
rpc_port = 9932
ws_port = 9942
extra_args = ["--no-mdns --bootnodes {{'bob-validator'|zombie('multiAddress')}}"]
balance = 2000000000000
[[relaychain.nodes]]
name = "bob-validator"
name = "bob-rococo-validator"
validator = true
rpc_port = 9933
ws_port = 9943
extra_args = ["--no-mdns --bootnodes {{'alice-validator'|zombie('multiAddress')}}"]
balance = 2000000000000
[[relaychain.nodes]]
name = "charlie-validator"
name = "charlie-rococo-validator"
validator = true
rpc_port = 9934
ws_port = 9944
extra_args = ["--no-mdns --bootnodes {{'alice-validator'|zombie('multiAddress')}}"]
balance = 2000000000000
[[parachains]]
id = 1013
@@ -34,71 +34,61 @@ cumulus_based = true
# run alice as parachain collator
[[parachains.collators]]
name = "alice-collator"
name = "bridge-hub-rococo-collator1"
validator = true
command = "{{POLKADOT_PARACHAIN_BINARY_PATH}}"
rpc_port = 8933
ws_port = 8943
args = [
"-lparachain=debug,runtime::bridge-hub=trace,runtime::bridge=trace,runtime::bridge-dispatch=trace,bridge=trace,runtime::bridge-messages=trace,xcm=trace",
]
extra_args = [
"--force-authoring", "--no-mdns", "--bootnodes {{'bob-collator'|zombie('multiAddress')}}",
"-- --port 41333 --rpc-port 48933 --ws-port 48943 --no-mdns", "--bootnodes {{'alice-validator'|zombie('multiAddress')}}"
"--force-authoring",
"--", "--port 41333", "--rpc-port 48933", "--ws-port 48943"
]
# run bob as parachain collator
[[parachains.collators]]
name = "bob-collator"
name = "bridge-hub-rococo-collator2"
validator = true
command = "{{POLKADOT_PARACHAIN_BINARY_PATH}}"
rpc_port = 8934
ws_port = 8944
args = [
"-lparachain=trace,runtime::bridge-hub=trace,runtime::bridge=trace,runtime::bridge-dispatch=trace,bridge=trace,runtime::bridge-messages=trace,xcm=trace",
]
extra_args = [
"--force-authoring", "--no-mdns", "--bootnodes {{'alice-collator'|zombie('multiAddress')}}",
"-- --port 41334 --rpc-port 48934 --ws-port 48944 --no-mdns", "--bootnodes {{'bob-validator'|zombie('multiAddress')}}"
"--force-authoring",
"--", "--port 41334", "--rpc-port 48934", "--ws-port 48944"
]
[[parachains]]
id = 1000
chain = "asset-hub-kusama-local"
chain = "asset-hub-rococo-local"
cumulus_based = true
[[parachains.collators]]
name = "rockmine-collator1"
name = "asset-hub-rococo-collator1"
rpc_port = 9911
ws_port = 9910
command = "{{POLKADOT_PARACHAIN_BINARY_PATH_FOR_ASSET_HUB_ROCOCO}}"
args = [
"-lparachain=debug,xcm=trace,runtime::bridge-transfer=trace",
]
extra_args = [
"--no-mdns", "--bootnodes {{'rockmine-collator2'|zombie('multiAddress')}}",
"-- --port 51333 --rpc-port 58933 --ws-port 58943 --no-mdns", "--bootnodes {{'alice-validator'|zombie('multiAddress')}}"
"--", "--port 51333", "--rpc-port 58933", "--ws-port 58943"
]
[[parachains.collators]]
name = "rockmine-collator2"
name = "asset-hub-rococo-collator2"
command = "{{POLKADOT_PARACHAIN_BINARY_PATH_FOR_ASSET_HUB_ROCOCO}}"
args = [
"-lparachain=debug,xcm=trace,runtime::bridge-transfer=trace",
]
extra_args = [
"--no-mdns", "--bootnodes {{'rockmine-collator1'|zombie('multiAddress')}}",
"-- --port 51433 --rpc-port 58833 --ws-port 58843 --no-mdns", "--bootnodes {{'alice-validator'|zombie('multiAddress')}}"
"--", "--port 51433", "--rpc-port 58833", "--ws-port 58843"
]
[[hrmp_channels]]
sender = 1000
recipient = 1013
max_capacity = 4
max_message_size = 524288
[[hrmp_channels]]
sender = 1013
recipient = 1000
max_capacity = 4
max_message_size = 524288
#[[hrmp_channels]]
#sender = 1000
#recipient = 1013
#max_capacity = 4
#max_message_size = 524288
#
#[[hrmp_channels]]
#sender = 1013
#recipient = 1000
#max_capacity = 4
#max_message_size = 524288
@@ -7,25 +7,25 @@ default_args = [ "-lparachain=debug,xcm=trace" ]
chain = "wococo-local"
[[relaychain.nodes]]
name = "alice-validator-wo"
name = "alice-wococo-validator"
validator = true
rpc_port = 9935
ws_port = 9945
extra_args = ["--no-mdns --bootnodes {{'bob-validator-wo'|zombie('multiAddress')}}"]
balance = 2000000000000
[[relaychain.nodes]]
name = "bob-validator-wo"
name = "bob-wococo-validator"
validator = true
rpc_port = 9936
ws_port = 9946
extra_args = ["--no-mdns --bootnodes {{'alice-validator-wo'|zombie('multiAddress')}}"]
balance = 2000000000000
[[relaychain.nodes]]
name = "charlie-validator-wo"
name = "charlie-wococo-validator"
validator = true
rpc_port = 9937
ws_port = 9947
extra_args = ["--no-mdns --bootnodes {{'alice-validator-wo'|zombie('multiAddress')}}"]
balance = 2000000000000
[[parachains]]
id = 1014
@@ -34,71 +34,61 @@ cumulus_based = true
# run alice as parachain collator
[[parachains.collators]]
name = "alice-collator-wo"
name = "bridge-hub-wococo-collator1"
validator = true
command = "{{POLKADOT_PARACHAIN_BINARY_PATH}}"
rpc_port = 8935
ws_port = 8945
args = [
"-lparachain=debug,runtime::mmr=info,substrate=info,runtime=info,runtime::bridge-hub=trace,runtime::bridge=trace,runtime::bridge-dispatch=trace,bridge=trace,runtime::bridge-messages=trace,xcm=trace",
]
extra_args = [
"--force-authoring", "--no-mdns", "--bootnodes {{'bob-collator-wo'|zombie('multiAddress')}}",
"-- --port 41335 --rpc-port 48935 --ws-port 48945 --no-mdns", "--bootnodes {{'alice-validator-wo'|zombie('multiAddress')}}"
"--force-authoring",
"--", "--port 41335", "--rpc-port 48935", "--ws-port 48945"
]
# run bob as parachain collator
[[parachains.collators]]
name = "bob-collator-wo"
name = "bridge-hub-wococo-collator2"
validator = true
command = "{{POLKADOT_PARACHAIN_BINARY_PATH}}"
rpc_port = 8936
ws_port = 8946
args = [
"-lparachain=trace,runtime::mmr=info,substrate=info,runtime=info,runtime::bridge-hub=trace,runtime::bridge=trace,runtime::bridge-dispatch=trace,bridge=trace,runtime::bridge-messages=trace,xcm=trace",
]
extra_args = [
"--force-authoring", "--no-mdns", "--bootnodes {{'alice-collator-wo'|zombie('multiAddress')}}",
"-- --port 41336 --rpc-port 48936 --ws-port 48946 --no-mdns", "--bootnodes {{'bob-validator-wo'|zombie('multiAddress')}}"
"--force-authoring",
"--", "--port 41336", "--rpc-port 48936", "--ws-port 48946"
]
[[parachains]]
id = 1000
chain = "asset-hub-westend-local"
chain = "asset-hub-wococo-local"
cumulus_based = true
[[parachains.collators]]
name = "wockmint-collator1"
name = "asset-hub-wococo-collator1"
rpc_port = 9011
ws_port = 9010
command = "{{POLKADOT_PARACHAIN_BINARY_PATH_FOR_ASSET_HUB_WOCOCO}}"
args = [
"-lparachain=debug,xcm=trace,runtime::bridge-transfer=trace",
]
extra_args = [
"--no-mdns", "--bootnodes {{'wockmint-collator2'|zombie('multiAddress')}}",
"-- --port 31333 --rpc-port 38933 --ws-port 38943 --no-mdns", "--bootnodes {{'alice-validator-wo'|zombie('multiAddress')}}"
"--", "--port 31333", "--rpc-port 38933", "--ws-port 38943"
]
[[parachains.collators]]
name = "wockmint-collator2"
name = "asset-hub-wococo-collator2"
command = "{{POLKADOT_PARACHAIN_BINARY_PATH_FOR_ASSET_HUB_WOCOCO}}"
args = [
"-lparachain=debug,xcm=trace,runtime::bridge-transfer=trace",
]
extra_args = [
"--no-mdns", "--bootnodes {{'wockmint-collator1'|zombie('multiAddress')}}",
"-- --port 31433 --rpc-port 38833 --ws-port 38843 --no-mdns", "--bootnodes {{'alice-validator-wo'|zombie('multiAddress')}}"
"--", "--port 31433", "--rpc-port 38833", "--ws-port 38843"
]
[[hrmp_channels]]
sender = 1000
recipient = 1014
max_capacity = 4
max_message_size = 524288
[[hrmp_channels]]
sender = 1014
recipient = 1000
max_capacity = 4
max_message_size = 524288
#[[hrmp_channels]]
#sender = 1000
#recipient = 1014
#max_capacity = 4
#max_message_size = 524288
#
#[[hrmp_channels]]
#sender = 1014
#recipient = 1000
#max_capacity = 4
#max_message_size = 524288
+1 -1
View File
@@ -151,7 +151,7 @@ pub type Barrier = TrailingSetTopicAsId<(
AllowKnownQueryResponses<XcmPallet>,
WithComputedOrigin<
(
// If the message is one that immediately attemps to pay for execution, then allow it.
// If the message is one that immediately attempts to pay for execution, then allow it.
AllowTopLevelPaidExecutionFrom<Everything>,
// Messages coming from system parachains need not pay for execution.
AllowExplicitUnpaidExecutionFrom<IsChildSystemParachain<ParaId>>,
+1 -1
View File
@@ -137,7 +137,7 @@ pub type Barrier = TrailingSetTopicAsId<(
AllowKnownQueryResponses<XcmPallet>,
WithComputedOrigin<
(
// If the message is one that immediately attemps to pay for execution, then allow it.
// If the message is one that immediately attempts to pay for execution, then allow it.
AllowTopLevelPaidExecutionFrom<Everything>,
// Subscriptions for version tracking are OK.
AllowSubscriptionsFrom<OnlyParachains>,