Add SetAccounts implementation to be able to access accounts for Create instruction after decoding#337
Merged
Merged
Conversation
…te instruction after decoding
…ar); fix tree count; lowercase error strings
gitteri
reviewed
Sep 26, 2025
Comment on lines
+353
to
+354
| buf = append(buf, byte(len(mx.AddressTableLookups))) | ||
| for _, lookup := range mx.AddressTableLookups { |
Comment on lines
-49
to
-51
| // | ||
| // [6] = [] SysVarRent | ||
| // ··········· SysVarRentPubkey |
Contributor
Author
There was a problem hiding this comment.
Yeah it wasn't clear to me either 😅
| func (inst *Create) Validate() error { | ||
| if inst.Payer.IsZero() { | ||
| return errors.New("Payer not set") | ||
| return errors.New("payer not set") |
| for _, sig := range tx.Signatures { | ||
| output = append(output, sig[:]...) | ||
| signatures := tx.Signatures | ||
| for i := len(signatures); i < int(tx.Message.Header.NumRequiredSignatures); i++ { |
There was a problem hiding this comment.
nit: If len(tx.Signatures) > tx.Message.Header.NumRequiredSignatures, you’ll serialize too many signatures below in the binaryTx. The wire format is expected to match the header exactly. You can return an error early to let the user know:
if len(signatures) > tx.Message.Header.NumRequiredSignatures {
return nil, fmt.Errorf("invalid signature length for NumRequiredSignatures header value")
}
jacobcreech
approved these changes
Sep 27, 2025
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.
Adding some logic to be able to retrieve the accounts from the ATA instruction after decoding.
I also removed the
SysVarRentPubkeyin the account list for Create. According to the Rust implementation, Create only expects 6 accounts, not 7.source.
This PR also includes changes from #308