Skip to content

[Codebase Audit] Reduce panic-prone calls in src/kyc/tests.rs #566

Description

@kelly-musk

Problem

src/kyc/tests.rs contains 35 panic-prone calls (unwrap, expect, or panic!).

Evidence

  • src/kyc/tests.rs:69let amount = BigDecimal::from_str("500.00").unwrap();
  • src/kyc/tests.rs:70let daily_used = BigDecimal::from_str("1000.00").unwrap();
  • src/kyc/tests.rs:71let monthly_used = BigDecimal::from_str("10000.00").unwrap();
  • src/kyc/tests.rs:78let amount = BigDecimal::from_str("2000.00").unwrap(); // Exceeds $1000 limit
  • src/kyc/tests.rs:79let daily_used = BigDecimal::from_str("0.00").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

Labels

Stellar WaveIssues in the Stellar wave program

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions