Enforce transaction compilation constraints in compileTransactionMessage#1496
Open
mcintyre94 wants to merge 2 commits intomainfrom
Open
Enforce transaction compilation constraints in compileTransactionMessage#1496mcintyre94 wants to merge 2 commits intomainfrom
mcintyre94 wants to merge 2 commits intomainfrom
Conversation
🦋 Changeset detectedLatest commit: aff3413 The changes in this PR will be included in the next version bump. This PR includes changesets to release 46 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 (10)
Unchanged files (132)
Total files change +1.89KB +0.39% Final result: ✅ View report in BundleMon website ➡️ |
Contributor
|
Documentation Preview: https://kit-docs-rc3eprbbm-anza-tech.vercel.app |
Adds validation to \`compileTransactionMessage\` (for all three versions — legacy, v0, v1) that throws a \`SolanaError\` when any of Solana's protocol limits are exceeded: more than 12 unique signer addresses, more than 64 unique account addresses, more than 64 instructions, or more than 255 account references in a single instruction. Four new error codes (\`TOO_MANY_SIGNER_ADDRESSES\`, \`TOO_MANY_ACCOUNT_ADDRESSES\`, \`TOO_MANY_INSTRUCTIONS\`, \`TOO_MANY_ACCOUNTS_IN_INSTRUCTION\`) are added to \`@solana/errors\` with corresponding context types and human-readable messages. Each version's test file is updated with boundary tests covering all four constraints.
1203b50 to
aff3413
Compare
Member
Author
This stack of pull requests is managed by Graphite. Learn more about stacking. |
This was referenced Mar 26, 2026
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.

Summary
compileTransactionMessage(legacy, v0, and v1) that enforce Solana protocol limits before a transaction reaches the network. Each violation throws a typedSolanaErrorwith structured context (actual count, max allowed, and for per-instruction violations, the instruction index).@solana/errors:SOLANA_ERROR__TRANSACTION__TOO_MANY_ACCOUNT_ADDRESSES(max 64),SOLANA_ERROR__TRANSACTION__TOO_MANY_SIGNER_ADDRESSES(max 12),SOLANA_ERROR__TRANSACTION__TOO_MANY_INSTRUCTIONS(max 64), andSOLANA_ERROR__TRANSACTION__TOO_MANY_ACCOUNTS_IN_INSTRUCTION(max 255).These limits are specified in the SIMD-0385 Transaction v1 spec and apply to legacy and v0 transactions as well. They're relevant for all transaction versions, but will be easier to hit without hitting the size limits after we allow 4kb v1 transactions.
A follow-up PR will update the transaction planner to handle these new errors in the same way that it handles transactions that exceed the size limit.
Part of #1223