Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR makes TransactionBuilder::raw_json process Sui programmable transaction inputs in the order defined by each input’s index field (rather than JSON array order), and adds a regression test to verify the behavior.
Changes:
- Sort raw JSON
inputsby their declaredindexbefore converting them intoCallArgs. - Add a unit test asserting that out-of-order JSON inputs are reordered into index order.
- Add supporting imports in the test for inspecting the produced
TransactionData.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| rust/chains/tw_sui/src/transaction/transaction_builder.rs | Sorts raw inputs by index prior to building the programmable transaction inputs vector. |
| rust/chains/tw_sui/tests/aftermath_json_support.rs | Adds a test that confirms raw_json orders inputs by declared index. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Binary size comparison➡️ aarch64-apple-ios: 14.34 MB ➡️ aarch64-apple-ios-sim: 14.35 MB ➡️ aarch64-linux-android: 18.78 MB ➡️ armv7-linux-androideabi: 16.21 MB ➡️ wasm32-unknown-emscripten: 13.69 MB |
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.
This pull request ensures that transaction inputs are processed in the order specified by their
indexfield, regardless of their order in the raw JSON, and adds a new test to verify this behavior.Transaction input ordering:
TransactionBuilder::raw_jsonto explicitly sort transaction inputs by theirindexfield before processing, ensuring consistent input order.Testing improvements:
test_raw_json_sorts_inputs_by_declared_indexinaftermath_json_support.rsto verify that inputs are sorted and processed according to their declared index, not their order in the JSON array.CallArg,TransactionData, andTransactionKindto support the new test.