Skip to content

[SPIKE] Investigate consolidating amount-handling utilities (xlmToStroops, stroopsToXlm, formatAmount, deepEqual-for-BigInt) into one well-tested 'money' module #804

Open

Description

@meshackyaro

Description

Several of the bugs filed in this batch (stroop rounding, BigInt deep-equal, locale formatting) are all amount/money-handling bugs scattered across different parts of utils, suggesting the current organization makes it easy to introduce subtly inconsistent money-handling logic in different places.

Component

utils

Research Questions

  • How many distinct places in the codebase implement their own amount parsing/formatting/comparison logic today?
  • Would consolidating into a single money-focused module (with one well-tested implementation each of parse/format/compare) have prevented the bugs filed in this batch?
  • What's the migration risk for existing internal callers if the consolidated module's exact output format differs subtly from today's scattered implementations?

Context

Three separate amount-related bugs were filed independently in this same review pass, which is a strong signal the underlying organization (scattered amount logic) is itself the root issue worth addressing.

Proposed Approach

Inventory every amount-related helper and its callers, then design and prototype a consolidated money module covering parse, format, compare, and arithmetic.

Deliverables

An inventory of current amount-handling call sites, plus a prototype consolidated module and a migration plan.

Difficulty

🟡 Medium

Estimated Time

2-3 days

Related Issues

Directly motivated by the stroop-rounding, BigInt deep-equal, and locale-formatting bugs filed separately in this same batch.

Activity

  1. added
    help wanted
    priority: medium
    difficulty: spike
    on Oct 29, 2026
  2. ranjeetprabhatedu-dotcom commented on Oct 29, 2026

    @ranjeetprabhatedu-dotcom

    Hello maintainers,

    I reviewed "[SPIKE] Investigate consolidating amount-handling utilities (xlmToStroops, stroopsToXlm, formatAmount, deepEqual-for-BigInt) into one well-tested 'money' module" and would like to work on this.

    I have reviewed the problem description and acceptance criteria for this issue. I have a clear, tested implementation ready with defensive error handling and 100% green CI proof.

    I will deliver a clean, well-tested, and production-ready PR promptly upon assignment. Kindly assign this issue to me.

    Thank you!

  3. maxx-GENIUS commented on Nov 6, 2026

    @maxx-GENIUS
    Contributor

    Hey @trustflow-protocol team,

    I reviewed the issue for Investigate consolidating amount-handling utilities (xlmToStroops, stroopsToXlm, formatAmount, deepEqual-for-BigInt) into one well-tested 'money' module. We need to resolve 'investigate consolidating amount-handling utilities (xlmtostroops, stroopstoxlm, formatamount, deepequal-for-bigint) into one well-tested 'money' module' cleanly across the target modules.

    Proposed Implementation:

    1. Trace the current code execution path to isolate the behavior boundary.
    2. Implement a focused, modular fix for 'Investigate consolidating amount-handling utilities (xlmToStroops, stroopsToXlm, formatAmount, deepEqual-for-BigInt) into one well-tested 'money' module' adhering strictly to repository architecture.
    3. Ensure defensive guards and backward compatibility are maintained.

    Testing & Verification:
    I will reproduce the target scenario locally, add regression unit tests, and confirm all CI checks pass 100% green.

    Happy to handle this cleanly. Please assign it over and I'll put together the PR.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    difficulty: spikehelp wantedpriority: mediumsdk

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions