feat: Rebrand Polkadot/Substrate references to PezkuwiChain

This commit systematically rebrands various references from Parity Technologies'
Polkadot/Substrate ecosystem to PezkuwiChain within the kurdistan-sdk.

Key changes include:
- Updated external repository URLs (zombienet-sdk, parity-db, parity-scale-codec, wasm-instrument) to point to pezkuwichain forks.
- Modified internal documentation and code comments to reflect PezkuwiChain naming and structure.
- Replaced direct references to  with  or specific paths within the  for XCM, Pezkuwi, and other modules.
- Cleaned up deprecated  issue and PR references in various  and  files, particularly in  and  modules.
- Adjusted image and logo URLs in documentation to point to PezkuwiChain assets.
- Removed or rephrased comments related to external Polkadot/Substrate PRs and issues.

This is a significant step towards fully customizing the SDK for the PezkuwiChain ecosystem.
This commit is contained in:
2025-12-14 00:04:10 +03:00
parent 286de54384
commit 1c0e57d984
9084 changed files with 997839 additions and 997557 deletions
@@ -0,0 +1,60 @@
[package]
name = "collectives-zagros-integration-tests"
version = "1.0.0"
authors.workspace = true
edition.workspace = true
license = "Apache-2.0"
description = "Collectives Zagros runtime integration tests with xcm-emulator"
publish = false
[lints]
workspace = true
[dependencies]
codec = { workspace = true }
# Bizinikiwi
pezframe-support = { workspace = true }
pezpallet-assets = { workspace = true }
pezpallet-balances = { workspace = true }
pezpallet-message-queue = { workspace = true }
pezpallet-treasury = { workspace = true }
pezpallet-utility = { workspace = true }
pezpallet-whitelist = { workspace = true }
pezsp-runtime = { workspace = true }
# Pezkuwi
collectives-zagros-runtime = { workspace = true }
pezpallet-xcm = { workspace = true }
pezkuwi-runtime-common = { workspace = true, default-features = true }
xcm = { workspace = true }
xcm-executor = { workspace = true }
zagros-runtime-constants = { workspace = true, default-features = true }
# Pezcumulus
pezcumulus-pezpallet-teyrchain-system = { workspace = true }
pezcumulus-pezpallet-xcmp-queue = { workspace = true }
emulated-integration-tests-common = { workspace = true }
zagros-system-emulated-network = { workspace = true }
[features]
runtime-benchmarks = [
"collectives-zagros-runtime/runtime-benchmarks",
"pezcumulus-pezpallet-teyrchain-system/runtime-benchmarks",
"pezcumulus-pezpallet-xcmp-queue/runtime-benchmarks",
"emulated-integration-tests-common/runtime-benchmarks",
"pezframe-support/runtime-benchmarks",
"pezpallet-assets/runtime-benchmarks",
"pezpallet-balances/runtime-benchmarks",
"pezpallet-message-queue/runtime-benchmarks",
"pezpallet-treasury/runtime-benchmarks",
"pezpallet-utility/runtime-benchmarks",
"pezpallet-whitelist/runtime-benchmarks",
"pezpallet-xcm/runtime-benchmarks",
"pezkuwi-runtime-common/runtime-benchmarks",
"pezsp-runtime/runtime-benchmarks",
"xcm-executor/runtime-benchmarks",
"xcm/runtime-benchmarks",
"zagros-runtime-constants/runtime-benchmarks",
"zagros-system-emulated-network/runtime-benchmarks",
]
@@ -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.
#[cfg(test)]
mod imports {
pub(crate) use xcm::{latest::ZAGROS_GENESIS_HASH, prelude::*};
pub(crate) use pezframe_support::assert_ok;
pub(crate) use emulated_integration_tests_common::{
accounts::ALICE,
test_teyrchain_is_trusted_teleporter,
xcm_emulator::{assert_expected_events, bx, Chain, TestExt, Teyrchain},
};
pub(crate) use zagros_system_emulated_network::{
asset_hub_zagros_emulated_chain::{
asset_hub_zagros_runtime::xcm_config::LocationToAccountId as AssetHubLocationToAccountId,
genesis::ED as ASSET_HUB_ZAGROS_ED, AssetHubZagrosParaPallet as AssetHubZagrosPallet,
},
bridge_hub_zagros_emulated_chain::BridgeHubZagrosParaPallet as BridgeHubZagrosPallet,
collectives_zagros_emulated_chain::{
collectives_zagros_runtime::{
fellowship as collectives_fellowship,
xcm_config::XcmConfig as CollectivesZagrosXcmConfig,
},
genesis::ED as COLLECTIVES_ZAGROS_ED,
CollectivesZagrosParaPallet as CollectivesZagrosPallet,
},
coretime_zagros_emulated_chain::CoretimeZagrosParaPallet as CoretimeZagrosPallet,
penpal_emulated_chain::{PenpalAssetOwner, PenpalBParaPallet as PenpalBPallet},
people_zagros_emulated_chain::PeopleZagrosParaPallet as PeopleZagrosPallet,
zagros_emulated_chain::{
genesis::ED as ZAGROS_ED,
zagros_runtime::{governance as zagros_governance, OriginCaller as ZagrosOriginCaller},
ZagrosRelayPallet as ZagrosPallet,
},
AssetHubZagrosPara as AssetHubZagros, AssetHubZagrosParaReceiver as AssetHubZagrosReceiver,
AssetHubZagrosParaSender as AssetHubZagrosSender, BridgeHubZagrosPara as BridgeHubZagros,
CollectivesZagrosPara as CollectivesZagros,
CollectivesZagrosParaReceiver as CollectivesZagrosReceiver,
CollectivesZagrosParaSender as CollectivesZagrosSender,
CoretimeZagrosPara as CoretimeZagros, PenpalBPara as PenpalB,
PeopleZagrosPara as PeopleZagros, ZagrosRelay as Zagros,
ZagrosRelayReceiver as ZagrosReceiver, ZagrosRelaySender as ZagrosSender,
};
}
#[cfg(test)]
mod tests;
@@ -0,0 +1,275 @@
// 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 XCM aliasing.
use crate::imports::*;
use emulated_integration_tests_common::{macros::AccountId, test_cross_chain_alias};
use pezframe_support::traits::ContainsPair;
use xcm::latest::Junctions::*;
const ALLOWED: bool = true;
const DENIED: bool = false;
const TELEPORT_FEES: bool = true;
const RESERVE_TRANSFER_FEES: bool = false;
#[test]
fn account_on_sibling_syschain_aliases_into_same_local_account() {
// origin and target are the same account on different chains
let origin: AccountId = [1; 32].into();
let target = origin.clone();
let fees = ZAGROS_ED * 10;
PenpalB::mint_foreign_asset(
<PenpalB as Chain>::RuntimeOrigin::signed(PenpalAssetOwner::get()),
Location::parent(),
origin.clone(),
fees * 10,
);
// Aliasing same account on different chains
test_cross_chain_alias!(
vec![
// between AH and Collectives: allowed
(AssetHubZagros, CollectivesZagros, TELEPORT_FEES, ALLOWED),
// between BH and Collectives: allowed
(BridgeHubZagros, CollectivesZagros, TELEPORT_FEES, ALLOWED),
// between Coretime and Collectives: allowed
(CoretimeZagros, CollectivesZagros, TELEPORT_FEES, ALLOWED),
// between People and Collectives: allowed
(PeopleZagros, CollectivesZagros, TELEPORT_FEES, ALLOWED),
// between Penpal and Collectives: denied
(PenpalB, CollectivesZagros, RESERVE_TRANSFER_FEES, DENIED)
],
origin,
target,
fees
);
}
#[test]
fn account_on_sibling_syschain_cannot_alias_into_different_local_account() {
// origin and target are different accounts on different chains
let origin: AccountId = [1; 32].into();
let target: AccountId = [2; 32].into();
let fees = ZAGROS_ED * 10;
PenpalB::mint_foreign_asset(
<PenpalB as Chain>::RuntimeOrigin::signed(PenpalAssetOwner::get()),
Location::parent(),
origin.clone(),
fees * 10,
);
// Aliasing different account on different chains
test_cross_chain_alias!(
vec![
// between AH and Collectives: denied
(AssetHubZagros, CollectivesZagros, TELEPORT_FEES, DENIED),
// between BH and Collectives: denied
(BridgeHubZagros, CollectivesZagros, TELEPORT_FEES, DENIED),
// between Coretime and Collectives: denied
(CoretimeZagros, CollectivesZagros, TELEPORT_FEES, DENIED),
// between People and Collectives: denied
(PeopleZagros, CollectivesZagros, TELEPORT_FEES, DENIED),
// between Penpal and Collectives: denied
(PenpalB, CollectivesZagros, RESERVE_TRANSFER_FEES, DENIED)
],
origin,
target,
fees
);
}
#[test]
fn aliasing_child_locations() {
use CollectivesZagrosXcmConfig as XcmConfig;
CollectivesZagros::execute_with(|| {
// Allows aliasing descendant of origin.
let origin = Location::new(1, X1([PalletInstance(8)].into()));
let target = Location::new(1, X2([PalletInstance(8), GeneralIndex(9)].into()));
assert!(<XcmConfig as xcm_executor::Config>::Aliasers::contains(&origin, &target));
let origin = Location::new(1, X1([Teyrchain(8)].into()));
let target = Location::new(
1,
X2([Teyrchain(8), AccountId32 { network: None, id: [1u8; 32] }].into()),
);
assert!(<XcmConfig as xcm_executor::Config>::Aliasers::contains(&origin, &target));
let origin = Location::new(1, X1([Teyrchain(8)].into()));
let target =
Location::new(1, X3([Teyrchain(8), PalletInstance(8), GeneralIndex(9)].into()));
assert!(<XcmConfig as xcm_executor::Config>::Aliasers::contains(&origin, &target));
// Does not allow if not descendant.
let origin = Location::new(1, X1([PalletInstance(8)].into()));
let target = Location::new(0, X2([PalletInstance(8), GeneralIndex(9)].into()));
assert!(!<XcmConfig as xcm_executor::Config>::Aliasers::contains(&origin, &target));
let origin = Location::new(1, X1([Teyrchain(8)].into()));
let target = Location::new(
0,
X2([Teyrchain(8), AccountId32 { network: None, id: [1u8; 32] }].into()),
);
assert!(!<XcmConfig as xcm_executor::Config>::Aliasers::contains(&origin, &target));
let origin = Location::new(1, X1([Teyrchain(8)].into()));
let target = Location::new(0, X1([AccountId32 { network: None, id: [1u8; 32] }].into()));
assert!(!<XcmConfig as xcm_executor::Config>::Aliasers::contains(&origin, &target));
let origin = Location::new(1, X1([AccountId32 { network: None, id: [1u8; 32] }].into()));
let target = Location::new(0, X1([AccountId32 { network: None, id: [1u8; 32] }].into()));
assert!(!<XcmConfig as xcm_executor::Config>::Aliasers::contains(&origin, &target));
});
}
#[test]
fn asset_hub_root_aliases_anything() {
use CollectivesZagrosXcmConfig as XcmConfig;
CollectivesZagros::execute_with(|| {
// Allows AH root to alias anything.
let origin = Location::new(1, X1([Teyrchain(1000)].into()));
let target = Location::new(1, X1([Teyrchain(2000)].into()));
assert!(<XcmConfig as xcm_executor::Config>::Aliasers::contains(&origin, &target));
let target = Location::new(1, X1([AccountId32 { network: None, id: [1u8; 32] }].into()));
assert!(<XcmConfig as xcm_executor::Config>::Aliasers::contains(&origin, &target));
let target = Location::new(
1,
X2([Teyrchain(8), AccountId32 { network: None, id: [1u8; 32] }].into()),
);
assert!(<XcmConfig as xcm_executor::Config>::Aliasers::contains(&origin, &target));
let target =
Location::new(1, X3([Teyrchain(42), PalletInstance(8), GeneralIndex(9)].into()));
assert!(<XcmConfig as xcm_executor::Config>::Aliasers::contains(&origin, &target));
let target = Location::new(2, X1([GlobalConsensus(Ethereum { chain_id: 1 })].into()));
assert!(<XcmConfig as xcm_executor::Config>::Aliasers::contains(&origin, &target));
let target = Location::new(2, X2([GlobalConsensus(Pezkuwi), Teyrchain(1000)].into()));
assert!(<XcmConfig as xcm_executor::Config>::Aliasers::contains(&origin, &target));
let target = Location::new(0, X2([PalletInstance(8), GeneralIndex(9)].into()));
assert!(<XcmConfig as xcm_executor::Config>::Aliasers::contains(&origin, &target));
// Other AH locations cannot alias anything.
let origin = Location::new(1, X2([Teyrchain(1000), GeneralIndex(9)].into()));
assert!(!<XcmConfig as xcm_executor::Config>::Aliasers::contains(&origin, &target));
let origin = Location::new(1, X2([Teyrchain(1000), PalletInstance(9)].into()));
assert!(!<XcmConfig as xcm_executor::Config>::Aliasers::contains(&origin, &target));
let origin = Location::new(
1,
X2([Teyrchain(1000), AccountId32 { network: None, id: [1u8; 32] }].into()),
);
assert!(!<XcmConfig as xcm_executor::Config>::Aliasers::contains(&origin, &target));
// Other root locations cannot alias anything.
let origin = Location::new(1, Here);
let target = Location::new(2, X1([GlobalConsensus(Ethereum { chain_id: 1 })].into()));
assert!(!<XcmConfig as xcm_executor::Config>::Aliasers::contains(&origin, &target));
let target = Location::new(2, X2([GlobalConsensus(Pezkuwi), Teyrchain(1000)].into()));
assert!(!<XcmConfig as xcm_executor::Config>::Aliasers::contains(&origin, &target));
let target = Location::new(0, X2([PalletInstance(8), GeneralIndex(9)].into()));
assert!(!<XcmConfig as xcm_executor::Config>::Aliasers::contains(&origin, &target));
let origin = Location::new(0, Here);
let target = Location::new(1, X1([Teyrchain(2000)].into()));
assert!(!<XcmConfig as xcm_executor::Config>::Aliasers::contains(&origin, &target));
let origin = Location::new(1, X1([Teyrchain(1001)].into()));
assert!(!<XcmConfig as xcm_executor::Config>::Aliasers::contains(&origin, &target));
let origin = Location::new(1, X1([Teyrchain(1002)].into()));
assert!(!<XcmConfig as xcm_executor::Config>::Aliasers::contains(&origin, &target));
});
}
#[test]
fn authorized_cross_chain_aliases() {
// origin and target are different accounts on different chains
let origin: AccountId = [100; 32].into();
let bad_origin: AccountId = [150; 32].into();
let target: AccountId = [200; 32].into();
let fees = ZAGROS_ED * 10;
let pal_admin = <PenpalB as Chain>::RuntimeOrigin::signed(PenpalAssetOwner::get());
PenpalB::mint_foreign_asset(pal_admin.clone(), Location::parent(), origin.clone(), fees * 10);
PenpalB::mint_foreign_asset(pal_admin, Location::parent(), bad_origin.clone(), fees * 10);
CollectivesZagros::fund_accounts(vec![(target.clone(), fees * 10)]);
// let's authorize `origin` on Penpal to alias `target` on Collectives
CollectivesZagros::execute_with(|| {
let penpal_origin = Location::new(
1,
X2([
Teyrchain(PenpalB::para_id().into()),
AccountId32 {
network: Some(ByGenesis(ZAGROS_GENESIS_HASH)),
id: origin.clone().into(),
},
]
.into()),
);
// `target` adds `penpal_origin` as authorized alias
assert_ok!(
<CollectivesZagros as CollectivesZagrosPallet>::PezkuwiXcm::add_authorized_alias(
<CollectivesZagros as Chain>::RuntimeOrigin::signed(target.clone()),
Box::new(penpal_origin.into()),
None
)
);
});
// Verify that unauthorized `bad_origin` cannot alias into `target`, from any chain.
test_cross_chain_alias!(
vec![
// between AH and Collectives: denied
(AssetHubZagros, CollectivesZagros, TELEPORT_FEES, DENIED),
// between BH and Collectives: denied
(BridgeHubZagros, CollectivesZagros, TELEPORT_FEES, DENIED),
// between People and Collectives: denied
(PeopleZagros, CollectivesZagros, TELEPORT_FEES, DENIED),
// between Penpal and Collectives: denied
(PenpalB, CollectivesZagros, RESERVE_TRANSFER_FEES, DENIED)
],
bad_origin,
target,
fees
);
// Verify that only authorized `penpal::origin` can alias into `target`, while `origin` on other
// chains cannot.
test_cross_chain_alias!(
vec![
// between AH and Collectives: denied
(AssetHubZagros, CollectivesZagros, TELEPORT_FEES, DENIED),
// between BH and Collectives: denied
(BridgeHubZagros, CollectivesZagros, TELEPORT_FEES, DENIED),
// between People and Collectives: denied
(PeopleZagros, CollectivesZagros, TELEPORT_FEES, DENIED),
// between Penpal and Collectives: allowed
(PenpalB, CollectivesZagros, RESERVE_TRANSFER_FEES, ALLOWED)
],
origin,
target,
fees
);
// remove authorization for `origin` on Penpal to alias `target` on Collectives
CollectivesZagros::execute_with(|| {
// `target` removes all authorized aliases
assert_ok!(
<CollectivesZagros as CollectivesZagrosPallet>::PezkuwiXcm::remove_all_authorized_aliases(
<CollectivesZagros as Chain>::RuntimeOrigin::signed(target.clone())
)
);
});
// Verify `penpal::origin` can no longer alias into `target` on Collectives.
test_cross_chain_alias!(
vec![(PenpalB, CollectivesZagros, RESERVE_TRANSFER_FEES, DENIED)],
origin,
target,
fees
);
}
@@ -0,0 +1,111 @@
// 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.
use crate::imports::*;
use collectives_zagros_runtime::{
fellowship::FellowshipSalaryPaymaster, secretary::SecretarySalaryPaymaster,
};
use pezframe_support::{
assert_ok,
traits::{fungibles::Mutate, tokens::Pay},
};
use xcm_executor::traits::ConvertLocation;
const FELLOWSHIP_SALARY_PALLET_ID: u8 = 64;
const SECRETARY_SALARY_PALLET_ID: u8 = 91;
#[test]
fn pay_salary_technical_fellowship() {
let asset_id: u32 = 1984;
let fellowship_salary = (
Parent,
Teyrchain(CollectivesZagros::para_id().into()),
PalletInstance(FELLOWSHIP_SALARY_PALLET_ID),
);
let pay_from =
AssetHubLocationToAccountId::convert_location(&fellowship_salary.into()).unwrap();
let pay_to = Zagros::account_id_of(ALICE);
let pay_amount = 9_000_000_000;
AssetHubZagros::execute_with(|| {
type AssetHubAssets = <AssetHubZagros as AssetHubZagrosPallet>::Assets;
assert_ok!(<AssetHubAssets as Mutate<_>>::mint_into(asset_id, &pay_from, pay_amount * 2));
});
CollectivesZagros::execute_with(|| {
type RuntimeEvent = <CollectivesZagros as Chain>::RuntimeEvent;
assert_ok!(FellowshipSalaryPaymaster::pay(&pay_to, (), pay_amount));
assert_expected_events!(
CollectivesZagros,
vec![
RuntimeEvent::XcmpQueue(cumulus_pallet_xcmp_queue::Event::XcmpMessageSent { .. }) => {},
]
);
});
AssetHubZagros::execute_with(|| {
type RuntimeEvent = <AssetHubZagros as Chain>::RuntimeEvent;
assert_expected_events!(
AssetHubZagros,
vec![
RuntimeEvent::Assets(pezpallet_assets::Event::Transferred { .. }) => {},
RuntimeEvent::MessageQueue(pezpallet_message_queue::Event::Processed { success: true ,.. }) => {},
]
);
});
}
#[test]
fn pay_salary_secretary() {
const USDT_ID: u32 = 1984;
let secretary_salary = (
Parent,
Teyrchain(CollectivesZagros::para_id().into()),
PalletInstance(SECRETARY_SALARY_PALLET_ID),
);
let pay_from = AssetHubLocationToAccountId::convert_location(&secretary_salary.into()).unwrap();
let pay_to = Zagros::account_id_of(ALICE);
let pay_amount = 9_000_000_000;
AssetHubZagros::execute_with(|| {
type AssetHubAssets = <AssetHubZagros as AssetHubZagrosPallet>::Assets;
// USDT registered in genesis, now mint some into the payer's account
assert_ok!(<AssetHubAssets as Mutate<_>>::mint_into(USDT_ID, &pay_from, pay_amount * 2));
});
CollectivesZagros::execute_with(|| {
type RuntimeEvent = <CollectivesZagros as Chain>::RuntimeEvent;
assert_ok!(SecretarySalaryPaymaster::pay(&pay_to, (), pay_amount));
assert_expected_events!(
CollectivesZagros,
vec![
RuntimeEvent::XcmpQueue(cumulus_pallet_xcmp_queue::Event::XcmpMessageSent { .. }) => {},
]
);
});
AssetHubZagros::execute_with(|| {
type RuntimeEvent = <AssetHubZagros as Chain>::RuntimeEvent;
assert_expected_events!(
AssetHubZagros,
vec![
RuntimeEvent::Assets(pezpallet_assets::Event::Transferred { .. }) => {},
RuntimeEvent::MessageQueue(pezpallet_message_queue::Event::Processed { success: true ,.. }) => {},
]
);
});
}
@@ -0,0 +1,72 @@
// 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.
use crate::imports::*;
use codec::Encode;
use collectives_fellowship::pezpallet_fellowship_origins::Origin::Fellows as FellowsOrigin;
use pezframe_support::{assert_ok, pezsp_runtime::traits::Dispatchable};
#[test]
fn fellows_whitelist_call() {
CollectivesZagros::execute_with(|| {
type RuntimeEvent = <CollectivesZagros as Chain>::RuntimeEvent;
type RuntimeCall = <CollectivesZagros as Chain>::RuntimeCall;
type RuntimeOrigin = <CollectivesZagros as Chain>::RuntimeOrigin;
type Runtime = <CollectivesZagros as Chain>::Runtime;
type ZagrosCall = <Zagros as Chain>::RuntimeCall;
type ZagrosRuntime = <Zagros as Chain>::Runtime;
let call_hash = [1u8; 32].into();
let whitelist_call = RuntimeCall::PezkuwiXcm(pezpallet_xcm::Call::<Runtime>::send {
dest: bx!(VersionedLocation::from(Location::parent())),
message: bx!(VersionedXcm::from(Xcm(vec![
UnpaidExecution { weight_limit: Unlimited, check_origin: None },
Transact {
origin_kind: OriginKind::Xcm,
call: ZagrosCall::Whitelist(
pezpallet_whitelist::Call::<ZagrosRuntime>::whitelist_call { call_hash }
)
.encode()
.into(),
fallback_max_weight: None
}
]))),
});
let fellows_origin: RuntimeOrigin = FellowsOrigin.into();
assert_ok!(whitelist_call.dispatch(fellows_origin));
assert_expected_events!(
CollectivesZagros,
vec![
RuntimeEvent::PezkuwiXcm(pezpallet_xcm::Event::Sent { .. }) => {},
]
);
});
Zagros::execute_with(|| {
type RuntimeEvent = <Zagros as Chain>::RuntimeEvent;
assert_expected_events!(
Zagros,
vec![
RuntimeEvent::Whitelist(pezpallet_whitelist::Event::CallWhitelisted { .. }) => {},
RuntimeEvent::MessageQueue(pezpallet_message_queue::Event::Processed { success: true, .. }) => {},
]
);
});
}
@@ -0,0 +1,242 @@
// 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.
use crate::imports::*;
use pezframe_support::{
assert_ok, dispatch::RawOrigin, instances::Instance1, pezsp_runtime::traits::Dispatchable,
traits::fungible::Inspect,
};
use pezkuwi_runtime_common::impls::VersionedLocatableAsset;
use xcm_executor::traits::ConvertLocation;
use zagros_runtime_constants::currency::UNITS;
use zagros_system_emulated_network::zagros_emulated_chain::zagros_runtime::Dmp;
// Fund Fellowship Treasury from Zagros Treasury and spend from Fellowship Treasury.
#[test]
fn fellowship_treasury_spend() {
// initial treasury balance on Asset Hub in WNDs.
let treasury_balance = 20_000_000 * UNITS;
// target fellowship balance on Asset Hub in WNDs.
let fellowship_treasury_balance = 1_000_000 * UNITS;
// fellowship first spend balance in WNDs.
let fellowship_spend_balance = 10_000 * UNITS;
let init_alice_balance = AssetHubZagros::execute_with(|| {
<<AssetHubZagros as AssetHubZagrosPallet>::Balances as Inspect<_>>::balance(
&AssetHubZagros::account_id_of(ALICE),
)
});
let check_account = AssetHubZagros::execute_with(|| {
<AssetHubZagros as AssetHubZagrosPallet>::PezkuwiXcm::check_account()
});
// prefund Asset Hub checking account so we accept teleport from relay
AssetHubZagros::fund_accounts(vec![(check_account, treasury_balance)]);
Zagros::execute_with(|| {
type RuntimeEvent = <Zagros as Chain>::RuntimeEvent;
type RuntimeCall = <Zagros as Chain>::RuntimeCall;
type Runtime = <Zagros as Chain>::Runtime;
type Balances = <Zagros as ZagrosPallet>::Balances;
type Treasury = <Zagros as ZagrosPallet>::Treasury;
// Fund Treasury account on Asset Hub with WNDs.
let root = <Zagros as Chain>::RuntimeOrigin::root();
let treasury_account = Treasury::account_id();
// Mist assets to Treasury account on Relay Chain.
assert_ok!(Balances::force_set_balance(
root.clone(),
treasury_account.clone().into(),
treasury_balance * 2,
));
Dmp::make_teyrchain_reachable(1000);
let native_asset = Location::here();
let asset_hub_location: Location = [Teyrchain(1000)].into();
let treasury_location: Location = (Parent, PalletInstance(37)).into();
let teleport_call = RuntimeCall::Utility(pezpallet_utility::Call::<Runtime>::dispatch_as {
as_origin: bx!(ZagrosOriginCaller::system(RawOrigin::Signed(treasury_account))),
call: bx!(RuntimeCall::XcmPallet(pezpallet_xcm::Call::<Runtime>::teleport_assets {
dest: bx!(VersionedLocation::from(asset_hub_location.clone())),
beneficiary: bx!(VersionedLocation::from(treasury_location)),
assets: bx!(VersionedAssets::from(Assets::from(Asset {
id: native_asset.clone().into(),
fun: treasury_balance.into()
}))),
fee_asset_id: bx!(native_asset.into()),
})),
});
// Dispatched from Root to `dispatch_as` `Signed(treasury_account)`.
assert_ok!(teleport_call.dispatch(root));
assert_expected_events!(
Zagros,
vec![
RuntimeEvent::XcmPallet(pezpallet_xcm::Event::Sent { .. }) => {},
]
);
});
Zagros::execute_with(|| {
type RuntimeEvent = <Zagros as Chain>::RuntimeEvent;
type RuntimeCall = <Zagros as Chain>::RuntimeCall;
type RuntimeOrigin = <Zagros as Chain>::RuntimeOrigin;
type Runtime = <Zagros as Chain>::Runtime;
type Treasury = <Zagros as ZagrosPallet>::Treasury;
// Fund Fellowship Treasury from Zagros Treasury.
let treasury_origin: RuntimeOrigin =
zagros_governance::pezpallet_custom_origins::Origin::Treasurer.into();
let fellowship_treasury_location: Location =
Location::new(1, [Teyrchain(1001), PalletInstance(65)]);
let asset_hub_location: Location = [Teyrchain(1000)].into();
let native_asset = Location::parent();
let treasury_spend_call = RuntimeCall::Treasury(pezpallet_treasury::Call::<Runtime>::spend {
asset_kind: bx!(VersionedLocatableAsset::from((
asset_hub_location.clone(),
native_asset.into()
))),
amount: fellowship_treasury_balance,
beneficiary: bx!(VersionedLocation::from(fellowship_treasury_location)),
valid_from: None,
});
assert_ok!(treasury_spend_call.dispatch(treasury_origin));
// Claim the spend.
let alice_signed = RuntimeOrigin::signed(Zagros::account_id_of(ALICE));
assert_ok!(Treasury::payout(alice_signed.clone(), 0));
assert_expected_events!(
Zagros,
vec![
RuntimeEvent::Treasury(pezpallet_treasury::Event::AssetSpendApproved { .. }) => {},
RuntimeEvent::Treasury(pezpallet_treasury::Event::Paid { .. }) => {},
]
);
});
AssetHubZagros::execute_with(|| {
type RuntimeEvent = <AssetHubZagros as Chain>::RuntimeEvent;
type Balances = <AssetHubZagros as AssetHubZagrosPallet>::Balances;
// Ensure that the funds deposited to the Fellowship Treasury account.
let fellowship_treasury_location: Location =
Location::new(1, [Teyrchain(1001), PalletInstance(65)]);
let fellowship_treasury_account =
AssetHubLocationToAccountId::convert_location(&fellowship_treasury_location).unwrap();
assert_eq!(
<Balances as Inspect<_>>::balance(&fellowship_treasury_account),
fellowship_treasury_balance
);
// Assert events triggered by xcm pay program:
// 1. treasury asset transferred to spend beneficiary;
// 2. response to Relay Chain Treasury pallet instance sent back;
// 3. XCM program completed;
assert_expected_events!(
AssetHubZagros,
vec![
RuntimeEvent::Balances(pezpallet_balances::Event::Transfer { .. }) => {},
RuntimeEvent::TeyrchainSystem(cumulus_pallet_teyrchain_system::Event::UpwardMessageSent { .. }) => {},
RuntimeEvent::MessageQueue(pezpallet_message_queue::Event::Processed { success: true ,.. }) => {},
]
);
});
CollectivesZagros::execute_with(|| {
type RuntimeEvent = <CollectivesZagros as Chain>::RuntimeEvent;
type RuntimeCall = <CollectivesZagros as Chain>::RuntimeCall;
type RuntimeOrigin = <CollectivesZagros as Chain>::RuntimeOrigin;
type Runtime = <CollectivesZagros as Chain>::Runtime;
type FellowshipTreasury =
<CollectivesZagros as CollectivesZagrosPallet>::FellowshipTreasury;
// Fund Alice account from Fellowship Treasury.
let fellows_origin: RuntimeOrigin =
collectives_fellowship::pezpallet_fellowship_origins::Origin::Fellows.into();
let asset_hub_location: Location = (Parent, Teyrchain(1000)).into();
let native_asset = Location::parent();
let alice_location: Location = [Junction::AccountId32 {
network: None,
id: CollectivesZagros::account_id_of(ALICE).into(),
}]
.into();
let fellowship_treasury_spend_call =
RuntimeCall::FellowshipTreasury(pezpallet_treasury::Call::<Runtime, Instance1>::spend {
asset_kind: bx!(VersionedLocatableAsset::from((
asset_hub_location,
native_asset.into()
))),
amount: fellowship_spend_balance,
beneficiary: bx!(VersionedLocation::from(alice_location)),
valid_from: None,
});
assert_ok!(fellowship_treasury_spend_call.dispatch(fellows_origin));
// Claim the spend.
let alice_signed = RuntimeOrigin::signed(CollectivesZagros::account_id_of(ALICE));
assert_ok!(FellowshipTreasury::payout(alice_signed.clone(), 0));
assert_expected_events!(
CollectivesZagros,
vec![
RuntimeEvent::FellowshipTreasury(pezpallet_treasury::Event::AssetSpendApproved { .. }) => {},
RuntimeEvent::FellowshipTreasury(pezpallet_treasury::Event::Paid { .. }) => {},
]
);
});
AssetHubZagros::execute_with(|| {
type RuntimeEvent = <AssetHubZagros as Chain>::RuntimeEvent;
type Balances = <AssetHubZagros as AssetHubZagrosPallet>::Balances;
// Ensure that the funds deposited to Alice account.
let alice_account = AssetHubZagros::account_id_of(ALICE);
assert_eq!(
<Balances as Inspect<_>>::balance(&alice_account),
fellowship_spend_balance + init_alice_balance
);
// Assert events triggered by xcm pay program:
// 1. treasury asset transferred to spend beneficiary;
// 2. response to Relay Chain Treasury pallet instance sent back;
// 3. XCM program completed;
assert_expected_events!(
AssetHubZagros,
vec![
RuntimeEvent::Balances(pezpallet_balances::Event::Transfer { .. }) => {},
RuntimeEvent::XcmpQueue(cumulus_pallet_xcmp_queue::Event::XcmpMessageSent { .. }) => {},
RuntimeEvent::MessageQueue(pezpallet_message_queue::Event::Processed { success: true ,.. }) => {},
]
);
});
}
@@ -0,0 +1,20 @@
// 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 aliases;
mod collectives_salary;
mod fellowship;
mod fellowship_treasury;
mod teleport;
@@ -0,0 +1,117 @@
// 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.
use crate::imports::*;
use emulated_integration_tests_common::{
test_relay_is_trusted_teleporter, test_teyrchain_is_trusted_teleporter_for_relay,
};
#[test]
fn teleport_via_limited_teleport_assets_from_and_to_relay() {
let amount = ZAGROS_ED * 10;
test_relay_is_trusted_teleporter!(
Zagros, // Origin
vec![CollectivesZagros], // Destinations
amount,
limited_teleport_assets
);
test_teyrchain_is_trusted_teleporter_for_relay!(
CollectivesZagros, // Origin
Zagros, // Destination
amount,
limited_teleport_assets
);
}
#[test]
fn teleport_via_transfer_assets_from_and_to_relay() {
let amount = ZAGROS_ED * 10;
test_relay_is_trusted_teleporter!(
Zagros, // Origin
vec![CollectivesZagros], // Destinations
amount,
transfer_assets
);
test_teyrchain_is_trusted_teleporter_for_relay!(
CollectivesZagros, // Origin
Zagros, // Destination
amount,
transfer_assets
);
}
#[test]
fn teleport_via_limited_teleport_assets_from_collectives_to_asset_hub() {
let amount = ASSET_HUB_ZAGROS_ED * 100;
let native_asset: Assets = (Parent, amount).into();
let fee_asset_id: AssetId = Parent.into();
test_teyrchain_is_trusted_teleporter!(
CollectivesZagros, // Origin
vec![AssetHubZagros], // Destinations
(native_asset, amount),
fee_asset_id,
limited_teleport_assets
);
}
#[test]
fn teleport_via_transfer_assets_from_collectives_to_asset_hub() {
let amount = ASSET_HUB_ZAGROS_ED * 100;
let native_asset: Assets = (Parent, amount).into();
let fee_asset_id: AssetId = Parent.into();
test_teyrchain_is_trusted_teleporter!(
CollectivesZagros, // Origin
vec![AssetHubZagros], // Destinations
(native_asset, amount),
fee_asset_id,
transfer_assets
);
}
#[test]
fn teleport_via_limited_teleport_assets_from_asset_hub_to_collectives() {
let amount = COLLECTIVES_ZAGROS_ED * 100;
let native_asset: Assets = (Parent, amount).into();
let fee_asset_id: AssetId = Parent.into();
test_teyrchain_is_trusted_teleporter!(
AssetHubZagros, // Origin
vec![CollectivesZagros], // Destinations
(native_asset, amount),
fee_asset_id,
limited_teleport_assets
);
}
#[test]
fn teleport_via_transfer_assets_from_asset_hub_to_collectives() {
let amount = COLLECTIVES_ZAGROS_ED * 100;
let native_asset: Assets = (Parent, amount).into();
let fee_asset_id: AssetId = Parent.into();
test_teyrchain_is_trusted_teleporter!(
AssetHubZagros, // Origin
vec![CollectivesZagros], // Destinations
(native_asset, amount),
fee_asset_id,
transfer_assets
);
}