mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-10 05:17:59 +00:00
c284a9312a
## Problem This PR addresses the issue with testnet AssetHub builds, which was discovered during the execution of `bot bench`. https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/4038738 ``` Compiling asset-hub-rococo-runtime-wasm v1.0.0 (/builds/parity/mirrors/polkadot-sdk/target/production/wbuild/asset-hub-rococo-runtime) warning: Linking globals named 'Core_version': symbol multiply defined! error: failed to load bitcode of module "rococo_runtime-8799ee884447805a.rococo_runtime.0bc572b8-cgu.0.rcgu.o": warning: `asset-hub-rococo-runtime-wasm` (lib) generated 1 warning error: could not compile `asset-hub-rococo-runtime-wasm` (lib) due to previous error; 1 warning emitted ``` https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/4038739 ``` Compiling asset-hub-westend-runtime-wasm v1.0.0 (/builds/parity/mirrors/polkadot-sdk/target/production/wbuild/asset-hub-westend-runtime) warning: Linking globals named 'Core_version': symbol multiply defined! error: failed to load bitcode of module "westend_runtime-86d7844430f97d5c.westend_runtime.b7678d03-cgu.0.rcgu.o": warning: `asset-hub-westend-runtime-wasm` (lib) generated 1 warning error: could not compile `asset-hub-westend-runtime-wasm` (lib) due to previous error; 1 warning emitted ``` ## Solution - Removed dependencies on `rococo-runtime` and `westend-runtime` introduced by [this PR](https://github.com/paritytech/polkadot-sdk/pull/1234/files#diff-a86375df98e04ca3cce1ea35c40257a222e2d5087f5f528ff33307678b78dc2dR534-R550). - Replaced `<rococo_runtime::Treasury as PalletInfoAccess>::index()` with `rococo_runtime_constants::TREASURY_PALLET_ID`. - Added `check_treasury_pallet_id` to the relay runtimes to ensure that the constant is aligned with the pallet id. - Added "Rococo Treasury" to the waived locations (that will not be charged fees in the executor) for `BridgeHubRococo` (to be aligned with AssetHubs). ## References [Full element discussion here](https://matrix.to/#/!JUeaZUiYbdrvzvtwSL:parity.io/$2PnjYMsWRjR7M3oOfGuRI0XkjdoqJLtRcAPVcDLuLVg?via=parity.io&via=web3.foundation). --------- Co-authored-by: command-bot <>
102 lines
3.8 KiB
Rust
102 lines
3.8 KiB
Rust
// Copyright (C) Parity Technologies (UK) Ltd.
|
|
// This file is part of Polkadot.
|
|
|
|
// Polkadot 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.
|
|
|
|
// Polkadot 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 Polkadot. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
//! Tests for the Westend Runtime Configuration
|
|
|
|
use std::collections::HashSet;
|
|
|
|
use crate::*;
|
|
use frame_support::traits::WhitelistedStorageKeys;
|
|
use sp_core::hexdisplay::HexDisplay;
|
|
use xcm::latest::prelude::*;
|
|
|
|
#[test]
|
|
fn remove_keys_weight_is_sensible() {
|
|
use runtime_common::crowdloan::WeightInfo;
|
|
let max_weight = <Runtime as crowdloan::Config>::WeightInfo::refund(RemoveKeysLimit::get());
|
|
// Max remove keys limit should be no more than half the total block weight.
|
|
assert!((max_weight * 2).all_lt(BlockWeights::get().max_block));
|
|
}
|
|
|
|
#[test]
|
|
fn sample_size_is_sensible() {
|
|
use runtime_common::auctions::WeightInfo;
|
|
// Need to clean up all samples at the end of an auction.
|
|
let samples: BlockNumber = EndingPeriod::get() / SampleLength::get();
|
|
let max_weight: frame_support::weights::Weight =
|
|
RocksDbWeight::get().reads_writes(samples.into(), samples.into());
|
|
// Max sample cleanup should be no more than half the total block weight.
|
|
assert!((max_weight * 2).all_lt(BlockWeights::get().max_block));
|
|
assert!((<Runtime as auctions::Config>::WeightInfo::on_initialize() * 2)
|
|
.all_lt(BlockWeights::get().max_block));
|
|
}
|
|
|
|
#[test]
|
|
fn call_size() {
|
|
RuntimeCall::assert_size_under(256);
|
|
}
|
|
|
|
#[test]
|
|
fn sanity_check_teleport_assets_weight() {
|
|
// This test sanity checks that at least 50 teleports can exist in a block.
|
|
// Usually when XCM runs into an issue, it will return a weight of `Weight::MAX`,
|
|
// so this test will certainly ensure that this problem does not occur.
|
|
use frame_support::dispatch::GetDispatchInfo;
|
|
let weight = pallet_xcm::Call::<Runtime>::teleport_assets {
|
|
dest: Box::new(Here.into()),
|
|
beneficiary: Box::new(Here.into()),
|
|
assets: Box::new((Here, 200_000).into()),
|
|
fee_asset_item: 0,
|
|
}
|
|
.get_dispatch_info()
|
|
.weight;
|
|
|
|
assert!((weight * 50).all_lt(BlockWeights::get().max_block));
|
|
}
|
|
|
|
#[test]
|
|
fn check_whitelist() {
|
|
let whitelist: HashSet<String> = AllPalletsWithSystem::whitelisted_storage_keys()
|
|
.iter()
|
|
.map(|e| HexDisplay::from(&e.key).to_string())
|
|
.collect();
|
|
|
|
// Block number
|
|
assert!(whitelist.contains("26aa394eea5630e07c48ae0c9558cef702a5c1b19ab7a04f536c519aca4983ac"));
|
|
// Total issuance
|
|
assert!(whitelist.contains("c2261276cc9d1f8598ea4b6a74b15c2f57c875e4cff74148e4628f264b974c80"));
|
|
// Execution phase
|
|
assert!(whitelist.contains("26aa394eea5630e07c48ae0c9558cef7ff553b5a9862a516939d82b3d3d8661a"));
|
|
// Event count
|
|
assert!(whitelist.contains("26aa394eea5630e07c48ae0c9558cef70a98fdbe9ce6c55837576c60c7af3850"));
|
|
// System events
|
|
assert!(whitelist.contains("26aa394eea5630e07c48ae0c9558cef780d41e5e16056765bc8461851072c9d7"));
|
|
// Configuration ActiveConfig
|
|
assert!(whitelist.contains("06de3d8a54d27e44a9d5ce189618f22db4b49d95320d9021994c850f25b8e385"));
|
|
// XcmPallet VersionDiscoveryQueue
|
|
assert!(whitelist.contains("1405f2411d0af5a7ff397e7c9dc68d194a222ba0333561192e474c59ed8e30e1"));
|
|
// XcmPallet SafeXcmVersion
|
|
assert!(whitelist.contains("1405f2411d0af5a7ff397e7c9dc68d196323ae84c43568be0d1394d5d0d522c4"));
|
|
}
|
|
|
|
#[test]
|
|
fn check_treasury_pallet_id() {
|
|
assert_eq!(
|
|
<Treasury as frame_support::traits::PalletInfoAccess>::index() as u8,
|
|
westend_runtime_constants::TREASURY_PALLET_ID
|
|
);
|
|
}
|