-
Notifications
You must be signed in to change notification settings - Fork 66
Add provisory blockhash lifetime helpers #519
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
base: main
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: 2df5868 The changes in this PR will be included in the next version bump. This PR includes changesets to release 40 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
BundleMonFiles updated (4)
Unchanged files (123)
Total files change +629B +0.18% Final result: ✅ View report in BundleMon website ➡️ |
Documentation Preview: https://kit-docs-me4rb4en8-anza-tech.vercel.app |
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.
Provisory. Such a British word to use. I love it.
So, hang on, instead of introducing the concept of a placeholder lifetime, isn't the right thing to do to relax the requirements of functions that don't really require one?
getComputeUnitEstimateForTransactionMessage
could stop requiring the message to satisfyTransactionMessageWithLifetime
compileTransactionMessage
could add an overload that:- produces
CompiledTransaction
when the input message does not satisfyTransactionMessageWithLifetime
- produces
CompiledTransaction & CompiledTransactionWithLifetime
when the input message satisfiesTransactionMessageWithLifetime
- produces
Rpc::simulateTransaction
could continue not to care, because it just takes inBase58EncodedBytes
compileTransaction
could continue requiring as input the more strictCompilableTransactionMessage & TransactionMessageWithLifetime
because there's still no good use case for marrying a transaction message that has no valid lifetime with a signature.
@steveluscher That is a good point. The only thing is the whole instruction plan machinery relies on the |
Show me a short example; I bet I can make it work. |
Hmm extracting a small example of this API is tricky but essentially
I believe we can change all of these to use a looser |
This PR adds the following items to the
transaction-messages
package:PROVISORY_BLOCKHASH_LIFETIME_CONSTRAINT
constant. It defines an invalid but temporary blockhash lifetime constraint that can be used for a variety of applications such as: simulating a transaction before setting its actual blockhash, calculating the size of the transaction message, etc.setTransactionMessageLifetimeUsingProvisoryBlockhash
function that simply sets the blockhash lifetime constraint using thePROVISORY_BLOCKHASH_LIFETIME_CONSTRAINT
.fillMissingTransactionMessageLifetimeUsingProvisoryBlockhash
function that only sets the provisory blockhash if and only if the provided transaction message does not already have a set lifetime constraint.Note that this is currently used by the Compute Budget client and will be required for Instruction Plans.