SDK: update error variants in `Feature::from_account_info` by buffalojoec · Pull Request #33750 · solana-labs/solana · GitHub
More Web Proxy on the site http://driver.im/
You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 22, 2025. It is now read-only.
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
Feature::from_account_info(..) checks that the owner field matches Feature111111111111111111111111111111111111 but it throws ProgramError::InvalidArgument.
It also throws ProgramError::InvalidArgument on deserialization failure.
Merging #33750 (32d5322) into master (fbded92) will decrease coverage by 0.1%.
Report is 1147 commits behind head on master.
The diff coverage is 88.5%.
Another way we could address this is by duplicating/moving the struct Feature definition into spl-feature-gate. But maybe it's better to leave it so that updating the interface is painful.
it's not clear to me why this method returns a ProgramError at all. doesn't seem to be used in runtime so making this change w/o a feature gate shouldn't break consensus. *::IncorrectProgramId is very much my least favorite of this legacy error codes. it misleads basically 100% of devs/users upon first encounter
IllegalOwner should really be IllegalWithSeedOwner. that error was added to return when system_instruction::Instruction::CreateWithSeed addresses would collide with PDAs. there's an InstructionError::InvalidAccountOwner that's most appropriate and has been used for failed ownership checks elsewhere. there's no ProgramError analog today, but maybe that's the problem. afaik ProgramError is a somewhat dubious clone of InstructionError. not having InvalidAccountOwner represented there means the TryFrom<InstructionError> impl returns Err, which is probably a bug. probably add that in a separate pr, then use it here
there's an InstructionError::InvalidAccountOwner that's most appropriate and has been used for failed ownership checks elsewhere. there's no ProgramError analog today, but maybe that's the problem. afaik ProgramError is a somewhat dubious clone of InstructionError. not having InvalidAccountOwner represented there means the TryFrom<InstructionError> impl returns Err, which is probably a bug. probably add that in a separate pr, then use it here
…ckport of #33750) (#33780)
SDK: update error variants in `Feature::from_account_info` (#33750)
(cherry picked from commit 6b1e9b8)
Co-authored-by: Joe C <joe.caulfield@solana.com>
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.
Problem
Feature::from_account_info(..)
checks that theowner
field matchesFeature111111111111111111111111111111111111
but it throwsProgramError::InvalidArgument
.It also throws
ProgramError::InvalidArgument
on deserialization failure.Summary of Changes
Update these errors to be more clear.