mirror of
https://github.com/pezkuwichain/pezkuwi-runtime-templates.git
synced 2026-06-12 10:01:06 +00:00
Fix tanssi on main (#393)
* fix the tanssi build & tests * fix fmt * update features for coverage * cleanup on coverage due runner out of space * a bit more tests to pass the codecov check * fix fmt
This commit is contained in:
@@ -120,8 +120,6 @@ impl SystemConfig for OpenZeppelinRuntime {
|
||||
type SlotDuration = ConstU64<SLOT_DURATION>;
|
||||
type Version = Version;
|
||||
}
|
||||
#[cfg(feature = "tanssi")]
|
||||
impl TanssiConfig for OpenZeppelinRuntime {}
|
||||
#[cfg(not(feature = "tanssi"))]
|
||||
impl ConsensusConfig for OpenZeppelinRuntime {
|
||||
type CollatorSelectionUpdateOrigin = CollatorSelectionUpdateOrigin;
|
||||
@@ -215,12 +213,17 @@ impl AssetsConfig for OpenZeppelinRuntime {
|
||||
type ForeignAssetModifierOrigin = EnsureRoot<AccountId>;
|
||||
type WeightToFee = WeightToFee;
|
||||
}
|
||||
#[cfg(feature = "tanssi")]
|
||||
impl TanssiConfig for OpenZeppelinRuntime {
|
||||
type AuthorInherent = pallet_author_inherent::weights::SubstrateWeight<Runtime>;
|
||||
type AuthoritiesNothing = pallet_cc_authorities_noting::weights::SubstrateWeight<Runtime>;
|
||||
}
|
||||
impl_openzeppelin_assets!(OpenZeppelinRuntime);
|
||||
impl_openzeppelin_system!(OpenZeppelinRuntime);
|
||||
#[cfg(not(feature = "tanssi"))]
|
||||
impl_openzeppelin_consensus!(OpenZeppelinRuntime);
|
||||
#[cfg(feature = "tanssi")]
|
||||
impl_openzeppelin_tanssi!();
|
||||
impl_openzeppelin_tanssi!(OpenZeppelinRuntime);
|
||||
impl_openzeppelin_governance!(OpenZeppelinRuntime);
|
||||
impl_openzeppelin_xcm!(OpenZeppelinRuntime);
|
||||
impl_openzeppelin_evm!(OpenZeppelinRuntime);
|
||||
|
||||
@@ -522,6 +522,38 @@ mod testing {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
|
||||
mod is_bridged_concrete_assets_from {
|
||||
use frame_support::traits::ContainsPair;
|
||||
use xcm::latest::{Asset, AssetId, Fungibility, Junctions, Location};
|
||||
|
||||
use crate::configs::{AssetHubLocation, IsBridgedConcreteAssetFrom};
|
||||
|
||||
#[test]
|
||||
pub fn is_bridged_concrete_assets_from_contains() {
|
||||
let asset = Asset {
|
||||
id: AssetId(Location { parents: 2, interior: Junctions::Here }),
|
||||
fun: Fungibility::Fungible(100),
|
||||
};
|
||||
assert!(IsBridgedConcreteAssetFrom::<AssetHubLocation>::contains(
|
||||
&asset,
|
||||
&AssetHubLocation::get()
|
||||
))
|
||||
}
|
||||
|
||||
#[test]
|
||||
pub fn is_bridged_concrete_assets_from_not_contains() {
|
||||
let asset = Asset {
|
||||
id: AssetId(Location { parents: 1, interior: Junctions::Here }),
|
||||
fun: Fungibility::Fungible(100),
|
||||
};
|
||||
assert!(!IsBridgedConcreteAssetFrom::<AssetHubLocation>::contains(
|
||||
&asset,
|
||||
&AssetHubLocation::get()
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
mod location_conversion {
|
||||
use sp_core::H160;
|
||||
use sp_runtime::traits::{Convert, TryConvert};
|
||||
|
||||
@@ -206,6 +206,7 @@ mod test {
|
||||
use crate::{types::ProxyType, AssetManager, RuntimeCall};
|
||||
|
||||
#[test]
|
||||
#[cfg(not(feature = "tanssi"))]
|
||||
fn test_filter_any() {
|
||||
let call = RuntimeCall::CollatorSelection(
|
||||
pallet_collator_selection::Call::set_desired_candidates { max: 10 },
|
||||
@@ -215,6 +216,7 @@ mod test {
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(not(feature = "tanssi"))]
|
||||
fn test_filter_nontransfer() {
|
||||
let proxy_type = ProxyType::NonTransfer;
|
||||
let valid_call = RuntimeCall::CollatorSelection(
|
||||
@@ -227,6 +229,7 @@ mod test {
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(not(feature = "tanssi"))]
|
||||
fn test_filter_cancel_proxy() {
|
||||
let proxy_type = ProxyType::CancelProxy;
|
||||
let invalid_call = RuntimeCall::CollatorSelection(
|
||||
@@ -241,6 +244,7 @@ mod test {
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(not(feature = "tanssi"))]
|
||||
fn test_filter_collator() {
|
||||
let proxy_type = ProxyType::Collator;
|
||||
let valid_call = RuntimeCall::CollatorSelection(
|
||||
|
||||
Reference in New Issue
Block a user