Handle transaction constraint errors in the transaction planner#1497
Handle transaction constraint errors in the transaction planner#1497mcintyre94 wants to merge 1 commit intographite-base/1497from
Conversation
When adding an instruction to an existing candidate transaction would violate one of the four new Solana protocol constraints (`TOO_MANY_ACCOUNT_ADDRESSES`, `TOO_MANY_SIGNER_ADDRESSES`, `TOO_MANY_INSTRUCTIONS`, `TOO_MANY_ACCOUNTS_IN_INSTRUCTION`), the planner now splits the instruction into a new transaction — the same behaviour it already had for the byte-size limit. Errors thrown when even a fresh message cannot accommodate the instruction propagate to the caller unchanged.
🦋 Changeset detectedLatest commit: d99a39c 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 |
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
BundleMonFiles updated (13)
Unchanged files (129)
Total files change +2.2KB +0.46% Final result: ✅ View report in BundleMon website ➡️ |
|
Documentation Preview: https://kit-docs-7qtjasvqh-anza-tech.vercel.app |
lorisleiva
left a comment
There was a problem hiding this comment.
Thanks! Instead of mocking, how would you feel about creating four real scenarios where we add too many things and expect them to produce a new transaction even though there would have been enough space in a transaction message?
For the propagates %s from compileTransactionMessage when even a fresh message cannot accommodate the plan error, we could throw this in the createTransactionMessage callback and achieve the same result.

Problem
The new errors thrown in
compileTransactionMessagein the previous PR are not handled by the transaction planner. This means that if we can't add an instruction to the transaction message being packed because it violates one of these constraints, we will throw.Summary of Changes
We now catch each of the new errors in addition to
SOLANA_ERROR__INSTRUCTION_PLANS__MESSAGE_CANNOT_ACCOMMODATE_PLANinselectAndMutateCandidate. The result of this is that we will attempt to pack the instruction into the next message (and then a new one), in the same way that we do when it is too large in bytes.Closes #1223