Skip to content

Decimal-edge tests for validate_token #235

Description

@kilodesodiq-arch

Problem Statement. validate_token(&env, &token) calls the token's decimals() and
accepts 0..=38 as valid. The boundary cases (0, 38, 39, div by 0 due to decimals=0
division) are not exercised.

Why it matters. Precision loans on tokens with 0 decimals would silently succeed
even if the integration team's policy requires minimum 6 or 7.

Technical Context. lib.rs::validate_token.

Expected Outcome. Tests for decimals = 0, 7, 38, 39. New policy field min_decimals
(default 0) configurable via admin.

Acceptance Criteria.

  • fund with decimals=39 returns new Error::InvalidTokenDecimals.
  • fund with decimals=0 still works unless policy is configured otherwise.

Files or modules likely to be affected. src/lib.rs, tests/aid_escrow_tests.rs.

Difficulty. Medium
Estimated effort. S



Backlog item #27 from `docs/maintainer-issue-backlog.md.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions