From 4bc0a09768a11f49ef3c6583be6274af7b3b5cfd Mon Sep 17 00:00:00 2001 From: Emanuele Cesena Date: Tue, 20 Aug 2024 18:48:26 -0700 Subject: [PATCH 1/2] asset: temp disable price time check --- anchor/Anchor.toml | 4 ++-- anchor/programs/glam/src/state/assets.rs | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/anchor/Anchor.toml b/anchor/Anchor.toml index b40de5fd..15531898 100644 --- a/anchor/Anchor.toml +++ b/anchor/Anchor.toml @@ -24,7 +24,7 @@ cluster = "localnet" wallet = "~/.config/solana/id.json" [scripts] -test = "../node_modules/.bin/nx run --skip-nx-cache anchor:jest --verbose --testPathPattern tests/ --testNamePattern glam_crud" +#test = "../node_modules/.bin/nx run --skip-nx-cache anchor:jest --verbose --testPathPattern tests/ --testNamePattern glam_crud" #test = "../node_modules/.bin/nx run --skip-nx-cache anchor:jest --verbose --testPathPattern tests/ --testNamePattern glam_investor" #test = "../node_modules/.bin/nx run --skip-nx-cache anchor:jest --verbose --testPathPattern tests/ --testNamePattern glam_drift" #test = "../node_modules/.bin/nx run --skip-nx-cache anchor:jest --verbose --testPathPattern tests/ --testNamePattern glam_marinade" @@ -34,7 +34,7 @@ test = "../node_modules/.bin/nx run --skip-nx-cache anchor:jest --verbose --test #test = "../node_modules/.bin/nx run --skip-nx-cache anchor:jest --verbose --testPathPattern tests/ --testNamePattern glam_wsol" #test = "../node_modules/.bin/nx run --skip-nx-cache anchor:jest --verbose --testPathPattern tests/ --testNamePattern glam_api_tx" #test = "../node_modules/.bin/nx run --skip-nx-cache anchor:jest --verbose --testPathPattern tests/ --testNamePattern devnet" -#test = "../node_modules/.bin/nx run --skip-nx-cache anchor:jest --verbose --testPathPattern tests/ --testNamePattern glam_sol_msol" +test = "../node_modules/.bin/nx run --skip-nx-cache anchor:jest --verbose --testPathPattern tests/ --testNamePattern glam_sol_msol" [test] startup_wait = 50000 diff --git a/anchor/programs/glam/src/state/assets.rs b/anchor/programs/glam/src/state/assets.rs index 1160d1e4..572a8ac7 100644 --- a/anchor/programs/glam/src/state/assets.rs +++ b/anchor/programs/glam/src/state/assets.rs @@ -90,10 +90,10 @@ impl<'a> AssetMeta<'a> { let mut asset_price = price_feed.get_price_unchecked(); // On mainnet, enforce that the price is newer than 30s ago // In tests, ignore this check - #[cfg(feature = "mainnet")] - if (asset_price.publish_time - _timestamp).abs() > 30 { - return Err(InvestorError::InvalidAssetPrice.into()); - }; + // #[cfg(feature = "mainnet")] + // if (asset_price.publish_time - _timestamp).abs() > 30 { + // return Err(InvestorError::InvalidAssetPrice.into()); + // }; // Scale price to expected decimals let asset_expo = -(self.decimals as i32); From 23e31a36e6ba15230b53ad3bb8df1bbfcbfce861 Mon Sep 17 00:00:00 2001 From: Yuru Shao Date: Tue, 20 Aug 2024 22:08:16 -0700 Subject: [PATCH 2/2] revert anchor.toml --- anchor/Anchor.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/anchor/Anchor.toml b/anchor/Anchor.toml index 15531898..b40de5fd 100644 --- a/anchor/Anchor.toml +++ b/anchor/Anchor.toml @@ -24,7 +24,7 @@ cluster = "localnet" wallet = "~/.config/solana/id.json" [scripts] -#test = "../node_modules/.bin/nx run --skip-nx-cache anchor:jest --verbose --testPathPattern tests/ --testNamePattern glam_crud" +test = "../node_modules/.bin/nx run --skip-nx-cache anchor:jest --verbose --testPathPattern tests/ --testNamePattern glam_crud" #test = "../node_modules/.bin/nx run --skip-nx-cache anchor:jest --verbose --testPathPattern tests/ --testNamePattern glam_investor" #test = "../node_modules/.bin/nx run --skip-nx-cache anchor:jest --verbose --testPathPattern tests/ --testNamePattern glam_drift" #test = "../node_modules/.bin/nx run --skip-nx-cache anchor:jest --verbose --testPathPattern tests/ --testNamePattern glam_marinade" @@ -34,7 +34,7 @@ wallet = "~/.config/solana/id.json" #test = "../node_modules/.bin/nx run --skip-nx-cache anchor:jest --verbose --testPathPattern tests/ --testNamePattern glam_wsol" #test = "../node_modules/.bin/nx run --skip-nx-cache anchor:jest --verbose --testPathPattern tests/ --testNamePattern glam_api_tx" #test = "../node_modules/.bin/nx run --skip-nx-cache anchor:jest --verbose --testPathPattern tests/ --testNamePattern devnet" -test = "../node_modules/.bin/nx run --skip-nx-cache anchor:jest --verbose --testPathPattern tests/ --testNamePattern glam_sol_msol" +#test = "../node_modules/.bin/nx run --skip-nx-cache anchor:jest --verbose --testPathPattern tests/ --testNamePattern glam_sol_msol" [test] startup_wait = 50000