CLI: Add the next nonce value to the output of sign - #69
Open
mcintyre94 wants to merge 1 commit into
Open
mcintyre94 wants to merge 1 commit into
mcintyre94 wants to merge 1 commit into
Conversation
`transaction sign` is already offline, so we don't validate the input `--nonce-hash` value is the current value, which would require fetching the nonce account. This means that it can be used to chain a sequence of transactions, by setting `--nonce-hash` to the next nonce value. This next nonce value can be computed offline, based on the execution message. `transaction sign` now computes this next nonce value, ie the value of the nonce after the message being authorized is executed. This is returned as part of the output of sign. A transaction that should be sequenced after can then use that as its `--nonce-hash`.
56 of 98 tasks
joncinque
approved these changes
Oct 2, 2026
joncinque
left a comment
There was a problem hiding this comment.
Just a couple of tiny things, take it or leave it. Looks great!
Comment on lines
+198
to
+199
| /// Nonce value after this message executes. Pass it as `--nonce-hash` to sign a message that | ||
| /// can only execute after this one. |
There was a problem hiding this comment.
nit: not sure if we need this comment since it's pretty well explained in SignCommand
| } | ||
|
|
||
| /// Submit a `transaction sign` entry whose only signer is its PDA authority. | ||
| fn submit_signed(env: &TestEnv, entry: &serde_json::Value) -> Output { |
There was a problem hiding this comment.
nit: let's pull out all the fields to make this a bit more reusable, so that it takes the address, signature, and authorization message as strings
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.
transaction signis already offline, so we don't validate the input--nonce-hashvalue is the current value, which would require fetching the nonce account.This means that it can be used to chain a sequence of transactions, by setting
--nonce-hashto the next nonce value. This next nonce value can be computed offline, based on the execution message.transaction signnow computes this next nonce value, ie the value of the nonce after the message being authorized is executed. This is returned as part of the output of sign. A transaction that should be sequenced after can then use that as its--nonce-hash.