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

Dry run xcms on bridge hubs to get forwarded xcms across the W<>R bridge #6002

Open
wants to merge 20 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
0a74c6e
fix(parachain-system): not include messages if empty
franciscoaguirre Oct 3, 2024
4ba9883
fix: exporters already add their message to xcmp-queue
franciscoaguirre Oct 3, 2024
b9755bf
doc: prdoc
franciscoaguirre Oct 3, 2024
4594acb
Merge branch 'master' into xcm-dry-run-redundant-forwarded-xcms
franciscoaguirre Oct 3, 2024
08dad22
test(bridge-hub-westend-integration-tests): add dry run test
franciscoaguirre Oct 4, 2024
196d265
Merge branch 'master' into xcm-dry-run-redundant-forwarded-xcms
franciscoaguirre Oct 4, 2024
5914f23
test(bridge-hub-rococo-integration-tests): add same test as in westend
franciscoaguirre Oct 4, 2024
84e60a0
test(emulated-integration-tests-common): refactor rococo and westend …
franciscoaguirre Oct 4, 2024
72d1a00
Merge branch 'master' into xcm-dry-run-redundant-forwarded-xcms
franciscoaguirre Oct 4, 2024
aab1b1d
doc: update prdoc
franciscoaguirre Oct 4, 2024
4cddc77
doc: add a note of why some impls are empty
franciscoaguirre Oct 4, 2024
250c987
".git/.scripts/commands/fmt/fmt.sh"
Oct 4, 2024
ddc07f3
Merge branch 'master' into xcm-dry-run-redundant-forwarded-xcms
franciscoaguirre Oct 4, 2024
5fab2ab
Merge branch 'master' into xcm-dry-run-redundant-forwarded-xcms
franciscoaguirre Oct 7, 2024
096b855
feat: allow dry-running on bridge hubs and getting xcms over the bridge
franciscoaguirre Oct 9, 2024
daa1d8a
doc: add prdoc
franciscoaguirre Oct 9, 2024
671a326
Merge branch 'master' into xcm-dry-run-pk-bridge
franciscoaguirre Oct 10, 2024
be83b0f
Merge branch 'master' into xcm-dry-run-pk-bridge
franciscoaguirre Oct 11, 2024
a6f8b11
Merge branch 'master' into xcm-dry-run-pk-bridge
bkontur Oct 15, 2024
840ab25
chore: some feedback
franciscoaguirre Oct 15, 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
Prev Previous commit
Next Next commit
test(bridge-hub-rococo-integration-tests): add same test as in westend
franciscoaguirre committed Oct 4, 2024
commit 5914f23cf7b6595f821a469e0486add4aad76877
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
@@ -28,6 +28,7 @@ sp-runtime = { workspace = true }
xcm = { workspace = true }
pallet-xcm = { workspace = true }
xcm-executor = { workspace = true }
xcm-runtime-apis = { workspace = true }

# Bridges
pallet-bridge-messages = { workspace = true }
Original file line number Diff line number Diff line change
@@ -534,3 +534,47 @@ fn send_back_wnds_from_penpal_rococo_through_asset_hub_rococo_to_asset_hub_weste
assert!(receiver_wnds_after > receiver_wnds_before);
assert!(receiver_wnds_after <= receiver_wnds_before + amount);
}

#[test]
fn dry_run_transfer_to_westend_sends_xcm_to_bridge_hub() {
use frame_support::{dispatch::RawOrigin, traits::fungible};
use sp_runtime::AccountId32;
use xcm::prelude::*;
use xcm_runtime_apis::dry_run::runtime_decl_for_dry_run_api::DryRunApiV1;

let who = AccountId32::new([1u8; 32]);
let transfer_amount = 10_000_000_000_000u128;
let initial_balance = transfer_amount * 10;

// Bridge setup.
AssetHubRococo::force_xcm_version(asset_hub_westend_location(), XCM_VERSION);
open_bridge_between_asset_hub_rococo_and_asset_hub_westend();

<AssetHubRococo as TestExt>::execute_with(|| {
type Runtime = <AssetHubRococo as Chain>::Runtime;
type RuntimeCall = <AssetHubRococo as Chain>::RuntimeCall;
type OriginCaller = <AssetHubRococo as Chain>::OriginCaller;
type Balances = <AssetHubRococo as AssetHubRococoPallet>::Balances;

// Give some initial funds.
<Balances as fungible::Mutate<_>>::set_balance(&who, initial_balance);

let call = RuntimeCall::PolkadotXcm(pallet_xcm::Call::transfer_assets {
dest: Box::new(VersionedLocation::from(asset_hub_westend_location())),
beneficiary: Box::new(VersionedLocation::from(Junction::AccountId32 {
id: who.clone().into(),
network: None,
})),
assets: Box::new(VersionedAssets::from(vec![
(Parent, transfer_amount).into(),
])),
fee_asset_item: 0,
weight_limit: Unlimited,
});
let result = Runtime::dry_run_call(OriginCaller::system(RawOrigin::Signed(who)), call).unwrap();
// We assert the dry run succeeds and sends only one message to the local bridge hub.
assert!(result.execution_result.is_ok());
assert_eq!(result.forwarded_xcms.len(), 1);
assert_eq!(result.forwarded_xcms[0].0, VersionedLocation::from(Location::new(1, [Parachain(BridgeHubRococo::para_id().into())])));
});
}
Original file line number Diff line number Diff line change
@@ -579,7 +579,7 @@ fn dry_run_transfer_to_rococo_sends_xcm_to_bridge_hub() {
// Give some initial funds.
<Balances as fungible::Mutate<_>>::set_balance(&who, initial_balance);

let call = RuntimeCall::PolkadotXcm(pallet_xcm::Call::limited_reserve_transfer_assets {
let call = RuntimeCall::PolkadotXcm(pallet_xcm::Call::transfer_assets {
dest: Box::new(VersionedLocation::from(asset_hub_rococo_location())),
beneficiary: Box::new(VersionedLocation::from(Junction::AccountId32 {
id: who.clone().into(),