difftreelog
refactor xcm transact forbidden test
in: master
17 files changed
runtime/common/tests/mod.rsdiffbeforeafterboth--- a/runtime/common/tests/mod.rs
+++ b/runtime/common/tests/mod.rs
@@ -14,22 +14,49 @@
// You should have received a copy of the GNU General Public License
// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
-use sp_runtime::BuildStorage;
+use sp_runtime::{BuildStorage, Storage};
use sp_core::{Public, Pair};
use sp_std::vec;
use up_common::types::AuraId;
-use crate::{GenesisConfig, ParachainInfoConfig};
+use crate::{Runtime, GenesisConfig, ParachainInfoConfig, RuntimeEvent, System};
+
+pub use sp_runtime::AccountId32 as AccountId;
+pub type Balance = u128;
pub mod xcm;
+#[cfg(any(feature = "opal-runtime", feature = "quartz-runtime"))]
+/// PARA_ID for Opal/Sapphire/Quartz
+const PARA_ID: u32 = 2095;
+
+#[cfg(feature = "unique-runtime")]
+/// PARA_ID for Unique
+const PARA_ID: u32 = 2037;
+
fn get_from_seed<TPublic: Public>(seed: &str) -> <TPublic::Pair as Pair>::Public {
TPublic::Pair::from_string(&format!("//{}", seed), None)
.expect("static values are valid; qed")
.public()
}
+fn last_events(n: usize) -> Vec<RuntimeEvent> {
+ System::events().into_iter().map(|e| e.event).rev().take(n).rev().collect()
+}
+
+fn new_test_ext(balances: Vec<(AccountId, Balance)>) -> sp_io::TestExternalities {
+ let mut storage = make_basic_storage();
+
+ pallet_balances::GenesisConfig::<Runtime> { balances }
+ .assimilate_storage(&mut storage)
+ .unwrap();
+
+ let mut ext = sp_io::TestExternalities::new(storage);
+ ext.execute_with(|| System::set_block_number(1));
+ ext
+}
+
#[cfg(feature = "collator-selection")]
-fn new_test_ext(para_id: u32) -> sp_io::TestExternalities {
+fn make_basic_storage() -> Storage {
use sp_core::{sr25519};
use sp_runtime::traits::{IdentifyAccount, Verify};
use crate::{AccountId, Signature, SessionKeys, CollatorSelectionConfig, SessionConfig};
@@ -66,7 +93,7 @@
collator_selection: CollatorSelectionConfig { invulnerables },
session: SessionConfig { keys },
parachain_info: ParachainInfoConfig {
- parachain_id: para_id.into(),
+ parachain_id: PARA_ID.into(),
},
..GenesisConfig::default()
};
@@ -75,7 +102,7 @@
}
#[cfg(not(feature = "collator-selection"))]
-fn new_test_ext(para_id: u32) -> sp_io::TestExternalities {
+fn make_basic_storage() -> Storage {
use crate::AuraConfig;
let cfg = GenesisConfig {
@@ -86,7 +113,7 @@
],
},
parachain_info: ParachainInfoConfig {
- parachain_id: para_id.into(),
+ parachain_id: PARA_ID.into(),
},
..GenesisConfig::default()
};
runtime/common/tests/xcm.rsdiffbeforeafterboth--- a/runtime/common/tests/xcm.rs
+++ b/runtime/common/tests/xcm.rs
@@ -14,149 +14,53 @@
// You should have received a copy of the GNU General Public License
// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
-use xcm_executor::traits::ShouldExecute;
-use xcm::latest::prelude::*;
-use logtest::Logger;
-use crate::RuntimeCall;
-use super::new_test_ext;
-use frame_support::pallet_prelude::Weight;
-
-fn catch_xcm_barrier_log(logger: &mut Logger, expected_msg: &str) -> Result<(), String> {
- for record in logger {
- if record.target() == "xcm::barrier" && record.args() == expected_msg {
- return Ok(());
- }
- }
-
- Err(format!(
- "the expected XCM barrier log `{}` is not found",
- expected_msg
- ))
-}
-
-/// WARNING: Uses log capturing
-/// See https://docs.rs/logtest/latest/logtest/index.html#constraints
-pub fn barrier_denies_transact<B: ShouldExecute>(logger: &mut Logger) {
- let location = MultiLocation {
- parents: 0,
- interior: Junctions::Here,
- };
-
- // We will never decode this "call",
- // so it is irrelevant what we are passing to the `transact` cmd.
- let fake_encoded_call = vec![0u8];
-
- let transact_inst: Instruction<RuntimeCall> = Transact {
- origin_kind: OriginKind::Superuser,
- require_weight_at_most: Weight::default(),
- call: fake_encoded_call.into(),
- };
-
- let mut xcm_program = vec![transact_inst];
+use xcm::{
+ VersionedXcm,
+ latest::{prelude::*, Error}
+};
+use codec::Encode;
+use crate::{Runtime, RuntimeCall, RuntimeOrigin, RuntimeEvent, PolkadotXcm};
+use super::{new_test_ext, last_events, AccountId};
+use frame_support::{
+ pallet_prelude::Weight,
+};
- let max_weight = Weight::from_parts(100_000, 100_000);
- let mut weight_credit = Weight::from_parts(100_000_000, 100_000_000);
+const ALICE: AccountId = AccountId::new([0u8; 32]);
+const BOB: AccountId = AccountId::new([1u8; 32]);
- let result = B::should_execute(&location, &mut xcm_program, max_weight, &mut weight_credit);
+const INITIAL_BALANCE: u128 = 1000000000000000000_0000; // 1000 UNQ
- assert!(
- result.is_err(),
- "the barrier should disallow the XCM transact cmd"
- );
+#[test]
+pub fn xcm_transact_is_forbidden() {
+ new_test_ext(vec![(ALICE, INITIAL_BALANCE)]).execute_with(|| {
+ PolkadotXcm::execute(
+ RuntimeOrigin::signed(ALICE),
+ Box::new(VersionedXcm::from(Xcm(vec![
+ Transact {
+ origin_kind: OriginKind::Native,
+ require_weight_at_most: Weight::from_parts(1000, 1000),
+ call: RuntimeCall::Balances(
+ pallet_balances::Call::<Runtime>::transfer {
+ dest: BOB.into(),
+ value: INITIAL_BALANCE / 2,
+ }
+ ).encode().into(),
+ }
+ ]))),
+ Weight::from_parts(1001000, 2000),
+ ).expect("XCM execute must succeed, the error should be in the `PolkadotXcm::Attempted` event");
- catch_xcm_barrier_log(logger, "transact XCM rejected").unwrap();
-}
-
-fn xcm_execute<B: ShouldExecute>(
- self_para_id: u32,
- location: &MultiLocation,
- xcm: &mut [Instruction<RuntimeCall>],
-) -> Result<(), ()> {
- new_test_ext(self_para_id).execute_with(|| {
- let max_weight = Weight::from_parts(100_000, 100_000);
- let mut weight_credit = Weight::from_parts(100_000_000, 100_000_000);
-
- B::should_execute(&location, xcm, max_weight, &mut weight_credit)
- })
-}
-
-fn make_multiassets(location: &MultiLocation) -> MultiAssets {
- let id = AssetId::Concrete(location.clone());
- let fun = Fungibility::Fungible(42);
- let multiasset = MultiAsset { id, fun };
-
- multiasset.into()
-}
-
-fn make_transfer_reserve_asset(location: &MultiLocation) -> Xcm<RuntimeCall> {
- let assets = make_multiassets(location);
- let inst = TransferReserveAsset {
- assets,
- dest: location.clone(),
- xcm: Xcm(vec![]),
- };
-
- Xcm::<RuntimeCall>(vec![inst])
-}
-
-fn make_deposit_reserve_asset(location: &MultiLocation) -> Xcm<RuntimeCall> {
- let assets = make_multiassets(location);
- let inst = DepositReserveAsset {
- assets: assets.into(),
- dest: location.clone(),
- xcm: Xcm(vec![]),
- };
-
- Xcm::<RuntimeCall>(vec![inst])
-}
-
-fn expect_transfer_location_denied<B: ShouldExecute>(
- logger: &mut Logger,
- self_para_id: u32,
- location: &MultiLocation,
- xcm: &mut [Instruction<RuntimeCall>],
-) -> Result<(), String> {
- let result = xcm_execute::<B>(self_para_id, location, xcm);
-
- if result.is_ok() {
- return Err("the barrier should deny the unknown location".into());
- }
-
- catch_xcm_barrier_log(logger, "Unexpected deposit or transfer location")
-}
-
-/// WARNING: Uses log capturing
-/// See https://docs.rs/logtest/latest/logtest/index.html#constraints
-pub fn barrier_denies_transfer_from_unknown_location<B>(
- logger: &mut Logger,
- self_para_id: u32,
-) -> Result<(), String>
-where
- B: ShouldExecute,
-{
- const UNKNOWN_PARACHAIN_ID: u32 = 4057;
-
- let unknown_location = MultiLocation {
- parents: 1,
- interior: X1(Parachain(UNKNOWN_PARACHAIN_ID)),
- };
-
- let mut transfer_reserve_asset = make_transfer_reserve_asset(&unknown_location);
- let mut deposit_reserve_asset = make_deposit_reserve_asset(&unknown_location);
-
- expect_transfer_location_denied::<B>(
- logger,
- self_para_id,
- &unknown_location,
- &mut transfer_reserve_asset.0,
- )?;
-
- expect_transfer_location_denied::<B>(
- logger,
- self_para_id,
- &unknown_location,
- &mut deposit_reserve_asset.0,
- )?;
-
- Ok(())
+ let xcm_event = &last_events(1)[0];
+ match xcm_event {
+ RuntimeEvent::PolkadotXcm(
+ pallet_xcm::Event::<Runtime>::Attempted(
+ Outcome::Incomplete(_weight, Error::NoPermission)
+ )
+ ) => { /* Pass */ },
+ _ => panic!(
+ "Expected PolkadotXcm.Attempted(Incomplete(_weight, NoPermission)),\
+ found: {xcm_event:#?}"
+ )
+ }
+ });
}
runtime/opal/Cargo.tomldiffbeforeafterboth1################################################################################2# Package34[package]5authors = ['Unique Network <support@uniquenetwork.io>']6build = 'build.rs'7description = 'Opal Runtime'8edition = '2021'9homepage = 'https://unique.network'10license = 'GPLv3'11name = 'opal-runtime'12repository = 'https://github.com/UniqueNetwork/unique-chain'13version.workspace = true1415[package.metadata.docs.rs]16targets = ['x86_64-unknown-linux-gnu']1718[features]19default = ['opal-runtime', 'std']20limit-testing = ['pallet-unique/limit-testing', 'up-data-structs/limit-testing']21opal-runtime = ['app-promotion', 'collator-selection', 'foreign-assets', 'preimage', 'pallet-test-utils', 'refungible']22pov-estimate = []23runtime-benchmarks = [24 'cumulus-pallet-parachain-system/runtime-benchmarks',25 'frame-benchmarking',26 'frame-support/runtime-benchmarks',27 'frame-system-benchmarking',28 'frame-system/runtime-benchmarks',29 'hex-literal',30 'pallet-app-promotion/runtime-benchmarks',31 'pallet-balances/runtime-benchmarks',32 'pallet-collator-selection/runtime-benchmarks',33 'pallet-common/runtime-benchmarks',34 'pallet-configuration/runtime-benchmarks',35 'pallet-ethereum/runtime-benchmarks',36 'pallet-evm-coder-substrate/runtime-benchmarks',37 'pallet-evm-migration/runtime-benchmarks',38 'pallet-foreign-assets/runtime-benchmarks',39 'pallet-fungible/runtime-benchmarks',40 'pallet-identity/runtime-benchmarks',41 'pallet-inflation/runtime-benchmarks',42 'pallet-maintenance/runtime-benchmarks',43 'pallet-nonfungible/runtime-benchmarks',44 "pallet-preimage/runtime-benchmarks",45 'pallet-refungible/runtime-benchmarks',46 'pallet-structure/runtime-benchmarks',47 'pallet-timestamp/runtime-benchmarks',48 'pallet-unique-scheduler-v2/runtime-benchmarks',49 'pallet-unique/runtime-benchmarks',50 'pallet-xcm/runtime-benchmarks',51 'sp-runtime/runtime-benchmarks',52 'xcm-builder/runtime-benchmarks',53]54std = [55 'codec/std',56 'cumulus-pallet-aura-ext/std',57 'cumulus-pallet-parachain-system/std',58 'cumulus-pallet-xcm/std',59 'cumulus-pallet-xcmp-queue/std',60 'cumulus-primitives-core/std',61 'cumulus-primitives-utility/std',62 'frame-executive/std',63 'frame-support/std',64 'frame-system-rpc-runtime-api/std',65 'frame-system/std',66 'frame-try-runtime/std',67 'pallet-aura/std',68 'pallet-balances/std',69 # 'pallet-contracts/std',70 # 'pallet-contracts-primitives/std',71 # 'pallet-contracts-rpc-runtime-api/std',72 # 'pallet-contract-helpers/std',73 "pallet-preimage/std",74 "pallet-authorship/std",75 "pallet-session/std",76 "sp-consensus-aura/std",77 'app-promotion-rpc/std',78 'evm-coder/std',79 'fp-evm-mapping/std',80 'fp-rpc/std',81 'fp-self-contained/std',82 'pallet-app-promotion/std',83 'pallet-base-fee/std',84 'pallet-charge-transaction/std',85 'pallet-collator-selection/std',86 'pallet-common/std',87 'pallet-configuration/std',88 'pallet-ethereum/std',89 'pallet-evm-coder-substrate/std',90 'pallet-evm-contract-helpers/std',91 'pallet-evm-migration/std',92 'pallet-evm-transaction-payment/std',93 'pallet-evm/std',94 'pallet-fungible/std',95 'pallet-identity/std',96 'pallet-inflation/std',97 'pallet-nonfungible/std',98 'pallet-refungible/std',99 'pallet-structure/std',100 'pallet-sudo/std',101 'pallet-timestamp/std',102 'pallet-transaction-payment-rpc-runtime-api/std',103 'pallet-transaction-payment/std',104 'pallet-treasury/std',105 'pallet-unique-scheduler-v2/std',106 'pallet-unique/std',107 'parachain-info/std',108 'serde',109 'sp-api/std',110 'sp-block-builder/std',111 'sp-core/std',112 'sp-inherents/std',113 'sp-io/std',114 'sp-offchain/std',115 'sp-runtime/std',116 'sp-session/std',117 'sp-std/std',118 'sp-transaction-pool/std',119 'sp-version/std',120 'up-common/std',121 'up-data-structs/std',122 'up-pov-estimate-rpc/std',123 'up-rpc/std',124 'up-sponsorship/std',125 'xcm-builder/std',126 'xcm-executor/std',127 'xcm/std',128129 "orml-tokens/std",130 "orml-traits/std",131 "orml-vesting/std",132 "orml-xtokens/std",133 "pallet-foreign-assets/std",134135 'pallet-maintenance/std',136 'pallet-test-utils/std',137]138try-runtime = [139 "pallet-authorship/try-runtime",140 "pallet-collator-selection/try-runtime",141 "pallet-identity/try-runtime",142 "pallet-session/try-runtime",143 "pallet-preimage/try-runtime",144 'cumulus-pallet-aura-ext/try-runtime',145 'cumulus-pallet-dmp-queue/try-runtime',146 'cumulus-pallet-parachain-system/try-runtime',147 'cumulus-pallet-xcm/try-runtime',148 'cumulus-pallet-xcmp-queue/try-runtime',149 'fp-self-contained/try-runtime',150 'frame-executive/try-runtime',151 'frame-support/try-runtime',152 'frame-system/try-runtime',153 'frame-try-runtime',154 'frame-try-runtime?/try-runtime',155 'orml-tokens/try-runtime',156 'orml-vesting/try-runtime',157 'orml-xtokens/try-runtime',158 'pallet-app-promotion/try-runtime',159 'pallet-aura/try-runtime',160 'pallet-balances/try-runtime',161 'pallet-base-fee/try-runtime',162 'pallet-charge-transaction/try-runtime',163 'pallet-common/try-runtime',164 'pallet-configuration/try-runtime',165 'pallet-ethereum/try-runtime',166 'pallet-evm-coder-substrate/try-runtime',167 'pallet-evm-contract-helpers/try-runtime',168 'pallet-evm-migration/try-runtime',169 'pallet-evm-transaction-payment/try-runtime',170 'pallet-evm/try-runtime',171 'pallet-foreign-assets/try-runtime',172 'pallet-fungible/try-runtime',173 'pallet-inflation/try-runtime',174 'pallet-maintenance/try-runtime',175 'pallet-nonfungible/try-runtime',176 'pallet-refungible/try-runtime',177 'pallet-structure/try-runtime',178 'pallet-sudo/try-runtime',179 'pallet-test-utils/try-runtime',180 'pallet-timestamp/try-runtime',181 'pallet-transaction-payment/try-runtime',182 'pallet-treasury/try-runtime',183 'pallet-unique-scheduler-v2/try-runtime',184 'pallet-unique/try-runtime',185 'pallet-xcm/try-runtime',186 'parachain-info/try-runtime',187]188189app-promotion = []190collator-selection = []191foreign-assets = []192preimage = []193pallet-test-utils = []194refungible = []195scheduler = []196197################################################################################198# local dependencies199200[dependencies]201# Note: `package = "parity-scale-codec"` must be supplied since the `Encode` macro searches for it.202codec = { workspace = true, package = "parity-scale-codec" }203204cumulus-pallet-aura-ext = { workspace = true }205cumulus-pallet-dmp-queue = { workspace = true }206cumulus-pallet-parachain-system = { workspace = true }207cumulus-pallet-xcm = { workspace = true }208cumulus-pallet-xcmp-queue = { workspace = true }209cumulus-primitives-core = { workspace = true }210cumulus-primitives-timestamp = { workspace = true }211cumulus-primitives-utility = { workspace = true }212frame-executive = { workspace = true }213frame-support = { workspace = true }214frame-system = { workspace = true }215frame-system-rpc-runtime-api = { workspace = true }216orml-tokens = { workspace = true }217orml-traits = { workspace = true }218orml-vesting = { workspace = true }219orml-xtokens = { workspace = true }220pallet-aura = { workspace = true }221pallet-authorship = { workspace = true }222pallet-balances = { workspace = true }223pallet-preimage = { workspace = true }224pallet-session = { workspace = true }225pallet-sudo = { workspace = true }226pallet-timestamp = { workspace = true }227pallet-transaction-payment = { workspace = true }228pallet-transaction-payment-rpc-runtime-api = { workspace = true }229pallet-treasury = { workspace = true }230pallet-xcm = { workspace = true }231parachain-info = { workspace = true }232polkadot-parachain = { workspace = true }233smallvec = { workspace = true }234sp-api = { workspace = true }235sp-arithmetic = { workspace = true }236sp-block-builder = { workspace = true }237sp-consensus-aura = { workspace = true }238sp-core = { workspace = true }239sp-inherents = { workspace = true }240sp-io = { workspace = true }241sp-offchain = { workspace = true }242sp-runtime = { workspace = true }243sp-session = { workspace = true }244sp-std = { workspace = true }245sp-transaction-pool = { workspace = true }246sp-version = { workspace = true }247xcm = { workspace = true }248xcm-builder = { workspace = true }249xcm-executor = { workspace = true }250251app-promotion-rpc = { workspace = true }252derivative = { workspace = true }253evm-coder = { workspace = true }254fp-evm = { workspace = true }255fp-evm-mapping = { workspace = true }256fp-rpc = { workspace = true }257fp-self-contained = { workspace = true }258log = { workspace = true }259num_enum = { workspace = true }260pallet-app-promotion = { workspace = true }261pallet-base-fee = { workspace = true }262pallet-charge-transaction = { workspace = true }263pallet-collator-selection = { workspace = true }264pallet-common = { workspace = true }265pallet-configuration = { workspace = true }266pallet-ethereum = { workspace = true }267pallet-evm = { workspace = true }268pallet-evm-coder-substrate = { workspace = true }269pallet-evm-contract-helpers = { workspace = true }270pallet-evm-migration = { workspace = true }271pallet-evm-precompile-simple = { workspace = true }272pallet-evm-transaction-payment = { workspace = true }273pallet-foreign-assets = { workspace = true }274pallet-fungible = { workspace = true }275pallet-identity = { workspace = true }276pallet-inflation = { workspace = true }277pallet-maintenance = { workspace = true }278pallet-nonfungible = { workspace = true }279pallet-refungible = { workspace = true }280pallet-structure = { workspace = true }281pallet-unique = { workspace = true }282pallet-unique-scheduler-v2 = { workspace = true }283precompile-utils-macro = { workspace = true }284scale-info = { workspace = true }285up-common = { workspace = true }286up-data-structs = { workspace = true }287up-pov-estimate-rpc = { workspace = true }288up-rpc = { workspace = true }289up-sponsorship = { workspace = true }290291################################################################################292# Optional dependencies293294frame-system-benchmarking = { workspace = true, optional = true}295frame-benchmarking = { workspace = true, optional = true }296frame-try-runtime = { workspace = true, optional = true }297serde = { workspace = true, optional = true }298hex-literal = { workspace = true, optional = true }299300################################################################################301# Test dependencies302303pallet-test-utils = { workspace = true }304305################################################################################306# Other Dependencies307308impl-trait-for-tuples = { workspace = true }309310[dev-dependencies]311logtest = { workspace = true }312313[build-dependencies]314substrate-wasm-builder = { workspace = true }1################################################################################2# Package34[package]5authors = ['Unique Network <support@uniquenetwork.io>']6build = 'build.rs'7description = 'Opal Runtime'8edition = '2021'9homepage = 'https://unique.network'10license = 'GPLv3'11name = 'opal-runtime'12repository = 'https://github.com/UniqueNetwork/unique-chain'13version.workspace = true1415[package.metadata.docs.rs]16targets = ['x86_64-unknown-linux-gnu']1718[features]19default = ['opal-runtime', 'std']20limit-testing = ['pallet-unique/limit-testing', 'up-data-structs/limit-testing']21opal-runtime = ['app-promotion', 'collator-selection', 'foreign-assets', 'preimage', 'pallet-test-utils', 'refungible']22pov-estimate = []23runtime-benchmarks = [24 'cumulus-pallet-parachain-system/runtime-benchmarks',25 'frame-benchmarking',26 'frame-support/runtime-benchmarks',27 'frame-system-benchmarking',28 'frame-system/runtime-benchmarks',29 'hex-literal',30 'pallet-app-promotion/runtime-benchmarks',31 'pallet-balances/runtime-benchmarks',32 'pallet-collator-selection/runtime-benchmarks',33 'pallet-common/runtime-benchmarks',34 'pallet-configuration/runtime-benchmarks',35 'pallet-ethereum/runtime-benchmarks',36 'pallet-evm-coder-substrate/runtime-benchmarks',37 'pallet-evm-migration/runtime-benchmarks',38 'pallet-foreign-assets/runtime-benchmarks',39 'pallet-fungible/runtime-benchmarks',40 'pallet-identity/runtime-benchmarks',41 'pallet-inflation/runtime-benchmarks',42 'pallet-maintenance/runtime-benchmarks',43 'pallet-nonfungible/runtime-benchmarks',44 "pallet-preimage/runtime-benchmarks",45 'pallet-refungible/runtime-benchmarks',46 'pallet-structure/runtime-benchmarks',47 'pallet-timestamp/runtime-benchmarks',48 'pallet-unique-scheduler-v2/runtime-benchmarks',49 'pallet-unique/runtime-benchmarks',50 'pallet-xcm/runtime-benchmarks',51 'sp-runtime/runtime-benchmarks',52 'xcm-builder/runtime-benchmarks',53]54std = [55 'codec/std',56 'cumulus-pallet-aura-ext/std',57 'cumulus-pallet-parachain-system/std',58 'cumulus-pallet-xcm/std',59 'cumulus-pallet-xcmp-queue/std',60 'cumulus-primitives-core/std',61 'cumulus-primitives-utility/std',62 'frame-executive/std',63 'frame-support/std',64 'frame-system-rpc-runtime-api/std',65 'frame-system/std',66 'frame-try-runtime/std',67 'pallet-aura/std',68 'pallet-balances/std',69 # 'pallet-contracts/std',70 # 'pallet-contracts-primitives/std',71 # 'pallet-contracts-rpc-runtime-api/std',72 # 'pallet-contract-helpers/std',73 "pallet-preimage/std",74 "pallet-authorship/std",75 "pallet-session/std",76 "sp-consensus-aura/std",77 'app-promotion-rpc/std',78 'evm-coder/std',79 'fp-evm-mapping/std',80 'fp-rpc/std',81 'fp-self-contained/std',82 'pallet-app-promotion/std',83 'pallet-base-fee/std',84 'pallet-charge-transaction/std',85 'pallet-collator-selection/std',86 'pallet-common/std',87 'pallet-configuration/std',88 'pallet-ethereum/std',89 'pallet-evm-coder-substrate/std',90 'pallet-evm-contract-helpers/std',91 'pallet-evm-migration/std',92 'pallet-evm-transaction-payment/std',93 'pallet-evm/std',94 'pallet-fungible/std',95 'pallet-identity/std',96 'pallet-inflation/std',97 'pallet-nonfungible/std',98 'pallet-refungible/std',99 'pallet-structure/std',100 'pallet-sudo/std',101 'pallet-timestamp/std',102 'pallet-transaction-payment-rpc-runtime-api/std',103 'pallet-transaction-payment/std',104 'pallet-treasury/std',105 'pallet-unique-scheduler-v2/std',106 'pallet-unique/std',107 'parachain-info/std',108 'serde',109 'sp-api/std',110 'sp-block-builder/std',111 'sp-core/std',112 'sp-inherents/std',113 'sp-io/std',114 'sp-offchain/std',115 'sp-runtime/std',116 'sp-session/std',117 'sp-std/std',118 'sp-transaction-pool/std',119 'sp-version/std',120 'up-common/std',121 'up-data-structs/std',122 'up-pov-estimate-rpc/std',123 'up-rpc/std',124 'up-sponsorship/std',125 'xcm-builder/std',126 'xcm-executor/std',127 'xcm/std',128129 "orml-tokens/std",130 "orml-traits/std",131 "orml-vesting/std",132 "orml-xtokens/std",133 "pallet-foreign-assets/std",134135 'pallet-maintenance/std',136 'pallet-test-utils/std',137]138try-runtime = [139 "pallet-authorship/try-runtime",140 "pallet-collator-selection/try-runtime",141 "pallet-identity/try-runtime",142 "pallet-session/try-runtime",143 "pallet-preimage/try-runtime",144 'cumulus-pallet-aura-ext/try-runtime',145 'cumulus-pallet-dmp-queue/try-runtime',146 'cumulus-pallet-parachain-system/try-runtime',147 'cumulus-pallet-xcm/try-runtime',148 'cumulus-pallet-xcmp-queue/try-runtime',149 'fp-self-contained/try-runtime',150 'frame-executive/try-runtime',151 'frame-support/try-runtime',152 'frame-system/try-runtime',153 'frame-try-runtime',154 'frame-try-runtime?/try-runtime',155 'orml-tokens/try-runtime',156 'orml-vesting/try-runtime',157 'orml-xtokens/try-runtime',158 'pallet-app-promotion/try-runtime',159 'pallet-aura/try-runtime',160 'pallet-balances/try-runtime',161 'pallet-base-fee/try-runtime',162 'pallet-charge-transaction/try-runtime',163 'pallet-common/try-runtime',164 'pallet-configuration/try-runtime',165 'pallet-ethereum/try-runtime',166 'pallet-evm-coder-substrate/try-runtime',167 'pallet-evm-contract-helpers/try-runtime',168 'pallet-evm-migration/try-runtime',169 'pallet-evm-transaction-payment/try-runtime',170 'pallet-evm/try-runtime',171 'pallet-foreign-assets/try-runtime',172 'pallet-fungible/try-runtime',173 'pallet-inflation/try-runtime',174 'pallet-maintenance/try-runtime',175 'pallet-nonfungible/try-runtime',176 'pallet-refungible/try-runtime',177 'pallet-structure/try-runtime',178 'pallet-sudo/try-runtime',179 'pallet-test-utils/try-runtime',180 'pallet-timestamp/try-runtime',181 'pallet-transaction-payment/try-runtime',182 'pallet-treasury/try-runtime',183 'pallet-unique-scheduler-v2/try-runtime',184 'pallet-unique/try-runtime',185 'pallet-xcm/try-runtime',186 'parachain-info/try-runtime',187]188189app-promotion = []190collator-selection = []191foreign-assets = []192preimage = []193pallet-test-utils = []194refungible = []195scheduler = []196197################################################################################198# local dependencies199200[dependencies]201# Note: `package = "parity-scale-codec"` must be supplied since the `Encode` macro searches for it.202codec = { workspace = true, package = "parity-scale-codec" }203204cumulus-pallet-aura-ext = { workspace = true }205cumulus-pallet-dmp-queue = { workspace = true }206cumulus-pallet-parachain-system = { workspace = true }207cumulus-pallet-xcm = { workspace = true }208cumulus-pallet-xcmp-queue = { workspace = true }209cumulus-primitives-core = { workspace = true }210cumulus-primitives-timestamp = { workspace = true }211cumulus-primitives-utility = { workspace = true }212frame-executive = { workspace = true }213frame-support = { workspace = true }214frame-system = { workspace = true }215frame-system-rpc-runtime-api = { workspace = true }216orml-tokens = { workspace = true }217orml-traits = { workspace = true }218orml-vesting = { workspace = true }219orml-xtokens = { workspace = true }220pallet-aura = { workspace = true }221pallet-authorship = { workspace = true }222pallet-balances = { workspace = true }223pallet-preimage = { workspace = true }224pallet-session = { workspace = true }225pallet-sudo = { workspace = true }226pallet-timestamp = { workspace = true }227pallet-transaction-payment = { workspace = true }228pallet-transaction-payment-rpc-runtime-api = { workspace = true }229pallet-treasury = { workspace = true }230pallet-xcm = { workspace = true }231parachain-info = { workspace = true }232polkadot-parachain = { workspace = true }233smallvec = { workspace = true }234sp-api = { workspace = true }235sp-arithmetic = { workspace = true }236sp-block-builder = { workspace = true }237sp-consensus-aura = { workspace = true }238sp-core = { workspace = true }239sp-inherents = { workspace = true }240sp-io = { workspace = true }241sp-offchain = { workspace = true }242sp-runtime = { workspace = true }243sp-session = { workspace = true }244sp-std = { workspace = true }245sp-transaction-pool = { workspace = true }246sp-version = { workspace = true }247xcm = { workspace = true }248xcm-builder = { workspace = true }249xcm-executor = { workspace = true }250251app-promotion-rpc = { workspace = true }252derivative = { workspace = true }253evm-coder = { workspace = true }254fp-evm = { workspace = true }255fp-evm-mapping = { workspace = true }256fp-rpc = { workspace = true }257fp-self-contained = { workspace = true }258log = { workspace = true }259num_enum = { workspace = true }260pallet-app-promotion = { workspace = true }261pallet-base-fee = { workspace = true }262pallet-charge-transaction = { workspace = true }263pallet-collator-selection = { workspace = true }264pallet-common = { workspace = true }265pallet-configuration = { workspace = true }266pallet-ethereum = { workspace = true }267pallet-evm = { workspace = true }268pallet-evm-coder-substrate = { workspace = true }269pallet-evm-contract-helpers = { workspace = true }270pallet-evm-migration = { workspace = true }271pallet-evm-precompile-simple = { workspace = true }272pallet-evm-transaction-payment = { workspace = true }273pallet-foreign-assets = { workspace = true }274pallet-fungible = { workspace = true }275pallet-identity = { workspace = true }276pallet-inflation = { workspace = true }277pallet-maintenance = { workspace = true }278pallet-nonfungible = { workspace = true }279pallet-refungible = { workspace = true }280pallet-structure = { workspace = true }281pallet-unique = { workspace = true }282pallet-unique-scheduler-v2 = { workspace = true }283precompile-utils-macro = { workspace = true }284scale-info = { workspace = true }285up-common = { workspace = true }286up-data-structs = { workspace = true }287up-pov-estimate-rpc = { workspace = true }288up-rpc = { workspace = true }289up-sponsorship = { workspace = true }290291################################################################################292# Optional dependencies293294frame-system-benchmarking = { workspace = true, optional = true}295frame-benchmarking = { workspace = true, optional = true }296frame-try-runtime = { workspace = true, optional = true }297serde = { workspace = true, optional = true }298hex-literal = { workspace = true, optional = true }299300################################################################################301# Test dependencies302303pallet-test-utils = { workspace = true }304305################################################################################306# Other Dependencies307308impl-trait-for-tuples = { workspace = true }309310[build-dependencies]311substrate-wasm-builder = { workspace = true }runtime/opal/src/lib.rsdiffbeforeafterboth--- a/runtime/opal/src/lib.rs
+++ b/runtime/opal/src/lib.rs
@@ -41,9 +41,6 @@
pub mod xcm_barrier;
-#[cfg(test)]
-mod tests;
-
pub use runtime_common::*;
pub const RUNTIME_NAME: &str = "opal";
runtime/opal/src/tests/logcapture.rsdiffbeforeafterboth--- a/runtime/opal/src/tests/logcapture.rs
+++ /dev/null
@@ -1,25 +0,0 @@
-// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.
-// This file is part of Unique Network.
-
-// Unique Network 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.
-
-// Unique Network 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 Unique Network. If not, see <http://www.gnu.org/licenses/>.
-
-use logtest::Logger;
-use super::xcm::opal_xcm_tests;
-
-#[test]
-fn opal_log_capture_tests() {
- let mut logger = Logger::start();
-
- opal_xcm_tests(&mut logger);
-}
runtime/opal/src/tests/mod.rsdiffbeforeafterboth--- a/runtime/opal/src/tests/mod.rs
+++ /dev/null
@@ -1,18 +0,0 @@
-// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.
-// This file is part of Unique Network.
-
-// Unique Network 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.
-
-// Unique Network 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 Unique Network. If not, see <http://www.gnu.org/licenses/>.
-
-mod logcapture;
-mod xcm;
runtime/opal/src/tests/xcm.rsdiffbeforeafterboth--- a/runtime/opal/src/tests/xcm.rs
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.
-// This file is part of Unique Network.
-
-// Unique Network 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.
-
-// Unique Network 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 Unique Network. If not, see <http://www.gnu.org/licenses/>.
-
-use logtest::Logger;
-use crate::{runtime_common::tests::xcm::*, xcm_barrier::Barrier};
-
-const OPAL_PARA_ID: u32 = 2095; // Same as Quartz
-
-pub fn opal_xcm_tests(logger: &mut Logger) {
- barrier_denies_transact::<Barrier>(logger);
-
- barrier_denies_transfer_from_unknown_location::<Barrier>(logger, OPAL_PARA_ID)
- .expect_err("opal runtime allows any location");
-}
runtime/quartz/Cargo.tomldiffbeforeafterboth--- a/runtime/quartz/Cargo.toml
+++ b/runtime/quartz/Cargo.toml
@@ -300,8 +300,5 @@
impl-trait-for-tuples = { workspace = true }
-[dev-dependencies]
-logtest = { workspace = true }
-
[build-dependencies]
substrate-wasm-builder = { workspace = true }
runtime/quartz/src/lib.rsdiffbeforeafterboth--- a/runtime/quartz/src/lib.rs
+++ b/runtime/quartz/src/lib.rs
@@ -41,9 +41,6 @@
pub mod xcm_barrier;
-#[cfg(test)]
-mod tests;
-
pub use runtime_common::*;
#[cfg(feature = "become-sapphire")]
runtime/quartz/src/tests/logcapture.rsdiffbeforeafterboth--- a/runtime/quartz/src/tests/logcapture.rs
+++ /dev/null
@@ -1,25 +0,0 @@
-// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.
-// This file is part of Unique Network.
-
-// Unique Network 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.
-
-// Unique Network 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 Unique Network. If not, see <http://www.gnu.org/licenses/>.
-
-use logtest::Logger;
-use super::xcm::quartz_xcm_tests;
-
-#[test]
-fn quartz_log_capture_tests() {
- let mut logger = Logger::start();
-
- quartz_xcm_tests(&mut logger);
-}
runtime/quartz/src/tests/mod.rsdiffbeforeafterboth--- a/runtime/quartz/src/tests/mod.rs
+++ /dev/null
@@ -1,18 +0,0 @@
-// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.
-// This file is part of Unique Network.
-
-// Unique Network 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.
-
-// Unique Network 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 Unique Network. If not, see <http://www.gnu.org/licenses/>.
-
-mod logcapture;
-mod xcm;
runtime/quartz/src/tests/xcm.rsdiffbeforeafterboth--- a/runtime/quartz/src/tests/xcm.rs
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.
-// This file is part of Unique Network.
-
-// Unique Network 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.
-
-// Unique Network 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 Unique Network. If not, see <http://www.gnu.org/licenses/>.
-
-use logtest::Logger;
-use crate::{runtime_common::tests::xcm::*, xcm_barrier::Barrier};
-
-const QUARTZ_PARA_ID: u32 = 2095;
-
-pub fn quartz_xcm_tests(logger: &mut Logger) {
- barrier_denies_transact::<Barrier>(logger);
-
- barrier_denies_transfer_from_unknown_location::<Barrier>(logger, QUARTZ_PARA_ID)
- .expect("quartz runtime denies an unknown location");
-}
runtime/unique/Cargo.tomldiffbeforeafterboth--- a/runtime/unique/Cargo.toml
+++ b/runtime/unique/Cargo.toml
@@ -298,8 +298,5 @@
impl-trait-for-tuples = { workspace = true }
-[dev-dependencies]
-logtest = { workspace = true }
-
[build-dependencies]
substrate-wasm-builder = { workspace = true }
runtime/unique/src/lib.rsdiffbeforeafterboth--- a/runtime/unique/src/lib.rs
+++ b/runtime/unique/src/lib.rs
@@ -41,9 +41,6 @@
pub mod xcm_barrier;
-#[cfg(test)]
-mod tests;
-
pub use runtime_common::*;
pub const RUNTIME_NAME: &str = "unique";
runtime/unique/src/tests/logcapture.rsdiffbeforeafterboth--- a/runtime/unique/src/tests/logcapture.rs
+++ /dev/null
@@ -1,25 +0,0 @@
-// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.
-// This file is part of Unique Network.
-
-// Unique Network 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.
-
-// Unique Network 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 Unique Network. If not, see <http://www.gnu.org/licenses/>.
-
-use logtest::Logger;
-use super::xcm::unique_xcm_tests;
-
-#[test]
-fn unique_log_capture_tests() {
- let mut logger = Logger::start();
-
- unique_xcm_tests(&mut logger);
-}
runtime/unique/src/tests/mod.rsdiffbeforeafterboth--- a/runtime/unique/src/tests/mod.rs
+++ /dev/null
@@ -1,18 +0,0 @@
-// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.
-// This file is part of Unique Network.
-
-// Unique Network 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.
-
-// Unique Network 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 Unique Network. If not, see <http://www.gnu.org/licenses/>.
-
-mod logcapture;
-mod xcm;
runtime/unique/src/tests/xcm.rsdiffbeforeafterboth--- a/runtime/unique/src/tests/xcm.rs
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.
-// This file is part of Unique Network.
-
-// Unique Network 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.
-
-// Unique Network 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 Unique Network. If not, see <http://www.gnu.org/licenses/>.
-
-use logtest::Logger;
-use crate::{runtime_common::tests::xcm::*, xcm_barrier::Barrier};
-
-const UNIQUE_PARA_ID: u32 = 2037;
-
-pub fn unique_xcm_tests(logger: &mut Logger) {
- barrier_denies_transact::<Barrier>(logger);
-
- barrier_denies_transfer_from_unknown_location::<Barrier>(logger, UNIQUE_PARA_ID)
- .expect("unique runtime denies an unknown location");
-}