Skip to content

Test large price values #443

Description

@AbelOsaretin

Description

Add a unit test verifying that compute_confidence_interval handles large price values (1e9 range) without overflow or precision loss.

Rationale

Prices on Stellar use 1e30 fixed-point precision. Large values (e.g., BTC at ~$100k = 1_000_000_000 * 1e30 stroops) must not cause integer overflow in percentile computation or spread calculation.

Test Case

#[test]
fn large_price_values() {
    let prices = vec![1_000_000_000i128, 2_000_000_000, 3_000_000_000];
    let p = compute_confidence_interval(&prices).unwrap();
    assert!(p.min <= p.max);
    assert!(p.min > 0);
    assert!(p.max > 0);
}

Acceptance Criteria

  • Test exists in oracle/src/prices.rs module tests
  • Verifies min <= max invariant
  • Verifies both values are positive (no underflow)
  • Test passes without overflow

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave program

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions