Skip to content

Commit

Permalink
add Pendulum parachain to decl_test_network in xcm integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
RustNinja committed Mar 29, 2023
1 parent cb5346a commit 8396e3f
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 32 deletions.
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.

2 changes: 2 additions & 0 deletions runtime/integration-tests/pendulum/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,5 @@ polkadot-parachain = { git = "https://github.com/paritytech/polkadot", branch =
polkadot-primitives = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.37" }
polkadot-runtime = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.37" }
polkadot-runtime-common = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.37" }

pendulum-runtime = { path = "../../pendulum"}
55 changes: 23 additions & 32 deletions runtime/integration-tests/pendulum/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,14 @@ use xcm_simulator::{decl_test_network, decl_test_parachain, decl_test_relay_chai
pub const ALICE: sp_runtime::AccountId32 = sp_runtime::AccountId32::new([0u8; 32]);
pub const INITIAL_BALANCE: u128 = 1_000_000_000;

// decl_test_parachain! {
// pub struct ParaA {
// Runtime = parachain::Runtime,
// XcmpMessageHandler = parachain::MsgQueue,
// DmpMessageHandler = parachain::MsgQueue,
// new_ext = para_ext(1),
// }
// }

// decl_test_parachain! {
// pub struct ParaB {
// Runtime = parachain::Runtime,
// XcmpMessageHandler = parachain::MsgQueue,
// DmpMessageHandler = parachain::MsgQueue,
// new_ext = para_ext(2),
// }
// }
decl_test_parachain! {
pub struct PendulumParachain {
Runtime = pendulum_runtime::Runtime,
XcmpMessageHandler = pendulum_runtime::XcmpQueue,
DmpMessageHandler = pendulum_runtime::DmpQueue,
new_ext = para_ext(1),
}
}

decl_test_relay_chain! {
pub struct Relay {
Expand All @@ -38,8 +29,8 @@ decl_test_network! {
pub struct MockNet {
relay_chain = Relay,
parachains = vec![
// (1, ParaA),
// (2, ParaB),
(1, PendulumParachain),
// (2, Statemint),
],
}
}
Expand All @@ -48,22 +39,22 @@ decl_test_network! {
// ParaId::from(id).into_account_truncating()
// }

// pub fn para_ext(para_id: u32) -> sp_io::TestExternalities {
// use parachain::{MsgQueue, Runtime, System};
pub fn para_ext(para_id: u32) -> sp_io::TestExternalities {
use pendulum_runtime::{Runtime, System};

// let mut t = frame_system::GenesisConfig::default().build_storage::<Runtime>().unwrap();
let mut t = frame_system::GenesisConfig::default().build_storage::<Runtime>().unwrap();

// pallet_balances::GenesisConfig::<Runtime> { balances: vec![(ALICE, INITIAL_BALANCE)] }
// .assimilate_storage(&mut t)
// .unwrap();
pallet_balances::GenesisConfig::<Runtime> { balances: vec![(ALICE, INITIAL_BALANCE)] }
.assimilate_storage(&mut t)
.unwrap();

// let mut ext = sp_io::TestExternalities::new(t);
// ext.execute_with(|| {
// System::set_block_number(1);
// MsgQueue::set_para_id(para_id.into());
// });
// ext
// }
let mut ext = sp_io::TestExternalities::new(t);
ext.execute_with(|| {
System::set_block_number(1);
// MsgQueue::set_para_id(para_id.into());
});
ext
}

pub fn relay_ext() -> sp_io::TestExternalities {
// use relay_chain::{Runtime, System};
Expand Down

0 comments on commit 8396e3f

Please sign in to comment.