Skip to content

fix: defensively guard minDstAmount BigInt parsing in fill() - #160

Open
Phantomcall wants to merge 1 commit into
stellar-vortex-protocol:mainfrom
Phantomcall:fix/min-dst-amount-defensive-parsing
Open

fix: defensively guard minDstAmount BigInt parsing in fill()#160
Phantomcall wants to merge 1 commit into
stellar-vortex-protocol:mainfrom
Phantomcall:fix/min-dst-amount-defensive-parsing

Conversation

@Phantomcall

Copy link
Copy Markdown

Adds a defensive try/catch around BigInt(intent.minDstAmount) in IntentsController.fill() that throws a clean BadRequestException with a data-integrity error message instead of letting an unhandled SyntaxError propagate as a 500.

Changes

Modified File: src/intents/intents.controller.ts

Wrapped BigInt(intent.minDstAmount) in a try/catch that throws a BadRequestException with a clear data-integrity error message when minDstAmount is not a valid integer string. This prevents ungraceful 500 errors from reaching clients when malformed data exists in the database (e.g., from direct DB writes or seed data).

Modified File: test/intents.e2e-spec.ts

Added an e2e test that:

  1. Creates an intent and accepts it
  2. Uses the IntentsService directly to corrupt the intent's minDstAmount to a malformed value
  3. Attempts to fill the intent
  4. Asserts HTTP 400 with the data integrity error message

Verification

  • npm run lint passes
  • npm run typecheck passes
  • npm test passes
  • npm run test:e2e passes (new e2e test for malformed minDstAmount)

Closes #66

Add a try/catch around BigInt(intent.minDstAmount) in IntentsController.fill()
that throws a clean BadRequestException with a data-integrity error message
instead of letting an unhandled SyntaxError propagate as a 500.

Adds an e2e test that corrupts an intent's minDstAmount to a malformed value
and asserts the fill endpoint returns 400 with a clear error message.
@drips-wave

drips-wave Bot commented Jul 28, 2026

Copy link
Copy Markdown

@Phantomcall Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

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.

Guard against malformed minDstAmount reaching BigInt()

1 participant