Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create xcm emulator tests for People-Rococo #2373

Merged
merged 106 commits into from
Dec 5, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
106 commits
Select commit Hold shift + click to select a range
9de660b
create initial structure
0xmovses Nov 16, 2023
0f3d4a1
Update cumulus/parachains/integration-tests/emulated/chains/parachain…
0xmovses Nov 20, 2023
71eafe0
updates
0xmovses Nov 20, 2023
92d9d63
parachain set identity
0xmovses Nov 20, 2023
1908d75
assert has_idenity
0xmovses Nov 20, 2023
7d20153
reap identity
0xmovses Nov 20, 2023
dffefa1
updates xcm tests
0xmovses Nov 20, 2023
cebde91
assert deposit amount non zero
0xmovses Nov 20, 2023
84e6ed5
set identity zero deposit
0xmovses Nov 21, 2023
a762093
add test args
0xmovses Nov 21, 2023
2a970c2
".git/.scripts/commands/fmt/fmt.sh"
Nov 21, 2023
aeec8ef
Update cumulus/parachains/integration-tests/emulated/tests/people/peo…
0xmovses Nov 22, 2023
319b3ae
address petrowski feedback
0xmovses Nov 22, 2023
13d9d18
assert on subs_of
0xmovses Nov 22, 2023
b92de0a
add asserts on parachain
0xmovses Nov 22, 2023
6275090
check unreserved amount
0xmovses Nov 22, 2023
9072f05
add xcm feature, cleanup
0xmovses Nov 22, 2023
10da8af
remove redundant comment
0xmovses Nov 22, 2023
b5e4b3e
".git/.scripts/commands/fmt/fmt.sh"
Nov 22, 2023
65da33e
Update cumulus/parachains/integration-tests/emulated/tests/people/peo…
0xmovses Nov 22, 2023
386744f
Update cumulus/parachains/integration-tests/emulated/tests/people/peo…
0xmovses Nov 22, 2023
a6312db
Update cumulus/parachains/integration-tests/emulated/tests/people/peo…
0xmovses Nov 22, 2023
5e3e9a3
Update substrate/frame/identity/src/lib.rs
0xmovses Nov 22, 2023
e8e88d1
Update substrate/frame/identity/src/lib.rs
0xmovses Nov 22, 2023
41b3564
Update polkadot/runtime/rococo/src/lib.rs
0xmovses Nov 22, 2023
21ce617
Update polkadot/runtime/rococo/src/lib.rs
0xmovses Nov 22, 2023
1e2ab6d
add some printlns
0xmovses Nov 22, 2023
98cb721
assert parachain processes msg queue
0xmovses Nov 22, 2023
7670e4d
Update substrate/frame/identity/src/lib.rs
0xmovses Nov 22, 2023
e90f351
assert additional events
0xmovses Nov 22, 2023
9fbc89e
assert on inner enum vals
0xmovses Nov 23, 2023
72b38e2
".git/.scripts/commands/fmt/fmt.sh"
Nov 23, 2023
0d1c309
fmt
0xmovses Nov 23, 2023
7b35c9f
fmt
0xmovses Nov 23, 2023
472d203
assert IdentityMigrator events
0xmovses Nov 24, 2023
342454e
Update cumulus/parachains/integration-tests/emulated/tests/people/peo…
0xmovses Nov 24, 2023
1bca9e7
Update cumulus/parachains/integration-tests/emulated/chains/parachain…
0xmovses Nov 24, 2023
c29d8f7
Update cumulus/parachains/integration-tests/emulated/tests/people/peo…
0xmovses Nov 24, 2023
11d0a6a
version 0 cargo.lock
0xmovses Nov 24, 2023
880f611
Add filter, update weights
0xmovses Nov 27, 2023
3b3454c
update amounts and weights, all tests passing
0xmovses Nov 27, 2023
6d868e1
Update cumulus/parachains/integration-tests/emulated/chains/parachain…
0xmovses Nov 28, 2023
ee8d510
Update cumulus/parachains/integration-tests/emulated/tests/people/peo…
0xmovses Nov 28, 2023
8f54f7b
Update cumulus/parachains/integration-tests/emulated/tests/people/peo…
0xmovses Nov 28, 2023
b4e826e
updates
0xmovses Nov 28, 2023
12840ef
address pr feedback
0xmovses Nov 28, 2023
7ccfff3
add type aliases
0xmovses Nov 28, 2023
301fffe
fix conflicts
0xmovses Nov 28, 2023
dd8441f
".git/.scripts/commands/fmt/fmt.sh"
Nov 28, 2023
b313e18
typo
0xmovses Nov 28, 2023
8e9b251
clippy
0xmovses Nov 28, 2023
5ae4cd8
atleast an ED
0xmovses Nov 28, 2023
da2f38e
assert equality on exact
0xmovses Nov 28, 2023
4fc3e01
".git/.scripts/commands/fmt/fmt.sh"
Nov 28, 2023
f575356
create identities
0xmovses Nov 29, 2023
3902107
generalise asserts
0xmovses Nov 29, 2023
bc6a03e
check many instances
0xmovses Nov 29, 2023
58f8e77
Update cumulus/parachains/integration-tests/emulated/tests/people/peo…
0xmovses Nov 29, 2023
8abca7c
add comment
0xmovses Nov 29, 2023
0e2ddc1
add petrowski cases
0xmovses Nov 29, 2023
512e3a1
updates cleanup
0xmovses Nov 29, 2023
3985fab
reduce code duplication
0xmovses Nov 30, 2023
239e297
Merge branch 'joe-people-chain' into 0xmovses-people-xcm-tests
0xmovses Nov 30, 2023
3d262dd
use calc_remote_deposit
0xmovses Nov 30, 2023
348b9c4
assert and calculate on remote deposit
0xmovses Nov 30, 2023
872e454
remove redundant comment
0xmovses Nov 30, 2023
363ad04
clean
0xmovses Nov 30, 2023
c394638
Update cumulus/parachains/integration-tests/emulated/tests/people/peo…
0xmovses Dec 1, 2023
dbcd0bb
updates
0xmovses Dec 1, 2023
0c51fc4
Revert "updates"
0xmovses Dec 1, 2023
51a21a7
add Subs cases, refactor, petrowski feedback
0xmovses Dec 1, 2023
c2ca2ab
cleanup
0xmovses Dec 1, 2023
97a59fc
integrate seadanda feedback and further refactors
0xmovses Dec 1, 2023
9bcaffb
improve Identity::new
0xmovses Dec 1, 2023
0877093
Update cumulus/parachains/integration-tests/emulated/tests/people/peo…
0xmovses Dec 1, 2023
5c4fa6a
integrate petrowski feedback
0xmovses Dec 1, 2023
d73f6fe
call n times for with n new accounts
0xmovses Dec 1, 2023
83a5e70
create set_subs, update assertions
0xmovses Dec 1, 2023
8d23635
update comment
0xmovses Dec 1, 2023
5861ab5
total_deposit from subs variant
0xmovses Dec 1, 2023
5ba20bd
fix conflict
0xmovses Dec 1, 2023
0a44a21
small cleanups
0xmovses Dec 1, 2023
c5f065f
remove unneeded match
0xmovses Dec 1, 2023
37845fe
add all 12 cases
0xmovses Dec 1, 2023
dca8618
use default
0xmovses Dec 1, 2023
72829cb
generalise calc deposit
0xmovses Dec 2, 2023
e3a9f45
Tweaks to emulator People testing (#2595)
0xmovses Dec 4, 2023
6b015f9
integrate aguirre feedback
0xmovses Dec 4, 2023
bc86d0d
typo
0xmovses Dec 4, 2023
84fa2b1
improve doc comment
0xmovses Dec 4, 2023
ee7c5a9
Update cumulus/parachains/integration-tests/emulated/common/src/lib.rs
0xmovses Dec 4, 2023
342165f
Update cumulus/parachains/integration-tests/emulated/common/src/lib.rs
0xmovses Dec 4, 2023
cb3f892
impl relay para methods for TestArgs
0xmovses Dec 4, 2023
5582178
refactors
0xmovses Dec 4, 2023
dca66bf
Update cumulus/parachains/integration-tests/emulated/tests/people/peo…
0xmovses Dec 4, 2023
860c647
Update cumulus/parachains/integration-tests/emulated/tests/people/peo…
0xmovses Dec 4, 2023
76f4400
Update cumulus/parachains/integration-tests/emulated/tests/people/peo…
0xmovses Dec 4, 2023
149cae4
Update cumulus/parachains/integration-tests/emulated/common/src/impls.rs
0xmovses Dec 4, 2023
bc66fcd
Update substrate/frame/identity/src/lib.rs
0xmovses Dec 4, 2023
4a9cb21
integrate seadanda feedback, remove unused
0xmovses Dec 4, 2023
b2dddf8
update feature name
0xmovses Dec 4, 2023
bd4183d
".git/.scripts/commands/fmt/fmt.sh"
Dec 4, 2023
8083b9e
wrong method name
0xmovses Dec 4, 2023
3d9d09f
Apply suggestions from code review
joepetrowski Dec 5, 2023
1d7d1dd
Merge branch 'joe-people-chain' into 0xmovses-people-xcm-tests
joepetrowski Dec 5, 2023
b33d317
Update cumulus/xcm/xcm-emulator/src/lib.rs
joepetrowski Dec 5, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 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 Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,15 @@ members = [
"cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-westend",
"cumulus/parachains/integration-tests/emulated/tests/bridges/bridge-hub-rococo",
"cumulus/parachains/integration-tests/emulated/tests/bridges/bridge-hub-westend",
"cumulus/parachains/integration-tests/emulated/tests/people/people-rococo",
"cumulus/parachains/integration-tests/emulated/common",
"cumulus/parachains/integration-tests/emulated/chains/relays/rococo",
"cumulus/parachains/integration-tests/emulated/chains/relays/westend",
"cumulus/parachains/integration-tests/emulated/chains/parachains/assets/asset-hub-rococo",
"cumulus/parachains/integration-tests/emulated/chains/parachains/assets/asset-hub-westend",
"cumulus/parachains/integration-tests/emulated/chains/parachains/bridges/bridge-hub-rococo",
"cumulus/parachains/integration-tests/emulated/chains/parachains/bridges/bridge-hub-westend",
"cumulus/parachains/integration-tests/emulated/chains/parachains/people/people-rococo",
"cumulus/parachains/integration-tests/emulated/networks/rococo-system",
"cumulus/parachains/integration-tests/emulated/networks/rococo-westend-system",
"cumulus/parachains/integration-tests/emulated/networks/westend-system",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
[package]
name = "people-rococo-emulated-chain"
version = "0.0.0"
0xmovses marked this conversation as resolved.
Show resolved Hide resolved
authors.workspace = true
edition.workspace = true
license = "Apache-2.0"
description = "People Rococo emulated chain"
publish = false

[dependencies]
serde_json = "1.0.104"

# Substrate
sp-core = { path = "../../../../../../../../substrate/primitives/core", default-features = false }
sp-runtime = { path = "../../../../../../../../substrate/primitives/runtime", default-features = false }
frame-support = { path = "../../../../../../../../substrate/frame/support", default-features = false }

# Polakadot
parachains-common = { path = "../../../../../../../parachains/common" }

# Cumulus
cumulus-primitives-core = { path = "../../../../../../../primitives/core", default-features = false }
emulated-integration-tests-common = { path = "../../../../common", default-features = false }
people-rococo-runtime = { path = "../../../../../../runtimes/people/people-rococo" }
rococo-emulated-chain = { path = "../../../relays/rococo" }
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
// 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
0xmovses marked this conversation as resolved.
Show resolved Hide resolved
use emulated_integration_tests_common::{
accounts, build_genesis_storage, collators, SAFE_XCM_VERSION,
};
use parachains_common::Balance;

pub const PARA_ID: u32 = 1000;
0xmovses marked this conversation as resolved.
Show resolved Hide resolved
pub const ED: Balance = parachains_common::rococo::currency::EXISTENTIAL_DEPOSIT;

pub fn genesis() -> Storage {
let genesis_config = asset_hub_rococo_runtime::RuntimeGenesisConfig {
system: asset_hub_rococo_runtime::SystemConfig::default(),
balances: asset_hub_rococo_runtime::BalancesConfig {
balances: accounts::init_balances()
.iter()
.cloned()
.map(|k| (k, ED * 4096 * 4096))
.collect(),
},
parachain_info: asset_hub_rococo_runtime::ParachainInfoConfig {
parachain_id: PARA_ID.into(),
..Default::default()
},
collator_selection: asset_hub_rococo_runtime::CollatorSelectionConfig {
invulnerables: collators::invulnerables().iter().cloned().map(|(acc, _)| acc).collect(),
candidacy_bond: ED * 16,
..Default::default()
},
session: asset_hub_rococo_runtime::SessionConfig {
keys: collators::invulnerables()
.into_iter()
.map(|(acc, aura)| {
(
acc.clone(), // account id
acc, // validator id
asset_hub_rococo_runtime::SessionKeys { aura }, // session keys
)
})
.collect(),
},
polkadot_xcm: asset_hub_rococo_runtime::PolkadotXcmConfig {
safe_xcm_version: Some(SAFE_XCM_VERSION),
..Default::default()
},
..Default::default()
};

build_genesis_storage(
&genesis_config,
asset_hub_rococo_runtime::WASM_BINARY.expect("WASM binary was not built, please build it!"),
)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
// 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.

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,
impl_assets_helpers_for_parachain, impl_foreign_assets_helpers_for_parachain, impls::Parachain,
xcm_emulator::decl_test_parachains,
};
use rococo_emulated_chain::Rococo;

// AssetHubRococo Parachain declaration
0xmovses marked this conversation as resolved.
Show resolved Hide resolved
decl_test_parachains! {
pub struct PeopleRococo {
genesis = genesis::genesis(),
on_init = {
people_rococo_runtime::AuraExt::on_initialize(1);
},
runtime = people_rococo_runtime,
core = {
XcmpMessageHandler: people_rococo_runtime::XcmpQueue,
LocationToAccountId: people_rococo_runtime::xcm_config::LocationToAccountId,
ParachainInfo: people_rococo_runtime::ParachainInfo,
},
pallets = {
PolkadotXcm: people_rococo_runtime::PolkadotXcm,
Assets: people_rococo_runtime::Assets,
ForeignAssets: people_rococo_runtime::ForeignAssets,
PoolAssets: people_rococo_runtime::PoolAssets,
AssetConversion: people_rococo_runtime::AssetConversion,
Balances: people_rococo_runtime::Balances,
}
},
}

// PeopleRococo implementation
impl_accounts_helpers_for_parachain!(AssetHubRococo);
impl_assert_events_helpers_for_parachain!(AssetHubRococo, false);
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ emulated-integration-tests-common = { path = "../../common", default-features =
rococo-emulated-chain = { path = "../../chains/relays/rococo" }
asset-hub-rococo-emulated-chain = { path = "../../chains/parachains/assets/asset-hub-rococo" }
bridge-hub-rococo-emulated-chain = { path = "../../chains/parachains/bridges/bridge-hub-rococo" }
people-rococo-emulated-chain = { path = "../../chains/parachains/people/people-rococo" }
penpal-emulated-chain = { path = "../../chains/parachains/testing/penpal" }
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,13 @@
pub use asset_hub_rococo_emulated_chain;
pub use bridge_hub_rococo_emulated_chain;
pub use penpal_emulated_chain;
pub use people_rococo_emulated_chain;
pub use rococo_emulated_chain;

use asset_hub_rococo_emulated_chain::AssetHubRococo;
use bridge_hub_rococo_emulated_chain::BridgeHubRococo;
use penpal_emulated_chain::{PenpalA, PenpalB};
use people_rococo_emulated_chain::PeopleRococo;
use rococo_emulated_chain::Rococo;

// Cumulus
Expand All @@ -37,6 +39,7 @@ decl_test_networks! {
BridgeHubRococo,
PenpalA,
PenpalB,
PeopleRococo,
],
bridge = ()
},
Expand All @@ -47,5 +50,6 @@ decl_test_sender_receiver_accounts_parameter_types! {
AssetHubRococoPara { sender: ALICE, receiver: BOB },
BridgeHubRococoPara { sender: ALICE, receiver: BOB },
PenpalAPara { sender: ALICE, receiver: BOB },
PenpalBPara { sender: ALICE, receiver: BOB }
PenpalBPara { sender: ALICE, receiver: BOB },
PeopleRococoPara { sender: ALICE, receiver: BOB }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
[package]
name = "people-rococo-integration-tests"
version = "1.0.0"
0xmovses marked this conversation as resolved.
Show resolved Hide resolved
authors.workspace = true
edition.workspace = true
license = "Apache-2.0"
description = "People Rococo runtime integration tests with xcm-emulator"
publish = false

[dependencies]
codec = { package = "parity-scale-codec", version = "3.4.0", default-features = false }
assert_matches = "1.5.0"

# Substrate
sp-runtime = { path = "../../../../../../../substrate/primitives/runtime", default-features = false}
frame-support = { path = "../../../../../../../substrate/frame/support", default-features = false}
pallet-balances = { path = "../../../../../../../substrate/frame/balances", default-features = false}
pallet-assets = { path = "../../../../../../../substrate/frame/assets", default-features = false}
pallet-asset-conversion = { path = "../../../../../../../substrate/frame/asset-conversion", default-features = false}
pallet-message-queue = { path = "../../../../../../../substrate/frame/message-queue", default-features = false }

# Polkadot
xcm = { package = "staging-xcm", path = "../../../../../../../polkadot/xcm", default-features = false}
pallet-xcm = { path = "../../../../../../../polkadot/xcm/pallet-xcm", default-features = false}
xcm-executor = { package = "staging-xcm-executor", path = "../../../../../../../polkadot/xcm/xcm-executor", default-features = false}
rococo-runtime = { path = "../../../../../../../polkadot/runtime/rococo" }

# Cumulus
asset-test-utils = { path = "../../../../../runtimes/assets/test-utils" }
parachains-common = { path = "../../../../../../parachains/common" }
people-rococo-runtime = { path = "../../../../../runtimes/people/people-rococo" }
emulated-integration-tests-common = { path = "../../../common", default-features = false }
penpal-runtime = { path = "../../../../../runtimes/testing/penpal" }
rococo-system-emulated-network ={ path = "../../../networks/rococo-system" }
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
// 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 tests;

pub use codec::Encode;

// Substrate
pub use frame_support::{
assert_err, assert_ok,
pallet_prelude::Weight,
sp_runtime::{AccountId32, DispatchError, DispatchResult},
traits::fungibles::Inspect,
};

// Polkadot
pub use xcm::{
prelude::{AccountId32 as AccountId32Junction, *},
v3::{Error, NetworkId::Rococo as RococoId},
};

// Cumulus
pub use asset_test_utils::xcm_helpers;
pub use emulated_integration_tests_common::{
test_parachain_is_trusted_teleporter,
xcm_emulator::{
assert_expected_events, bx, helpers::weight_within_threshold, Chain, Parachain as Para,
RelayChain as Relay, Test, TestArgs, TestContext, TestExt,
},
xcm_helpers::{xcm_transact_paid_execution, xcm_transact_unpaid_execution},
PROOF_SIZE_THRESHOLD, REF_TIME_THRESHOLD, XCM_V3,
};
pub use parachains_common::{AccountId, Balance};
pub use rococo_system_emulated_network::{
people_rococo_emulated_chain::{
genesis::ED as ASSET_HUB_ROCOCO_ED, PeopleRococoParaPallet as AssetHubRococoPallet,
},
rococo_emulated_chain::{genesis::ED as ROCOCO_ED, RococoRelayPallet as RococoPallet},
PenpalAPara as PenpalA, PeopleRococoPara as PeopleRococo,
PeopleRococoParaReceiver as PeopleRococoReceiver, PeopleRococoParaSender as PeopleRococoSender,
RococoRelay as Rococo, RococoRelayReceiver as RococoReceiver,
RococoRelaySender as RococoSender,
};

pub type RelayToSystemParaTest = Test<Rococo, PeopleRococo>;
pub type RelayToParaTest = Test<Rococo, PenpalA>;
pub type SystemParaToRelayTest = Test<PeopleRococo, Rococo>;
pub type SystemParaToParaTest = Test<PeopleRococo, PenpalA>;
pub type ParaToSystemParaTest = Test<PenpalA, PeopleRococo>;
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 teleport;
Loading
Loading