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,84 @@
[package]
name = "pezpallet-contracts-mock-network"
version = "3.0.0"
authors.workspace = true
edition.workspace = true
license.workspace = true
homepage.workspace = true
repository.workspace = true
description = "A mock network for testing pezpallet-contracts"
[lints]
workspace = true
[dependencies]
codec = { features = ["derive", "max-encoded-len"], workspace = true }
pezframe-support = { workspace = true }
pezframe-system = { workspace = true }
pezpallet-assets = { workspace = true, default-features = true }
pezpallet-balances = { workspace = true, default-features = true }
pezpallet-contracts = { workspace = true, default-features = true }
pezpallet-contracts-uapi = { workspace = true }
pezpallet-message-queue = { workspace = true, default-features = true }
pezpallet-timestamp = { workspace = true, default-features = true }
pezpallet-xcm = { workspace = true }
pezkuwi-primitives = { workspace = true, default-features = true }
pezkuwi-runtime-teyrchains = { workspace = true, default-features = true }
pezkuwi-teyrchain-primitives = { workspace = true, default-features = true }
scale-info = { features = ["derive"], workspace = true }
pezsp-api = { workspace = true }
pezsp-core = { workspace = true }
pezsp-io = { workspace = true }
pezsp-keystore = { workspace = true, default-features = true }
pezsp-runtime = { workspace = true }
pezsp-tracing = { workspace = true, default-features = true }
xcm = { workspace = true }
xcm-builder = { workspace = true, default-features = true }
xcm-executor = { workspace = true }
xcm-simulator = { workspace = true, default-features = true }
[dev-dependencies]
pezpallet-contracts-fixtures = { workspace = true }
[features]
default = ["std"]
std = [
"codec/std",
"pezframe-support/std",
"pezframe-system/std",
"pezpallet-balances/std",
"pezpallet-contracts/std",
"pezpallet-timestamp/std",
"pezpallet-xcm/std",
"scale-info/std",
"pezsp-api/std",
"pezsp-core/std",
"pezsp-io/std",
"pezsp-keystore/std",
"pezsp-runtime/std",
"xcm-executor/std",
"xcm/std",
]
runtime-benchmarks = [
"pezframe-support/runtime-benchmarks",
"pezframe-system/runtime-benchmarks",
"pezpallet-assets/runtime-benchmarks",
"pezpallet-balances/runtime-benchmarks",
"pezpallet-contracts-fixtures/runtime-benchmarks",
"pezpallet-contracts/runtime-benchmarks",
"pezpallet-message-queue/runtime-benchmarks",
"pezpallet-timestamp/runtime-benchmarks",
"pezpallet-xcm/runtime-benchmarks",
"pezkuwi-primitives/runtime-benchmarks",
"pezkuwi-runtime-teyrchains/runtime-benchmarks",
"pezkuwi-teyrchain-primitives/runtime-benchmarks",
"pezsp-api/runtime-benchmarks",
"pezsp-io/runtime-benchmarks",
"pezsp-runtime/runtime-benchmarks",
"xcm-builder/runtime-benchmarks",
"xcm-executor/runtime-benchmarks",
"xcm-simulator/runtime-benchmarks",
"xcm/runtime-benchmarks",
]
@@ -0,0 +1,155 @@
// Copyright (C) Parity Technologies (UK) Ltd.
// This file is part of Bizinikiwi.
// Bizinikiwi is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Bizinikiwi is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with Bizinikiwi. If not, see <http://www.gnu.org/licenses/>.
pub mod mocks;
pub mod primitives;
pub mod relay_chain;
pub mod teyrchain;
#[cfg(test)]
mod tests;
use crate::primitives::{AccountId, UNITS};
pub use pezpallet_contracts::test_utils::{ALICE, BOB};
use pezsp_runtime::BuildStorage;
use xcm::latest::prelude::*;
use xcm_executor::traits::ConvertLocation;
pub use xcm_simulator::TestExt;
use xcm_simulator::{decl_test_network, decl_test_relay_chain, decl_test_teyrchain};
// Accounts
pub const ADMIN: pezsp_runtime::AccountId32 = pezsp_runtime::AccountId32::new([0u8; 32]);
// Balances
pub const INITIAL_BALANCE: u128 = 1_000_000_000 * UNITS;
decl_test_teyrchain! {
pub struct ParaA {
Runtime = teyrchain::Runtime,
XcmpMessageHandler = teyrchain::MsgQueue,
DmpMessageHandler = teyrchain::MsgQueue,
new_ext = para_ext(1),
}
}
decl_test_relay_chain! {
pub struct Relay {
Runtime = relay_chain::Runtime,
RuntimeCall = relay_chain::RuntimeCall,
RuntimeEvent = relay_chain::RuntimeEvent,
XcmConfig = relay_chain::XcmConfig,
MessageQueue = relay_chain::MessageQueue,
System = relay_chain::System,
new_ext = relay_ext(),
}
}
decl_test_network! {
pub struct MockNet {
relay_chain = Relay,
teyrchains = vec![
(1, ParaA),
],
}
}
pub fn relay_sovereign_account_id() -> AccountId {
let location: Location = (Parent,).into();
teyrchain::SovereignAccountOf::convert_location(&location).unwrap()
}
pub fn teyrchain_sovereign_account_id(para: u32) -> AccountId {
let location: Location = (Teyrchain(para),).into();
relay_chain::SovereignAccountOf::convert_location(&location).unwrap()
}
pub fn teyrchain_account_sovereign_account_id(
para: u32,
who: pezsp_runtime::AccountId32,
) -> AccountId {
let location: Location = (
Teyrchain(para),
AccountId32 { network: Some(relay_chain::RelayNetwork::get()), id: who.into() },
)
.into();
relay_chain::SovereignAccountOf::convert_location(&location).unwrap()
}
pub fn para_ext(para_id: u32) -> pezsp_io::TestExternalities {
use teyrchain::{MsgQueue, Runtime, System};
let mut t = pezframe_system::GenesisConfig::<Runtime>::default().build_storage().unwrap();
pezpallet_balances::GenesisConfig::<Runtime> {
balances: vec![
(ALICE, INITIAL_BALANCE),
(relay_sovereign_account_id(), INITIAL_BALANCE),
(BOB, INITIAL_BALANCE),
],
..Default::default()
}
.assimilate_storage(&mut t)
.unwrap();
pezpallet_assets::GenesisConfig::<Runtime> {
assets: vec![
(0u128, ADMIN, false, 1u128), // Create derivative asset for relay's native token
],
metadata: Default::default(),
accounts: vec![
(0u128, ALICE, INITIAL_BALANCE),
(0u128, relay_sovereign_account_id(), INITIAL_BALANCE),
],
next_asset_id: None,
reserves: vec![],
}
.assimilate_storage(&mut t)
.unwrap();
let mut ext = pezsp_io::TestExternalities::new(t);
ext.execute_with(|| {
pezsp_tracing::try_init_simple();
System::set_block_number(1);
MsgQueue::set_para_id(para_id.into());
});
ext
}
pub fn relay_ext() -> pezsp_io::TestExternalities {
use relay_chain::{Runtime, System};
let mut t = pezframe_system::GenesisConfig::<Runtime>::default().build_storage().unwrap();
pezpallet_balances::GenesisConfig::<Runtime> {
balances: vec![
(ALICE, INITIAL_BALANCE),
(teyrchain_sovereign_account_id(1), INITIAL_BALANCE),
(teyrchain_account_sovereign_account_id(1, ALICE), INITIAL_BALANCE),
],
..Default::default()
}
.assimilate_storage(&mut t)
.unwrap();
let mut ext = pezsp_io::TestExternalities::new(t);
ext.execute_with(|| {
System::set_block_number(1);
});
ext
}
pub type TeyrchainPalletXcm = pezpallet_xcm::Pallet<teyrchain::Runtime>;
pub type TeyrchainBalances = pezpallet_balances::Pallet<teyrchain::Runtime>;
@@ -0,0 +1,18 @@
// Copyright (C) Parity Technologies (UK) Ltd.
// This file is part of Bizinikiwi.
// Bizinikiwi is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Bizinikiwi is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with Bizinikiwi. If not, see <http://www.gnu.org/licenses/>.
pub mod msg_queue;
pub mod relay_message_queue;
@@ -0,0 +1,189 @@
// Copyright (C) Parity Technologies (UK) Ltd.
// This file is part of Bizinikiwi.
// Bizinikiwi is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Bizinikiwi is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with Bizinikiwi. If not, see <http://www.gnu.org/licenses/>.
//! Teyrchain runtime mock.
use codec::{Decode, Encode};
use pezframe_support::weights::Weight;
use pezkuwi_primitives::BlockNumber as RelayBlockNumber;
use pezkuwi_teyrchain_primitives::primitives::{
DmpMessageHandler, Id as ParaId, XcmpMessageFormat, XcmpMessageHandler,
};
use pezsp_runtime::traits::{Get, Hash};
use xcm::{latest::prelude::*, VersionedXcm};
#[pezframe_support::pallet]
pub mod pallet {
use super::*;
use pezframe_support::pezpallet_prelude::*;
#[pallet::config]
pub trait Config: pezframe_system::Config {
#[allow(deprecated)]
type RuntimeEvent: From<Event<Self>> + IsType<<Self as pezframe_system::Config>::RuntimeEvent>;
type XcmExecutor: ExecuteXcm<Self::RuntimeCall>;
}
#[pallet::call]
impl<T: Config> Pallet<T> {}
#[pallet::pallet]
#[pallet::without_storage_info]
pub struct Pallet<T>(_);
#[pallet::storage]
pub(super) type TeyrchainId<T: Config> = StorageValue<_, ParaId, ValueQuery>;
#[pallet::storage]
/// A queue of received DMP messages
pub(super) type ReceivedDmp<T: Config> = StorageValue<_, Vec<Xcm<T::RuntimeCall>>, ValueQuery>;
impl<T: Config> Get<ParaId> for Pallet<T> {
fn get() -> ParaId {
TeyrchainId::<T>::get()
}
}
pub type MessageId = [u8; 32];
#[pallet::event]
#[pallet::generate_deposit(pub(super) fn deposit_event)]
pub enum Event<T: Config> {
/// Some XCM was executed OK.
Success(Option<T::Hash>),
/// Some XCM failed.
Fail(Option<T::Hash>, XcmError),
/// Bad XCM version used.
BadVersion(Option<T::Hash>),
/// Bad XCM format used.
BadFormat(Option<T::Hash>),
// DMP
/// Downward message is invalid XCM.
InvalidFormat(MessageId),
/// Downward message is unsupported version of XCM.
UnsupportedVersion(MessageId),
/// Downward message executed with the given outcome.
ExecutedDownward(MessageId, Outcome),
}
impl<T: Config> Pallet<T> {
pub fn set_para_id(para_id: ParaId) {
TeyrchainId::<T>::put(para_id);
}
pub fn teyrchain_id() -> ParaId {
TeyrchainId::<T>::get()
}
pub fn received_dmp() -> Vec<Xcm<T::RuntimeCall>> {
ReceivedDmp::<T>::get()
}
fn handle_xcmp_message(
sender: ParaId,
_sent_at: RelayBlockNumber,
xcm: VersionedXcm<T::RuntimeCall>,
max_weight: Weight,
) -> Result<Weight, XcmError> {
let hash = Encode::using_encoded(&xcm, T::Hashing::hash);
let mut message_hash = Encode::using_encoded(&xcm, pezsp_io::hashing::blake2_256);
let (result, event) = match Xcm::<T::RuntimeCall>::try_from(xcm) {
Ok(xcm) => {
let location = (Parent, Teyrchain(sender.into()));
match T::XcmExecutor::prepare_and_execute(
location,
xcm,
&mut message_hash,
max_weight,
Weight::zero(),
) {
Outcome::Error(InstructionError { error, .. }) =>
(Err(error), Event::Fail(Some(hash), error)),
Outcome::Complete { used } => (Ok(used), Event::Success(Some(hash))),
// As far as the caller is concerned, this was dispatched without error, so
// we just report the weight used.
Outcome::Incomplete {
used, error: InstructionError { error, .. }, ..
} => (Ok(used), Event::Fail(Some(hash), error)),
}
},
Err(()) => (Err(XcmError::UnhandledXcmVersion), Event::BadVersion(Some(hash))),
};
Self::deposit_event(event);
result
}
}
impl<T: Config> XcmpMessageHandler for Pallet<T> {
fn handle_xcmp_messages<'a, I: Iterator<Item = (ParaId, RelayBlockNumber, &'a [u8])>>(
iter: I,
max_weight: Weight,
) -> Weight {
for (sender, sent_at, data) in iter {
let mut data_ref = data;
let _ = XcmpMessageFormat::decode(&mut data_ref)
.expect("Simulator encodes with versioned xcm format; qed");
let mut remaining_fragments = data_ref;
while !remaining_fragments.is_empty() {
if let Ok(xcm) =
VersionedXcm::<T::RuntimeCall>::decode(&mut remaining_fragments)
{
let _ = Self::handle_xcmp_message(sender, sent_at, xcm, max_weight);
} else {
debug_assert!(false, "Invalid incoming XCMP message data");
}
}
}
max_weight
}
}
impl<T: Config> DmpMessageHandler for Pallet<T> {
fn handle_dmp_messages(
iter: impl Iterator<Item = (RelayBlockNumber, Vec<u8>)>,
limit: Weight,
) -> Weight {
for (_i, (_sent_at, data)) in iter.enumerate() {
let mut id = pezsp_io::hashing::blake2_256(&data[..]);
let maybe_versioned = VersionedXcm::<T::RuntimeCall>::decode(&mut &data[..]);
match maybe_versioned {
Err(_) => {
Self::deposit_event(Event::InvalidFormat(id));
},
Ok(versioned) => match Xcm::try_from(versioned) {
Err(()) => Self::deposit_event(Event::UnsupportedVersion(id)),
Ok(x) => {
let outcome = T::XcmExecutor::prepare_and_execute(
Parent,
x.clone(),
&mut id,
limit,
Weight::zero(),
);
ReceivedDmp::<T>::append(x);
Self::deposit_event(Event::ExecutedDownward(id, outcome));
},
},
}
}
limit
}
}
}
@@ -0,0 +1,52 @@
// Copyright (C) Parity Technologies (UK) Ltd.
// This file is part of Bizinikiwi.
// Bizinikiwi is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Bizinikiwi is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with Bizinikiwi. If not, see <http://www.gnu.org/licenses/>.
use pezframe_support::{parameter_types, weights::Weight};
use xcm::latest::prelude::*;
use xcm_simulator::{
AggregateMessageOrigin, ProcessMessage, ProcessMessageError, UmpQueueId, WeightMeter,
};
use crate::relay_chain::{RuntimeCall, XcmConfig};
parameter_types! {
/// Amount of weight that can be spent per block to service messages.
pub MessageQueueServiceWeight: Weight = Weight::from_parts(1_000_000_000, 1_000_000);
pub const MessageQueueHeapSize: u32 = 65_536;
pub const MessageQueueMaxStale: u32 = 16;
}
/// Message processor to handle any messages that were enqueued into the `MessageQueue` pallet.
pub struct MessageProcessor;
impl ProcessMessage for MessageProcessor {
type Origin = AggregateMessageOrigin;
fn process_message(
message: &[u8],
origin: Self::Origin,
meter: &mut WeightMeter,
id: &mut [u8; 32],
) -> Result<bool, ProcessMessageError> {
let para = match origin {
AggregateMessageOrigin::Ump(UmpQueueId::Para(para)) => para,
};
xcm_builder::ProcessXcmMessage::<
Junction,
xcm_executor::XcmExecutor<XcmConfig>,
RuntimeCall,
>::process_message(message, Junction::Teyrchain(para.into()), meter, id)
}
}
@@ -0,0 +1,23 @@
// Copyright (C) Parity Technologies (UK) Ltd.
// This file is part of Bizinikiwi.
// Bizinikiwi is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Bizinikiwi is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with Bizinikiwi. If not, see <http://www.gnu.org/licenses/>.
pub type Balance = u128;
pub const UNITS: Balance = 10_000_000_000;
pub const CENTS: Balance = UNITS / 100; // 100_000_000
pub type AccountId = pezsp_runtime::AccountId32;
pub type AssetIdForAssets = u128;
@@ -0,0 +1,243 @@
// Copyright (C) Parity Technologies (UK) Ltd.
// This file is part of Bizinikiwi.
// Bizinikiwi is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Bizinikiwi is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with Bizinikiwi. If not, see <http://www.gnu.org/licenses/>.
//! Relay chain runtime mock.
use pezframe_support::{
construct_runtime, derive_impl, parameter_types,
traits::{Contains, Disabled, Everything, Nothing},
weights::Weight,
};
use pezframe_system::EnsureRoot;
use pezsp_core::{ConstU32, H256};
use pezsp_runtime::traits::IdentityLookup;
use pezkuwi_runtime_teyrchains::{configuration, origin, shared};
use pezkuwi_teyrchain_primitives::primitives::Id as ParaId;
use xcm::latest::prelude::*;
use xcm_builder::{
AccountId32Aliases, AllowExplicitUnpaidExecutionFrom, AllowSubscriptionsFrom,
AllowTopLevelPaidExecutionFrom, ChildSystemTeyrchainAsSuperuser, ChildTeyrchainAsNative,
ChildTeyrchainConvertsVia, DescribeAllTerminal, DescribeFamily, FixedRateOfFungible,
FixedWeightBounds, FrameTransactionalProcessor, FungibleAdapter, HashedDescription, IsConcrete,
SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, WithComputedOrigin,
};
use xcm_executor::{Config, XcmExecutor};
use super::{
mocks::relay_message_queue::*,
primitives::{AccountId, Balance},
};
#[derive_impl(pezframe_system::config_preludes::TestDefaultConfig)]
impl pezframe_system::Config for Runtime {
type RuntimeOrigin = RuntimeOrigin;
type RuntimeCall = RuntimeCall;
type Block = Block;
type Nonce = u64;
type Hash = H256;
type Hashing = ::pezsp_runtime::traits::BlakeTwo256;
type AccountId = AccountId;
type Lookup = IdentityLookup<Self::AccountId>;
type RuntimeEvent = RuntimeEvent;
type BlockWeights = ();
type BlockLength = ();
type Version = ();
type PalletInfo = PalletInfo;
type AccountData = pezpallet_balances::AccountData<Balance>;
type OnNewAccount = ();
type OnKilledAccount = ();
type DbWeight = ();
type BaseCallFilter = Everything;
type SystemWeightInfo = ();
type SS58Prefix = ();
type OnSetCode = ();
type MaxConsumers = ConstU32<16>;
}
parameter_types! {
pub ExistentialDeposit: Balance = 1;
pub const MaxLocks: u32 = 50;
pub const MaxReserves: u32 = 50;
}
impl pezpallet_balances::Config for Runtime {
type MaxLocks = MaxLocks;
type Balance = Balance;
type RuntimeEvent = RuntimeEvent;
type DustRemoval = ();
type ExistentialDeposit = ExistentialDeposit;
type AccountStore = System;
type WeightInfo = ();
type MaxReserves = MaxReserves;
type ReserveIdentifier = [u8; 8];
type FreezeIdentifier = ();
type MaxFreezes = ConstU32<0>;
type RuntimeHoldReason = RuntimeHoldReason;
type RuntimeFreezeReason = RuntimeFreezeReason;
type DoneSlashHandler = ();
}
impl shared::Config for Runtime {
type DisabledValidators = ();
}
impl configuration::Config for Runtime {
type WeightInfo = configuration::TestWeightInfo;
}
parameter_types! {
pub RelayNetwork: NetworkId = ByGenesis([0; 32]);
pub const TokenLocation: Location = Here.into_location();
pub UniversalLocation: InteriorLocation = RelayNetwork::get().into();
pub UnitWeightCost: u64 = 1_000;
}
pub type SovereignAccountOf = (
HashedDescription<AccountId, DescribeFamily<DescribeAllTerminal>>,
AccountId32Aliases<RelayNetwork, AccountId>,
ChildTeyrchainConvertsVia<ParaId, AccountId>,
);
pub type LocalBalancesTransactor =
FungibleAdapter<Balances, IsConcrete<TokenLocation>, SovereignAccountOf, AccountId, ()>;
pub type AssetTransactors = LocalBalancesTransactor;
type LocalOriginConverter = (
SovereignSignedViaLocation<SovereignAccountOf, RuntimeOrigin>,
ChildTeyrchainAsNative<origin::Origin, RuntimeOrigin>,
SignedAccountId32AsNative<RelayNetwork, RuntimeOrigin>,
ChildSystemTeyrchainAsSuperuser<ParaId, RuntimeOrigin>,
);
parameter_types! {
pub const XcmInstructionWeight: Weight = Weight::from_parts(1_000, 1_000);
pub TokensPerSecondPerMegabyte: (AssetId, u128, u128) =
(AssetId(TokenLocation::get()), 1_000_000_000_000, 1024 * 1024);
pub const MaxInstructions: u32 = 100;
pub const MaxAssetsIntoHolding: u32 = 64;
}
pub struct ChildrenTeyrchains;
impl Contains<Location> for ChildrenTeyrchains {
fn contains(location: &Location) -> bool {
matches!(location.unpack(), (0, [Teyrchain(_)]))
}
}
pub type XcmRouter = crate::RelayChainXcmRouter;
pub type Barrier = WithComputedOrigin<
(
AllowExplicitUnpaidExecutionFrom<ChildrenTeyrchains>,
AllowTopLevelPaidExecutionFrom<Everything>,
AllowSubscriptionsFrom<Everything>,
),
UniversalLocation,
ConstU32<1>,
>;
pub struct XcmConfig;
impl Config for XcmConfig {
type RuntimeCall = RuntimeCall;
type XcmSender = XcmRouter;
type XcmEventEmitter = XcmPallet;
type AssetTransactor = AssetTransactors;
type OriginConverter = LocalOriginConverter;
type IsReserve = ();
type IsTeleporter = ();
type UniversalLocation = UniversalLocation;
type Barrier = Barrier;
type Weigher = FixedWeightBounds<XcmInstructionWeight, RuntimeCall, MaxInstructions>;
type Trader = FixedRateOfFungible<TokensPerSecondPerMegabyte, ()>;
type ResponseHandler = XcmPallet;
type AssetTrap = XcmPallet;
type AssetLocker = XcmPallet;
type AssetExchanger = ();
type AssetClaims = XcmPallet;
type SubscriptionService = XcmPallet;
type PalletInstancesInfo = AllPalletsWithSystem;
type FeeManager = ();
type MaxAssetsIntoHolding = MaxAssetsIntoHolding;
type MessageExporter = ();
type UniversalAliases = Nothing;
type CallDispatcher = RuntimeCall;
type SafeCallFilter = Everything;
type Aliasers = Nothing;
type TransactionalProcessor = FrameTransactionalProcessor;
type HrmpNewChannelOpenRequestHandler = ();
type HrmpChannelAcceptedHandler = ();
type HrmpChannelClosingHandler = ();
type XcmRecorder = XcmPallet;
}
pub type LocalOriginToLocation = SignedToAccountId32<RuntimeOrigin, AccountId, RelayNetwork>;
impl pezpallet_xcm::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type SendXcmOrigin = xcm_builder::EnsureXcmOrigin<RuntimeOrigin, LocalOriginToLocation>;
type XcmRouter = XcmRouter;
type ExecuteXcmOrigin = xcm_builder::EnsureXcmOrigin<RuntimeOrigin, LocalOriginToLocation>;
type XcmExecuteFilter = Everything;
type XcmExecutor = XcmExecutor<XcmConfig>;
type XcmTeleportFilter = Everything;
type XcmReserveTransferFilter = Everything;
type Weigher = FixedWeightBounds<XcmInstructionWeight, RuntimeCall, MaxInstructions>;
type UniversalLocation = UniversalLocation;
type RuntimeOrigin = RuntimeOrigin;
type RuntimeCall = RuntimeCall;
const VERSION_DISCOVERY_QUEUE_SIZE: u32 = 100;
type AdvertisedXcmVersion = pezpallet_xcm::CurrentXcmVersion;
type Currency = Balances;
type CurrencyMatcher = IsConcrete<TokenLocation>;
type TrustedLockers = ();
type SovereignAccountOf = SovereignAccountOf;
type MaxLockers = ConstU32<8>;
type MaxRemoteLockConsumers = ConstU32<0>;
type RemoteLockConsumerIdentifier = ();
type WeightInfo = pezpallet_xcm::TestWeightInfo;
type AdminOrigin = EnsureRoot<AccountId>;
// Aliasing is disabled: xcm_executor::Config::Aliasers is set to `Nothing`.
type AuthorizedAliasConsideration = Disabled;
}
impl origin::Config for Runtime {}
type Block = pezframe_system::mocking::MockBlock<Runtime>;
impl pezpallet_message_queue::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type Size = u32;
type HeapSize = MessageQueueHeapSize;
type MaxStale = MessageQueueMaxStale;
type ServiceWeight = MessageQueueServiceWeight;
type IdleMaxServiceWeight = ();
type MessageProcessor = MessageProcessor;
type QueueChangeHandler = ();
type WeightInfo = ();
type QueuePausedQuery = ();
}
construct_runtime!(
pub enum Runtime {
System: pezframe_system,
Balances: pezpallet_balances,
ParasOrigin: origin,
XcmPallet: pezpallet_xcm,
MessageQueue: pezpallet_message_queue,
}
);
@@ -0,0 +1,201 @@
// This file is part of Bizinikiwi.
// 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::{
primitives::{AccountId, CENTS},
relay_chain,
teyrchain::{self, Runtime},
teyrchain_account_sovereign_account_id, MockNet, ParaA, Relay, TeyrchainBalances, ALICE, BOB,
INITIAL_BALANCE,
};
use codec::{Decode, Encode};
use pezframe_support::traits::{fungibles::Mutate, Currency};
use pezpallet_contracts::{test_utils::builder::*, Code};
use pezpallet_contracts_fixtures::compile_module;
use pezpallet_contracts_uapi::ReturnErrorCode;
use xcm::{v4::prelude::*, VersionedLocation, VersionedXcm};
use xcm_simulator::TestExt;
macro_rules! assert_return_code {
( $x:expr , $y:expr $(,)? ) => {{
assert_eq!(u32::from_le_bytes($x.data[..].try_into().unwrap()), $y as u32);
}};
}
fn bare_call(dest: pezsp_runtime::AccountId32) -> BareCallBuilder<teyrchain::Runtime> {
BareCallBuilder::<teyrchain::Runtime>::bare_call(ALICE, dest)
}
/// Instantiate the tests contract, and fund it with some balance and assets.
fn instantiate_test_contract(name: &str) -> AccountId {
let (wasm, _) = compile_module::<Runtime>(name).unwrap();
// Instantiate contract.
let contract_addr = ParaA::execute_with(|| {
BareInstantiateBuilder::<teyrchain::Runtime>::bare_instantiate(ALICE, Code::Upload(wasm))
.build_and_unwrap_account_id()
});
// Funds contract account with some balance and assets.
ParaA::execute_with(|| {
teyrchain::Balances::make_free_balance_be(&contract_addr, INITIAL_BALANCE);
teyrchain::Assets::mint_into(0u32.into(), &contract_addr, INITIAL_BALANCE).unwrap();
});
Relay::execute_with(|| {
let sovereign_account = teyrchain_account_sovereign_account_id(1u32, contract_addr.clone());
relay_chain::Balances::make_free_balance_be(&sovereign_account, INITIAL_BALANCE);
});
contract_addr
}
#[test]
fn test_xcm_execute() {
MockNet::reset();
let contract_addr = instantiate_test_contract("xcm_execute");
// Execute XCM instructions through the contract.
ParaA::execute_with(|| {
let amount: u128 = 10 * CENTS;
let assets: Asset = (Here, amount).into();
let beneficiary = AccountId32 { network: None, id: BOB.clone().into() };
// The XCM used to transfer funds to Bob.
let message: Xcm<()> = Xcm::builder_unsafe()
.withdraw_asset(assets.clone())
.deposit_asset(assets, beneficiary)
.build();
let result = bare_call(contract_addr.clone())
.data(VersionedXcm::V4(message).encode())
.build();
assert_eq!(result.gas_consumed, result.gas_required);
assert_return_code!(&result.result.unwrap(), ReturnErrorCode::Success);
// Check if the funds are subtracted from the account of Alice and added to the account of
// Bob.
let initial = INITIAL_BALANCE;
assert_eq!(TeyrchainBalances::free_balance(BOB), initial + amount);
assert_eq!(TeyrchainBalances::free_balance(&contract_addr), initial - amount);
});
}
#[test]
fn test_xcm_execute_incomplete() {
MockNet::reset();
let contract_addr = instantiate_test_contract("xcm_execute");
let amount = 10 * CENTS;
// Execute XCM instructions through the contract.
ParaA::execute_with(|| {
let assets: Asset = (Here, amount).into();
let beneficiary = AccountId32 { network: None, id: BOB.clone().into() };
// The XCM used to transfer funds to Bob.
let message: Xcm<()> = Xcm::builder_unsafe()
.withdraw_asset(assets.clone())
// This will fail as the contract does not have enough balance to complete both
// withdrawals.
.withdraw_asset((Here, INITIAL_BALANCE))
.buy_execution(assets.clone(), Unlimited)
.deposit_asset(assets, beneficiary)
.build();
let result = bare_call(contract_addr.clone())
.data(VersionedXcm::V4(message).encode())
.build();
assert_eq!(result.gas_consumed, result.gas_required);
assert_return_code!(&result.result.unwrap(), ReturnErrorCode::XcmExecutionFailed);
assert_eq!(TeyrchainBalances::free_balance(BOB), INITIAL_BALANCE);
assert_eq!(TeyrchainBalances::free_balance(&contract_addr), INITIAL_BALANCE - amount);
});
}
#[test]
fn test_xcm_execute_reentrant_call() {
MockNet::reset();
let contract_addr = instantiate_test_contract("xcm_execute");
ParaA::execute_with(|| {
let transact_call = teyrchain::RuntimeCall::Contracts(pezpallet_contracts::Call::call {
dest: contract_addr.clone(),
gas_limit: 1_000_000.into(),
storage_deposit_limit: None,
data: vec![],
value: 0u128,
});
// The XCM used to transfer funds to Bob.
let message: Xcm<teyrchain::RuntimeCall> = Xcm::builder_unsafe()
.transact(OriginKind::Native, 1_000_000_000, transact_call.encode())
.expect_transact_status(MaybeErrorCode::Success)
.build();
let result = bare_call(contract_addr.clone())
.data(VersionedXcm::V4(message).encode())
.build_and_unwrap_result();
assert_return_code!(&result, ReturnErrorCode::XcmExecutionFailed);
// Funds should not change hands as the XCM transact failed.
assert_eq!(TeyrchainBalances::free_balance(BOB), INITIAL_BALANCE);
});
}
#[test]
fn test_xcm_send() {
MockNet::reset();
let contract_addr = instantiate_test_contract("xcm_send");
let amount = 1_000 * CENTS;
let fee = teyrchain::estimate_message_fee(4); // Accounts for the `DescendOrigin` instruction added by `send_xcm`
// Send XCM instructions through the contract, to transfer some funds from the contract
// derivative account to Alice on the relay chain.
ParaA::execute_with(|| {
let dest = VersionedLocation::V4(Parent.into());
let assets: Asset = (Here, amount).into();
let beneficiary = AccountId32 { network: None, id: ALICE.clone().into() };
let message: Xcm<()> = Xcm::builder()
.withdraw_asset(assets.clone())
.buy_execution((Here, fee), Unlimited)
.deposit_asset(assets, beneficiary)
.build();
let result = bare_call(contract_addr.clone())
.data((dest, VersionedXcm::V4(message)).encode())
.build_and_unwrap_result();
let mut data = &result.data[..];
XcmHash::decode(&mut data).expect("Failed to decode xcm_send message_id");
});
Relay::execute_with(|| {
let derived_contract_addr = &teyrchain_account_sovereign_account_id(1, contract_addr);
assert_eq!(
INITIAL_BALANCE - amount,
relay_chain::Balances::free_balance(derived_contract_addr)
);
assert_eq!(INITIAL_BALANCE + amount - fee, relay_chain::Balances::free_balance(ALICE));
});
}
@@ -0,0 +1,354 @@
// Copyright (C) Parity Technologies (UK) Ltd.
// This file is part of Bizinikiwi.
// Bizinikiwi is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Bizinikiwi is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with Bizinikiwi. If not, see <http://www.gnu.org/licenses/>.
//! Teyrchain runtime mock.
mod contracts_config;
use crate::{
mocks::msg_queue::pallet as mock_msg_queue,
primitives::{AccountId, AssetIdForAssets, Balance},
};
use core::marker::PhantomData;
use pezframe_support::{
construct_runtime, derive_impl, parameter_types,
traits::{
AsEnsureOriginWithArg, Contains, ContainsPair, Disabled, Everything, EverythingBut, Nothing,
},
weights::{
constants::{WEIGHT_PROOF_SIZE_PER_MB, WEIGHT_REF_TIME_PER_SECOND},
Weight,
},
};
use pezframe_system::{EnsureRoot, EnsureSigned};
use pezpallet_xcm::XcmPassthrough;
use pezsp_core::{ConstU32, ConstU64, H256};
use pezsp_runtime::traits::{Get, IdentityLookup, MaybeEquivalence};
use xcm::latest::prelude::*;
use xcm_builder::{
AccountId32Aliases, AllowExplicitUnpaidExecutionFrom, AllowTopLevelPaidExecutionFrom,
ConvertedConcreteId, EnsureXcmOrigin, FixedRateOfFungible, FixedWeightBounds,
FrameTransactionalProcessor, FungibleAdapter, FungiblesAdapter, IsConcrete, NativeAsset,
NoChecking, ParentAsSuperuser, ParentIsPreset, SignedAccountId32AsNative, SignedToAccountId32,
SovereignSignedViaLocation, WithComputedOrigin,
};
use xcm_executor::{traits::JustTry, Config, XcmExecutor};
pub type SovereignAccountOf =
(AccountId32Aliases<RelayNetwork, AccountId>, ParentIsPreset<AccountId>);
#[derive_impl(pezframe_system::config_preludes::TestDefaultConfig)]
impl pezframe_system::Config for Runtime {
type RuntimeOrigin = RuntimeOrigin;
type RuntimeCall = RuntimeCall;
type Nonce = u64;
type Block = Block;
type Hash = H256;
type Hashing = ::pezsp_runtime::traits::BlakeTwo256;
type AccountId = AccountId;
type Lookup = IdentityLookup<Self::AccountId>;
type RuntimeEvent = RuntimeEvent;
type BlockWeights = ();
type BlockLength = ();
type Version = ();
type PalletInfo = PalletInfo;
type AccountData = pezpallet_balances::AccountData<Balance>;
type OnNewAccount = ();
type OnKilledAccount = ();
type DbWeight = ();
type BaseCallFilter = Everything;
type SystemWeightInfo = ();
type SS58Prefix = ();
type OnSetCode = ();
type MaxConsumers = ConstU32<16>;
}
parameter_types! {
pub ExistentialDeposit: Balance = 1;
pub const MaxLocks: u32 = 50;
pub const MaxReserves: u32 = 50;
}
impl pezpallet_balances::Config for Runtime {
type AccountStore = System;
type Balance = Balance;
type DustRemoval = ();
type ExistentialDeposit = ExistentialDeposit;
type FreezeIdentifier = ();
type MaxFreezes = ConstU32<0>;
type MaxLocks = MaxLocks;
type MaxReserves = MaxReserves;
type ReserveIdentifier = [u8; 8];
type RuntimeEvent = RuntimeEvent;
type RuntimeHoldReason = RuntimeHoldReason;
type RuntimeFreezeReason = RuntimeFreezeReason;
type WeightInfo = ();
type DoneSlashHandler = ();
}
parameter_types! {
pub const AssetDeposit: u128 = 1_000_000;
pub const MetadataDepositBase: u128 = 1_000_000;
pub const MetadataDepositPerByte: u128 = 100_000;
pub const AssetAccountDeposit: u128 = 1_000_000;
pub const ApprovalDeposit: u128 = 1_000_000;
pub const AssetsStringLimit: u32 = 50;
pub const RemoveItemsLimit: u32 = 50;
}
impl pezpallet_assets::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type Balance = Balance;
type AssetId = AssetIdForAssets;
type ReserveData = ();
type Currency = Balances;
type CreateOrigin = AsEnsureOriginWithArg<EnsureSigned<AccountId>>;
type ForceOrigin = EnsureRoot<AccountId>;
type AssetDeposit = AssetDeposit;
type MetadataDepositBase = MetadataDepositBase;
type MetadataDepositPerByte = MetadataDepositPerByte;
type AssetAccountDeposit = AssetAccountDeposit;
type ApprovalDeposit = ApprovalDeposit;
type StringLimit = AssetsStringLimit;
type Holder = ();
type Freezer = ();
type Extra = ();
type WeightInfo = ();
type RemoveItemsLimit = RemoveItemsLimit;
type AssetIdParameter = AssetIdForAssets;
type CallbackHandle = ();
#[cfg(feature = "runtime-benchmarks")]
type BenchmarkHelper = ();
}
parameter_types! {
pub const ReservedXcmpWeight: Weight = Weight::from_parts(WEIGHT_REF_TIME_PER_SECOND.saturating_div(4), 0);
pub const ReservedDmpWeight: Weight = Weight::from_parts(WEIGHT_REF_TIME_PER_SECOND.saturating_div(4), 0);
}
parameter_types! {
pub const KsmLocation: Location = Location::parent();
pub const TokenLocation: Location = Here.into_location();
pub const RelayNetwork: NetworkId = ByGenesis([0; 32]);
pub UniversalLocation: InteriorLocation = [GlobalConsensus(RelayNetwork::get()), Teyrchain(MsgQueue::teyrchain_id().into())].into();
}
pub type XcmOriginToCallOrigin = (
SovereignSignedViaLocation<SovereignAccountOf, RuntimeOrigin>,
ParentAsSuperuser<RuntimeOrigin>,
SignedAccountId32AsNative<RelayNetwork, RuntimeOrigin>,
XcmPassthrough<RuntimeOrigin>,
);
parameter_types! {
pub const XcmInstructionWeight: Weight = Weight::from_parts(1_000, 1_000);
pub TokensPerSecondPerMegabyte: (AssetId, u128, u128) = (AssetId(Parent.into()), 1_000_000_000_000, 1024 * 1024);
pub const MaxInstructions: u32 = 100;
pub const MaxAssetsIntoHolding: u32 = 64;
pub ForeignPrefix: Location = (Parent,).into();
pub CheckingAccount: AccountId = PezkuwiXcm::check_account();
pub TrustedLockPairs: (Location, AssetFilter) =
(Parent.into(), Wild(AllOf { id: AssetId(Parent.into()), fun: WildFungible }));
}
pub fn estimate_message_fee(number_of_instructions: u64) -> u128 {
let weight = estimate_weight(number_of_instructions);
estimate_fee_for_weight(weight)
}
pub fn estimate_weight(number_of_instructions: u64) -> Weight {
XcmInstructionWeight::get().saturating_mul(number_of_instructions)
}
pub fn estimate_fee_for_weight(weight: Weight) -> u128 {
let (_, units_per_second, units_per_mb) = TokensPerSecondPerMegabyte::get();
units_per_second * (weight.ref_time() as u128) / (WEIGHT_REF_TIME_PER_SECOND as u128) +
units_per_mb * (weight.proof_size() as u128) / (WEIGHT_PROOF_SIZE_PER_MB as u128)
}
pub type LocalBalancesTransactor =
FungibleAdapter<Balances, IsConcrete<TokenLocation>, SovereignAccountOf, AccountId, ()>;
pub struct FromLocationToAsset<Location, AssetId>(PhantomData<(Location, AssetId)>);
impl MaybeEquivalence<Location, AssetIdForAssets>
for FromLocationToAsset<Location, AssetIdForAssets>
{
fn convert(value: &Location) -> Option<AssetIdForAssets> {
match value.unpack() {
(1, []) => Some(0 as AssetIdForAssets),
(1, [Teyrchain(para_id)]) => Some(*para_id as AssetIdForAssets),
_ => None,
}
}
fn convert_back(_id: &AssetIdForAssets) -> Option<Location> {
None
}
}
pub type ForeignAssetsTransactor = FungiblesAdapter<
Assets,
ConvertedConcreteId<
AssetIdForAssets,
Balance,
FromLocationToAsset<Location, AssetIdForAssets>,
JustTry,
>,
SovereignAccountOf,
AccountId,
NoChecking,
CheckingAccount,
>;
/// Means for transacting assets on this chain
pub type AssetTransactors = (LocalBalancesTransactor, ForeignAssetsTransactor);
pub struct ParentRelay;
impl Contains<Location> for ParentRelay {
fn contains(location: &Location) -> bool {
location.contains_parents_only(1)
}
}
pub struct ThisTeyrchain;
impl Contains<Location> for ThisTeyrchain {
fn contains(location: &Location) -> bool {
matches!(location.unpack(), (0, [Junction::AccountId32 { .. }]))
}
}
pub type XcmRouter = crate::TeyrchainXcmRouter<MsgQueue>;
pub type Barrier = (
xcm_builder::AllowUnpaidExecutionFrom<ThisTeyrchain>,
WithComputedOrigin<
(AllowExplicitUnpaidExecutionFrom<ParentRelay>, AllowTopLevelPaidExecutionFrom<Everything>),
UniversalLocation,
ConstU32<1>,
>,
);
parameter_types! {
pub NftCollectionOne: AssetFilter
= Wild(AllOf { fun: WildNonFungible, id: AssetId((Parent, GeneralIndex(1)).into()) });
pub NftCollectionOneForRelay: (AssetFilter, Location)
= (NftCollectionOne::get(), Parent.into());
pub RelayNativeAsset: AssetFilter = Wild(AllOf { fun: WildFungible, id: AssetId((Parent, Here).into()) });
pub RelayNativeAssetForRelay: (AssetFilter, Location) = (RelayNativeAsset::get(), Parent.into());
}
pub type TrustedTeleporters =
(xcm_builder::Case<NftCollectionOneForRelay>, xcm_builder::Case<RelayNativeAssetForRelay>);
pub type TrustedReserves = EverythingBut<xcm_builder::Case<NftCollectionOneForRelay>>;
pub struct XcmConfig;
impl Config for XcmConfig {
type RuntimeCall = RuntimeCall;
type XcmSender = XcmRouter;
type XcmEventEmitter = PezkuwiXcm;
type AssetTransactor = AssetTransactors;
type OriginConverter = XcmOriginToCallOrigin;
type IsReserve = (NativeAsset, TrustedReserves);
type IsTeleporter = TrustedTeleporters;
type UniversalLocation = UniversalLocation;
type Barrier = Barrier;
type Weigher = FixedWeightBounds<XcmInstructionWeight, RuntimeCall, MaxInstructions>;
type Trader = FixedRateOfFungible<TokensPerSecondPerMegabyte, ()>;
type ResponseHandler = PezkuwiXcm;
type AssetTrap = PezkuwiXcm;
type AssetLocker = PezkuwiXcm;
type AssetExchanger = ();
type AssetClaims = PezkuwiXcm;
type SubscriptionService = PezkuwiXcm;
type PalletInstancesInfo = AllPalletsWithSystem;
type FeeManager = ();
type MaxAssetsIntoHolding = MaxAssetsIntoHolding;
type MessageExporter = ();
type UniversalAliases = Nothing;
type CallDispatcher = RuntimeCall;
type SafeCallFilter = Everything;
type Aliasers = Nothing;
type TransactionalProcessor = FrameTransactionalProcessor;
type HrmpNewChannelOpenRequestHandler = ();
type HrmpChannelAcceptedHandler = ();
type HrmpChannelClosingHandler = ();
type XcmRecorder = PezkuwiXcm;
}
impl mock_msg_queue::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type XcmExecutor = XcmExecutor<XcmConfig>;
}
pub type LocalOriginToLocation = SignedToAccountId32<RuntimeOrigin, AccountId, RelayNetwork>;
pub struct TrustedLockerCase<T>(PhantomData<T>);
impl<T: Get<(Location, AssetFilter)>> ContainsPair<Location, Asset> for TrustedLockerCase<T> {
fn contains(origin: &Location, asset: &Asset) -> bool {
let (o, a) = T::get();
a.matches(asset) && &o == origin
}
}
impl pezpallet_xcm::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type SendXcmOrigin = EnsureXcmOrigin<RuntimeOrigin, LocalOriginToLocation>;
type XcmRouter = XcmRouter;
type ExecuteXcmOrigin = EnsureXcmOrigin<RuntimeOrigin, LocalOriginToLocation>;
type XcmExecuteFilter = Everything;
type XcmExecutor = XcmExecutor<XcmConfig>;
type XcmTeleportFilter = Nothing;
type XcmReserveTransferFilter = Everything;
type Weigher = FixedWeightBounds<XcmInstructionWeight, RuntimeCall, MaxInstructions>;
type UniversalLocation = UniversalLocation;
type RuntimeOrigin = RuntimeOrigin;
type RuntimeCall = RuntimeCall;
const VERSION_DISCOVERY_QUEUE_SIZE: u32 = 100;
type AdvertisedXcmVersion = pezpallet_xcm::CurrentXcmVersion;
type Currency = Balances;
type CurrencyMatcher = IsConcrete<TokenLocation>;
type TrustedLockers = TrustedLockerCase<TrustedLockPairs>;
type SovereignAccountOf = SovereignAccountOf;
type MaxLockers = ConstU32<8>;
type MaxRemoteLockConsumers = ConstU32<0>;
type RemoteLockConsumerIdentifier = ();
type WeightInfo = pezpallet_xcm::TestWeightInfo;
type AdminOrigin = EnsureRoot<AccountId>;
// Aliasing is disabled: xcm_executor::Config::Aliasers is set to `Nothing`.
type AuthorizedAliasConsideration = Disabled;
}
type Block = pezframe_system::mocking::MockBlock<Runtime>;
impl pezpallet_timestamp::Config for Runtime {
type Moment = u64;
type OnTimestampSet = ();
type MinimumPeriod = ConstU64<1>;
type WeightInfo = ();
}
construct_runtime!(
pub enum Runtime
{
System: pezframe_system,
Balances: pezpallet_balances,
Timestamp: pezpallet_timestamp,
MsgQueue: mock_msg_queue,
PezkuwiXcm: pezpallet_xcm,
Contracts: pezpallet_contracts,
Assets: pezpallet_assets,
}
);
@@ -0,0 +1,33 @@
// Copyright (C) Parity Technologies (UK) Ltd.
// This file is part of Bizinikiwi.
// Bizinikiwi is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Bizinikiwi is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with Bizinikiwi. If not, see <http://www.gnu.org/licenses/>.
use super::{Balances, Runtime, RuntimeCall, RuntimeEvent};
use crate::teyrchain::RuntimeHoldReason;
use pezframe_support::{derive_impl, parameter_types};
parameter_types! {
pub Schedule: pezpallet_contracts::Schedule<Runtime> = Default::default();
}
#[derive_impl(pezpallet_contracts::config_preludes::TestDefaultConfig)]
impl pezpallet_contracts::Config for Runtime {
type AddressGenerator = pezpallet_contracts::DefaultAddressGenerator;
type CallStack = [pezpallet_contracts::Frame<Self>; 5];
type Currency = Balances;
type Schedule = Schedule;
type Time = super::Timestamp;
type Xcm = pezpallet_xcm::Pallet<Self>;
}