Support any program loader in getProgramAuthority - #106
Merged
Conversation
This fixes non-canonical metadata writes for programs owned by loaders other than v1, v2 or v3 — e.g. native programs such as ComputeBudget — by mirroring the on-chain authority check instead of rejecting unknown loaders. Removes the unused LOADER_V1_PROGRAM_ADDRESS, LOADER_V2_PROGRAM_ADDRESS and LOADER_V4_PROGRAM_ADDRESS exports.
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.
This PR fixes non-canonical metadata writes for programs owned by loaders other than v1, v2 or v3 — e.g. native programs such as
ComputeBudget111...— which currently fail withUnsupported loader program: NativeLoader1111...before the--non-canonicaloption is even considered.The JS client now mirrors the on-chain authority check: loader-v3 programs resolve their upgrade authority via the program data account, while programs with any other owner (loader v1, v2, v4, the native loader, etc.) resolve to the program's own address as authority, matching
is_program_authorityin the on-chain program. Note that canonical metadata for native programs remains impossible by design, since nobody can sign as a native program.The unused
LOADER_V1_PROGRAM_ADDRESS,LOADER_V2_PROGRAM_ADDRESSandLOADER_V4_PROGRAM_ADDRESSexports are removed, which is a breaking change for the next release. New tests cover authority resolution for loader-v3 programs, native programs and non-executable accounts.