-
Notifications
You must be signed in to change notification settings - Fork 3
feat(sdk): Add CommandArgumentError::InvalidArgumentArity
#177
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
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
Thoralf-M
approved these changes
Sep 3, 2025
Dkwcs
approved these changes
Sep 3, 2025
Dkwcs
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
thibault-martinez
approved these changes
Sep 3, 2025
Dkwcs
added a commit
to iotaledger/iota
that referenced
this pull request
Sep 5, 2025
…atting results (#8424) # Description of change The adapter now pre-normalizes PTB arguments that reference outputs from earlier commands (“results”), including nested results, and fails early on out-of-bounds indexes before typing executes. This is the first step toward “xargs-style” PTB programming and potential future “splat” ergonomics Users get deterministic “index out of bounds” errors when they reference non-existent inputs/results, rather than cryptic typing-phase or execution-phase failures. (See Sui’s new tests where Input(1), Result(1), or NestedResult(2,0) trip clean IndexOutOfBounds before typing. ### Behaviour Before and After **Invalid `Input(i)` and `Result(k)` are caught early** **Before (symptomatic)** An invalid index could travel into typing/execution and surface as less clear errors (e.g., invalid usage/object by value). **After** ``` Error: Transaction Effects Status: Invalid command argument at 1. Out of bounds access to input or result vector 100 Execution Error: ... CommandArgumentError { arg_idx: 1, kind: IndexOutOfBounds { idx: 100 } } ... ``` **Nested results `(NestedResult(k, j))` get validated** If a prior command returns a tuple, you can reference an element with NestedResult(k, j). The adapter now checks both k and j early. Example from tests: ``` //# programmable //> test::m::a(); // cmd 0, returns A //> test::m::a2(); // cmd 1, returns (A, A) //> test::m::take_b(Result(0), NestedResult(2, 0)) // '2' is out of range ``` This fails before typing with: ``` Invalid command argument at 1. Out of bounds access to input or result vector 2 ... IndexOutOfBounds { idx: 2 } ... ``` because there are only prior results at indices 0 and 1. According to [changes](MystenLabs/sui@03806d3). We also had to update [iota-rust-sdk](iotaledger/iota-rust-sdk#177). ## Links to any relevant issues Fixes #8271 . ## How the change has been tested iota-adapter-transactional-tests: `cargo nextest run`
miker83z
pushed a commit
to iotaledger/iota
that referenced
this pull request
Sep 8, 2025
…atting results (#8424) The adapter now pre-normalizes PTB arguments that reference outputs from earlier commands (“results”), including nested results, and fails early on out-of-bounds indexes before typing executes. This is the first step toward “xargs-style” PTB programming and potential future “splat” ergonomics Users get deterministic “index out of bounds” errors when they reference non-existent inputs/results, rather than cryptic typing-phase or execution-phase failures. (See Sui’s new tests where Input(1), Result(1), or NestedResult(2,0) trip clean IndexOutOfBounds before typing. **Invalid `Input(i)` and `Result(k)` are caught early** **Before (symptomatic)** An invalid index could travel into typing/execution and surface as less clear errors (e.g., invalid usage/object by value). **After** ``` Error: Transaction Effects Status: Invalid command argument at 1. Out of bounds access to input or result vector 100 Execution Error: ... CommandArgumentError { arg_idx: 1, kind: IndexOutOfBounds { idx: 100 } } ... ``` **Nested results `(NestedResult(k, j))` get validated** If a prior command returns a tuple, you can reference an element with NestedResult(k, j). The adapter now checks both k and j early. Example from tests: ``` //# programmable //> test::m::a(); // cmd 0, returns A //> test::m::a2(); // cmd 1, returns (A, A) //> test::m::take_b(Result(0), NestedResult(2, 0)) // '2' is out of range ``` This fails before typing with: ``` Invalid command argument at 1. Out of bounds access to input or result vector 2 ... IndexOutOfBounds { idx: 2 } ... ``` because there are only prior results at indices 0 and 1. According to [changes](MystenLabs/sui@03806d3). We also had to update [iota-rust-sdk](iotaledger/iota-rust-sdk#177). Fixes #8271 . iota-adapter-transactional-tests: `cargo nextest run`
miker83z
pushed a commit
to iotaledger/iota
that referenced
this pull request
Sep 8, 2025
…atting results (#8424) The adapter now pre-normalizes PTB arguments that reference outputs from earlier commands (“results”), including nested results, and fails early on out-of-bounds indexes before typing executes. This is the first step toward “xargs-style” PTB programming and potential future “splat” ergonomics Users get deterministic “index out of bounds” errors when they reference non-existent inputs/results, rather than cryptic typing-phase or execution-phase failures. (See Sui’s new tests where Input(1), Result(1), or NestedResult(2,0) trip clean IndexOutOfBounds before typing. **Invalid `Input(i)` and `Result(k)` are caught early** **Before (symptomatic)** An invalid index could travel into typing/execution and surface as less clear errors (e.g., invalid usage/object by value). **After** ``` Error: Transaction Effects Status: Invalid command argument at 1. Out of bounds access to input or result vector 100 Execution Error: ... CommandArgumentError { arg_idx: 1, kind: IndexOutOfBounds { idx: 100 } } ... ``` **Nested results `(NestedResult(k, j))` get validated** If a prior command returns a tuple, you can reference an element with NestedResult(k, j). The adapter now checks both k and j early. Example from tests: ``` //# programmable //> test::m::a(); // cmd 0, returns A //> test::m::a2(); // cmd 1, returns (A, A) //> test::m::take_b(Result(0), NestedResult(2, 0)) // '2' is out of range ``` This fails before typing with: ``` Invalid command argument at 1. Out of bounds access to input or result vector 2 ... IndexOutOfBounds { idx: 2 } ... ``` because there are only prior results at indices 0 and 1. According to [changes](MystenLabs/sui@03806d3). We also had to update [iota-rust-sdk](iotaledger/iota-rust-sdk#177). Fixes #8271 . iota-adapter-transactional-tests: `cargo nextest run`
miker83z
pushed a commit
to iotaledger/iota
that referenced
this pull request
Sep 8, 2025
…atting results (#8424) The adapter now pre-normalizes PTB arguments that reference outputs from earlier commands (“results”), including nested results, and fails early on out-of-bounds indexes before typing executes. This is the first step toward “xargs-style” PTB programming and potential future “splat” ergonomics Users get deterministic “index out of bounds” errors when they reference non-existent inputs/results, rather than cryptic typing-phase or execution-phase failures. (See Sui’s new tests where Input(1), Result(1), or NestedResult(2,0) trip clean IndexOutOfBounds before typing. **Invalid `Input(i)` and `Result(k)` are caught early** **Before (symptomatic)** An invalid index could travel into typing/execution and surface as less clear errors (e.g., invalid usage/object by value). **After** ``` Error: Transaction Effects Status: Invalid command argument at 1. Out of bounds access to input or result vector 100 Execution Error: ... CommandArgumentError { arg_idx: 1, kind: IndexOutOfBounds { idx: 100 } } ... ``` **Nested results `(NestedResult(k, j))` get validated** If a prior command returns a tuple, you can reference an element with NestedResult(k, j). The adapter now checks both k and j early. Example from tests: ``` //# programmable //> test::m::a(); // cmd 0, returns A //> test::m::a2(); // cmd 1, returns (A, A) //> test::m::take_b(Result(0), NestedResult(2, 0)) // '2' is out of range ``` This fails before typing with: ``` Invalid command argument at 1. Out of bounds access to input or result vector 2 ... IndexOutOfBounds { idx: 2 } ... ``` because there are only prior results at indices 0 and 1. According to [changes](MystenLabs/sui@03806d3). We also had to update [iota-rust-sdk](iotaledger/iota-rust-sdk#177). Fixes #8271 . iota-adapter-transactional-tests: `cargo nextest run`
miker83z
pushed a commit
to iotaledger/iota
that referenced
this pull request
Sep 8, 2025
…atting results (#8424) The adapter now pre-normalizes PTB arguments that reference outputs from earlier commands (“results”), including nested results, and fails early on out-of-bounds indexes before typing executes. This is the first step toward “xargs-style” PTB programming and potential future “splat” ergonomics Users get deterministic “index out of bounds” errors when they reference non-existent inputs/results, rather than cryptic typing-phase or execution-phase failures. (See Sui’s new tests where Input(1), Result(1), or NestedResult(2,0) trip clean IndexOutOfBounds before typing. **Invalid `Input(i)` and `Result(k)` are caught early** **Before (symptomatic)** An invalid index could travel into typing/execution and surface as less clear errors (e.g., invalid usage/object by value). **After** ``` Error: Transaction Effects Status: Invalid command argument at 1. Out of bounds access to input or result vector 100 Execution Error: ... CommandArgumentError { arg_idx: 1, kind: IndexOutOfBounds { idx: 100 } } ... ``` **Nested results `(NestedResult(k, j))` get validated** If a prior command returns a tuple, you can reference an element with NestedResult(k, j). The adapter now checks both k and j early. Example from tests: ``` //# programmable //> test::m::a(); // cmd 0, returns A //> test::m::a2(); // cmd 1, returns (A, A) //> test::m::take_b(Result(0), NestedResult(2, 0)) // '2' is out of range ``` This fails before typing with: ``` Invalid command argument at 1. Out of bounds access to input or result vector 2 ... IndexOutOfBounds { idx: 2 } ... ``` because there are only prior results at indices 0 and 1. According to [changes](MystenLabs/sui@03806d3). We also had to update [iota-rust-sdk](iotaledger/iota-rust-sdk#177). Fixes #8271 . iota-adapter-transactional-tests: `cargo nextest run`
miker83z
pushed a commit
to iotaledger/iota
that referenced
this pull request
Sep 10, 2025
…atting results (#8424) The adapter now pre-normalizes PTB arguments that reference outputs from earlier commands (“results”), including nested results, and fails early on out-of-bounds indexes before typing executes. This is the first step toward “xargs-style” PTB programming and potential future “splat” ergonomics Users get deterministic “index out of bounds” errors when they reference non-existent inputs/results, rather than cryptic typing-phase or execution-phase failures. (See Sui’s new tests where Input(1), Result(1), or NestedResult(2,0) trip clean IndexOutOfBounds before typing. **Invalid `Input(i)` and `Result(k)` are caught early** **Before (symptomatic)** An invalid index could travel into typing/execution and surface as less clear errors (e.g., invalid usage/object by value). **After** ``` Error: Transaction Effects Status: Invalid command argument at 1. Out of bounds access to input or result vector 100 Execution Error: ... CommandArgumentError { arg_idx: 1, kind: IndexOutOfBounds { idx: 100 } } ... ``` **Nested results `(NestedResult(k, j))` get validated** If a prior command returns a tuple, you can reference an element with NestedResult(k, j). The adapter now checks both k and j early. Example from tests: ``` //# programmable //> test::m::a(); // cmd 0, returns A //> test::m::a2(); // cmd 1, returns (A, A) //> test::m::take_b(Result(0), NestedResult(2, 0)) // '2' is out of range ``` This fails before typing with: ``` Invalid command argument at 1. Out of bounds access to input or result vector 2 ... IndexOutOfBounds { idx: 2 } ... ``` because there are only prior results at indices 0 and 1. According to [changes](MystenLabs/sui@03806d3). We also had to update [iota-rust-sdk](iotaledger/iota-rust-sdk#177). Fixes #8271 . iota-adapter-transactional-tests: `cargo nextest run`
Merged
This was referenced Nov 5, 2025
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.
Description
Adds the
CommandArgumentError::InvalidArgumentArityvariant.Closes iotaledger/iota#8421