Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
f10d1f8
migrate alliance, fast-unstake and bags list to use derive-impl (#1636)
kianenigma Oct 1, 2023
aba60cb
Bump the known_good_semver group with 1 update (#1802)
dependabot[bot] Oct 6, 2023
6ef8495
[xcm] Use `Weight::MAX` for `reserve_asset_deposited`, `receive_telep…
bkontur Oct 10, 2023
1f605f9
allow treasury to do reserve asset transfers (#1447)
samelamin Oct 12, 2023
e1b2b2c
[xcm] Small enhancements for `NetworkExportTable` and `xcm-builder` (…
bkontur Oct 17, 2023
e3b7ecb
nit: use traits::tokens::fungible => use traits::fungible (#1753)
gilescope Oct 17, 2023
b6fd84e
increase MAX_ASSETS_FOR_BUY_EXECUTION (#1733)
xlc Oct 17, 2023
cfdf01e
Add Runtime Missing Crate Descriptions (#1909)
joepetrowski Oct 18, 2023
48a4578
Introduce XcmFeesToAccount fee manager (#1234)
KiChjang Oct 18, 2023
6363deb
`xcm`: Change `TypeInfo::path` to not include `staging` (#1948)
bkchr Oct 20, 2023
be68e47
Ensure correct variant count in `Runtime[Hold/Freeze]Reason` (#1900)
kianenigma Oct 24, 2023
ec9b237
Improve features dev-ex (#1831)
ggwpez Oct 24, 2023
ce01d18
Direct XCM `ExportMessage` fees for different bridges to different re…
serban300 Nov 1, 2023
d7ddb77
[FRAME] Short-circuit fungible self transfer (#2118)
ggwpez Nov 1, 2023
97a4578
XCM MultiAssets: sort after reanchoring (#2129)
serban300 Nov 2, 2023
bb88a12
Use `Message Queue` as DMP and XCMP dispatch queue (#1246)
ggwpez Nov 2, 2023
0e5a8c2
XCM builder pattern (#2107)
franciscoaguirre Nov 8, 2023
ac9bfcb
Make PalletInfo fields public (#2231)
franciscoaguirre Nov 8, 2023
03ef3cf
Remove unnecessary map_error (#2239)
KiChjang Nov 9, 2023
45abe41
Add descriptions to all published crates (#2029)
ggwpez Nov 9, 2023
206c597
Improve `VersionedMigration` naming conventions (#2264)
liamaharon Nov 10, 2023
47226e6
Contracts: Add XCM traits to interface with contracts (#2086)
pgherveou Nov 10, 2023
fef1319
pallet-xcm: enhance `reserve_transfer_assets` to support remote reser…
acatangiu Nov 13, 2023
ed7e152
Fix `expect_pallet` benchmarks not relaying on hard-coded `frame_syst…
bkontur Nov 14, 2023
050590b
Contracts expose pallet-xcm (#1248)
pgherveou Nov 14, 2023
4d64fd6
pallet-xcm: use XcmTeleportFilter for teleported fees in reserve tran…
acatangiu Nov 15, 2023
028e9a0
xcm: SovereignPaidRemoteExporter: remove unused RefundSurplus instruc…
acatangiu Nov 15, 2023
4833844
Different XCM builders, default one requires fee payment (#2253)
franciscoaguirre Nov 21, 2023
8161848
pallet-xcm: ensure xcm outcome is always complete, revert effects oth…
xlc Nov 24, 2023
1fadbf0
pallet-xcm: fix benchmarking (#2489)
acatangiu Nov 24, 2023
084683c
Added NetworkId::PolkadotBulletin variant (#2517)
svyatonik Nov 28, 2023
66b7eca
Moves all test runtimes to use `derive_impl` (#2409)
gupnik Nov 28, 2023
8ed0d91
Bump the known_good_semver group with 2 updates (#2570)
dependabot[bot] Nov 30, 2023
884b714
Enforce consistent and correct toml formatting (#2518)
liamaharon Dec 1, 2023
7e20f20
Bump the known_good_semver group with 1 update (#2575)
dependabot[bot] Dec 1, 2023
c0b2711
pallet-xcm: add new flexible `transfer_assets()` call/extrinsic (#2388)
acatangiu Dec 6, 2023
6a38610
feat(xcm): support json schema (for CosmWasm VM support) (#1454)
dzmitry-lahoda Dec 7, 2023
7742c54
pallet-xcm: fix test benchmarks (#2679)
acatangiu Dec 11, 2023
7b8f275
Bump the known_good_semver group with 2 updates (#2675)
dependabot[bot] Dec 11, 2023
28ca8cb
Ensure xcm versions over bridge (on sending chains) (#2481)
bkontur Dec 12, 2023
067bc40
Set clippy lints in workspace (requires rust 1.74) (#2390)
gilescope Dec 13, 2023
e805395
Add FungibleAdapter (#2684)
franciscoaguirre Dec 14, 2023
22de005
Bump the known_good_semver group with 1 update (#2698)
dependabot[bot] Dec 14, 2023
13ff299
Relaxed clippy fixes/nits (#2661)
bkontur Dec 18, 2023
df0f61a
Fix clippy lints behind feature gates and add new CI step all feature…
seadanda Dec 20, 2023
9163e46
xcm: Improve debuggability (#2799)
bkchr Dec 26, 2023
9af9081
Bump the known_good_semver group with 2 updates (#2810)
dependabot[bot] Dec 28, 2023
d828107
Bump the known_good_semver group with 4 updates (#2845)
dependabot[bot] Jan 4, 2024
fcba5a8
Bump the known_good_semver group with 4 updates (#2865)
dependabot[bot] Jan 7, 2024
25db393
Bump trybuild from 1.0.83 to 1.0.88 (#2902)
dependabot[bot] Jan 10, 2024
79fa8fb
XCMv4 (#1230)
franciscoaguirre Jan 16, 2024
6fa1efe
Filter votes from disabled validators in `BackedCandidates` in proces…
tdimitrov Jan 18, 2024
9286cd7
Switch All `construct_runtime`s to New Syntax (#2979)
joepetrowski Jan 22, 2024
9e69eeb
Add unit impl for XcmAssetTransfers trait (#3022)
franciscoaguirre Jan 23, 2024
0690605
rpc: backpressured RPC server (bump jsonrpsee 0.20) (#1313)
niklasad1 Jan 23, 2024
2870a4b
Transactional processing for XCM (#1222)
vstam1 Jan 24, 2024
e657452
Bump arbitrary from 1.3.0 to 1.3.2 (#3037)
dependabot[bot] Jan 24, 2024
a6d7975
Merge commit 'e657452c10676ab8d5d65d1d3d6e01507d05f432'
franciscoaguirre Jan 25, 2024
5ba9eb2
Fix conflicts
franciscoaguirre Jan 25, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
202 changes: 138 additions & 64 deletions Cargo.lock

Large diffs are not rendered by default.

14 changes: 9 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,16 @@ version.workspace = true
license.workspace = true

[dependencies]
bounded-collections = { version = "0.1.8", default-features = false, features = ["serde"] }
derivative = { version = "2.2.0", default-features = false, features = [ "use_core" ] }
array-bytes = "6.1"
bounded-collections = { version = "0.1.9", default-features = false, features = ["serde"] }
derivative = { version = "2.2.0", default-features = false, features = ["use_core"] }
impl-trait-for-tuples = "0.2.2"
log = { version = "0.4.17", default-features = false }
parity-scale-codec = { version = "3.6.1", default-features = false, features = [ "derive", "max-encoded-len" ] }
scale-info = { version = "2.5.0", default-features = false, features = ["derive", "serde"] }
parity-scale-codec = { version = "3.6.1", default-features = false, features = ["derive", "max-encoded-len"] }
scale-info = { version = "2.10.0", default-features = false, features = ["derive", "serde"] }
sp-weights = { git = "https://github.com/paritytech/polkadot-sdk", branch = "master", default-features = false, features = ["serde"] }
serde = { version = "1.0.188", default-features = false, features = ["alloc", "derive"] }
serde = { version = "1.0.195", default-features = false, features = ["alloc", "derive", "rc"] }
schemars = { version = "0.8.13", default-features = true, optional = true }
xcm-procedural = { path = "procedural" }
environmental = { version = "1.1.4", default-features = false }

Expand All @@ -29,11 +31,13 @@ wasm-api = []
std = [
"bounded-collections/std",
"environmental/std",
"log/std",
"parity-scale-codec/std",
"scale-info/std",
"serde/std",
"sp-weights/std",
]
json-schema = ["bounded-collections/json-schema", "dep:schemars"]

[workspace]
resolver = "2"
Expand Down
7 changes: 5 additions & 2 deletions pallet-xcm-benchmarks/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@ authors.workspace = true
edition.workspace = true
license.workspace = true
version.workspace = true
description = "Benchmarks for the XCM pallet"

[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]

[dependencies]
codec = { package = "parity-scale-codec", version = "3.6.1", default-features = false }
log = "0.4.17"
scale-info = { version = "2.5.0", default-features = false, features = ["derive"] }
scale-info = { version = "2.10.0", default-features = false, features = ["derive"] }
frame-benchmarking = { git = "https://github.com/paritytech/polkadot-sdk", branch = "master", default-features = false }
frame-support = { git = "https://github.com/paritytech/polkadot-sdk", branch = "master", default-features = false }
frame-system = { git = "https://github.com/paritytech/polkadot-sdk", branch = "master", default-features = false }
Expand All @@ -35,12 +36,14 @@ polkadot-runtime-common = { git = "https://github.com/paritytech/polkadot-sdk",
polkadot-primitives = { git = "https://github.com/paritytech/polkadot-sdk", branch = "master" }

[features]
default = [ "std" ]
default = ["std"]
std = [
"codec/std",
"frame-benchmarking/std",
"frame-support/std",
"frame-system/std",
"log/std",
"scale-info/std",
"sp-io/std",
"sp-runtime/std",
"sp-std/std",
Expand Down
97 changes: 53 additions & 44 deletions pallet-xcm-benchmarks/src/fungible/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,17 @@
// along with Polkadot. If not, see <http://www.gnu.org/licenses/>.

use super::*;
use crate::{account_and_location, new_executor, AssetTransactorOf, XcmCallOf};
use crate::{account_and_location, new_executor, AssetTransactorOf, EnsureDelivery, XcmCallOf};
use frame_benchmarking::{benchmarks_instance_pallet, BenchmarkError, BenchmarkResult};
use frame_support::{
pallet_prelude::Get,
traits::fungible::{Inspect, Mutate},
weights::Weight,
};
use sp_runtime::traits::{Bounded, Zero};
use sp_std::{prelude::*, vec};
use xcm::latest::prelude::*;
use xcm_executor::traits::{ConvertLocation, TransactAsset};
use xcm::latest::{prelude::*, MAX_ITEMS_IN_ASSETS};
use xcm_executor::traits::{ConvertLocation, FeeReason, TransactAsset};

benchmarks_instance_pallet! {
where_clause { where
Expand All @@ -42,17 +43,9 @@ benchmarks_instance_pallet! {
withdraw_asset {
let (sender_account, sender_location) = account_and_location::<T>(1);
let worst_case_holding = T::worst_case_holding(0);
let asset = T::get_multi_asset();
let asset = T::get_asset();

<AssetTransactorOf<T>>::deposit_asset(
&asset,
&sender_location,
&XcmContext {
origin: Some(sender_location.clone()),
message_id: [0; 32],
topic: None,
},
).unwrap();
<AssetTransactorOf<T>>::deposit_asset(&asset, &sender_location, None).unwrap();
// check the assets of origin.
assert!(!T::TransactAsset::balance(&sender_account).is_zero());

Expand All @@ -70,22 +63,14 @@ benchmarks_instance_pallet! {

transfer_asset {
let (sender_account, sender_location) = account_and_location::<T>(1);
let asset = T::get_multi_asset();
let assets: MultiAssets = vec![ asset.clone() ].into();
let asset = T::get_asset();
let assets: Assets = vec![ asset.clone() ].into();
// this xcm doesn't use holding

let dest_location = T::valid_destination()?;
let dest_account = T::AccountIdConverter::convert_location(&dest_location).unwrap();

<AssetTransactorOf<T>>::deposit_asset(
&asset,
&sender_location,
&XcmContext {
origin: Some(sender_location.clone()),
message_id: [0; 32],
topic: None,
},
).unwrap();
<AssetTransactorOf<T>>::deposit_asset(&asset, &sender_location, None).unwrap();
assert!(T::TransactAsset::balance(&dest_account).is_zero());

let mut executor = new_executor::<T>(sender_location);
Expand All @@ -103,20 +88,27 @@ benchmarks_instance_pallet! {
let dest_location = T::valid_destination()?;
let dest_account = T::AccountIdConverter::convert_location(&dest_location).unwrap();

let asset = T::get_multi_asset();
<AssetTransactorOf<T>>::deposit_asset(
&asset,
let (expected_fees_mode, expected_assets_in_holding) = T::DeliveryHelper::ensure_successful_delivery(
&sender_location,
&XcmContext {
origin: Some(sender_location.clone()),
message_id: [0; 32],
topic: None,
},
).unwrap();
let assets: MultiAssets = vec![ asset ].into();
&dest_location,
FeeReason::TransferReserveAsset
);
let sender_account_balance_before = T::TransactAsset::balance(&sender_account);

let asset = T::get_asset();
<AssetTransactorOf<T>>::deposit_asset(&asset, &sender_location, None).unwrap();
assert!(T::TransactAsset::balance(&sender_account) > sender_account_balance_before);
let assets: Assets = vec![asset].into();
assert!(T::TransactAsset::balance(&dest_account).is_zero());

let mut executor = new_executor::<T>(sender_location);
if let Some(expected_fees_mode) = expected_fees_mode {
executor.set_fees_mode(expected_fees_mode);
}
if let Some(expected_assets_in_holding) = expected_assets_in_holding {
executor.set_holding(expected_assets_in_holding.into());
}

let instruction = Instruction::TransferReserveAsset {
assets,
dest: dest_location,
Expand All @@ -126,18 +118,18 @@ benchmarks_instance_pallet! {
}: {
executor.bench_process(xcm)?;
} verify {
assert!(T::TransactAsset::balance(&sender_account).is_zero());
assert!(T::TransactAsset::balance(&sender_account) <= sender_account_balance_before);
assert!(!T::TransactAsset::balance(&dest_account).is_zero());
// TODO: Check sender queue is not empty. #4426
}

reserve_asset_deposited {
let (trusted_reserve, transferable_reserve_asset) = T::TrustedReserve::get()
.ok_or(BenchmarkError::Override(
BenchmarkResult::from_weight(T::BlockWeights::get().max_block)
BenchmarkResult::from_weight(Weight::MAX)
))?;

let assets: MultiAssets = vec![ transferable_reserve_asset ].into();
let assets: Assets = vec![ transferable_reserve_asset ].into();

let mut executor = new_executor::<T>(trusted_reserve);
let instruction = Instruction::ReserveAssetDeposited(assets.clone());
Expand All @@ -149,16 +141,33 @@ benchmarks_instance_pallet! {
}

initiate_reserve_withdraw {
let (sender_account, sender_location) = account_and_location::<T>(1);
let holding = T::worst_case_holding(1);
let assets_filter = MultiAssetFilter::Definite(holding.clone());
let assets_filter = AssetFilter::Definite(holding.clone().into_inner().into_iter().take(MAX_ITEMS_IN_ASSETS).collect::<Vec<_>>().into());
let reserve = T::valid_destination().map_err(|_| BenchmarkError::Skip)?;
let mut executor = new_executor::<T>(Default::default());

let (expected_fees_mode, expected_assets_in_holding) = T::DeliveryHelper::ensure_successful_delivery(
&sender_location,
&reserve,
FeeReason::InitiateReserveWithdraw,
);
let sender_account_balance_before = T::TransactAsset::balance(&sender_account);

let mut executor = new_executor::<T>(sender_location);
executor.set_holding(holding.into());
if let Some(expected_fees_mode) = expected_fees_mode {
executor.set_fees_mode(expected_fees_mode);
}
if let Some(expected_assets_in_holding) = expected_assets_in_holding {
executor.set_holding(expected_assets_in_holding.into());
}
let instruction = Instruction::InitiateReserveWithdraw { assets: assets_filter, reserve, xcm: Xcm(vec![]) };
let xcm = Xcm(vec![instruction]);
}: {
executor.bench_process(xcm)?;
} verify {
// Check we charged the delivery fees
assert!(T::TransactAsset::balance(&sender_account) <= sender_account_balance_before);
// The execute completing successfully is as good as we can check.
// TODO: Potentially add new trait to XcmSender to detect a queued outgoing message. #4426
}
Expand All @@ -179,23 +188,23 @@ benchmarks_instance_pallet! {
)?;
}

let assets: MultiAssets = vec![ teleportable_asset ].into();
let assets: Assets = vec![ teleportable_asset ].into();

let mut executor = new_executor::<T>(trusted_teleporter);
let instruction = Instruction::ReceiveTeleportedAsset(assets.clone());
let xcm = Xcm(vec![instruction]);
}: {
executor.bench_process(xcm).map_err(|_| {
BenchmarkError::Override(
BenchmarkResult::from_weight(T::BlockWeights::get().max_block)
BenchmarkResult::from_weight(Weight::MAX)
)
})?;
} verify {
assert!(executor.holding().ensure_contains(&assets).is_ok());
}

deposit_asset {
let asset = T::get_multi_asset();
let asset = T::get_asset();
let mut holding = T::worst_case_holding(1);

// Add our asset to the holding.
Expand All @@ -221,7 +230,7 @@ benchmarks_instance_pallet! {
}

deposit_reserve_asset {
let asset = T::get_multi_asset();
let asset = T::get_asset();
let mut holding = T::worst_case_holding(1);

// Add our asset to the holding.
Expand All @@ -248,7 +257,7 @@ benchmarks_instance_pallet! {
}

initiate_teleport {
let asset = T::get_multi_asset();
let asset = T::get_asset();
let mut holding = T::worst_case_holding(0);

// Add our asset to the holding.
Expand Down
Loading