Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ lto = true
codegen-units = 1

[profile.test]
opt-level = 0
lto = false
codegen-units = 16

Expand Down
4 changes: 0 additions & 4 deletions contracts/predict-iq/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,3 @@ soroban-sdk = { workspace = true, features = ["testutils"] }

[features]
testutils = ["soroban-sdk/testutils"]

[[test]]
name = "gas_benchmark"
path = "benches/gas_benchmark.rs"
16 changes: 16 additions & 0 deletions contracts/predict-iq/src/modules/oracles_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Loading