-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Compile time warning whenever AccountInfo or UncheckedAccount is used #1387
Comments
Might even be worth making this an error. |
What's the best practice for account passed for CPI to non anchor program?
|
|
If not ie, is this bad? #[account(
init,
payer=user,
token::mint = mint,
token::authority = escrow_authority,
)]
pub escrow: Account<'info, TokenAccount>,
#[account(
seeds=[b"authority", escrow.key().as_ref()],
bump=escrow_authority_bump,
)]
pub escrow_authority: AccountInfo<'info>, |
You can use |
I might be confused here. What's the difference between an |
|
Ah, then can I make a request that For example, if SPL Token's But also, I dunno anything and I might be thinking about this wrong. |
I can take this one.
I think we just want people to pause and think about what they are doing, and hopefully enumerate the possible security issues if there is no restrictions on the account. It'll be easy to get around with the comment. |
We should emit warnings from
anchor build
whenever these types are used. To suppress the warnings, a special comment can be added. For example,SAFETY:
orCHECK:
, as is commonly done with unsafe code in rust.The text was updated successfully, but these errors were encountered: