Skip to content

Commit

Permalink
tests for TREASURY_PALLET_ID
Browse files Browse the repository at this point in the history
  • Loading branch information
svyatonik committed Nov 10, 2023
1 parent 10b2664 commit 4420a47
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
13 changes: 9 additions & 4 deletions relay/kusama/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ use sp_runtime::traits::Get;
pub use sp_runtime::BuildStorage;

/// Constant values used within the runtime.
use kusama_runtime_constants::{currency::*, fee::*, time::*};
use kusama_runtime_constants::{currency::*, fee::*, time::*, TREASURY_PALLET_ID};

// Weights used in the runtime.
mod weights;
Expand Down Expand Up @@ -751,8 +751,8 @@ parameter_types! {
pub const TreasuryPalletId: PalletId = PalletId(*b"py/trsry");
pub const PayoutSpendPeriod: BlockNumber = 30 * DAYS;
// The asset's interior location for the paying account. This is the Treasury
// pallet instance (which sits at index 19).
pub TreasuryInteriorLocation: InteriorMultiLocation = PalletInstance(18).into();
// pallet instance (which sits at index 18).
pub TreasuryInteriorLocation: InteriorMultiLocation = PalletInstance(TREASURY_PALLET_ID).into();

pub const TipCountdown: BlockNumber = 1 * DAYS;
pub const TipFindersFee: Percent = Percent::from_percent(20);
Expand Down Expand Up @@ -2573,7 +2573,7 @@ mod fees_tests {
#[cfg(test)]
mod multiplier_tests {
use super::*;
use frame_support::{dispatch::DispatchInfo, traits::OnFinalize};
use frame_support::{dispatch::DispatchInfo, traits::{OnFinalize, PalletInfoAccess}};
use runtime_common::{MinimumMultiplier, TargetBlockFullness};
use separator::Separatable;
use sp_runtime::traits::Convert;
Expand Down Expand Up @@ -2618,6 +2618,11 @@ mod multiplier_tests {
assert!(on_idle / block_time <= 0.5f32)
}

#[test]
fn treasury_pallet_index_is_correct() {
assert_eq!(TREASURY_PALLET_ID, <Treasury as PalletInfoAccess>::index() as u8);
}

#[test]
#[ignore]
fn multiplier_growth_simulator() {
Expand Down
9 changes: 7 additions & 2 deletions relay/polkadot/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ use sp_runtime::traits::Get;
pub use sp_runtime::BuildStorage;

/// Constant values used within the runtime.
use polkadot_runtime_constants::{currency::*, fee::*, time::*};
use polkadot_runtime_constants::{currency::*, fee::*, time::*, TREASURY_PALLET_ID};

// Weights used in the runtime.
mod weights;
Expand Down Expand Up @@ -716,7 +716,7 @@ parameter_types! {
pub const PayoutSpendPeriod: BlockNumber = 30 * DAYS;
// The asset's interior location for the paying account. This is the Treasury
// pallet instance (which sits at index 19).
pub TreasuryInteriorLocation: InteriorMultiLocation = PalletInstance(19).into();
pub TreasuryInteriorLocation: InteriorMultiLocation = PalletInstance(TREASURY_PALLET_ID).into();

pub const TipCountdown: BlockNumber = 1 * DAYS;
pub const TipFindersFee: Percent = Percent::from_percent(20);
Expand Down Expand Up @@ -2588,6 +2588,11 @@ mod multiplier_tests {
assert!(on_idle / block_time <= 0.5f32)
}

#[test]
fn treasury_pallet_index_is_correct() {
assert_eq!(TREASURY_PALLET_ID, <Treasury as PalletInfoAccess>::index() as u8);
}

#[test]
#[ignore]
fn multiplier_growth_simulator() {
Expand Down

0 comments on commit 4420a47

Please sign in to comment.