Skip to content

test: add currency-precision helper boundary tests (#2092) - #2379

Merged
Baskarayelu merged 1 commit into
QuickLendX:mainfrom
YazarAyobami:test/issue-2092-currency-precision-tests
Jul 28, 2026
Merged

test: add currency-precision helper boundary tests (#2092)#2379
Baskarayelu merged 1 commit into
QuickLendX:mainfrom
YazarAyobami:test/issue-2092-currency-precision-tests

Conversation

@YazarAyobami

@YazarAyobami YazarAyobami commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

#Closes #2092

Add a dedicated test module that locks in three behaviour buckets for payments::require_matching_currency_precision:

  • Matching (must succeed): token contract reports decimals=0, decimals=18 (boundary inclusive), and the SAC default decimals=7.
  • Over-precision (must be rejected with InvalidCurrency): decimals=19 (just-over), decimals=20, and decimals=u32::MAX (saturation).
  • Malformed (must be rejected with InvalidCurrency): unregistered address with no contract behind it, plus a wrong-return-type case that is gated behind a #[ignore] because Soroban 25.x aborts cross-contract type-mismatch calls at the host level (TODO note explains how to re-enable once the SDK stops doing that).

Two cross-cutting tests confirm that the InvalidAmount vs InvalidCurrency error buckets are never confused with each other, and that over-precision rejection is amount-independent (both 1 and i128::MAX are rejected).

The new module uses plain #[cfg(test)] with no feature gate so it runs on every CI matrix entry, satisfying the issue's acceptance criteria.

Closes #2092

Add a dedicated test module that locks in three behaviour buckets for
`payments::require_matching_currency_precision`:

- **Matching** (must succeed): token contract reports decimals=0,
  decimals=18 (boundary inclusive), and the SAC default decimals=7.
- **Over-precision** (must be rejected with InvalidCurrency):
  decimals=19 (just-over), decimals=20, and decimals=u32::MAX (saturation).
- **Malformed** (must be rejected with InvalidCurrency): unregistered
  address with no contract behind it, plus a wrong-return-type case that
  is gated behind a `#[ignore]` because Soroban 25.x aborts cross-contract
  type-mismatch calls at the host level (TODO note explains how to
  re-enable once the SDK stops doing that).

Two cross-cutting tests confirm that the `InvalidAmount` vs
`InvalidCurrency` error buckets are never confused with each other,
and that over-precision rejection is amount-independent (both `1`
and `i128::MAX` are rejected).

The new module uses plain `#[cfg(test)]` with no feature gate so it
runs on every CI matrix entry, satisfying the issue's acceptance
criteria.

Closes QuickLendX#2092
@drips-wave

drips-wave Bot commented Jul 28, 2026

Copy link
Copy Markdown

@YazarAyobami Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@Baskarayelu
Baskarayelu merged commit e43fe67 into QuickLendX:main Jul 28, 2026
0 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add tests for the currency-precision helper

2 participants