Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XCM V5 - SetHints instruction #6566

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ fn test_set_asset_claimer_within_a_chain() {

type RuntimeCall = <AssetHubWestend as Chain>::RuntimeCall;
let asset_trap_xcm = Xcm::<RuntimeCall>::builder_unsafe()
.set_asset_claimer(bob_location.clone())
.set_hints(vec![AssetClaimer { location: bob_location.clone() }])
.withdraw_asset(assets.clone())
.clear_origin()
.build();
Expand Down Expand Up @@ -116,7 +116,7 @@ fn test_set_asset_claimer_between_the_chains() {
let assets: Assets = (Parent, trap_amount).into();
type RuntimeCall = <BridgeHubWestend as Chain>::RuntimeCall;
let trap_xcm = Xcm::<RuntimeCall>::builder_unsafe()
.set_asset_claimer(alice_bh_sibling.clone())
.set_hints(vec![AssetClaimer { location: alice_bh_sibling.clone() }])
.withdraw_asset(assets.clone())
.clear_origin()
.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ use alloc::vec::Vec;
use frame_support::weights::Weight;
use pallet_xcm_benchmarks_fungible::WeightInfo as XcmFungibleWeight;
use pallet_xcm_benchmarks_generic::WeightInfo as XcmGeneric;
use sp_runtime::BoundedVec;
use xcm::{
latest::{prelude::*, AssetTransferFilter},
DoubleEncoded,
Expand Down Expand Up @@ -172,8 +173,16 @@ impl<Call> XcmWeightInfo<Call> for AssetHubRococoXcmWeight<Call> {
fn clear_error() -> Weight {
XcmGeneric::<Runtime>::clear_error()
}
fn set_asset_claimer(_location: &Location) -> Weight {
XcmGeneric::<Runtime>::set_asset_claimer()
fn set_hints(hints: &BoundedVec<Hint, HintNumVariants>) -> Weight {
let mut weight = Weight::zero();
for hint in hints {
match hint {
AssetClaimer { .. } => {
weight = weight.saturating_add(XcmGeneric::<Runtime>::asset_claimer());
},
}
}
weight
}
fn claim_asset(_assets: &Assets, _ticket: &Location) -> Weight {
XcmGeneric::<Runtime>::claim_asset()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ impl<T: frame_system::Config> WeightInfo<T> {
// Minimum execution time: 5_803_000 picoseconds.
Weight::from_parts(5_983_000, 0)
}
pub fn set_asset_claimer() -> Weight {
pub fn asset_claimer() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ use alloc::vec::Vec;
use frame_support::weights::Weight;
use pallet_xcm_benchmarks_fungible::WeightInfo as XcmFungibleWeight;
use pallet_xcm_benchmarks_generic::WeightInfo as XcmGeneric;
use sp_runtime::BoundedVec;
use xcm::{
latest::{prelude::*, AssetTransferFilter},
DoubleEncoded,
Expand Down Expand Up @@ -172,8 +173,16 @@ impl<Call> XcmWeightInfo<Call> for AssetHubWestendXcmWeight<Call> {
fn clear_error() -> Weight {
XcmGeneric::<Runtime>::clear_error()
}
fn set_asset_claimer(_location: &Location) -> Weight {
XcmGeneric::<Runtime>::set_asset_claimer()
fn set_hints(hints: &BoundedVec<Hint, HintNumVariants>) -> Weight {
let mut weight = Weight::zero();
for hint in hints {
match hint {
AssetClaimer { .. } => {
weight = weight.saturating_add(XcmGeneric::<Runtime>::asset_claimer());
},
}
}
weight
}
fn claim_asset(_assets: &Assets, _ticket: &Location) -> Weight {
XcmGeneric::<Runtime>::claim_asset()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ impl<T: frame_system::Config> WeightInfo<T> {
// Minimum execution time: 5_580_000 picoseconds.
Weight::from_parts(5_950_000, 0)
}
pub fn set_asset_claimer() -> Weight {
pub fn asset_claimer() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ use codec::Encode;
use frame_support::weights::Weight;
use pallet_xcm_benchmarks_fungible::WeightInfo as XcmFungibleWeight;
use pallet_xcm_benchmarks_generic::WeightInfo as XcmGeneric;
use sp_runtime::BoundedVec;
use xcm::{
latest::{prelude::*, AssetTransferFilter},
DoubleEncoded,
Expand Down Expand Up @@ -253,8 +254,16 @@ impl<Call> XcmWeightInfo<Call> for BridgeHubRococoXcmWeight<Call> {
fn unpaid_execution(_: &WeightLimit, _: &Option<Location>) -> Weight {
XcmGeneric::<Runtime>::unpaid_execution()
}
fn set_asset_claimer(_location: &Location) -> Weight {
XcmGeneric::<Runtime>::set_asset_claimer()
fn set_hints(hints: &BoundedVec<Hint, HintNumVariants>) -> Weight {
let mut weight = Weight::zero();
for hint in hints {
match hint {
AssetClaimer { .. } => {
weight = weight.saturating_add(XcmGeneric::<Runtime>::asset_claimer());
},
}
}
weight
}
fn execute_with_origin(_: &Option<InteriorLocation>, _: &Xcm<Call>) -> Weight {
XcmGeneric::<Runtime>::execute_with_origin()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ impl<T: frame_system::Config> WeightInfo<T> {
// Minimum execution time: 1_085_000 picoseconds.
Weight::from_parts(1_161_000, 0)
}
pub fn set_asset_claimer() -> Weight {
pub fn asset_claimer() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ use codec::Encode;
use frame_support::weights::Weight;
use pallet_xcm_benchmarks_fungible::WeightInfo as XcmFungibleWeight;
use pallet_xcm_benchmarks_generic::WeightInfo as XcmGeneric;
use sp_runtime::BoundedVec;
use xcm::{
latest::{prelude::*, AssetTransferFilter},
DoubleEncoded,
Expand Down Expand Up @@ -174,8 +175,16 @@ impl<Call> XcmWeightInfo<Call> for BridgeHubWestendXcmWeight<Call> {
fn clear_error() -> Weight {
XcmGeneric::<Runtime>::clear_error()
}
fn set_asset_claimer(_location: &Location) -> Weight {
XcmGeneric::<Runtime>::set_asset_claimer()
fn set_hints(hints: &BoundedVec<Hint, HintNumVariants>) -> Weight {
let mut weight = Weight::zero();
for hint in hints {
match hint {
AssetClaimer { .. } => {
weight = weight.saturating_add(XcmGeneric::<Runtime>::asset_claimer());
},
}
}
weight
}
fn claim_asset(_assets: &Assets, _ticket: &Location) -> Weight {
XcmGeneric::<Runtime>::claim_asset()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ impl<T: frame_system::Config> WeightInfo<T> {
// Minimum execution time: 995_000 picoseconds.
Weight::from_parts(1_060_000, 0)
}
pub fn set_asset_claimer() -> Weight {
pub fn asset_claimer() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ use alloc::vec::Vec;
use frame_support::weights::Weight;
use pallet_xcm_benchmarks_fungible::WeightInfo as XcmFungibleWeight;
use pallet_xcm_benchmarks_generic::WeightInfo as XcmGeneric;
use sp_runtime::BoundedVec;
use xcm::{
latest::{prelude::*, AssetTransferFilter},
DoubleEncoded,
Expand Down Expand Up @@ -251,8 +252,16 @@ impl<Call> XcmWeightInfo<Call> for CoretimeRococoXcmWeight<Call> {
fn unpaid_execution(_: &WeightLimit, _: &Option<Location>) -> Weight {
XcmGeneric::<Runtime>::unpaid_execution()
}
fn set_asset_claimer(_location: &Location) -> Weight {
XcmGeneric::<Runtime>::set_asset_claimer()
fn set_hints(hints: &BoundedVec<Hint, HintNumVariants>) -> Weight {
let mut weight = Weight::zero();
for hint in hints {
match hint {
AssetClaimer { .. } => {
weight = weight.saturating_add(XcmGeneric::<Runtime>::asset_claimer());
},
}
}
weight
}
fn execute_with_origin(_: &Option<InteriorLocation>, _: &Xcm<Call>) -> Weight {
XcmGeneric::<Runtime>::execute_with_origin()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ impl<T: frame_system::Config> WeightInfo<T> {
// Minimum execution time: 650_000 picoseconds.
Weight::from_parts(673_000, 0)
}
pub fn set_asset_claimer() -> Weight {
pub fn asset_claimer() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ use alloc::vec::Vec;
use frame_support::weights::Weight;
use pallet_xcm_benchmarks_fungible::WeightInfo as XcmFungibleWeight;
use pallet_xcm_benchmarks_generic::WeightInfo as XcmGeneric;
use sp_runtime::BoundedVec;
use xcm::{
latest::{prelude::*, AssetTransferFilter},
DoubleEncoded,
Expand Down Expand Up @@ -172,8 +173,16 @@ impl<Call> XcmWeightInfo<Call> for CoretimeWestendXcmWeight<Call> {
fn clear_error() -> Weight {
XcmGeneric::<Runtime>::clear_error()
}
fn set_asset_claimer(_location: &Location) -> Weight {
XcmGeneric::<Runtime>::set_asset_claimer()
fn set_hints(hints: &BoundedVec<Hint, HintNumVariants>) -> Weight {
let mut weight = Weight::zero();
for hint in hints {
match hint {
AssetClaimer { .. } => {
weight = weight.saturating_add(XcmGeneric::<Runtime>::asset_claimer());
},
}
}
weight
}
fn claim_asset(_assets: &Assets, _ticket: &Location) -> Weight {
XcmGeneric::<Runtime>::claim_asset()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ impl<T: frame_system::Config> WeightInfo<T> {
// Minimum execution time: 624_000 picoseconds.
Weight::from_parts(659_000, 0)
}
pub fn set_asset_claimer() -> Weight {
pub fn asset_claimer() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ use alloc::vec::Vec;
use frame_support::weights::Weight;
use pallet_xcm_benchmarks_fungible::WeightInfo as XcmFungibleWeight;
use pallet_xcm_benchmarks_generic::WeightInfo as XcmGeneric;
use sp_runtime::BoundedVec;
use xcm::{
latest::{prelude::*, AssetTransferFilter},
DoubleEncoded,
Expand Down Expand Up @@ -250,8 +251,16 @@ impl<Call> XcmWeightInfo<Call> for PeopleRococoXcmWeight<Call> {
fn unpaid_execution(_: &WeightLimit, _: &Option<Location>) -> Weight {
XcmGeneric::<Runtime>::unpaid_execution()
}
fn set_asset_claimer(_location: &Location) -> Weight {
XcmGeneric::<Runtime>::set_asset_claimer()
fn set_hints(hints: &BoundedVec<Hint, HintNumVariants>) -> Weight {
let mut weight = Weight::zero();
for hint in hints {
match hint {
AssetClaimer { .. } => {
weight = weight.saturating_add(XcmGeneric::<Runtime>::asset_claimer());
},
}
}
weight
}
fn execute_with_origin(_: &Option<InteriorLocation>, _: &Xcm<Call>) -> Weight {
XcmGeneric::<Runtime>::execute_with_origin()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ impl<T: frame_system::Config> WeightInfo<T> {
// Minimum execution time: 685_000 picoseconds.
Weight::from_parts(757_000, 0)
}
pub fn set_asset_claimer() -> Weight {
pub fn asset_claimer() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ use alloc::vec::Vec;
use frame_support::weights::Weight;
use pallet_xcm_benchmarks_fungible::WeightInfo as XcmFungibleWeight;
use pallet_xcm_benchmarks_generic::WeightInfo as XcmGeneric;
use sp_runtime::BoundedVec;
use xcm::{
latest::{prelude::*, AssetTransferFilter},
DoubleEncoded,
Expand Down Expand Up @@ -250,8 +251,16 @@ impl<Call> XcmWeightInfo<Call> for PeopleWestendXcmWeight<Call> {
fn unpaid_execution(_: &WeightLimit, _: &Option<Location>) -> Weight {
XcmGeneric::<Runtime>::unpaid_execution()
}
fn set_asset_claimer(_location: &Location) -> Weight {
XcmGeneric::<Runtime>::set_asset_claimer()
fn set_hints(hints: &BoundedVec<Hint, HintNumVariants>) -> Weight {
let mut weight = Weight::zero();
for hint in hints {
match hint {
AssetClaimer { .. } => {
weight = weight.saturating_add(XcmGeneric::<Runtime>::asset_claimer());
},
}
}
weight
}
fn execute_with_origin(_: &Option<InteriorLocation>, _: &Xcm<Call>) -> Weight {
XcmGeneric::<Runtime>::execute_with_origin()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ impl<T: frame_system::Config> WeightInfo<T> {
// Minimum execution time: 598_000 picoseconds.
Weight::from_parts(655_000, 0)
}
pub fn set_asset_claimer() -> Weight {
pub fn asset_claimer() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
Expand Down
13 changes: 11 additions & 2 deletions polkadot/runtime/rococo/src/weights/xcm/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ use xcm::{latest::prelude::*, DoubleEncoded};

use pallet_xcm_benchmarks_fungible::WeightInfo as XcmBalancesWeight;
use pallet_xcm_benchmarks_generic::WeightInfo as XcmGeneric;
use sp_runtime::BoundedVec;
use xcm::latest::AssetTransferFilter;

/// Types of asset supported by the Rococo runtime.
Expand Down Expand Up @@ -286,8 +287,16 @@ impl<RuntimeCall> XcmWeightInfo<RuntimeCall> for RococoXcmWeight<RuntimeCall> {
fn unpaid_execution(_: &WeightLimit, _: &Option<Location>) -> Weight {
XcmGeneric::<Runtime>::unpaid_execution()
}
fn set_asset_claimer(_location: &Location) -> Weight {
XcmGeneric::<Runtime>::set_asset_claimer()
fn set_hints(hints: &BoundedVec<Hint, HintNumVariants>) -> Weight {
let mut weight = Weight::zero();
for hint in hints {
match hint {
AssetClaimer { .. } => {
weight = weight.saturating_add(XcmGeneric::<Runtime>::asset_claimer());
},
}
}
weight
}
fn execute_with_origin(_: &Option<InteriorLocation>, _: &Xcm<RuntimeCall>) -> Weight {
XcmGeneric::<Runtime>::execute_with_origin()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ impl<T: frame_system::Config> WeightInfo<T> {
// Minimum execution time: 2_899_000 picoseconds.
Weight::from_parts(3_090_000, 0)
}
pub(crate) fn set_asset_claimer() -> Weight {
pub(crate) fn asset_claimer() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
Expand Down
15 changes: 11 additions & 4 deletions polkadot/runtime/westend/src/weights/xcm/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ use xcm::{

use pallet_xcm_benchmarks_fungible::WeightInfo as XcmBalancesWeight;
use pallet_xcm_benchmarks_generic::WeightInfo as XcmGeneric;
use sp_runtime::BoundedVec;
use xcm::latest::AssetTransferFilter;

/// Types of asset supported by the westend runtime.
Expand Down Expand Up @@ -204,11 +205,17 @@ impl<RuntimeCall> XcmWeightInfo<RuntimeCall> for WestendXcmWeight<RuntimeCall> {
fn clear_error() -> Weight {
XcmGeneric::<Runtime>::clear_error()
}

fn set_asset_claimer(_location: &Location) -> Weight {
XcmGeneric::<Runtime>::set_asset_claimer()
fn set_hints(hints: &BoundedVec<Hint, HintNumVariants>) -> Weight {
let mut weight = Weight::zero();
for hint in hints {
match hint {
AssetClaimer { .. } => {
weight = weight.saturating_add(XcmGeneric::<Runtime>::asset_claimer());
},
}
}
weight
}

fn claim_asset(_assets: &Assets, _ticket: &Location) -> Weight {
XcmGeneric::<Runtime>::claim_asset()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ impl<T: frame_system::Config> WeightInfo<T> {
// Minimum execution time: 3_096_000 picoseconds.
Weight::from_parts(3_313_000, 0)
}
pub(crate) fn set_asset_claimer() -> Weight {
pub(crate) fn asset_claimer() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
Expand Down
Loading