Skip to content

CLI: Add the next nonce value to the output of sign - #69

Open
mcintyre94 wants to merge 1 commit into
mainfrom
sign-output-next-nonce
Open

mcintyre94 wants to merge 1 commit into
mainfrom
sign-output-next-nonce

Conversation

@mcintyre94

Copy link
Copy Markdown
Member

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.

`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`.
@mcintyre94 mcintyre94 mentioned this pull request Sep 30, 2026
56 of 98 tasks

@joncinque joncinque left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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 {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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

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.

2 participants