Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 0 additions & 1 deletion bridges/modules/xcm-bridge-hub/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,6 @@ impl xcm_executor::Config for XcmConfig {
type Trader = ();
type ResponseHandler = ();
type AssetTrap = ();
type AssetClaims = ();
type SubscriptionService = ();
type PalletInstancesInfo = ();
type MaxAssetsIntoHolding = ();
Expand Down
12 changes: 8 additions & 4 deletions bridges/snowbridge/pallets/inbound-queue/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,11 @@ impl TransactAsset for SuccessfulTransactor {
Ok(())
}

fn deposit_asset(_what: &Asset, _who: &Location, _context: Option<&XcmContext>) -> XcmResult {
fn deposit_asset(
_what: AssetsInHolding,
_who: &Location,
_context: Option<&XcmContext>,
) -> Result<(), (AssetsInHolding, XcmError)> {
Ok(())
}

Expand All @@ -210,16 +214,16 @@ impl TransactAsset for SuccessfulTransactor {
_who: &Location,
_context: Option<&XcmContext>,
) -> Result<AssetsInHolding, XcmError> {
Ok(AssetsInHolding::default())
Ok(AssetsInHolding::new())
}

fn internal_transfer_asset(
_what: &Asset,
_from: &Location,
_to: &Location,
_context: &XcmContext,
) -> Result<AssetsInHolding, XcmError> {
Ok(AssetsInHolding::default())
) -> Result<Asset, XcmError> {
Ok(_what.clone())
}
}

Expand Down
14 changes: 9 additions & 5 deletions bridges/snowbridge/test-utils/src/mock_xcm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,11 @@ impl TransactAsset for SuccessfulTransactor {
Ok(())
}

fn deposit_asset(_what: &Asset, _who: &Location, _context: Option<&XcmContext>) -> XcmResult {
fn deposit_asset(
_what: AssetsInHolding,
_who: &Location,
_context: Option<&XcmContext>,
) -> Result<(), (AssetsInHolding, XcmError)> {
Ok(())
}

Expand All @@ -106,16 +110,16 @@ impl TransactAsset for SuccessfulTransactor {
_who: &Location,
_context: Option<&XcmContext>,
) -> Result<AssetsInHolding, XcmError> {
Ok(AssetsInHolding::default())
Ok(AssetsInHolding::new())
}

fn internal_transfer_asset(
_what: &Asset,
_from: &Location,
_to: &Location,
_context: &XcmContext,
) -> Result<AssetsInHolding, XcmError> {
Ok(AssetsInHolding::default())
) -> Result<Asset, XcmError> {
Ok(_what.clone())
}
}

Expand Down Expand Up @@ -153,5 +157,5 @@ impl FeeManager for MockXcmExecutor {
IS_WAIVED.with(|l| l.borrow().contains(&r))
}

fn handle_fee(_: Assets, _: Option<&XcmContext>, _: FeeReason) {}
fn handle_fee(_: AssetsInHolding, _: Option<&XcmContext>, _: FeeReason) {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ macro_rules! test_parachain_is_trusted_teleporter {
$crate::macros::cumulus_pallet_xcmp_queue::Event::XcmpMessageSent { .. }
) => {},
RuntimeEvent::Balances(
$crate::macros::pallet_balances::Event::Burned { who: sender, amount }
$crate::macros::pallet_balances::Event::Withdraw { who: sender, .. }
) => {},
]
);
Expand All @@ -179,7 +179,7 @@ macro_rules! test_parachain_is_trusted_teleporter {
$receiver_para,
vec![
RuntimeEvent::Balances(
$crate::macros::pallet_balances::Event::Minted { who: receiver, .. }
$crate::macros::pallet_balances::Event::Deposit { who: receiver, .. }
) => {},
RuntimeEvent::MessageQueue(
$crate::macros::pallet_message_queue::Event::Processed { success: true, .. }
Expand Down Expand Up @@ -303,7 +303,7 @@ macro_rules! test_relay_is_trusted_teleporter {
$crate::macros::pallet_xcm::Event::Attempted { outcome: $crate::macros::Outcome::Complete { .. } }
) => {},
RuntimeEvent::Balances(
$crate::macros::pallet_balances::Event::Burned { who: sender, amount }
$crate::macros::pallet_balances::Event::Withdraw { who: sender, .. }
) => {},
RuntimeEvent::XcmPallet(
$crate::macros::pallet_xcm::Event::Sent { .. }
Expand All @@ -320,7 +320,7 @@ macro_rules! test_relay_is_trusted_teleporter {
$receiver_para,
vec![
RuntimeEvent::Balances(
$crate::macros::pallet_balances::Event::Minted { who: receiver, .. }
$crate::macros::pallet_balances::Event::Deposit { who: receiver, .. }
) => {},
RuntimeEvent::MessageQueue(
$crate::macros::pallet_message_queue::Event::Processed { success: true, .. }
Expand Down Expand Up @@ -468,7 +468,7 @@ macro_rules! test_parachain_is_trusted_teleporter_for_relay {
$crate::macros::pallet_xcm::Event::Attempted { outcome: $crate::macros::Outcome::Complete { .. } }
) => {},
RuntimeEvent::Balances(
$crate::macros::pallet_balances::Event::Burned { who: sender, amount }
$crate::macros::pallet_balances::Event::Withdraw { who: sender, .. }
) => {},
RuntimeEvent::PolkadotXcm(
$crate::macros::pallet_xcm::Event::Sent { .. }
Expand All @@ -485,7 +485,7 @@ macro_rules! test_parachain_is_trusted_teleporter_for_relay {
$receiver_relay,
vec![
RuntimeEvent::Balances(
$crate::macros::pallet_balances::Event::Minted { who: receiver, .. }
$crate::macros::pallet_balances::Event::Deposit { who: receiver, .. }
) => {},
RuntimeEvent::MessageQueue(
$crate::macros::pallet_message_queue::Event::Processed { success: true, .. }
Expand Down Expand Up @@ -520,6 +520,7 @@ macro_rules! test_chain_can_claim_assets {
$crate::macros::Junction::AccountId32 { network: Some($network_id), id: sender.clone().into() }.into();
let versioned_assets: $crate::macros::VersionedAssets = $assets.clone().into();

// FIXME: either use a dummy imbalance tracker, or even better, avoid calling drop/claim directly and instead go through XCM executor
<$sender_para as $crate::macros::TestExt>::execute_with(|| {
// Assets are trapped for whatever reason.
// The possible reasons for this might differ from runtime to runtime, so here we just drop them directly.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,17 @@ use emulated_integration_tests_common::test_chain_can_claim_assets;

#[test]
fn assets_can_be_claimed() {
let amount = AssetHubWestendExistentialDeposit::get();
let assets: Assets = (Parent, amount).into();
// TODO: fix `test_chain_can_claim_assets()` in
// "cumulus/parachains/integration-tests/emulated/common/src/macros.rs"

test_chain_can_claim_assets!(
AssetHubWestend,
RuntimeCall,
NetworkId::ByGenesis(WESTEND_GENESIS_HASH),
assets,
amount
);
// let amount = AssetHubWestendExistentialDeposit::get();
// let assets: Assets = (Parent, amount).into();

// test_chain_can_claim_assets!(
// AssetHubWestend,
// RuntimeCall,
// NetworkId::ByGenesis(WESTEND_GENESIS_HASH),
// assets,
// amount
// );
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@ fn para_to_para_assethub_hop_assertions(mut t: ParaToParaThroughAHTest) {
vec![
// Withdrawn from sender parachain SA
RuntimeEvent::Balances(
pallet_balances::Event::Burned { who, amount }
pallet_balances::Event::Withdraw { who, amount }
) => {
who: *who == sov_penpal_a_on_ah,
amount: *amount == t.args.amount,
},
// Deposited to receiver parachain SA
RuntimeEvent::Balances(
pallet_balances::Event::Minted { who, .. }
pallet_balances::Event::Deposit { who, .. }
) => {
who: *who == sov_penpal_b_on_ah,
},
Expand Down Expand Up @@ -750,7 +750,7 @@ fn transfer_native_asset_from_relay_to_penpal_through_asset_hub() {
Westend,
vec![
// Amount to teleport is withdrawn from Sender
RuntimeEvent::Balances(pallet_balances::Event::Burned { who, amount }) => {
RuntimeEvent::Balances(pallet_balances::Event::Withdraw { who, amount }) => {
who: *who == t.sender.account_id,
amount: *amount == t.args.amount,
},
Expand All @@ -767,7 +767,7 @@ fn transfer_native_asset_from_relay_to_penpal_through_asset_hub() {
vec![
// Deposited to receiver parachain SA
RuntimeEvent::Balances(
pallet_balances::Event::Minted { who, .. }
pallet_balances::Event::Deposit { who, .. }
) => {
who: *who == sov_penpal_on_ah,
},
Expand All @@ -782,9 +782,9 @@ fn transfer_native_asset_from_relay_to_penpal_through_asset_hub() {
assert_expected_events!(
PenpalA,
vec![
RuntimeEvent::ForeignAssets(pallet_assets::Event::Issued { asset_id, owner, .. }) => {
RuntimeEvent::ForeignAssets(pallet_assets::Event::Deposited { asset_id, who, .. }) => {
asset_id: *asset_id == Location::new(1, Here),
owner: *owner == t.receiver.account_id,
who: *who == t.receiver.account_id,
},
]
);
Expand Down
Loading
Loading