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.
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
Add
Message::is_maybe_writable
#35340Add
Message::is_maybe_writable
#35340Changes from 1 commit
f0cf45e
4ea93f0
36f958c
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Thinking about this one more, I wonder if we can come up with a more descriptive fn name; the returned ix definitely does use durable nonce but the nonce account may not be writable.
Also, I quibble with "uses" in the first place, since this is a method that returns the instruction, not a bool.
Super wordy, but what about
try_get_durable_nonce_instruction
? Sort of ignores the "maybe writable" partThere 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.
Yeah it definitely looks like it's using a durable nonce but in the context of the Solana runtime, a tx is only considered to be using a durable nonce if it's a "valid" durable nonce which requires the nonce account to be writable. Maybe a name with "valid" in it would be more clear?
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.
Yeah, fair. I'm open to adding "valid" somehow
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.
Actually I think I was focusing too much on the validity... a nonce is also only valid if the transaction's recent blockhash is correct. This method should probably not be doing the writable check at all.
I'm inclined to go with your suggestion of
try_get_durable_nonce_instruction
but I will add it as an alias and deprecate the original function because I really shouldn't have introduced that breaking change in the first place.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.
Ok actually I think I'm going to just leave everything as is but take out the is-writable check from this function
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.
Same comment here about the fact that it definitely uses durable nonce, just is maybe writable. I haven't thought of a better option for this one, though.