mirror of
https://github.com/pezkuwichain/pezkuwi-runtime-templates.git
synced 2026-04-22 03:17:56 +00:00
Fix tests (#358)
* update evm template tests * update generic runtime constant tests * avoid workflows cancelling each other --------- Co-authored-by: Gustavo Gonzalez <gustavo.gonzalez@openzeppelin.com>
This commit is contained in:
@@ -24,7 +24,7 @@ on:
|
|||||||
# If new code is pushed to a PR branch, then cancel in progress workflows for
|
# If new code is pushed to a PR branch, then cancel in progress workflows for
|
||||||
# that PR. Ensures that we don't waste CI time, and returns results quicker.
|
# that PR. Ensures that we don't waste CI time, and returns results quicker.
|
||||||
concurrency:
|
concurrency:
|
||||||
group: ci-${{ github.ref }}
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
|
|
||||||
env:
|
env:
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ on:
|
|||||||
# If new code is pushed to a PR branch, then cancel in progress workflows for
|
# If new code is pushed to a PR branch, then cancel in progress workflows for
|
||||||
# that PR. Ensures that we don't waste CI time, and returns results quicker.
|
# that PR. Ensures that we don't waste CI time, and returns results quicker.
|
||||||
concurrency:
|
concurrency:
|
||||||
group: ci-${{ github.ref }}
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
|
|
||||||
env:
|
env:
|
||||||
|
|||||||
@@ -18,228 +18,250 @@ mod constant_tests {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: fix the tests
|
mod runtime_tests {
|
||||||
// mod runtime_tests {
|
use evm_runtime_template::{
|
||||||
// use evm_runtime_template::{
|
configs,
|
||||||
// configs::{asset_config::*, *},
|
constants::{currency::*, *},
|
||||||
// constants::{currency::*, *},
|
BlockNumber, Runtime,
|
||||||
// *,
|
};
|
||||||
// };
|
use frame_support::{pallet_prelude::Weight, traits::TypedGet, PalletId};
|
||||||
// use frame_support::{pallet_prelude::Weight, traits::TypedGet, PalletId};
|
use sp_runtime::{create_runtime_str, Perbill};
|
||||||
// use sp_runtime::create_runtime_str;
|
use sp_version::RuntimeVersion;
|
||||||
// use sp_version::RuntimeVersion;
|
use xcm::latest::prelude::BodyId;
|
||||||
// use xcm::latest::prelude::BodyId;
|
|
||||||
|
|
||||||
// // RUNTIME_API_VERSIONS constant is generated by a macro and is private.
|
// RUNTIME_API_VERSIONS constant is generated by a macro and is private.
|
||||||
// #[test]
|
#[test]
|
||||||
// fn check_version() {
|
fn check_version() {
|
||||||
// assert_eq!(
|
assert_eq!(
|
||||||
// VERSION,
|
VERSION,
|
||||||
// RuntimeVersion {
|
RuntimeVersion {
|
||||||
// spec_name: create_runtime_str!("template-parachain"),
|
spec_name: create_runtime_str!("template-parachain"),
|
||||||
// impl_name: create_runtime_str!("template-parachain"),
|
impl_name: create_runtime_str!("template-parachain"),
|
||||||
// authoring_version: 1,
|
authoring_version: 1,
|
||||||
// spec_version: 1,
|
spec_version: 1,
|
||||||
// impl_version: 0,
|
impl_version: 0,
|
||||||
// apis: evm_runtime_template::RUNTIME_API_VERSIONS,
|
apis: evm_runtime_template::RUNTIME_API_VERSIONS,
|
||||||
// transaction_version: 1,
|
transaction_version: 1,
|
||||||
// state_version: 1,
|
state_version: 1,
|
||||||
// }
|
}
|
||||||
// );
|
);
|
||||||
// }
|
}
|
||||||
|
|
||||||
// #[test]
|
#[test]
|
||||||
// fn weight_to_fee_constants() {
|
fn weight_to_fee_constants() {
|
||||||
// assert_eq!(P_FACTOR, 10);
|
assert_eq!(P_FACTOR, 10);
|
||||||
|
|
||||||
// assert_eq!(Q_FACTOR, 100);
|
assert_eq!(Q_FACTOR, 100);
|
||||||
|
|
||||||
// assert_eq!(POLY_DEGREE, 1);
|
assert_eq!(POLY_DEGREE, 1);
|
||||||
// }
|
}
|
||||||
|
|
||||||
// #[test]
|
#[test]
|
||||||
// fn frame_system_constants() {
|
fn frame_system_constants() {
|
||||||
// #[cfg(not(feature = "async-backing"))]
|
#[cfg(not(feature = "async-backing"))]
|
||||||
// assert_eq!(
|
assert_eq!(
|
||||||
// MAXIMUM_BLOCK_WEIGHT,
|
MAXIMUM_BLOCK_WEIGHT,
|
||||||
// Weight::from_parts(
|
Weight::from_parts(
|
||||||
// frame_support::weights::constants::WEIGHT_REF_TIME_PER_SECOND.saturating_div(2),
|
frame_support::weights::constants::WEIGHT_REF_TIME_PER_SECOND.saturating_div(2),
|
||||||
// cumulus_primitives_core::relay_chain::MAX_POV_SIZE as u64
|
cumulus_primitives_core::relay_chain::MAX_POV_SIZE as u64
|
||||||
// )
|
)
|
||||||
// );
|
);
|
||||||
|
|
||||||
// #[cfg(feature = "async-backing")]
|
#[cfg(feature = "async-backing")]
|
||||||
// assert_eq!(
|
assert_eq!(
|
||||||
// MAXIMUM_BLOCK_WEIGHT,
|
MAXIMUM_BLOCK_WEIGHT,
|
||||||
// Weight::from_parts(
|
Weight::from_parts(
|
||||||
// frame_support::weights::constants::WEIGHT_REF_TIME_PER_SECOND.saturating_mul(2),
|
frame_support::weights::constants::WEIGHT_REF_TIME_PER_SECOND.saturating_mul(2),
|
||||||
// cumulus_primitives_core::relay_chain::MAX_POV_SIZE as u64
|
cumulus_primitives_core::relay_chain::MAX_POV_SIZE as u64
|
||||||
// )
|
)
|
||||||
// );
|
);
|
||||||
|
|
||||||
// assert_eq!(AVERAGE_ON_INITIALIZE_RATIO, Perbill::from_percent(5));
|
assert_eq!(AVERAGE_ON_INITIALIZE_RATIO, Perbill::from_percent(5));
|
||||||
|
|
||||||
// assert_eq!(NORMAL_DISPATCH_RATIO, Perbill::from_percent(75));
|
assert_eq!(NORMAL_DISPATCH_RATIO, Perbill::from_percent(75));
|
||||||
// #[cfg(not(feature = "async-backing"))]
|
#[cfg(not(feature = "async-backing"))]
|
||||||
// assert_eq!(UNINCLUDED_SEGMENT_CAPACITY, 1);
|
assert_eq!(UNINCLUDED_SEGMENT_CAPACITY, 1);
|
||||||
// #[cfg(feature = "async-backing")]
|
#[cfg(feature = "async-backing")]
|
||||||
// assert_eq!(UNINCLUDED_SEGMENT_CAPACITY, 3);
|
assert_eq!(UNINCLUDED_SEGMENT_CAPACITY, 3);
|
||||||
|
|
||||||
// assert_eq!(BLOCK_PROCESSING_VELOCITY, 1);
|
assert_eq!(BLOCK_PROCESSING_VELOCITY, 1);
|
||||||
|
|
||||||
// assert_eq!(RELAY_CHAIN_SLOT_DURATION_MILLIS, 6000);
|
assert_eq!(RELAY_CHAIN_SLOT_DURATION_MILLIS, 6000);
|
||||||
|
|
||||||
// #[cfg(not(feature = "async-backing"))]
|
#[cfg(not(feature = "async-backing"))]
|
||||||
// assert_eq!(MILLISECS_PER_BLOCK, 12000);
|
assert_eq!(MILLISECS_PER_BLOCK, 12000);
|
||||||
// #[cfg(feature = "async-backing")]
|
#[cfg(feature = "async-backing")]
|
||||||
// assert_eq!(MILLISECS_PER_BLOCK, 6000);
|
assert_eq!(MILLISECS_PER_BLOCK, 6000);
|
||||||
|
|
||||||
// assert_eq!(SLOT_DURATION, MILLISECS_PER_BLOCK);
|
assert_eq!(SLOT_DURATION, MILLISECS_PER_BLOCK);
|
||||||
|
|
||||||
// assert_eq!(MINUTES, 60_000 / (MILLISECS_PER_BLOCK as BlockNumber));
|
assert_eq!(MINUTES, 60_000 / (MILLISECS_PER_BLOCK as BlockNumber));
|
||||||
|
|
||||||
// assert_eq!(HOURS, MINUTES * 60);
|
assert_eq!(HOURS, MINUTES * 60);
|
||||||
|
|
||||||
// assert_eq!(DAYS, HOURS * 24);
|
assert_eq!(DAYS, HOURS * 24);
|
||||||
|
|
||||||
// assert_eq!(MAX_BLOCK_LENGTH, 5 * 1024 * 1024);
|
assert_eq!(MAX_BLOCK_LENGTH, 5 * 1024 * 1024);
|
||||||
|
|
||||||
// assert_eq!(SS58Prefix::get(), 42);
|
assert_eq!(<Runtime as frame_system::Config>::SS58Prefix::get(), 42);
|
||||||
|
|
||||||
// assert_eq!(<Runtime as frame_system::Config>::MaxConsumers::get(), 16);
|
assert_eq!(<Runtime as frame_system::Config>::MaxConsumers::get(), 16);
|
||||||
// }
|
}
|
||||||
|
|
||||||
// #[test]
|
#[test]
|
||||||
// fn proxy_constants() {
|
fn proxy_constants() {
|
||||||
// assert_eq!(MaxProxies::get(), 32);
|
assert_eq!(<Runtime as pallet_proxy::Config>::MaxProxies::get(), 32);
|
||||||
|
|
||||||
// assert_eq!(MaxPending::get(), 32);
|
assert_eq!(<Runtime as pallet_proxy::Config>::MaxPending::get(), 32);
|
||||||
|
|
||||||
// assert_eq!(ProxyDepositBase::get(), deposit(1, 40));
|
assert_eq!(<Runtime as pallet_proxy::Config>::ProxyDepositBase::get(), deposit(1, 40));
|
||||||
|
|
||||||
// assert_eq!(AnnouncementDepositBase::get(), deposit(1, 48));
|
assert_eq!(
|
||||||
|
<Runtime as pallet_proxy::Config>::AnnouncementDepositBase::get(),
|
||||||
|
deposit(1, 48)
|
||||||
|
);
|
||||||
|
|
||||||
// assert_eq!(ProxyDepositFactor::get(), deposit(0, 33));
|
assert_eq!(<Runtime as pallet_proxy::Config>::ProxyDepositFactor::get(), deposit(0, 33));
|
||||||
|
|
||||||
// assert_eq!(AnnouncementDepositFactor::get(), deposit(0, 66));
|
assert_eq!(
|
||||||
// }
|
<Runtime as pallet_proxy::Config>::AnnouncementDepositFactor::get(),
|
||||||
|
deposit(0, 66)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// #[test]
|
#[test]
|
||||||
// fn balances_constants() {
|
fn balances_constants() {
|
||||||
// assert_eq!(MaxFreezes::get(), 0);
|
assert_eq!(<Runtime as pallet_balances::Config>::MaxFreezes::get(), 0);
|
||||||
|
|
||||||
// assert_eq!(MaxLocks::get(), 50);
|
assert_eq!(<Runtime as pallet_balances::Config>::MaxLocks::get(), 50);
|
||||||
|
|
||||||
// assert_eq!(MaxReserves::get(), 50);
|
assert_eq!(<Runtime as pallet_balances::Config>::MaxReserves::get(), 50);
|
||||||
// }
|
}
|
||||||
|
|
||||||
// #[test]
|
#[test]
|
||||||
// fn assets_constants() {
|
fn assets_constants() {
|
||||||
// assert_eq!(AssetDeposit::get(), 10 * CENTS);
|
assert_eq!(<Runtime as pallet_assets::Config>::AssetDeposit::get(), 10 * CENTS);
|
||||||
|
|
||||||
// assert_eq!(AssetAccountDeposit::get(), deposit(1, 16));
|
// TODO: uncomment once patch is merged and updated RC is released and pointed to in deps
|
||||||
|
//assert_eq!(<Runtime as pallet_assets::Config>::AssetAccountDeposit::get(), deposit(1, 16));
|
||||||
|
assert_eq!(<Runtime as pallet_assets::Config>::AssetAccountDeposit::get(), MILLICENTS);
|
||||||
|
|
||||||
// assert_eq!(ApprovalDeposit::get(), MILLICENTS);
|
assert_eq!(<Runtime as pallet_assets::Config>::ApprovalDeposit::get(), MILLICENTS);
|
||||||
|
|
||||||
// assert_eq!(StringLimit::get(), 50);
|
assert_eq!(<Runtime as pallet_assets::Config>::StringLimit::get(), 50);
|
||||||
|
|
||||||
// assert_eq!(MetadataDepositBase::get(), deposit(1, 68));
|
assert_eq!(<Runtime as pallet_assets::Config>::MetadataDepositBase::get(), deposit(1, 68));
|
||||||
|
|
||||||
// assert_eq!(MetadataDepositPerByte::get(), deposit(0, 1));
|
assert_eq!(
|
||||||
|
<Runtime as pallet_assets::Config>::MetadataDepositPerByte::get(),
|
||||||
|
deposit(0, 1)
|
||||||
|
);
|
||||||
|
|
||||||
// assert_eq!(RemoveItemsLimit::get(), 1000);
|
assert_eq!(<Runtime as pallet_assets::Config>::RemoveItemsLimit::get(), 1000);
|
||||||
// }
|
}
|
||||||
|
|
||||||
// #[test]
|
#[test]
|
||||||
// fn transaction_payment_constants() {
|
fn transaction_payment_constants() {
|
||||||
// assert_eq!(TransactionByteFee::get(), 10 * MICROCENTS);
|
assert_eq!(configs::TransactionByteFee::get(), 10 * MICROCENTS);
|
||||||
|
|
||||||
// assert_eq!(OperationalFeeMultiplier::get(), 5);
|
assert_eq!(
|
||||||
// }
|
<Runtime as pallet_transaction_payment::Config>::OperationalFeeMultiplier::get(),
|
||||||
|
5
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// #[test]
|
#[test]
|
||||||
// fn cumulus_pallet_parachain_system_constants() {
|
fn cumulus_pallet_parachain_system_constants() {
|
||||||
// assert_eq!(ReservedXcmpWeight::get(), MAXIMUM_BLOCK_WEIGHT.saturating_div(4));
|
assert_eq!(
|
||||||
|
<Runtime as cumulus_pallet_parachain_system::Config>::ReservedXcmpWeight::get(),
|
||||||
|
MAXIMUM_BLOCK_WEIGHT.saturating_div(4)
|
||||||
|
);
|
||||||
|
|
||||||
// assert_eq!(ReservedDmpWeight::get(), MAXIMUM_BLOCK_WEIGHT.saturating_div(4));
|
assert_eq!(
|
||||||
// }
|
<Runtime as cumulus_pallet_parachain_system::Config>::ReservedDmpWeight::get(),
|
||||||
|
MAXIMUM_BLOCK_WEIGHT.saturating_div(4)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// #[test]
|
#[test]
|
||||||
// fn message_queue_constants() {
|
fn message_queue_constants() {
|
||||||
// assert_eq!(HeapSize::get(), 64 * 1024);
|
assert_eq!(<Runtime as pallet_message_queue::Config>::HeapSize::get(), 64 * 1024);
|
||||||
// assert_eq!(MaxStale::get(), 8);
|
assert_eq!(<Runtime as pallet_message_queue::Config>::MaxStale::get(), 8);
|
||||||
// }
|
}
|
||||||
|
|
||||||
// #[test]
|
#[test]
|
||||||
// fn cumulus_pallet_xcmp_queue_constants() {
|
fn cumulus_pallet_xcmp_queue_constants() {
|
||||||
// assert_eq!(MaxInboundSuspended::get(), 1000);
|
assert_eq!(
|
||||||
// }
|
<Runtime as cumulus_pallet_xcmp_queue::Config>::MaxInboundSuspended::get(),
|
||||||
|
1000
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// #[test]
|
#[test]
|
||||||
// fn multisig_constants() {
|
fn multisig_constants() {
|
||||||
// assert_eq!(DepositBase::get(), deposit(1, 88));
|
assert_eq!(<Runtime as pallet_multisig::Config>::DepositBase::get(), deposit(1, 88));
|
||||||
|
|
||||||
// assert_eq!(DepositFactor::get(), deposit(0, 32));
|
assert_eq!(<Runtime as pallet_multisig::Config>::DepositFactor::get(), deposit(0, 32));
|
||||||
|
|
||||||
// assert_eq!(MaxSignatories::get(), 100);
|
assert_eq!(<Runtime as pallet_multisig::Config>::MaxSignatories::get(), 100);
|
||||||
// }
|
}
|
||||||
|
|
||||||
// #[test]
|
#[test]
|
||||||
// fn session_constants() {
|
fn session_constants() {
|
||||||
// assert_eq!(Period::get(), 6 * HOURS);
|
assert_eq!(configs::Period::get(), 6 * HOURS);
|
||||||
|
|
||||||
// assert_eq!(Offset::get(), 0);
|
assert_eq!(configs::Offset::get(), 0);
|
||||||
// }
|
}
|
||||||
|
|
||||||
// #[test]
|
#[test]
|
||||||
// #[allow(clippy::assertions_on_constants)]
|
#[allow(clippy::assertions_on_constants)]
|
||||||
// fn aura_constants() {
|
fn aura_constants() {
|
||||||
// #[cfg(not(feature = "async-backing"))]
|
#[cfg(not(feature = "async-backing"))]
|
||||||
// assert!(!AllowMultipleBlocksPerSlot::get());
|
assert!(!<Runtime as pallet_aura::Config>::AllowMultipleBlocksPerSlot::get());
|
||||||
// #[cfg(feature = "async-backing")]
|
#[cfg(feature = "async-backing")]
|
||||||
// assert!(AllowMultipleBlocksPerSlot::get());
|
assert!(<Runtime as pallet_aura::Config>::AllowMultipleBlocksPerSlot::get());
|
||||||
|
|
||||||
// assert_eq!(MaxAuthorities::get(), 100_000);
|
assert_eq!(<Runtime as pallet_aura::Config>::MaxAuthorities::get(), 100_000);
|
||||||
// }
|
}
|
||||||
|
|
||||||
// #[test]
|
#[test]
|
||||||
// fn collator_selection_constants() {
|
fn collator_selection_constants() {
|
||||||
// let pallet_id_to_string = |id: PalletId| -> String {
|
let pallet_id_to_string = |id: PalletId| -> String {
|
||||||
// core::str::from_utf8(&id.0).unwrap_or_default().to_string()
|
core::str::from_utf8(&id.0).unwrap_or_default().to_string()
|
||||||
// };
|
};
|
||||||
|
|
||||||
// assert_eq!(pallet_id_to_string(PotId::get()), pallet_id_to_string(PalletId(*b"PotStake")));
|
assert_eq!(
|
||||||
|
pallet_id_to_string(<Runtime as pallet_collator_selection::Config>::PotId::get()),
|
||||||
|
pallet_id_to_string(PalletId(*b"PotStake"))
|
||||||
|
);
|
||||||
|
|
||||||
// assert_eq!(SessionLength::get(), 6 * HOURS);
|
assert_eq!(configs::Period::get(), 6 * HOURS);
|
||||||
|
|
||||||
// assert_eq!(StakingAdminBodyId::get(), BodyId::Defense);
|
assert_eq!(configs::StakingAdminBodyId::get(), BodyId::Defense);
|
||||||
|
|
||||||
// assert_eq!(MaxCandidates::get(), 100);
|
assert_eq!(<Runtime as pallet_collator_selection::Config>::MaxCandidates::get(), 100);
|
||||||
|
|
||||||
// assert_eq!(MaxInvulnerables::get(), 20);
|
assert_eq!(<Runtime as pallet_collator_selection::Config>::MaxInvulnerables::get(), 20);
|
||||||
|
|
||||||
// assert_eq!(MinEligibleCollators::get(), 4);
|
assert_eq!(<Runtime as pallet_collator_selection::Config>::MinEligibleCollators::get(), 4);
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
|
|
||||||
// mod xcm_tests {
|
mod xcm_tests {
|
||||||
// use evm_runtime_template::configs::xcm_config::*;
|
use evm_runtime_template::{configs, Runtime};
|
||||||
// use frame_support::weights::Weight;
|
use frame_support::weights::Weight;
|
||||||
|
|
||||||
// #[test]
|
#[test]
|
||||||
// fn xcm_executor_constants() {
|
fn xcm_executor_constants() {
|
||||||
// assert_eq!(UnitWeightCost::get(), Weight::from_parts(1_000_000_000, 64 * 1024));
|
assert_eq!(configs::UnitWeightCost::get(), Weight::from_parts(1_000_000_000, 64 * 1024));
|
||||||
// assert_eq!(MaxInstructions::get(), 100);
|
assert_eq!(configs::MaxInstructions::get(), 100);
|
||||||
// assert_eq!(MaxAssetsIntoHolding::get(), 64);
|
assert_eq!(configs::MaxAssetsIntoHolding::get(), 64);
|
||||||
// }
|
}
|
||||||
|
|
||||||
// #[test]
|
#[test]
|
||||||
// fn pallet_xcm_constants() {
|
fn pallet_xcm_constants() {
|
||||||
// assert_eq!(MaxLockers::get(), 8);
|
assert_eq!(<Runtime as pallet_xcm::Config>::MaxLockers::get(), 8);
|
||||||
// assert_eq!(MaxRemoteLockConsumers::get(), 0);
|
assert_eq!(<Runtime as pallet_xcm::Config>::MaxRemoteLockConsumers::get(), 0);
|
||||||
// assert_eq!(
|
assert_eq!(<Runtime as pallet_xcm::Config>::VERSION_DISCOVERY_QUEUE_SIZE, 100);
|
||||||
// <evm_runtime_template::Runtime as pallet_xcm::Config>::VERSION_DISCOVERY_QUEUE_SIZE,
|
}
|
||||||
// 100
|
}
|
||||||
// );
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|||||||
@@ -18,227 +18,252 @@ mod constant_tests {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: fix the imports for these tests.
|
mod runtime_tests {
|
||||||
// mod runtime_tests {
|
use frame_support::{pallet_prelude::Weight, traits::TypedGet, PalletId};
|
||||||
// use frame_support::{pallet_prelude::Weight, traits::TypedGet, PalletId};
|
use generic_runtime_template::{
|
||||||
// use generic_runtime_template::{
|
configs,
|
||||||
// configs::{asset_config::*, *},
|
constants::{currency::*, *},
|
||||||
// constants::{currency::*, *},
|
BlockNumber, Runtime,
|
||||||
// *,
|
};
|
||||||
// };
|
use sp_runtime::{create_runtime_str, Perbill};
|
||||||
// use sp_runtime::create_runtime_str;
|
use sp_version::RuntimeVersion;
|
||||||
// use sp_version::RuntimeVersion;
|
use xcm::latest::prelude::BodyId;
|
||||||
// use xcm::latest::prelude::BodyId;
|
|
||||||
|
|
||||||
// #[test]
|
#[test]
|
||||||
// fn check_runtime_api_version() {
|
fn check_runtime_api_version() {
|
||||||
// assert_eq!(
|
assert_eq!(
|
||||||
// VERSION,
|
VERSION,
|
||||||
// RuntimeVersion {
|
RuntimeVersion {
|
||||||
// spec_name: create_runtime_str!("template-parachain"),
|
spec_name: create_runtime_str!("template-parachain"),
|
||||||
// impl_name: create_runtime_str!("template-parachain"),
|
impl_name: create_runtime_str!("template-parachain"),
|
||||||
// authoring_version: 1,
|
authoring_version: 1,
|
||||||
// spec_version: 1,
|
spec_version: 1,
|
||||||
// impl_version: 0,
|
impl_version: 0,
|
||||||
// apis: generic_runtime_template::apis::RUNTIME_API_VERSIONS,
|
apis: generic_runtime_template::apis::RUNTIME_API_VERSIONS,
|
||||||
// transaction_version: 1,
|
transaction_version: 1,
|
||||||
// state_version: 1,
|
state_version: 1,
|
||||||
// }
|
}
|
||||||
// );
|
);
|
||||||
// }
|
}
|
||||||
|
|
||||||
// #[test]
|
#[test]
|
||||||
// fn weight_to_fee_constants() {
|
fn weight_to_fee_constants() {
|
||||||
// assert_eq!(P_FACTOR, 10);
|
assert_eq!(P_FACTOR, 10);
|
||||||
|
|
||||||
// assert_eq!(Q_FACTOR, 100);
|
assert_eq!(Q_FACTOR, 100);
|
||||||
|
|
||||||
// assert_eq!(POLY_DEGREE, 1);
|
assert_eq!(POLY_DEGREE, 1);
|
||||||
// }
|
}
|
||||||
|
|
||||||
// #[test]
|
#[test]
|
||||||
// fn frame_system_constants() {
|
fn frame_system_constants() {
|
||||||
// #[cfg(not(feature = "async-backing"))]
|
#[cfg(not(feature = "async-backing"))]
|
||||||
// assert_eq!(
|
assert_eq!(
|
||||||
// MAXIMUM_BLOCK_WEIGHT,
|
MAXIMUM_BLOCK_WEIGHT,
|
||||||
// Weight::from_parts(
|
Weight::from_parts(
|
||||||
// frame_support::weights::constants::WEIGHT_REF_TIME_PER_SECOND.saturating_div(2),
|
frame_support::weights::constants::WEIGHT_REF_TIME_PER_SECOND.saturating_div(2),
|
||||||
// cumulus_primitives_core::relay_chain::MAX_POV_SIZE as u64
|
cumulus_primitives_core::relay_chain::MAX_POV_SIZE as u64
|
||||||
// )
|
)
|
||||||
// );
|
);
|
||||||
|
|
||||||
// #[cfg(feature = "async-backing")]
|
#[cfg(feature = "async-backing")]
|
||||||
// assert_eq!(
|
assert_eq!(
|
||||||
// MAXIMUM_BLOCK_WEIGHT,
|
MAXIMUM_BLOCK_WEIGHT,
|
||||||
// Weight::from_parts(
|
Weight::from_parts(
|
||||||
// frame_support::weights::constants::WEIGHT_REF_TIME_PER_SECOND.saturating_mul(2),
|
frame_support::weights::constants::WEIGHT_REF_TIME_PER_SECOND.saturating_mul(2),
|
||||||
// cumulus_primitives_core::relay_chain::MAX_POV_SIZE as u64
|
cumulus_primitives_core::relay_chain::MAX_POV_SIZE as u64
|
||||||
// )
|
)
|
||||||
// );
|
);
|
||||||
|
|
||||||
// assert_eq!(AVERAGE_ON_INITIALIZE_RATIO, Perbill::from_percent(5));
|
assert_eq!(AVERAGE_ON_INITIALIZE_RATIO, Perbill::from_percent(5));
|
||||||
|
|
||||||
// assert_eq!(NORMAL_DISPATCH_RATIO, Perbill::from_percent(75));
|
assert_eq!(NORMAL_DISPATCH_RATIO, Perbill::from_percent(75));
|
||||||
// #[cfg(not(feature = "async-backing"))]
|
#[cfg(not(feature = "async-backing"))]
|
||||||
// assert_eq!(UNINCLUDED_SEGMENT_CAPACITY, 1);
|
assert_eq!(UNINCLUDED_SEGMENT_CAPACITY, 1);
|
||||||
// #[cfg(feature = "async-backing")]
|
#[cfg(feature = "async-backing")]
|
||||||
// assert_eq!(UNINCLUDED_SEGMENT_CAPACITY, 3);
|
assert_eq!(UNINCLUDED_SEGMENT_CAPACITY, 3);
|
||||||
|
|
||||||
// assert_eq!(BLOCK_PROCESSING_VELOCITY, 1);
|
assert_eq!(BLOCK_PROCESSING_VELOCITY, 1);
|
||||||
|
|
||||||
// assert_eq!(RELAY_CHAIN_SLOT_DURATION_MILLIS, 6000);
|
assert_eq!(RELAY_CHAIN_SLOT_DURATION_MILLIS, 6000);
|
||||||
|
|
||||||
// #[cfg(not(feature = "async-backing"))]
|
#[cfg(not(feature = "async-backing"))]
|
||||||
// assert_eq!(MILLISECS_PER_BLOCK, 12000);
|
assert_eq!(MILLISECS_PER_BLOCK, 12000);
|
||||||
// #[cfg(feature = "async-backing")]
|
#[cfg(feature = "async-backing")]
|
||||||
// assert_eq!(MILLISECS_PER_BLOCK, 6000);
|
assert_eq!(MILLISECS_PER_BLOCK, 6000);
|
||||||
|
|
||||||
// assert_eq!(SLOT_DURATION, MILLISECS_PER_BLOCK);
|
assert_eq!(SLOT_DURATION, MILLISECS_PER_BLOCK);
|
||||||
|
|
||||||
// assert_eq!(MINUTES, 60_000 / (MILLISECS_PER_BLOCK as BlockNumber));
|
assert_eq!(MINUTES, 60_000 / (MILLISECS_PER_BLOCK as BlockNumber));
|
||||||
|
|
||||||
// assert_eq!(HOURS, MINUTES * 60);
|
assert_eq!(HOURS, MINUTES * 60);
|
||||||
|
|
||||||
// assert_eq!(DAYS, HOURS * 24);
|
assert_eq!(DAYS, HOURS * 24);
|
||||||
|
|
||||||
// assert_eq!(MAX_BLOCK_LENGTH, 5 * 1024 * 1024);
|
assert_eq!(MAX_BLOCK_LENGTH, 5 * 1024 * 1024);
|
||||||
|
|
||||||
// assert_eq!(SS58Prefix::get(), 42);
|
assert_eq!(<Runtime as frame_system::Config>::SS58Prefix::get(), 42);
|
||||||
|
|
||||||
// assert_eq!(<Runtime as frame_system::Config>::MaxConsumers::get(), 16);
|
assert_eq!(<Runtime as frame_system::Config>::MaxConsumers::get(), 16);
|
||||||
// }
|
}
|
||||||
|
|
||||||
// #[test]
|
#[test]
|
||||||
// fn proxy_constants() {
|
fn proxy_constants() {
|
||||||
// assert_eq!(MaxProxies::get(), 32);
|
assert_eq!(<Runtime as pallet_proxy::Config>::MaxProxies::get(), 32);
|
||||||
|
|
||||||
// assert_eq!(MaxPending::get(), 32);
|
assert_eq!(<Runtime as pallet_proxy::Config>::MaxPending::get(), 32);
|
||||||
|
|
||||||
// assert_eq!(ProxyDepositBase::get(), deposit(1, 40));
|
assert_eq!(<Runtime as pallet_proxy::Config>::ProxyDepositBase::get(), deposit(1, 40));
|
||||||
|
|
||||||
// assert_eq!(AnnouncementDepositBase::get(), deposit(1, 48));
|
assert_eq!(
|
||||||
|
<Runtime as pallet_proxy::Config>::AnnouncementDepositBase::get(),
|
||||||
|
deposit(1, 48)
|
||||||
|
);
|
||||||
|
|
||||||
// assert_eq!(ProxyDepositFactor::get(), deposit(0, 33));
|
assert_eq!(<Runtime as pallet_proxy::Config>::ProxyDepositFactor::get(), deposit(0, 33));
|
||||||
|
|
||||||
// assert_eq!(AnnouncementDepositFactor::get(), deposit(0, 66));
|
assert_eq!(
|
||||||
// }
|
<Runtime as pallet_proxy::Config>::AnnouncementDepositFactor::get(),
|
||||||
|
deposit(0, 66)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// #[test]
|
#[test]
|
||||||
// fn balances_constants() {
|
fn balances_constants() {
|
||||||
// assert_eq!(MaxFreezes::get(), 0);
|
assert_eq!(<Runtime as pallet_balances::Config>::MaxFreezes::get(), 0);
|
||||||
|
|
||||||
// assert_eq!(MaxLocks::get(), 50);
|
assert_eq!(<Runtime as pallet_balances::Config>::MaxLocks::get(), 50);
|
||||||
|
|
||||||
// assert_eq!(MaxReserves::get(), 50);
|
assert_eq!(<Runtime as pallet_balances::Config>::MaxReserves::get(), 50);
|
||||||
// }
|
}
|
||||||
|
|
||||||
// #[test]
|
#[test]
|
||||||
// fn assets_constants() {
|
fn assets_constants() {
|
||||||
// assert_eq!(AssetDeposit::get(), 10 * CENTS);
|
assert_eq!(<Runtime as pallet_assets::Config>::AssetDeposit::get(), 10 * CENTS);
|
||||||
|
|
||||||
// assert_eq!(AssetAccountDeposit::get(), deposit(1, 16));
|
// TODO: uncomment once patch is merged and updated RC is released and pointed to in deps
|
||||||
|
//assert_eq!(<Runtime as pallet_assets::Config>::AssetAccountDeposit::get(), deposit(1, 16));
|
||||||
|
assert_eq!(
|
||||||
|
<Runtime as pallet_assets::Config>::AssetAccountDeposit::get(),
|
||||||
|
EXISTENTIAL_DEPOSIT
|
||||||
|
);
|
||||||
|
|
||||||
// assert_eq!(ApprovalDeposit::get(), EXISTENTIAL_DEPOSIT);
|
assert_eq!(<Runtime as pallet_assets::Config>::ApprovalDeposit::get(), EXISTENTIAL_DEPOSIT);
|
||||||
|
|
||||||
// assert_eq!(StringLimit::get(), 50);
|
assert_eq!(<Runtime as pallet_assets::Config>::StringLimit::get(), 50);
|
||||||
|
|
||||||
// assert_eq!(MetadataDepositBase::get(), deposit(1, 68));
|
assert_eq!(<Runtime as pallet_assets::Config>::MetadataDepositBase::get(), deposit(1, 68));
|
||||||
|
|
||||||
// assert_eq!(MetadataDepositPerByte::get(), deposit(0, 1));
|
assert_eq!(
|
||||||
|
<Runtime as pallet_assets::Config>::MetadataDepositPerByte::get(),
|
||||||
|
deposit(0, 1)
|
||||||
|
);
|
||||||
|
|
||||||
// assert_eq!(RemoveItemsLimit::get(), 1000);
|
assert_eq!(<Runtime as pallet_assets::Config>::RemoveItemsLimit::get(), 1000);
|
||||||
// }
|
}
|
||||||
|
|
||||||
// #[test]
|
#[test]
|
||||||
// fn transaction_payment_constants() {
|
fn transaction_payment_constants() {
|
||||||
// assert_eq!(TransactionByteFee::get(), 10 * MICROCENTS);
|
assert_eq!(configs::TransactionByteFee::get(), 10 * MICROCENTS);
|
||||||
|
|
||||||
// assert_eq!(OperationalFeeMultiplier::get(), 5);
|
assert_eq!(
|
||||||
// }
|
<Runtime as pallet_transaction_payment::Config>::OperationalFeeMultiplier::get(),
|
||||||
|
5
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// #[test]
|
#[test]
|
||||||
// fn cumulus_pallet_parachain_system_constants() {
|
fn cumulus_pallet_parachain_system_constants() {
|
||||||
// assert_eq!(ReservedXcmpWeight::get(), MAXIMUM_BLOCK_WEIGHT.saturating_div(4));
|
assert_eq!(
|
||||||
|
<Runtime as cumulus_pallet_parachain_system::Config>::ReservedXcmpWeight::get(),
|
||||||
|
MAXIMUM_BLOCK_WEIGHT.saturating_div(4)
|
||||||
|
);
|
||||||
|
|
||||||
// assert_eq!(ReservedDmpWeight::get(), MAXIMUM_BLOCK_WEIGHT.saturating_div(4));
|
assert_eq!(
|
||||||
// }
|
<Runtime as cumulus_pallet_parachain_system::Config>::ReservedDmpWeight::get(),
|
||||||
|
MAXIMUM_BLOCK_WEIGHT.saturating_div(4)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// #[test]
|
#[test]
|
||||||
// fn message_queue_constants() {
|
fn message_queue_constants() {
|
||||||
// assert_eq!(HeapSize::get(), 64 * 1024);
|
assert_eq!(<Runtime as pallet_message_queue::Config>::HeapSize::get(), 64 * 1024);
|
||||||
// assert_eq!(MaxStale::get(), 8);
|
assert_eq!(<Runtime as pallet_message_queue::Config>::MaxStale::get(), 8);
|
||||||
// }
|
}
|
||||||
|
|
||||||
// #[test]
|
#[test]
|
||||||
// fn cumulus_pallet_xcmp_queue_constants() {
|
fn cumulus_pallet_xcmp_queue_constants() {
|
||||||
// assert_eq!(MaxInboundSuspended::get(), 1000);
|
assert_eq!(
|
||||||
// }
|
<Runtime as cumulus_pallet_xcmp_queue::Config>::MaxInboundSuspended::get(),
|
||||||
|
1000
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// #[test]
|
#[test]
|
||||||
// fn multisig_constants() {
|
fn multisig_constants() {
|
||||||
// assert_eq!(DepositBase::get(), deposit(1, 88));
|
assert_eq!(<Runtime as pallet_multisig::Config>::DepositBase::get(), deposit(1, 88));
|
||||||
|
|
||||||
// assert_eq!(DepositFactor::get(), deposit(0, 32));
|
assert_eq!(<Runtime as pallet_multisig::Config>::DepositFactor::get(), deposit(0, 32));
|
||||||
|
|
||||||
// assert_eq!(MaxSignatories::get(), 100);
|
assert_eq!(<Runtime as pallet_multisig::Config>::MaxSignatories::get(), 100);
|
||||||
// }
|
}
|
||||||
|
|
||||||
// #[test]
|
#[test]
|
||||||
// fn session_constants() {
|
fn session_constants() {
|
||||||
// assert_eq!(Period::get(), 6 * HOURS);
|
assert_eq!(configs::Period::get(), 6 * HOURS);
|
||||||
|
|
||||||
// assert_eq!(Offset::get(), 0);
|
assert_eq!(configs::Offset::get(), 0);
|
||||||
// }
|
}
|
||||||
|
|
||||||
// #[test]
|
#[test]
|
||||||
// #[allow(clippy::assertions_on_constants)]
|
#[allow(clippy::assertions_on_constants)]
|
||||||
// fn aura_constants() {
|
fn aura_constants() {
|
||||||
// #[cfg(not(feature = "async-backing"))]
|
#[cfg(not(feature = "async-backing"))]
|
||||||
// assert!(!AllowMultipleBlocksPerSlot::get());
|
assert!(!<Runtime as pallet_aura::Config>::AllowMultipleBlocksPerSlot::get());
|
||||||
// #[cfg(feature = "async-backing")]
|
#[cfg(feature = "async-backing")]
|
||||||
// assert!(AllowMultipleBlocksPerSlot::get());
|
assert!(<Runtime as pallet_aura::Config>::AllowMultipleBlocksPerSlot::get());
|
||||||
|
|
||||||
// assert_eq!(<Runtime as pallet_aura::Config>::MaxAuthorities::get(), 100_000);
|
assert_eq!(<Runtime as pallet_aura::Config>::MaxAuthorities::get(), 100_000);
|
||||||
// }
|
}
|
||||||
|
|
||||||
// #[test]
|
#[test]
|
||||||
// fn collator_selection_constants() {
|
fn collator_selection_constants() {
|
||||||
// let pallet_id_to_string = |id: PalletId| -> String {
|
let pallet_id_to_string = |id: PalletId| -> String {
|
||||||
// core::str::from_utf8(&id.0).unwrap_or_default().to_string()
|
core::str::from_utf8(&id.0).unwrap_or_default().to_string()
|
||||||
// };
|
};
|
||||||
|
|
||||||
// assert_eq!(pallet_id_to_string(PotId::get()), pallet_id_to_string(PalletId(*b"PotStake")));
|
assert_eq!(
|
||||||
|
pallet_id_to_string(<Runtime as pallet_collator_selection::Config>::PotId::get()),
|
||||||
|
pallet_id_to_string(PalletId(*b"PotStake"))
|
||||||
|
);
|
||||||
|
|
||||||
// assert_eq!(SessionLength::get(), 6 * HOURS);
|
assert_eq!(configs::Period::get(), 6 * HOURS);
|
||||||
|
|
||||||
// assert_eq!(StakingAdminBodyId::get(), BodyId::Defense);
|
assert_eq!(configs::StakingAdminBodyId::get(), BodyId::Defense);
|
||||||
|
|
||||||
// assert_eq!(<Runtime as pallet_collator_selection::Config>::MaxCandidates::get(), 100);
|
assert_eq!(<Runtime as pallet_collator_selection::Config>::MaxCandidates::get(), 100);
|
||||||
|
|
||||||
// assert_eq!(<Runtime as pallet_collator_selection::Config>::MaxInvulnerables::get(), 20);
|
assert_eq!(<Runtime as pallet_collator_selection::Config>::MaxInvulnerables::get(), 20);
|
||||||
|
|
||||||
// assert_eq!(<Runtime as pallet_collator_selection::Config>::MinEligibleCollators::get(), 4);
|
assert_eq!(<Runtime as pallet_collator_selection::Config>::MinEligibleCollators::get(), 4);
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
|
|
||||||
mod xcm_tests {
|
mod xcm_tests {
|
||||||
use frame_support::weights::Weight;
|
use frame_support::weights::Weight;
|
||||||
use generic_runtime_template::configs::*;
|
use generic_runtime_template::{configs, Runtime};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn xcm_executor_constants() {
|
fn xcm_executor_constants() {
|
||||||
assert_eq!(UnitWeightCost::get(), Weight::from_parts(1_000_000_000, 64 * 1024));
|
assert_eq!(configs::UnitWeightCost::get(), Weight::from_parts(1_000_000_000, 64 * 1024));
|
||||||
assert_eq!(MaxInstructions::get(), 100);
|
assert_eq!(configs::MaxInstructions::get(), 100);
|
||||||
assert_eq!(MaxAssetsIntoHolding::get(), 64);
|
assert_eq!(configs::MaxAssetsIntoHolding::get(), 64);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn pallet_xcm_constants() {
|
fn pallet_xcm_constants() {
|
||||||
assert_eq!(MaxLockers::get(), 8);
|
assert_eq!(<Runtime as pallet_xcm::Config>::MaxLockers::get(), 8);
|
||||||
assert_eq!(MaxRemoteLockConsumers::get(), 0);
|
assert_eq!(<Runtime as pallet_xcm::Config>::MaxRemoteLockConsumers::get(), 0);
|
||||||
assert_eq!(
|
assert_eq!(<Runtime as pallet_xcm::Config>::VERSION_DISCOVERY_QUEUE_SIZE, 100);
|
||||||
<generic_runtime_template::Runtime as pallet_xcm::Config>::VERSION_DISCOVERY_QUEUE_SIZE,
|
|
||||||
100
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user