Skip to content

[Codebase Audit] Reduce panic-prone calls in src/aml/ctr_tests.rs #568

Description

@kelly-musk

Problem

src/aml/ctr_tests.rs contains 32 panic-prone calls (unwrap, expect, or panic!).

Evidence

  • src/aml/ctr_tests.rs:21let amount1 = Decimal::from_str("1000000").unwrap();
  • src/aml/ctr_tests.rs:22let amount2 = Decimal::from_str("2500000").unwrap();
  • src/aml/ctr_tests.rs:23let amount3 = Decimal::from_str("1500000").unwrap();
  • src/aml/ctr_tests.rs:26assert_eq!(total, Decimal::from_str("5000000").unwrap());
  • src/aml/ctr_tests.rs:32let usd_amount = Decimal::from_str("1000").unwrap();

Proposed fix

Replace non-essential unwrap/expect usages with typed error propagation and contextual logging. Keep explicit panics only where unrecoverable invariants are well-documented.

Acceptance criteria

  • All avoidable panic-prone calls in this file are removed or justified with comments/tests.
  • Error paths return typed errors and preserve observability context.
  • Existing tests pass (or new tests cover changed paths).

Metadata

Metadata

Assignees

No one assigned

    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