diff --git a/finance/lending/anchor-v1/programs/lending/tests/common/mod.rs b/finance/lending/anchor-v1/programs/lending/tests/common/mod.rs index dcf51deb7..f55eee231 100644 --- a/finance/lending/anchor-v1/programs/lending/tests/common/mod.rs +++ b/finance/lending/anchor-v1/programs/lending/tests/common/mod.rs @@ -733,11 +733,11 @@ impl Env { /// 5% bonus, 50% close factor, 10% reserve factor (protocol's cut of interest), /// kink at 80% utilization, 2%/20%/150% APR curve. /// Slots in a year, which is how a reserve turns an APR into a per-slot rate. -/// 78_840_000 is a 400ms slot: 2.5 slots/second * 60 * 60 * 24 * 365. It is a +/// 157_680_000 is a 200ms slot: 5 slots/second * 60 * 60 * 24 * 365. It is a /// test fixture, not a law: a deployment reads the slot time off the cluster it /// points at (two `getBlockTime` results a known number of slots apart) and /// updates the reserve when the protocol changes it. -pub const SLOTS_PER_YEAR: u64 = 78_840_000; +pub const SLOTS_PER_YEAR: u64 = 157_680_000; pub fn default_config() -> ReserveConfig { ReserveConfig { diff --git a/finance/lending/anchor-v1/programs/lending/tests/test_interest.rs b/finance/lending/anchor-v1/programs/lending/tests/test_interest.rs index 15d6be350..67b93c0b1 100644 --- a/finance/lending/anchor-v1/programs/lending/tests/test_interest.rs +++ b/finance/lending/anchor-v1/programs/lending/tests/test_interest.rs @@ -87,7 +87,7 @@ fn protocol_fees_accrue_and_owner_can_collect() { // No interest has accrued yet, so no fees. assert_eq!(env.reserve(&borrow).accumulated_protocol_fees, 0); - env.warp_slots(7_884_000); + env.warp_slots(SLOTS_PER_YEAR / 10); env.refresh_reserve_only(&borrower, &borrow); // Fees accrued, and they are ~10% (the reserve factor) of total interest. diff --git a/finance/lending/anchor-v1/programs/lending/tests/test_rounding.rs b/finance/lending/anchor-v1/programs/lending/tests/test_rounding.rs index 7cebb803c..1c0a0aa97 100644 --- a/finance/lending/anchor-v1/programs/lending/tests/test_rounding.rs +++ b/finance/lending/anchor-v1/programs/lending/tests/test_rounding.rs @@ -1,6 +1,6 @@ mod common; -use common::{ata, default_config, dollars, Env}; +use common::{ata, default_config, dollars, Env, SLOTS_PER_YEAR}; use solana_signer::Signer; /// After interest makes the pool worth more than its share supply, a deposit so @@ -26,7 +26,7 @@ fn deposit_that_would_mint_zero_shares_is_rejected() { .unwrap(); // Accrue enough interest that total liquidity exceeds the share supply. - env.warp_slots(7_884_000); + env.warp_slots(SLOTS_PER_YEAR / 10); env.refresh_reserve_only(&borrower, &borrow); assert!(env.reserve(&borrow).borrow_accumulation_factor > lending::constants::FIXED_POINT_SCALE); diff --git a/finance/lending/anchor/programs/lending/tests/common/mod.rs b/finance/lending/anchor/programs/lending/tests/common/mod.rs index ce490c299..c60092c0c 100644 --- a/finance/lending/anchor/programs/lending/tests/common/mod.rs +++ b/finance/lending/anchor/programs/lending/tests/common/mod.rs @@ -798,11 +798,11 @@ impl Env { /// 5% bonus, 50% close factor, 10% reserve factor (protocol's cut of interest), /// kink at 80% utilization, 2%/20%/150% APR curve. /// Slots in a year, which is how a reserve turns an APR into a per-slot rate. -/// 78_840_000 is a 400ms slot: 2.5 slots/second * 60 * 60 * 24 * 365. It is a +/// 157_680_000 is a 200ms slot: 5 slots/second * 60 * 60 * 24 * 365. It is a /// test fixture, not a law: a deployment reads the slot time off the cluster it /// points at (two `getBlockTime` results a known number of slots apart) and /// updates the reserve when the protocol changes it. -pub const SLOTS_PER_YEAR: u64 = 78_840_000; +pub const SLOTS_PER_YEAR: u64 = 157_680_000; pub fn default_config() -> ReserveConfig { ReserveConfig { diff --git a/finance/lending/anchor/programs/lending/tests/test_interest.rs b/finance/lending/anchor/programs/lending/tests/test_interest.rs index 864c9423f..b1330e86f 100644 --- a/finance/lending/anchor/programs/lending/tests/test_interest.rs +++ b/finance/lending/anchor/programs/lending/tests/test_interest.rs @@ -104,7 +104,7 @@ fn protocol_fees_accrue_and_owner_can_collect() { // No interest has accrued yet, so no fees. assert_eq!(env.reserve(&borrow).accumulated_protocol_fees, 0); - env.warp_slots(7_884_000); + env.warp_slots(SLOTS_PER_YEAR / 10); env.refresh_reserve_only(&borrower, &borrow); // Fees accrued, and they are ~10% (the reserve factor) of total interest. diff --git a/finance/lending/anchor/programs/lending/tests/test_rounding.rs b/finance/lending/anchor/programs/lending/tests/test_rounding.rs index f135e4dbe..899537db3 100644 --- a/finance/lending/anchor/programs/lending/tests/test_rounding.rs +++ b/finance/lending/anchor/programs/lending/tests/test_rounding.rs @@ -3,7 +3,7 @@ mod common; use anchor_v2_testing::Signer; use lending::errors::LendingError; -use common::{ata, default_config, dollars, Env}; +use common::{ata, default_config, dollars, Env, SLOTS_PER_YEAR}; /// After interest makes the pool worth more than its share supply, a deposit so /// small it would mint zero shares is rejected rather than silently giving the @@ -35,7 +35,7 @@ fn deposit_that_would_mint_zero_shares_is_rejected() { .unwrap(); // Accrue enough interest that total liquidity exceeds the share supply. - env.warp_slots(7_884_000); + env.warp_slots(SLOTS_PER_YEAR / 10); env.refresh_reserve_only(&borrower, &borrow); assert!( env.reserve(&borrow).borrow_accumulation_factor > lending::constants::FIXED_POINT_SCALE diff --git a/finance/lending/quasar/src/tests.rs b/finance/lending/quasar/src/tests.rs index 4831fae46..a2decaa93 100644 --- a/finance/lending/quasar/src/tests.rs +++ b/finance/lending/quasar/src/tests.rs @@ -30,10 +30,10 @@ const DECIMALS: u8 = 6; const UNIT: u64 = 1_000_000; // 1 token at 6 decimals /// Slots in a year, which is how a reserve turns an APR into a per-slot rate. -/// 78_840_000 is a 400ms slot: 2.5 slots/second * 60 * 60 * 24 * 365. It is a +/// 157_680_000 is a 200ms slot: 5 slots/second * 60 * 60 * 24 * 365. It is a /// fixture, not a law: a deployment reads the slot time off the cluster it /// points at and calls `update_slots_per_year` when the protocol changes it. -const SLOTS_PER_YEAR: u64 = 78_840_000; +const SLOTS_PER_YEAR: u64 = 157_680_000; // Deterministic addresses. const OWNER: Pubkey = Pubkey::new_from_array([1; 32]); @@ -766,7 +766,7 @@ mod slot_warp { world.borrow(500 * UNIT).assert_success(); // ~0.1 year passes; re-publish prices so feeds stay fresh. - world.svm.sysvars.warp_to_slot(7_884_000); + world.svm.sysvars.warp_to_slot(super::SLOTS_PER_YEAR / 10); world.set_price(COLLATERAL_MINT, world.collateral_price, dollars(1)); world.set_price(BORROW_MINT, world.borrow_price, dollars(1)); @@ -821,7 +821,7 @@ mod slot_warp { world.borrow(500 * UNIT).assert_success(); // First window, at the figure the reserve was created with. - let window = 7_884_000; + let window = super::SLOTS_PER_YEAR / 10; let start = world.svm.sysvars.clock.slot; world.svm.sysvars.warp_to_slot(start + window); let first = balance(&world.collect_borrow_fees(), OWNER_BORROW); @@ -854,7 +854,7 @@ mod slot_warp { // ~0.1 year passes; interest accrues, and the reserve factor (10%) // sets some of it aside for the market owner. - world.svm.sysvars.warp_to_slot(7_884_000); + world.svm.sysvars.warp_to_slot(super::SLOTS_PER_YEAR / 10); let result = world.collect_borrow_fees(); result.assert_success();