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-builder] Replaced deprecated CurrencyAdapter with FungibleAdapter #3287

Merged
merged 9 commits into from
Feb 13, 2024
1 change: 1 addition & 0 deletions bridges/snowbridge/runtime/test-common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ pub fn send_transfer_token_message_success<Runtime, XcmConfig>(
let channel_id: ChannelId = origin.into();

let nonce = snowbridge_pallet_outbound_queue::Nonce::<Runtime>::try_get(channel_id);
dbg!(&nonce);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should probably remove this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

assert_ok!(nonce);
assert_eq!(nonce.unwrap(), 1);

Expand Down
8 changes: 3 additions & 5 deletions cumulus/pallets/xcmp-queue/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,9 @@ use sp_runtime::{
BuildStorage,
};
use xcm::prelude::*;
#[allow(deprecated)]
use xcm_builder::CurrencyAdapter;
use xcm_builder::{
FixedWeightBounds, FrameTransactionalProcessor, IsConcrete, NativeAsset, ParentIsPreset,
FixedWeightBounds, FrameTransactionalProcessor, FungibleAdapter, IsConcrete, NativeAsset,
ParentIsPreset,
};
use xcm_executor::traits::ConvertOrigin;

Expand Down Expand Up @@ -133,8 +132,7 @@ parameter_types! {
}

/// Means for transacting assets on this chain.
#[allow(deprecated)]
pub type LocalAssetTransactor = CurrencyAdapter<
pub type LocalAssetTransactor = FungibleAdapter<
// Use this currency:
Balances,
// Use this currency when it is a fungible asset matching the given location or name:
Expand Down
13 changes: 5 additions & 8 deletions cumulus/parachain-template/runtime/src/xcm_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,13 @@ use pallet_xcm::XcmPassthrough;
use polkadot_parachain_primitives::primitives::Sibling;
use polkadot_runtime_common::impls::ToAuthor;
use xcm::latest::prelude::*;
#[allow(deprecated)]
use xcm_builder::CurrencyAdapter;
use xcm_builder::{
AccountId32Aliases, AllowExplicitUnpaidExecutionFrom, AllowTopLevelPaidExecutionFrom,
DenyReserveTransferToRelayChain, DenyThenTry, EnsureXcmOrigin, FixedWeightBounds,
FrameTransactionalProcessor, IsConcrete, NativeAsset, ParentIsPreset, RelayChainAsNative,
SiblingParachainAsNative, SiblingParachainConvertsVia, SignedAccountId32AsNative,
SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit, TrailingSetTopicAsId,
UsingComponents, WithComputedOrigin, WithUniqueTopic,
FrameTransactionalProcessor, FungibleAdapter, IsConcrete, NativeAsset, ParentIsPreset,
RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia,
SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit,
TrailingSetTopicAsId, UsingComponents, WithComputedOrigin, WithUniqueTopic,
};
use xcm_executor::XcmExecutor;

Expand All @@ -44,8 +42,7 @@ pub type LocationToAccountId = (
);

/// Means for transacting assets on this chain.
#[allow(deprecated)]
pub type LocalAssetTransactor = CurrencyAdapter<
pub type LocalAssetTransactor = FungibleAdapter<
// Use this currency:
Balances,
// Use this currency when it is a fungible asset matching the given location or name:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ macro_rules! test_parachain_is_trusted_teleporter {
$crate::macros::cumulus_pallet_xcmp_queue::Event::XcmpMessageSent { .. }
) => {},
RuntimeEvent::Balances(
$crate::macros::pallet_balances::Event::Withdraw { who: sender, amount }
$crate::macros::pallet_balances::Event::Burned { who: sender, amount }
) => {},
]
);
Expand All @@ -90,7 +90,7 @@ macro_rules! test_parachain_is_trusted_teleporter {
$receiver_para,
vec![
RuntimeEvent::Balances(
$crate::macros::pallet_balances::Event::Deposit { who: receiver, .. }
$crate::macros::pallet_balances::Event::Minted { who: receiver, .. }
) => {},
RuntimeEvent::MessageQueue(
$crate::macros::pallet_message_queue::Event::Processed { success: true, .. }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ fn para_receiver_assertions<Test>(_: Test) {
assert_expected_events!(
PenpalA,
vec![
RuntimeEvent::Balances(pallet_balances::Event::Deposit { .. }) => {},
RuntimeEvent::Balances(pallet_balances::Event::Minted { .. }) => {},
RuntimeEvent::MessageQueue(
pallet_message_queue::Event::Processed { success: true, .. }
) => {},
Expand All @@ -82,7 +82,7 @@ fn para_to_system_para_sender_assertions(t: ParaToSystemParaTest) {
vec![
// Amount to reserve transfer is transferred to Parachain's Sovereign account
RuntimeEvent::Balances(
pallet_balances::Event::Withdraw { who, amount }
pallet_balances::Event::Burned { who, amount }
) => {
who: *who == t.sender.account_id,
amount: *amount == t.args.amount,
Expand All @@ -101,12 +101,12 @@ fn para_to_system_para_receiver_assertions(t: ParaToSystemParaTest) {
vec![
// Amount to reserve transfer is withdrawn from Parachain's Sovereign account
RuntimeEvent::Balances(
pallet_balances::Event::Withdraw { who, amount }
pallet_balances::Event::Burned { who, amount }
) => {
who: *who == sov_penpal_on_ahr.clone().into(),
amount: *amount == t.args.amount,
},
RuntimeEvent::Balances(pallet_balances::Event::Deposit { .. }) => {},
RuntimeEvent::Balances(pallet_balances::Event::Minted { .. }) => {},
RuntimeEvent::MessageQueue(
pallet_message_queue::Event::Processed { success: true, .. }
) => {},
Expand Down Expand Up @@ -143,7 +143,7 @@ fn system_para_to_para_assets_receiver_assertions<Test>(_: Test) {
assert_expected_events!(
PenpalA,
vec![
RuntimeEvent::Balances(pallet_balances::Event::Deposit { .. }) => {},
RuntimeEvent::Balances(pallet_balances::Event::Minted { .. }) => {},
RuntimeEvent::Assets(pallet_assets::Event::Issued { .. }) => {},
RuntimeEvent::MessageQueue(
pallet_message_queue::Event::Processed { success: true, .. }
Expand All @@ -160,7 +160,7 @@ fn para_to_para_sender_assertions(t: ParaToParaTest) {
vec![
// Amount to reserve transfer is transferred to Parachain's Sovereign account
RuntimeEvent::Balances(
pallet_balances::Event::Withdraw { who, amount }
pallet_balances::Event::Burned { who, amount }
) => {
who: *who == t.sender.account_id,
amount: *amount == t.args.amount,
Expand All @@ -184,14 +184,14 @@ fn para_to_para_relay_hop_assertions(t: ParaToParaTest) {
vec![
// Withdrawn from sender parachain SA
RuntimeEvent::Balances(
pallet_balances::Event::Withdraw { who, amount }
pallet_balances::Event::Burned { who, amount }
) => {
who: *who == sov_penpal_a_on_rococo,
amount: *amount == t.args.amount,
},
// Deposited to receiver parachain SA
RuntimeEvent::Balances(
pallet_balances::Event::Deposit { who, .. }
pallet_balances::Event::Minted { who, .. }
) => {
who: *who == sov_penpal_b_on_rococo,
},
Expand All @@ -207,7 +207,7 @@ fn para_to_para_receiver_assertions(_: ParaToParaTest) {
assert_expected_events!(
PenpalB,
vec![
RuntimeEvent::Balances(pallet_balances::Event::Deposit { .. }) => {},
RuntimeEvent::Balances(pallet_balances::Event::Minted { .. }) => {},
RuntimeEvent::MessageQueue(
pallet_message_queue::Event::Processed { success: true, .. }
) => {},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ fn relay_origin_assertions(t: RelayToSystemParaTest) {
Rococo,
vec![
// Amount to teleport is withdrawn from Sender
RuntimeEvent::Balances(pallet_balances::Event::Withdraw { who, amount }) => {
RuntimeEvent::Balances(pallet_balances::Event::Burned { 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 }) => {
RuntimeEvent::Balances(pallet_balances::Event::Minted { who, amount }) => {
who: *who == <Rococo as RococoPallet>::XcmPallet::check_account(),
amount: *amount == t.args.amount,
},
Expand All @@ -54,12 +54,12 @@ fn relay_dest_assertions(t: SystemParaToRelayTest) {
Rococo,
vec![
// Amount is withdrawn from Relay Chain's `CheckAccount`
RuntimeEvent::Balances(pallet_balances::Event::Withdraw { who, amount }) => {
RuntimeEvent::Balances(pallet_balances::Event::Burned { 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, .. }) => {
RuntimeEvent::Balances(pallet_balances::Event::Minted { who, .. }) => {
who: *who == t.receiver.account_id,
},
]
Expand Down Expand Up @@ -88,7 +88,7 @@ fn para_origin_assertions(t: SystemParaToRelayTest) {
AssetHubRococo,
vec![
// Amount is withdrawn from Sender's account
RuntimeEvent::Balances(pallet_balances::Event::Withdraw { who, amount }) => {
RuntimeEvent::Balances(pallet_balances::Event::Burned { who, amount }) => {
who: *who == t.sender.account_id,
amount: *amount == t.args.amount,
},
Expand All @@ -105,7 +105,7 @@ fn para_dest_assertions(t: RelayToSystemParaTest) {
AssetHubRococo,
vec![
// Amount minus fees are deposited in Receiver's account
RuntimeEvent::Balances(pallet_balances::Event::Deposit { who, .. }) => {
RuntimeEvent::Balances(pallet_balances::Event::Minted { who, .. }) => {
who: *who == t.receiver.account_id,
},
]
Expand All @@ -122,7 +122,7 @@ fn penpal_to_ah_foreign_assets_sender_assertions(t: ParaToSystemParaTest) {
PenpalA,
vec![
RuntimeEvent::Balances(
pallet_balances::Event::Withdraw { who, amount }
pallet_balances::Event::Burned { who, amount }
) => {
who: *who == t.sender.account_id,
amount: *amount == t.args.amount,
Expand All @@ -149,12 +149,12 @@ fn penpal_to_ah_foreign_assets_receiver_assertions(t: ParaToSystemParaTest) {
vec![
// native asset reserve transfer for paying fees, withdrawn from Penpal's sov account
RuntimeEvent::Balances(
pallet_balances::Event::Withdraw { who, amount }
pallet_balances::Event::Burned { who, amount }
) => {
who: *who == sov_penpal_on_ahr.clone().into(),
amount: *amount == t.args.amount,
},
RuntimeEvent::Balances(pallet_balances::Event::Deposit { who, .. }) => {
RuntimeEvent::Balances(pallet_balances::Event::Minted { who, .. }) => {
who: *who == t.receiver.account_id,
},
RuntimeEvent::ForeignAssets(pallet_assets::Event::Issued { asset_id, owner, amount }) => {
Expand Down Expand Up @@ -221,7 +221,7 @@ fn ah_to_penpal_foreign_assets_receiver_assertions(t: SystemParaToParaTest) {
amount: *amount == expected_asset_amount,
},
// native asset for fee is deposited to receiver
RuntimeEvent::Balances(pallet_balances::Event::Deposit { who, .. }) => {
RuntimeEvent::Balances(pallet_balances::Event::Minted { who, .. }) => {
who: *who == t.receiver.account_id,
},
RuntimeEvent::MessageQueue(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ fn para_receiver_assertions<Test>(_: Test) {
assert_expected_events!(
PenpalB,
vec![
RuntimeEvent::Balances(pallet_balances::Event::Deposit { .. }) => {},
RuntimeEvent::Balances(pallet_balances::Event::Minted { .. }) => {},
RuntimeEvent::MessageQueue(
pallet_message_queue::Event::Processed { success: true, .. }
) => {},
Expand All @@ -88,7 +88,7 @@ fn para_to_system_para_sender_assertions(t: ParaToSystemParaTest) {
vec![
// Amount to reserve transfer is transferred to Parachain's Sovereign account
RuntimeEvent::Balances(
pallet_balances::Event::Withdraw { who, amount }
pallet_balances::Event::Burned { who, amount }
) => {
who: *who == t.sender.account_id,
amount: *amount == t.args.amount,
Expand All @@ -109,12 +109,12 @@ fn para_to_system_para_receiver_assertions(t: ParaToSystemParaTest) {
vec![
// Amount to reserve transfer is transferred to Parachain's Sovereign account
RuntimeEvent::Balances(
pallet_balances::Event::Withdraw { who, amount }
pallet_balances::Event::Burned { who, amount }
) => {
who: *who == sov_penpal_on_ahw.clone().into(),
amount: *amount == t.args.amount,
},
RuntimeEvent::Balances(pallet_balances::Event::Deposit { .. }) => {},
RuntimeEvent::Balances(pallet_balances::Event::Minted { .. }) => {},
RuntimeEvent::MessageQueue(
pallet_message_queue::Event::Processed { success: true, .. }
) => {},
Expand Down Expand Up @@ -153,7 +153,7 @@ fn system_para_to_para_assets_receiver_assertions<Test>(_: Test) {
assert_expected_events!(
PenpalB,
vec![
RuntimeEvent::Balances(pallet_balances::Event::Deposit { .. }) => {},
RuntimeEvent::Balances(pallet_balances::Event::Minted { .. }) => {},
RuntimeEvent::Assets(pallet_assets::Event::Issued { .. }) => {},
RuntimeEvent::MessageQueue(
pallet_message_queue::Event::Processed { success: true, .. }
Expand All @@ -170,7 +170,7 @@ fn para_to_para_sender_assertions(t: ParaToParaTest) {
vec![
// Amount to reserve transfer is transferred to Parachain's Sovereign account
RuntimeEvent::Balances(
pallet_balances::Event::Withdraw { who, amount }
pallet_balances::Event::Burned { who, amount }
) => {
who: *who == t.sender.account_id,
amount: *amount == t.args.amount,
Expand All @@ -194,14 +194,14 @@ fn para_to_para_relay_hop_assertions(t: ParaToParaTest) {
vec![
// Withdrawn from sender parachain SA
RuntimeEvent::Balances(
pallet_balances::Event::Withdraw { who, amount }
pallet_balances::Event::Burned { who, amount }
) => {
who: *who == sov_penpal_b_on_westend,
amount: *amount == t.args.amount,
},
// Deposited to receiver parachain SA
RuntimeEvent::Balances(
pallet_balances::Event::Deposit { who, .. }
pallet_balances::Event::Minted { who, .. }
) => {
who: *who == sov_penpal_a_on_westend,
},
Expand All @@ -217,7 +217,7 @@ fn para_to_para_receiver_assertions(_: ParaToParaTest) {
assert_expected_events!(
PenpalA,
vec![
RuntimeEvent::Balances(pallet_balances::Event::Deposit { .. }) => {},
RuntimeEvent::Balances(pallet_balances::Event::Minted { .. }) => {},
RuntimeEvent::MessageQueue(
pallet_message_queue::Event::Processed { success: true, .. }
) => {},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ fn relay_origin_assertions(t: RelayToSystemParaTest) {
Westend,
vec![
// Amount to teleport is withdrawn from Sender
RuntimeEvent::Balances(pallet_balances::Event::Withdraw { who, amount }) => {
RuntimeEvent::Balances(pallet_balances::Event::Burned { 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 }) => {
RuntimeEvent::Balances(pallet_balances::Event::Minted { who, amount }) => {
who: *who == <Westend as WestendPallet>::XcmPallet::check_account(),
amount: *amount == t.args.amount,
},
Expand All @@ -54,12 +54,12 @@ fn relay_dest_assertions(t: SystemParaToRelayTest) {
Westend,
vec![
// Amount is withdrawn from Relay Chain's `CheckAccount`
RuntimeEvent::Balances(pallet_balances::Event::Withdraw { who, amount }) => {
RuntimeEvent::Balances(pallet_balances::Event::Burned { who, amount }) => {
who: *who == <Westend as WestendPallet>::XcmPallet::check_account(),
amount: *amount == t.args.amount,
},
// Amount minus fees are deposited in Receiver's account
RuntimeEvent::Balances(pallet_balances::Event::Deposit { who, .. }) => {
RuntimeEvent::Balances(pallet_balances::Event::Minted { who, .. }) => {
who: *who == t.receiver.account_id,
},
]
Expand Down Expand Up @@ -88,7 +88,7 @@ fn para_origin_assertions(t: SystemParaToRelayTest) {
AssetHubWestend,
vec![
// Amount is withdrawn from Sender's account
RuntimeEvent::Balances(pallet_balances::Event::Withdraw { who, amount }) => {
RuntimeEvent::Balances(pallet_balances::Event::Burned { who, amount }) => {
who: *who == t.sender.account_id,
amount: *amount == t.args.amount,
},
Expand All @@ -105,7 +105,7 @@ fn para_dest_assertions(t: RelayToSystemParaTest) {
AssetHubWestend,
vec![
// Amount minus fees are deposited in Receiver's account
RuntimeEvent::Balances(pallet_balances::Event::Deposit { who, .. }) => {
RuntimeEvent::Balances(pallet_balances::Event::Minted { who, .. }) => {
who: *who == t.receiver.account_id,
},
]
Expand All @@ -122,7 +122,7 @@ fn penpal_to_ah_foreign_assets_sender_assertions(t: ParaToSystemParaTest) {
PenpalB,
vec![
RuntimeEvent::Balances(
pallet_balances::Event::Withdraw { who, amount }
pallet_balances::Event::Burned { who, amount }
) => {
who: *who == t.sender.account_id,
amount: *amount == t.args.amount,
Expand All @@ -149,12 +149,12 @@ fn penpal_to_ah_foreign_assets_receiver_assertions(t: ParaToSystemParaTest) {
vec![
// native asset reserve transfer for paying fees, withdrawn from Penpal's sov account
RuntimeEvent::Balances(
pallet_balances::Event::Withdraw { who, amount }
pallet_balances::Event::Burned { who, amount }
) => {
who: *who == sov_penpal_on_ahr.clone().into(),
amount: *amount == t.args.amount,
},
RuntimeEvent::Balances(pallet_balances::Event::Deposit { who, .. }) => {
RuntimeEvent::Balances(pallet_balances::Event::Minted { who, .. }) => {
who: *who == t.receiver.account_id,
},
RuntimeEvent::ForeignAssets(pallet_assets::Event::Issued { asset_id, owner, amount }) => {
Expand Down Expand Up @@ -221,7 +221,7 @@ fn ah_to_penpal_foreign_assets_receiver_assertions(t: SystemParaToParaTest) {
amount: *amount == expected_asset_amount,
},
// native asset for fee is deposited to receiver
RuntimeEvent::Balances(pallet_balances::Event::Deposit { who, .. }) => {
RuntimeEvent::Balances(pallet_balances::Event::Minted { who, .. }) => {
who: *who == t.receiver.account_id,
},
RuntimeEvent::MessageQueue(
Expand Down
Loading
Loading