This repository has been archived by the owner on Oct 22, 2024. It is now read-only.
forked from paritytech/polkadot-sdk
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
claravanstaden
authored and
claravanstaden
committed
Oct 20, 2023
1 parent
53fd05a
commit 4a15f7d
Showing
12 changed files
with
506 additions
and
271 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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 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 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 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 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 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 |
---|---|---|
|
@@ -14,4 +14,5 @@ | |
// limitations under the License. | ||
|
||
mod example; | ||
mod snowbridge; | ||
mod teleport; |
126 changes: 126 additions & 0 deletions
126
...s/parachains/integration-tests/emulated/bridges/bridge-hub-rococo/src/tests/snowbridge.rs
This file contains 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,126 @@ | ||
// 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::*; | ||
use integration_tests_common::BridgeHubRococoPallet; | ||
use snowbridge_control; | ||
|
||
#[test] | ||
fn create_agent() { | ||
let sudo_origin = <Rococo as Chain>::RuntimeOrigin::root(); | ||
let destination = Rococo::child_location_of(BridgeHubRococo::para_id()).into(); | ||
|
||
let remote_xcm = VersionedXcm::from(Xcm(vec![ | ||
UnpaidExecution { weight_limit: WeightLimit::Unlimited, check_origin: None }, | ||
DescendOrigin(X1(Parachain(1000))), | ||
Transact { | ||
require_weight_at_most: 3000000000.into(), | ||
origin_kind: OriginKind::Xcm, | ||
call: vec![51, 1].into(), | ||
}, | ||
])); | ||
|
||
//Rococo Global Consensus | ||
// Send XCM message from Relay Chain to Bridge Hub source Parachain | ||
Rococo::execute_with(|| { | ||
assert_ok!(<Rococo as RococoPallet>::XcmPallet::send( | ||
sudo_origin, | ||
bx!(destination), | ||
bx!(remote_xcm), | ||
)); | ||
|
||
type RuntimeEvent = <Rococo as Chain>::RuntimeEvent; | ||
|
||
assert_expected_events!( | ||
Rococo, | ||
vec![ | ||
RuntimeEvent::XcmPallet(pallet_xcm::Event::Sent { .. }) => {}, | ||
] | ||
); | ||
}); | ||
|
||
BridgeHubRococo::execute_with(|| { | ||
type RuntimeEvent = <BridgeHubRococo as Chain>::RuntimeEvent; | ||
|
||
assert_expected_events!( | ||
BridgeHubRococo, | ||
vec![ | ||
RuntimeEvent::DmpQueue(cumulus_pallet_dmp_queue::Event::ExecutedDownward { | ||
outcome: Outcome::Complete(_), | ||
.. | ||
}) => {}, | ||
RuntimeEvent::EthereumControl(snowbridge_control::Event::CreateAgent { | ||
.. | ||
}) => {}, | ||
] | ||
); | ||
}); | ||
} | ||
|
||
#[test] | ||
fn create_channel() { | ||
let sudo_origin = <Rococo as Chain>::RuntimeOrigin::root(); | ||
let destination = Rococo::child_location_of(BridgeHubRococo::para_id()).into(); | ||
|
||
let remote_xcm = VersionedXcm::from(Xcm(vec![ | ||
UnpaidExecution { weight_limit: WeightLimit::Unlimited, check_origin: None }, | ||
DescendOrigin(X1(Parachain(1000))), | ||
Transact { | ||
require_weight_at_most: 8000000000.into(), | ||
origin_kind: OriginKind::Xcm, | ||
call: vec![51, 2].into(), | ||
}, | ||
])); | ||
|
||
//BridgeHubRococo::execute_with(|| { // TODO Create agent in storage | ||
// <BridgeHubRococo as BridgeHubRococoPallet>::EthereumControl::create_agent(sudo_origin); | ||
//}); | ||
|
||
//Rococo Global Consensus | ||
// Send XCM message from Relay Chain to Bridge Hub source Parachain | ||
Rococo::execute_with(|| { | ||
assert_ok!(<Rococo as RococoPallet>::XcmPallet::send( | ||
sudo_origin, | ||
bx!(destination), | ||
bx!(remote_xcm), | ||
)); | ||
|
||
type RuntimeEvent = <Rococo as Chain>::RuntimeEvent; | ||
|
||
assert_expected_events!( | ||
Rococo, | ||
vec![ | ||
RuntimeEvent::XcmPallet(pallet_xcm::Event::Sent { .. }) => {}, | ||
] | ||
); | ||
}); | ||
|
||
BridgeHubRococo::execute_with(|| { | ||
type RuntimeEvent = <BridgeHubRococo as Chain>::RuntimeEvent; | ||
|
||
assert_expected_events!( | ||
BridgeHubRococo, | ||
vec![ | ||
RuntimeEvent::DmpQueue(cumulus_pallet_dmp_queue::Event::ExecutedDownward { | ||
outcome: Outcome::Complete(_), | ||
.. | ||
}) => {}, | ||
RuntimeEvent::EthereumControl(snowbridge_control::Event::CreateChannel { | ||
.. | ||
}) => {}, | ||
] | ||
); | ||
}); | ||
} |
This file contains 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 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
Oops, something went wrong.