Skip to content

fix: harden balance type-safety and precision handling (closes #227)#299

Merged
Mosas2000 merged 27 commits intomainfrom
fix/227-balance-type-safety
Mar 17, 2026
Merged

fix: harden balance type-safety and precision handling (closes #227)#299
Mosas2000 merged 27 commits intomainfrom
fix/227-balance-type-safety

Conversation

@Mosas2000
Copy link
Copy Markdown
Owner

Summary

This PR resolves issue #227 by eliminating unsafe balance handling patterns and enforcing integer-safe micro-STX logic across hooks, utilities, and tip form validation.

What changed

  • now normalizes API balance values to canonical non-negative integer micro-STX strings.
  • Added precision-safe utilities in :

  • Updated and to use integer-safe balance sufficiency checks instead of float comparisons.
  • Hardened formatting path for very large balances.
  • Expanded regression coverage in:

  • Added changelog entry documenting the fix.

Verification

  • Ran targeted test suite:

RUN v3.2.4 /Users/macosbigsur/Documents/Code/Stacks-project/TipStream

  • Result: 3 test files passed, 115 tests passed.

Notes

  • This branch intentionally preserves a granular history with 27 commits, as requested.

Closes #227

@Mosas2000 Mosas2000 merged commit 2aafc9c into main Mar 17, 2026
5 of 8 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.

🟠 HIGH: useBalance stores BigInt but consumers use Number arithmetic

1 participant