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

  1. GBOYEE commented on Jul 15, 2026

    @GBOYEE

    Hey! validate_token in lib.rs accepts 0..=38 decimals but the boundary cases aren't tested. I'll add cases for decimals 0, 7, 38, and 39 in tests/aid_escrow_tests.rs, plus a min_decimals policy field (default 0) so fund with 39 returns Error::InvalidTokenDecimals. I can have this in a couple hours. Mind if I take this on?

  2. mercy60 commented on Jul 21, 2026

    @mercy60
    Contributor

    Hi, I am a fullStack developer with years of experience, I have worked on so many project and I can submit a PR in less than 24hrs. Can I work on this please

  3. grantfox-oss commented on Jul 21, 2026

    @grantfox-oss

    🦊 GrantFox — @mercy60 has been assigned to this issue as part of the Official Campaign | FWC26 campaign!

    Next steps:

    1. Open a Pull Request referencing this issue (e.g., Closes #235)
    2. Your PR will be reviewed by the ChainForgee maintainers

    Good luck! Track your progress on GrantFox.

  4. grantfox-oss commented on Jul 28, 2026

    @grantfox-oss

    🎉 This issue has been marked as completed on GrantFox as part of the Official Campaign | FWC26 campaign!

    @mercy60's PR #412 was approved and merged by @kilodesodiq-arch.

    🏆 @mercy60: You earned 35 FoxPoints for this contribution! Your current tier: Explorer (121 total points). Track your full progress on GrantFox.

    👏 Great work, @mercy60! Keep contributing to ChainForgee.

  5. added a commit that references this issue on Jul 31, 2026
    5d70441
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