Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: deprecate AccountInfo, have people explicitly use UncheckedAccount #2794

Open
mikemaccana opened this issue Jan 28, 2024 · 2 comments
Labels
enhancement New feature or request lang

Comments

@mikemaccana
Copy link
Contributor

mikemaccana commented Jan 28, 2024

Per the anchor docs:

AccountInfo can be used as a type but Unchecked Account should be used instead.

If my understanding is correct,

  • UncheckedAccount is unsafe, and is named appropriately for something that does not perform checks.

  • AccountInfo is unsafe, and has a name that doesn't indicate it should be avoided unless you know what you're doing (I'm aware the name comes from Solana itself not Anchor)

Ideally Anchor should have one name that's explicit for unchecked accounts. AccountInfo should throw up a warning or just be removed in the next breaking release.

This would also mean we don't have to bother explaining this to everyone learning Anchor (as some background, I'm currently reorienting the Solana Development Course to focus on Anchor as the preferred mechanism for Rust).

Thanks for listening! 😊

@acheroncrypto acheroncrypto added enhancement New feature or request lang labels Jan 28, 2024
@acheroncrypto
Copy link
Collaborator

Yes, your understanding is correct. Also, using UncheckedAccount is more performant than using AccountInfo. This is a reasonable request and in fact, I was already considering deprecating AccountInfo before the next release.

@mikemaccana
Copy link
Contributor Author

Thanks Acheron!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request lang
Projects
None yet
Development

No branches or pull requests

2 participants