Skip to content

fix(ed25519): Add a check for NativeAmount to be non-negative#4663

Merged
sergei-boiko-trustwallet merged 2 commits intomasterfrom
fix/xrp-amount
Mar 6, 2026
Merged

fix(ed25519): Add a check for NativeAmount to be non-negative#4663
sergei-boiko-trustwallet merged 2 commits intomasterfrom
fix/xrp-amount

Conversation

@sergei-boiko-trustwallet
Copy link
Copy Markdown
Contributor

This pull request improves validation for XRP amounts in the NativeAmount type by adding a check to prevent negative values, and updates the associated tests to cover this new validation.

Validation improvements:

  • Added a check in the NativeAmount::new constructor to return an error if a negative amount is provided, ensuring that XRP amounts cannot be negative.

Testing:

  • Updated the test suite to include a case that verifies an error is returned when attempting to parse a negative amount.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request adds validation to prevent negative XRP amounts in the NativeAmount type. The validation ensures that XRP native amounts conform to the XRP ledger specification, which requires amounts to be non-negative. This is consistent with the encoding logic that sets a positive sign bit when serializing amounts.

Changes:

  • Added a negative value check in NativeAmount::new to reject amounts less than zero
  • Added a test case to verify negative amounts are properly rejected

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Feb 24, 2026

Binary size comparison

➡️ aarch64-apple-ios: 14.34 MB

➡️ aarch64-apple-ios-sim: 14.34 MB

➡️ aarch64-linux-android:

- 18.77 MB
+ 18.77 MB 	 +1 KB

➡️ armv7-linux-androideabi:

- 16.20 MB
+ 16.20 MB 	 +1 KB

➡️ wasm32-unknown-emscripten:

- 13.68 MB
+ 13.68 MB 	 +1 KB

@sergei-boiko-trustwallet sergei-boiko-trustwallet merged commit 35ae605 into master Mar 6, 2026
16 checks passed
@sergei-boiko-trustwallet sergei-boiko-trustwallet deleted the fix/xrp-amount branch March 6, 2026 07:26
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.

4 participants