-
Notifications
You must be signed in to change notification settings - Fork 808
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
import coretime rococo parachain and network in integration tests
- Loading branch information
1 parent
3a00332
commit da8df3f
Showing
15 changed files
with
313 additions
and
1 deletion.
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
24 changes: 24 additions & 0 deletions
24
...rachains/integration-tests/emulated/chains/parachains/coretime/coretime-rococo/Cargo.toml
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,24 @@ | ||
[package] | ||
name = "coretime-rococo-emulated-chain" | ||
version = "0.0.0" | ||
authors.workspace = true | ||
edition.workspace = true | ||
license = "Apache-2.0" | ||
description = "Coretime Rococo emulated chain" | ||
publish = false | ||
|
||
[lints] | ||
workspace = true | ||
|
||
[dependencies] | ||
|
||
# Substrate | ||
sp-core = { workspace = true } | ||
frame-support = { workspace = true } | ||
|
||
# Cumulus | ||
parachains-common = { workspace = true, default-features = true } | ||
cumulus-primitives-core = { workspace = true } | ||
coretime-rococo-runtime = { workspace = true, default-features = true } | ||
emulated-integration-tests-common = { workspace = true } | ||
testnet-parachains-constants = { features = ["rococo"], workspace = true, default-features = true } |
66 changes: 66 additions & 0 deletions
66
...ains/integration-tests/emulated/chains/parachains/coretime/coretime-rococo/src/genesis.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,66 @@ | ||
// 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. | ||
|
||
// Substrate | ||
use sp_core::storage::Storage; | ||
|
||
// Cumulus | ||
use emulated_integration_tests_common::{ | ||
accounts, build_genesis_storage, collators, SAFE_XCM_VERSION, | ||
}; | ||
use parachains_common::Balance; | ||
|
||
pub const PARA_ID: u32 = 1005; | ||
pub const ED: Balance = testnet_parachains_constants::rococo::currency::EXISTENTIAL_DEPOSIT; | ||
|
||
pub fn genesis() -> Storage { | ||
let genesis_config = coretime_rococo_runtime::RuntimeGenesisConfig { | ||
system: coretime_rococo_runtime::SystemConfig::default(), | ||
balances: coretime_rococo_runtime::BalancesConfig { | ||
balances: accounts::init_balances().iter().cloned().map(|k| (k, ED * 4096)).collect(), | ||
}, | ||
parachain_info: coretime_rococo_runtime::ParachainInfoConfig { | ||
parachain_id: PARA_ID.into(), | ||
..Default::default() | ||
}, | ||
collator_selection: coretime_rococo_runtime::CollatorSelectionConfig { | ||
invulnerables: collators::invulnerables().iter().cloned().map(|(acc, _)| acc).collect(), | ||
candidacy_bond: ED * 16, | ||
..Default::default() | ||
}, | ||
session: coretime_rococo_runtime::SessionConfig { | ||
keys: collators::invulnerables() | ||
.into_iter() | ||
.map(|(acc, aura)| { | ||
( | ||
acc.clone(), // account id | ||
acc, // validator id | ||
coretime_rococo_runtime::SessionKeys { aura }, // session keys | ||
) | ||
}) | ||
.collect(), | ||
}, | ||
polkadot_xcm: coretime_rococo_runtime::PolkadotXcmConfig { | ||
safe_xcm_version: Some(SAFE_XCM_VERSION), | ||
..Default::default() | ||
}, | ||
..Default::default() | ||
}; | ||
|
||
build_genesis_storage( | ||
&genesis_config, | ||
coretime_rococo_runtime::WASM_BINARY.expect("WASM binary was not built, please build it!"), | ||
) | ||
} |
38 changes: 38 additions & 0 deletions
38
...rachains/integration-tests/emulated/chains/parachains/coretime/coretime-rococo/src/lib.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,38 @@ | ||
pub use coretime_rococo_runtime; | ||
|
||
pub mod genesis; | ||
|
||
// Substrate | ||
use frame_support::traits::OnInitialize; | ||
|
||
// Cumulus | ||
use emulated_integration_tests_common::{ | ||
impl_accounts_helpers_for_parachain, impl_assert_events_helpers_for_parachain, | ||
impls::Parachain, xcm_emulator::decl_test_parachains, | ||
}; | ||
|
||
// CoretimeRococo Parachain declaration | ||
decl_test_parachains! { | ||
pub struct CoretimeRococo { | ||
genesis = genesis::genesis(), | ||
on_init = { | ||
coretime_rococo_runtime::AuraExt::on_initialize(1); | ||
}, | ||
runtime = coretime_rococo_runtime, | ||
core = { | ||
XcmpMessageHandler: coretime_rococo_runtime::XcmpQueue, | ||
LocationToAccountId: coretime_rococo_runtime::xcm_config::LocationToAccountId, | ||
ParachainInfo: coretime_rococo_runtime::ParachainInfo, | ||
MessageOrigin: cumulus_primitives_core::AggregateMessageOrigin, | ||
}, | ||
pallets = { | ||
PolkadotXcm: coretime_rococo_runtime::PolkadotXcm, | ||
Balances: coretime_rococo_runtime::Balances, | ||
Broker: coretime_rococo_runtime::Broker, | ||
} | ||
}, | ||
} | ||
|
||
// CoretimeRococo implementation | ||
impl_accounts_helpers_for_parachain!(CoretimeRococo); | ||
impl_assert_events_helpers_for_parachain!(CoretimeRococo); |
15 changes: 15 additions & 0 deletions
15
...achains/integration-tests/emulated/chains/parachains/coretime/coretime-westend/Cargo.toml
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,15 @@ | ||
[package] | ||
name = "coretime-westend-emulated-chain" | ||
version = "0.0.0" | ||
authors.workspace = true | ||
edition.workspace = true | ||
license = "Apache-2.0" | ||
description = "Coretime Westend emulated chain" | ||
publish = false | ||
|
||
[lints] | ||
workspace = true | ||
|
||
[dependencies] | ||
|
||
|
14 changes: 14 additions & 0 deletions
14
...achains/integration-tests/emulated/chains/parachains/coretime/coretime-westend/src/lib.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,14 @@ | ||
pub fn add(left: usize, right: usize) -> usize { | ||
left + right | ||
} | ||
|
||
#[cfg(test)] | ||
mod tests { | ||
use super::*; | ||
|
||
#[test] | ||
fn it_works() { | ||
let result = add(2, 2); | ||
assert_eq!(result, 4); | ||
} | ||
} |
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
28 changes: 28 additions & 0 deletions
28
cumulus/parachains/integration-tests/emulated/tests/coretime/coretime-rococo/Cargo.toml
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,28 @@ | ||
[package] | ||
name = "coretime-rococo-integration-tests" | ||
version = "0.1.0" | ||
authors.workspace = true | ||
edition.workspace = true | ||
license = "Apache-2.0" | ||
description = "Coretime Rococo runtime integration tests with xcm-emulator" | ||
publish = false | ||
|
||
[dependencies] | ||
|
||
# Substrate | ||
frame-support = { workspace = true } | ||
pallet-balances = { workspace = true } | ||
pallet-message-queue = { workspace = true } | ||
pallet-identity = { workspace = true } | ||
sp-runtime = { workspace = true } | ||
|
||
# Polkadot | ||
polkadot-runtime-common = { workspace = true, default-features = true } | ||
rococo-runtime-constants = { workspace = true, default-features = true } | ||
xcm = { workspace = true } | ||
xcm-executor = { workspace = true } | ||
|
||
# Cumulus | ||
emulated-integration-tests-common = { workspace = true } | ||
parachains-common = { workspace = true, default-features = true } | ||
rococo-system-emulated-network = { workspace = true } |
2 changes: 2 additions & 0 deletions
2
cumulus/parachains/integration-tests/emulated/tests/coretime/coretime-rococo/src/lib.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,2 @@ | ||
#[cfg(test)] | ||
mod tests; |
29 changes: 29 additions & 0 deletions
29
...hains/integration-tests/emulated/tests/coretime/coretime-rococo/src/tests/claim_assets.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,29 @@ | ||
// 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. | ||
|
||
//! Tests related to claiming assets trapped during XCM execution. | ||
// use crate::imports::*; | ||
|
||
// use emulated_integration_tests_common::test_chain_can_claim_assets; | ||
// use xcm_executor::traits::DropAssets; | ||
|
||
// #[test] | ||
// fn assets_can_be_claimed() { | ||
// let amount = CoretimeRococoExistentialDeposit::get(); | ||
// let assets: Assets = (Parent, amount).into(); | ||
|
||
// test_chain_can_claim_assets!(CoretimeRococo, RuntimeCall, NetworkId::Rococo, assets, amount); | ||
// } |
16 changes: 16 additions & 0 deletions
16
...lus/parachains/integration-tests/emulated/tests/coretime/coretime-rococo/src/tests/mod.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,16 @@ | ||
// 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. | ||
|
||
mod claim_assets; |
13 changes: 13 additions & 0 deletions
13
cumulus/parachains/integration-tests/emulated/tests/coretime/coretime-westend/Cargo.toml
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,13 @@ | ||
[package] | ||
name = "coretime-westend-integration-tests" | ||
version = "0.1.0" | ||
authors.workspace = true | ||
edition.workspace = true | ||
license = "Apache-2.0" | ||
description = "Coretime Westend runtime integration tests with xcm-emulator" | ||
publish = false | ||
|
||
[dependencies] | ||
|
||
# Cumulus | ||
emulated-integration-tests-common = { workspace = true } |
14 changes: 14 additions & 0 deletions
14
cumulus/parachains/integration-tests/emulated/tests/coretime/coretime-westend/src/lib.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,14 @@ | ||
pub fn add(left: usize, right: usize) -> usize { | ||
left + right | ||
} | ||
|
||
#[cfg(test)] | ||
mod tests { | ||
use super::*; | ||
|
||
#[test] | ||
fn it_works() { | ||
let result = add(2, 2); | ||
assert_eq!(result, 4); | ||
} | ||
} |