Skip to content
This repository has been archived by the owner on Jan 10, 2025. It is now read-only.

Fix #7549 #7627

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open

Conversation

Danver97
Copy link

@Danver97 Danver97 commented Jan 5, 2025

As explained in #7549, InitializeMint and InitializeMint2 without FreezeAuthority break decodeInitializeMintInstruction and decodeInitializeMint2Instruction respectively.

Since buffer layouts apparently don't support optional fields, this is currently a workaround. Indeed, this solution won't scale well when more than one optional field is present as it would require implementing the same logic for each combination of presence of each optional field.

The actual solution would require supporting optional Layouts in buffer-layouts, adapt the Structure layout to account for it and easily provide a list of spans, then re-implement COptionPublicKeyLayout with it and check in decodeInitializeMintInstruction and decodeInitializeMint2Instruction if the length of the buffer is in one of the values of spans provided by Structure.

Overall, I'd recommend not allowing optional fields, but rather have then set to a null value like 0 or -1.

@mergify mergify bot added the community Community contribution label Jan 5, 2025
@Danver97
Copy link
Author

Danver97 commented Jan 6, 2025

@joncinque Can you please review this PR?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
community Community contribution
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant