Mention max int64 in amount validation errors#970
Open
chrisx9z wants to merge 1 commit into
Open
Conversation
Comment: Makes path payment amount validation failures call out the maximum 64-bit signed integer limit.
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds coverage and messaging for Stellar amount bounds by rejecting destMin values that would overflow 64-bit signed integer limits.
Changes:
- Added a unit test asserting
pathPaymentStrictSendrejectsdestMinvalues exceedingMAX_INT64. - Expanded the shared amount-requirements error message to include the 64-bit signed integer maximum constraint.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| test/unit/operations/classic_ops_test.js | Adds a regression test for destMin overflow handling in path payments. |
| src/operation.js | Updates the common amount validation error message to mention the int64 maximum rule. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| ); | ||
| }); | ||
|
|
||
| it('fails to create path payment operation when destMin exceeds MAX_INT64', function () { |
|
|
||
| static constructAmountRequirementsError(arg) { | ||
| return `${arg} argument must be of type String, represent a positive number and have at most 7 digits after the decimal`; | ||
| return `${arg} argument must be of type String, represent a positive number, have at most 7 digits after the decimal, and not exceed the maximum 64-bit signed integer value`; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
destMinexceeding the max amount.Fixes #789.
Verification
corepack yarn mocha test/unit/operations/classic_ops_test.js --grep "pathPaymentStrictSend" --require @babel/register --require ./test/test-helper.jscorepack yarn eslint -c ./config/.eslintrc.js src/operation.jsnode --check src/operation.jsnode --check test/unit/operations/classic_ops_test.jsgit diff --check