Skip to content

[codex] validate fund invoice stroops as BigInt strings#546

Open
MyouzzZ wants to merge 1 commit into
Liquifact:mainfrom
MyouzzZ:codex/bigint-amount-stroops-506
Open

[codex] validate fund invoice stroops as BigInt strings#546
MyouzzZ wants to merge 1 commit into
Liquifact:mainfrom
MyouzzZ:codex/bigint-amount-stroops-506

Conversation

@MyouzzZ

@MyouzzZ MyouzzZ commented Jul 3, 2026

Copy link
Copy Markdown

Closes #506

Summary

  • Reuse the shared validateAmountStroops BigInt validator in POST /api/invest/fund-invoice instead of coercing through Number().
  • Keep amountStroops as a strict decimal string through the funding path and reject JSON numbers, signs, decimals, scientific notation, leading zeros, zero, and values above 10^18 before escrow submission or persistence.
  • Validate the escrow submission entry point as well so stubbed/delegated/submitted paths never accept a JS number.
  • Document the string-only amountStroops contract in README and the route OpenAPI block, with focused route/service tests.
  • Restore small broken support exports/imports/metrics/logger wrapping that prevented the relevant route/CI tests from loading cleanly in this checkout.

Tests

  • npm test -- --silent tests/invest.fund.test.js tests/investorCommitment.validation.test.js tests/escrowSubmit.amount.test.js tests/escrow.derived.test.js
  • npx eslint src/routes/invest.js src/services/investorCommitment.js src/services/escrowSubmit.js src/middleware/kycGating.js src/middleware/requestId.js src/middleware/correlationId.js src/metrics.js src/logger.js tests/invest.fund.test.js tests/escrowSubmit.amount.test.js

@MyouzzZ MyouzzZ force-pushed the codex/bigint-amount-stroops-506 branch from 60348bc to fe0bc4e Compare July 3, 2026 00:28
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.

Validate fund-invoice amountStroops with BigInt to stop precision loss and float acceptance

1 participant