-
Notifications
You must be signed in to change notification settings - Fork 1.2k
[Snowbridge]: Ensure source always from AH for exported message #6838
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
Closed
Closed
Changes from 2 commits
Commits
Show all changes
36 commits
Select commit
Hold shift + click to select a range
8a88a8b
Ensure source always from AH
yrong 53ee95e
More tests for edge cases
yrong 525e6a6
Update bridges/snowbridge/primitives/router/src/outbound/mod.rs
yrong c3b8b88
Update bridges/snowbridge/primitives/router/src/outbound/mod.rs
yrong a7cb93d
Update bridges/snowbridge/primitives/router/src/outbound/mod.rs
yrong 277d51b
Load AssetHub's ParaId from runtime
yrong c2a8ba9
More tests
yrong 7192a5a
Add prdoc
yrong f7b6f3a
Merge branch 'master' into check-souce-from-ah
yrong 62f629b
Fix fmt
yrong eff2ef2
Merge branch 'check-souce-from-ah' of https://github.com/yrong/polkad…
yrong f84cc0a
Merge branch 'master' into check-souce-from-ah
yrong df1e673
Fix the comment
yrong 11f8d57
Merge branch 'master' into check-souce-from-ah
yrong 2bf5bb1
Rename as WhitelistedParaId
yrong 73961f4
Merge branch 'check-souce-from-ah' of https://github.com/yrong/polkad…
yrong b5d4369
Merge branch 'master' into check-souce-from-ah
yrong 0a51fec
Revert change
yrong e2e0228
Barrier DenyFirstExportMessageFrom
yrong 7102219
Merge branch 'master' into check-souce-from-ah
yrong 7f529ed
Rename
yrong ccf9a28
Fix xcm config
yrong 5226eed
Cleanup
yrong e779308
Update prdoc/pr_6838.prdoc
franciscoaguirre 3a66cdb
More tests
yrong 5f9ea7f
Merge branch 'check-souce-from-ah' of https://github.com/yrong/polkad…
yrong 15ae2b3
Update cumulus/parachains/integration-tests/emulated/tests/bridges/br…
yrong e792f7d
Cleanup
yrong d0027ea
Update bridges/snowbridge/primitives/router/src/outbound/barriers.rs
yrong fcadbd7
Update bridges/snowbridge/primitives/router/src/outbound/barriers.rs
yrong 4b51b60
Update bridges/snowbridge/primitives/router/src/outbound/barriers.rs
yrong 6701841
Update bridges/snowbridge/primitives/router/src/outbound/barriers.rs
yrong efa5114
Fix format
yrong f53964b
Merge branch 'master' into check-souce-from-ah
yrong 421b4ef
Fix clippy
yrong ef72cdf
Merge branch 'master' into check-souce-from-ah
yrong File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
93 changes: 93 additions & 0 deletions
93
...gration-tests/emulated/tests/bridges/bridge-hub-westend/src/tests/snowbridge_edge_case.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,93 @@ | ||
| // Copyright (C) Parity Technologies (UK) Ltd. | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||
| // you may not use this file except in compliance with the License. | ||
| // You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, software | ||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| // See the License for the specific language governing permissions and | ||
| // limitations under the License. | ||
| use crate::imports::*; | ||
| use bridge_hub_westend_runtime::xcm_config::LocationToAccountId; | ||
| use xcm_executor::traits::ConvertLocation; | ||
|
|
||
| use crate::tests::snowbridge::{CHAIN_ID,WETH,ETHEREUM_DESTINATION_ADDRESS}; | ||
|
|
||
| const INITIAL_FUND: u128 = 5_000_000_000_000; | ||
| const TOKEN_AMOUNT: u128 = 100_000_000_000; | ||
|
|
||
| pub fn bridge_hub() -> Location { | ||
| Location::new(1, Parachain(BridgeHubWestend::para_id().into())) | ||
| } | ||
|
|
||
| pub fn beneficiary() -> Location { | ||
| Location::new(0, [AccountKey20 { network: None, key: ETHEREUM_DESTINATION_ADDRESS.into() }]) | ||
| } | ||
|
|
||
| #[test] | ||
| fn user_export_message_from_ah_directly_will_fail() { | ||
| let sov_account_for_assethub_sender = LocationToAccountId::convert_location(&Location::new( | ||
| 1, | ||
| [ | ||
| Parachain(AssetHubWestend::para_id().into()), | ||
| AccountId32 { | ||
| network: Some(ByGenesis(WESTEND_GENESIS_HASH)), | ||
| id: AssetHubWestendSender::get().into(), | ||
| }, | ||
| ], | ||
| )) | ||
| .unwrap(); | ||
| BridgeHubWestend::fund_accounts(vec![(sov_account_for_assethub_sender, INITIAL_FUND)]); | ||
|
|
||
| AssetHubWestend::execute_with(|| { | ||
| type RuntimeEvent = <AssetHubWestend as Chain>::RuntimeEvent; | ||
| type RuntimeOrigin = <AssetHubWestend as Chain>::RuntimeOrigin; | ||
|
|
||
| let local_fee_asset = | ||
| Asset { id: AssetId(Location::parent()), fun: Fungible(1_000_000_000_000) }; | ||
|
|
||
| let weth_location_reanchored = | ||
| Location::new(0, [AccountKey20 { network: None, key: WETH.into() }]); | ||
|
|
||
| let weth_asset = Asset { | ||
| id: AssetId(weth_location_reanchored.clone()), | ||
| fun: Fungible(TOKEN_AMOUNT * 1_000_000_000), | ||
| }; | ||
|
|
||
| assert_ok!(<AssetHubWestend as AssetHubWestendPallet>::PolkadotXcm::send( | ||
| RuntimeOrigin::signed(AssetHubWestendSender::get()), | ||
| bx!(VersionedLocation::from(bridge_hub())), | ||
| bx!(VersionedXcm::from(Xcm(vec![ | ||
| WithdrawAsset(local_fee_asset.clone().into()), | ||
| BuyExecution { fees: local_fee_asset.clone(), weight_limit: Unlimited }, | ||
| ExportMessage { | ||
| network: Ethereum { chain_id: CHAIN_ID }, | ||
| destination: Here, | ||
| xcm: Xcm(vec![ | ||
| WithdrawAsset(weth_asset.clone().into()), | ||
| DepositAsset { assets: Wild(All), beneficiary: beneficiary() }, | ||
| SetTopic([0; 32]), | ||
| ]), | ||
| }, | ||
| ]))), | ||
| )); | ||
|
|
||
| assert_expected_events!( | ||
| AssetHubWestend, | ||
| vec![RuntimeEvent::PolkadotXcm(pallet_xcm::Event::Sent{ .. }) => {},] | ||
| ); | ||
| }); | ||
|
|
||
| BridgeHubWestend::execute_with(|| { | ||
| type RuntimeEvent = <BridgeHubWestend as Chain>::RuntimeEvent; | ||
| assert_expected_events!( | ||
| BridgeHubWestend, | ||
| vec![RuntimeEvent::MessageQueue(pallet_message_queue::Event::Processed{ success:false, .. }) => {},] | ||
| ); | ||
| }); | ||
| } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.