diff --git a/Cargo.toml b/Cargo.toml index a32b08b..b0f7e0c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,6 +14,7 @@ lto = true codegen-units = 1 [profile.test] +opt-level = 0 lto = false codegen-units = 16 diff --git a/contracts/predict-iq/Cargo.toml b/contracts/predict-iq/Cargo.toml index 2ac57ec..656b904 100644 --- a/contracts/predict-iq/Cargo.toml +++ b/contracts/predict-iq/Cargo.toml @@ -15,7 +15,3 @@ soroban-sdk = { workspace = true, features = ["testutils"] } [features] testutils = ["soroban-sdk/testutils"] - -[[test]] -name = "gas_benchmark" -path = "benches/gas_benchmark.rs" diff --git a/contracts/predict-iq/src/modules/oracles_test.rs b/contracts/predict-iq/src/modules/oracles_test.rs index 30bcb0a..3b2f30f 100644 --- a/contracts/predict-iq/src/modules/oracles_test.rs +++ b/contracts/predict-iq/src/modules/oracles_test.rs @@ -91,6 +91,22 @@ fn test_reject_stale_price() { assert_eq!(result, Err(ErrorCode::StalePrice)); } +#[test] +fn test_accept_price_at_exact_staleness_boundary() { + let e = Env::default(); + + let config = test_config(&e); + let price = PythPrice { + price: 100000, + conf: 1000, // 1% of price - within 2% threshold + expo: -2, + publish_time: e.ledger().timestamp() as i64 - 300, // exactly 300 seconds old (max_staleness_seconds) + }; + + let result = validate_price(&e, &price, &config); + assert!(result.is_ok(), "Price at exact staleness boundary (age == max_staleness_seconds) should be accepted"); +} + #[test] fn test_reject_low_confidence() { let e = Env::default();