-
Notifications
You must be signed in to change notification settings - Fork 69
Add transaction size helpers #425
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
Conversation
🦋 Changeset detectedLatest commit: 867e852 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 |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
BundleMonFiles updated (7)
Unchanged files (120)
Total files change +1.07KB +0.31% Final result: ✅ View report in BundleMon website ➡️ |
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.
Nice, LGTM!
0825090
to
f33ef5d
Compare
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.
For instance: adding an instruction to or changing the lifetime of a transaction message should remove the
TransactionMessageUnderSizeLimit
type
I think this is only true when you're going from not-nonce to nonce. Otherwise the size of the transaction should stay the same or decrease.
Lifetime before | Lifetime after | Should remove TransactionMessageUnderSizeLimit |
---|---|---|
None | Blockhash | ❌ |
None | Nonce | ✅ |
Blockhash | Nonce | ✅ |
Blockhash | Blockhash | ❌ |
Blockhash | None | ❌ |
Nonce | Nonce | ❌ |
Nonce | Blockhash | ❌ |
Nonce | None | ❌ |
f33ef5d
to
18f576a
Compare
@steveluscher I'm a little confused by your table. Could the second half of it be a bad copy/paste? |
18f576a
to
243b7f6
Compare
I don't think so! Essentially all blockhash-based transactions will be the same size, even one that has ‘no’ blockhash, because all that changes is the choice of 32 lifetime specifier bytes in the message, but never the number of bytes. If a nonce transaction used to have an acceptable size, it will always have an acceptable size if it changes to a blockhash-based one, because the only thing that could have happened is that the If a nonce transaction used to have an acceptable size, it will still have an acceptable size given a new choice of nonce; while the choice of lifetime specifier and |
Oh so sorry, my brain could categorically not see the difference between "Nonce" and "None" on that table. Makes a lot more sense now. I'll definitely keep that in mind when I add this logic in subsequent PRs. |
243b7f6
to
89bf30d
Compare
5aeb05a
to
af2e039
Compare
af2e039
to
437f9f8
Compare
437f9f8
to
e9d78a5
Compare
Documentation Preview: https://kit-docs-1lgwzynj4-anza-tech.vercel.app |
e9d78a5
to
dbbc080
Compare
6982c44
to
c8b5fda
Compare
87bbf91
to
4e54279
Compare
c8b5fda
to
82ecc10
Compare
4e54279
to
a864afe
Compare
82ecc10
to
e659cfc
Compare
a864afe
to
630dd47
Compare
630dd47
to
f3093e0
Compare
e659cfc
to
3049e01
Compare
f3093e0
to
56aa6ee
Compare
56aa6ee
to
867e852
Compare
Merge activity
|
Because there has been no activity on this PR for 14 days since it was merged, it has been automatically locked. Please open a new issue if it requires a follow up. |
This PR adds various types and functions to help get the size of a transaction (or its message) and ensure its size is valid (under the transaction size limit).
Additionally, it provides two new types —
TransactionUnderSizeLimit
andTransactionMessageUnderSizeLimit
— to provide additional type safety before sending a transaction.In this PR,
TransactionUnderSizeLimit
andTransactionMessageUnderSizeLimit
are only used by their respective type guards but this stack of PR aims to use these types to offer more type safety in other parts of the code. For instance: adding an instruction to or changing the lifetime of a transaction message should remove theTransactionMessageUnderSizeLimit
type if any; sending a transaction should require theTransactionUnderSizeLimit
; compiling aTransactionMessageUnderSizeLimit
into a transaction should return aTransactionUnderSizeLimit
; etc.The next few PRs don't do any of that just yet but prepare the field for such changes. Mainly, it aims to bring more consistency amongst the type flags of transactions and transaction messages so adding yet another one does not affect the developer experience.