Skip to content

Commit

Permalink
fix: some test
Browse files Browse the repository at this point in the history
  • Loading branch information
franciscoaguirre committed Dec 4, 2024
1 parent 227e799 commit 07b1129
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 10 deletions.
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.

19 changes: 15 additions & 4 deletions cumulus/parachains/integration-tests/emulated/common/src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -464,12 +464,23 @@ macro_rules! test_xcm_fee_querying_apis_work_for_asset_hub {
type Assets = <$asset_hub as [<$asset_hub Pallet>]>::Assets;
type AssetConversion = <$asset_hub as [<$asset_hub Pallet>]>::AssetConversion;
let wnd = Location::new(1, []);
let wnd_v3 = xcm::v3::Location::parent();
let usdt = Location::new(0, [PalletInstance(ASSETS_PALLET_ID), GeneralIndex(USDT_ID.into())]);
let usdt_v3: xcm::v3::Location = (xcm::v3::Junction::PalletInstance(ASSETS_PALLET_ID), xcm::v3::Junction::GeneralIndex(USDT_ID.into())).into();
let sender = [<$asset_hub Sender>]::get();
// We create USDT if it doesn't exist.
let _ = Assets::force_create(
RuntimeOrigin::root(),
USDT_ID.into(),
sender.clone().into(),
false,
1,
);
// Then we can create a pool with WND.
assert_ok!(AssetConversion::create_pool(
RuntimeOrigin::signed(sender.clone()),
Box::new(wnd.clone()),
Box::new(usdt.clone()),
Box::new(wnd_v3),
Box::new(usdt_v3),
));

type Runtime = <$asset_hub as Chain>::Runtime;
Expand Down Expand Up @@ -502,8 +513,8 @@ macro_rules! test_xcm_fee_querying_apis_work_for_asset_hub {
// We make 1 WND = 4 USDT.
assert_ok!(AssetConversion::add_liquidity(
RuntimeOrigin::signed(sender.clone()),
Box::new(wnd),
Box::new(usdt.clone()),
Box::new(wnd_v3),
Box::new(usdt_v3),
1_000_000_000_000,
4_000_000_000_000,
0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,4 @@ parachains-common.workspace = true
parachains-common.default-features = true
emulated-integration-tests-common.workspace = true
rococo-system-emulated-network.workspace = true
xcm-runtime-apis.workspace = true
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ mod imports {
// Cumulus
pub use asset_test_utils::xcm_helpers;
pub use emulated_integration_tests_common::{
test_parachain_is_trusted_teleporter, test_parachain_is_trusted_teleporter_for_relay,
test_relay_is_trusted_teleporter, test_xcm_fee_querying_apis_work_for_asset_hub,
test_parachain_is_trusted_teleporter,
test_xcm_fee_querying_apis_work_for_asset_hub,
xcm_emulator::{
assert_expected_events, bx, Chain, Parachain as Para, RelayChain as Relay, Test,
TestArgs, TestContext, TestExt,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ mod imports {
// Cumulus
pub use asset_test_utils::xcm_helpers;
pub use emulated_integration_tests_common::{
test_parachain_is_trusted_teleporter, test_parachain_is_trusted_teleporter_for_relay,
test_relay_is_trusted_teleporter, test_xcm_fee_querying_apis_work_for_asset_hub,
test_parachain_is_trusted_teleporter,
test_xcm_fee_querying_apis_work_for_asset_hub,
xcm_emulator::{
assert_expected_events, bx, Chain, Parachain as Para, RelayChain as Relay, Test,
TestArgs, TestContext, TestExt,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1360,7 +1360,7 @@ impl_runtime_apis! {
Err(XcmPaymentApiError::AssetNotFound)
}
},
Ok(xcm::v3::AssetId::Abstract(_)) | Err(_) => {
Err(_) => {
log::trace!(target: "xcm::xcm_runtime_apis", "query_weight_to_asset_fee - failed to convert asset: {asset:?}!");
Err(XcmPaymentApiError::VersionedConversionFailed)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1388,7 +1388,7 @@ impl_runtime_apis! {
Err(XcmPaymentApiError::AssetNotFound)
}
},
Ok(xcm::v3::AssetId::Abstract(_)) | Err(_) => {
Err(_) => {
log::trace!(target: "xcm::xcm_runtime_apis", "query_weight_to_asset_fee - failed to convert asset: {asset:?}!");
Err(XcmPaymentApiError::VersionedConversionFailed)
}
Expand Down

0 comments on commit 07b1129

Please sign in to comment.