Skip to content

Commit

Permalink
runtime tests
Browse files Browse the repository at this point in the history
  • Loading branch information
claravanstaden authored and claravanstaden committed Oct 4, 2023
1 parent 12c1325 commit 324468e
Showing 1 changed file with 58 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,15 @@

use crate::*;
use snowbridge_control;
use integration_tests_common::BridgeHubRococoPallet;

#[test]
fn create_agent() {
let sudo_origin = <Rococo as Chain>::RuntimeOrigin::root();
let destination = Rococo::child_location_of(BridgeHubRococo::para_id()).into();
let weight_limit = WeightLimit::Unlimited;
let check_origin = None;

let remote_xcm = VersionedXcm::from(Xcm(vec![
UnpaidExecution { weight_limit, check_origin },
UnpaidExecution { weight_limit: WeightLimit::Unlimited, check_origin: None },
DescendOrigin(X1(Parachain(1000))),
Transact {
require_weight_at_most: 3000000000.into(),
Expand Down Expand Up @@ -69,3 +68,59 @@ fn create_agent() {
);
});
}

#[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 {
..
}) => {},
]
);
});
}

0 comments on commit 324468e

Please sign in to comment.