refactor!: return signature SCVal from Auth.Signer for custom account contracts#806
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR refactors Soroban authorization signing to support custom account contracts by changing Auth.Signer to return a signature SCVal directly (attached verbatim), and adds helper APIs to build the default Stellar Account signature shape and payload hash.
Changes:
- Breaking API change:
Auth.Signer.sign(HashIDPreimage)now returnsSCVal(andAuth.Signature/ client-side ed25519 verification are removed). - Added
Auth.authorizationPayloadHash(...)andAuth.defaultAccountSignatureScVal(...)helpers; updatedauthorizeInvocation(..., publicKey)parameter naming toaddress. - Centralized lexicographic unsigned byte comparison into
Util.compareBytesUnsigned(...)and updated comparators/sorting logic; added/updated tests and changelog notes.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/test/kotlin/org/stellar/sdk/UtilTest.kt | Adds unit tests for Util.compareBytesUnsigned. |
| src/test/java/org/stellar/sdk/AuthTest.java | Updates signing tests for new Signer contract; adds coverage for custom signature SCVal behavior and helper methods. |
| src/main/java/org/stellar/sdk/Util.java | Adds compareBytesUnsigned(byte[], byte[]) utility. |
| src/main/java/org/stellar/sdk/scval/ScvComparator.java | Switches byte comparisons to Util.compareBytesUnsigned for SCVal/address ordering. |
| src/main/java/org/stellar/sdk/Auth.java | Implements the Signer -> SCVal refactor; adds helper methods; updates delegate sorting to use shared unsigned byte comparator. |
| CHANGELOG.md | Documents the breaking change and migration snippet for Auth.Signer. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #806 +/- ##
============================================
- Coverage 82.92% 82.91% -0.01%
Complexity 1660 1660
============================================
Files 232 232
Lines 6060 6046 -14
Branches 678 677 -1
============================================
- Hits 5025 5013 -12
+ Misses 658 656 -2
Partials 377 377
🚀 New features to boost your workflow:
|
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.
No description provided.