Replace SAFETY with CHECK (#11)

This commit is contained in:
Tom Linton 2022-02-21 15:04:02 +13:00 committed by GitHub
parent 73ad095541
commit b992f4828b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -147,7 +147,7 @@ will result in an error similar to the following:
Error: Error:
/anchor/tests/unchecked/programs/unchecked/src/lib.rs:15:8 /anchor/tests/unchecked/programs/unchecked/src/lib.rs:15:8
Struct field "potentially_dangerous" is unsafe, but is not documented. Struct field "potentially_dangerous" is unsafe, but is not documented.
Please add a `/// SAFETY:` doc comment explaining why no checks through types are necessary. Please add a `/// CHECK:` doc comment explaining why no checks through types are necessary.
See https://book.anchor-lang.com/chapter_3/the_accounts_struct.html#safety-checks for more information. See https://book.anchor-lang.com/chapter_3/the_accounts_struct.html#safety-checks for more information.
``` ```
@ -156,7 +156,7 @@ To fix this, write a doc comment describing the potential security implications,
```rust,ignore ```rust,ignore
#[derive(Accounts)] #[derive(Accounts)]
pub struct Initialize<'info> { pub struct Initialize<'info> {
/// SAFETY: This is not dangerous because we don't read or write from this account /// CHECK: This is not dangerous because we don't read or write from this account
pub potentially_dangerous: UncheckedAccount<'info> pub potentially_dangerous: UncheckedAccount<'info>
} }
``` ```