mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 09:21:04 +00:00
[xcm-emulator] Redo Parachain init (#1356)
* bring back proper init * refactor block cycle * ".git/.scripts/commands/fmt/fmt.sh" * Update cumulus/xcm/xcm-emulator/src/lib.rs Co-authored-by: Squirrel <gilescope@gmail.com> --------- Co-authored-by: command-bot <> Co-authored-by: Giles Cope <gilescope@gmail.com>
This commit is contained in:
+71
-70
@@ -14,85 +14,86 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::*;
|
||||
|
||||
#[test]
|
||||
#[ignore]
|
||||
fn example() {
|
||||
// // Init tests variables
|
||||
// // XcmPallet send arguments
|
||||
// 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;
|
||||
// Init tests variables
|
||||
// XcmPallet send arguments
|
||||
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 = Xcm(vec![ClearOrigin]);
|
||||
let remote_xcm = Xcm(vec![ClearOrigin]);
|
||||
|
||||
// let xcm = VersionedXcm::from(Xcm(vec![
|
||||
// UnpaidExecution { weight_limit, check_origin },
|
||||
// ExportMessage {
|
||||
// network: WococoId,
|
||||
// destination: X1(Parachain(AssetHubWococo::para_id().into())),
|
||||
// xcm: remote_xcm,
|
||||
// },
|
||||
// ]));
|
||||
let xcm = VersionedXcm::from(Xcm(vec![
|
||||
UnpaidExecution { weight_limit, check_origin },
|
||||
ExportMessage {
|
||||
network: WococoId,
|
||||
destination: X1(Parachain(AssetHubWococo::para_id().into())),
|
||||
xcm: remote_xcm,
|
||||
},
|
||||
]));
|
||||
|
||||
// //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!(xcm),
|
||||
// ));
|
||||
//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!(xcm),
|
||||
));
|
||||
|
||||
// type RuntimeEvent = <Rococo as Chain>::RuntimeEvent;
|
||||
type RuntimeEvent = <Rococo as Chain>::RuntimeEvent;
|
||||
|
||||
// assert_expected_events!(
|
||||
// Rococo,
|
||||
// vec![
|
||||
// RuntimeEvent::XcmPallet(pallet_xcm::Event::Sent { .. }) => {},
|
||||
// ]
|
||||
// );
|
||||
// });
|
||||
// // Receive XCM message in Bridge Hub source Parachain
|
||||
// BridgeHubRococo::execute_with(|| {
|
||||
// type RuntimeEvent = <BridgeHubRococo as Chain>::RuntimeEvent;
|
||||
assert_expected_events!(
|
||||
Rococo,
|
||||
vec![
|
||||
RuntimeEvent::XcmPallet(pallet_xcm::Event::Sent { .. }) => {},
|
||||
]
|
||||
);
|
||||
});
|
||||
// Receive XCM message in Bridge Hub source Parachain
|
||||
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::BridgeWococoMessages(pallet_bridge_messages::Event::MessageAccepted {
|
||||
// lane_id: LaneId([0, 0, 0, 1]),
|
||||
// nonce: 1,
|
||||
// }) => {},
|
||||
// ]
|
||||
// );
|
||||
// });
|
||||
assert_expected_events!(
|
||||
BridgeHubRococo,
|
||||
vec![
|
||||
RuntimeEvent::DmpQueue(cumulus_pallet_dmp_queue::Event::ExecutedDownward {
|
||||
outcome: Outcome::Complete(_),
|
||||
..
|
||||
}) => {},
|
||||
RuntimeEvent::BridgeWococoMessages(pallet_bridge_messages::Event::MessageAccepted {
|
||||
lane_id: LaneId([0, 0, 0, 1]),
|
||||
nonce: 1,
|
||||
}) => {},
|
||||
]
|
||||
);
|
||||
});
|
||||
|
||||
// // Wococo GLobal Consensus
|
||||
// // Receive XCM message in Bridge Hub target Parachain
|
||||
// BridgeHubWococo::execute_with(|| {
|
||||
// type RuntimeEvent = <BridgeHubWococo as Chain>::RuntimeEvent;
|
||||
// Wococo GLobal Consensus
|
||||
// Receive XCM message in Bridge Hub target Parachain
|
||||
BridgeHubWococo::execute_with(|| {
|
||||
type RuntimeEvent = <BridgeHubWococo as Chain>::RuntimeEvent;
|
||||
|
||||
// assert_expected_events!(
|
||||
// BridgeHubWococo,
|
||||
// vec![
|
||||
// RuntimeEvent::XcmpQueue(cumulus_pallet_xcmp_queue::Event::XcmpMessageSent { .. }) => {},
|
||||
// ]
|
||||
// );
|
||||
// });
|
||||
// // Receive embeded XCM message within `ExportMessage` in Parachain destination
|
||||
// AssetHubWococo::execute_with(|| {
|
||||
// type RuntimeEvent = <AssetHubWococo as Chain>::RuntimeEvent;
|
||||
assert_expected_events!(
|
||||
BridgeHubWococo,
|
||||
vec![
|
||||
RuntimeEvent::XcmpQueue(cumulus_pallet_xcmp_queue::Event::XcmpMessageSent { .. }) => {},
|
||||
]
|
||||
);
|
||||
});
|
||||
// Receive embeded XCM message within `ExportMessage` in Parachain destination
|
||||
AssetHubWococo::execute_with(|| {
|
||||
type RuntimeEvent = <AssetHubWococo as Chain>::RuntimeEvent;
|
||||
|
||||
// assert_expected_events!(
|
||||
// AssetHubWococo,
|
||||
// vec![
|
||||
// RuntimeEvent::XcmpQueue(cumulus_pallet_xcmp_queue::Event::Fail { .. }) => {},
|
||||
// ]
|
||||
// );
|
||||
// });
|
||||
assert_expected_events!(
|
||||
AssetHubWococo,
|
||||
vec![
|
||||
RuntimeEvent::XcmpQueue(cumulus_pallet_xcmp_queue::Event::Fail { .. }) => {},
|
||||
]
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user