fix: minor typos in the docs (#94)
This commit is contained in:
parent
4d4d9859a2
commit
8796a052ad
|
@ -109,7 +109,7 @@ However, a user mistakenly passes Account B as an argument to the `foo` instruct
|
|||
|
||||
This is where the discriminator comes into play. It uniquely identifies the type of an account. Even though Account A and Account B are structurally identical and share the same owner, they have different discriminators.
|
||||
|
||||
When the `foo` instruction gets executed, the Anchor framework checks the discriminator of the account passed as argument. If you have declared `foo` as `foo: Account<'info, A>`, Anchor will make sure that the passed account's discriminator matches that of Account A. If the discriminators don't match (as would be the case if Account B was passed), Anchor raises an error, preventing any unintended effects on Account B.
|
||||
When the `foo` instruction gets executed, the Anchor framework checks the discriminator of the account passed as an argument. If you have declared `foo` as `foo: Account<'info, A>`, Anchor will make sure that the passed account's discriminator matches that of Account A. If the discriminators don't match (as would be the case if Account B was passed), Anchor raises an error, preventing any unintended effects on Account B.
|
||||
|
||||
The discriminator helps Anchor to ensure that the account being processed is indeed the one expected, preventing type-related errors at runtime. This mechanism is automatically handled when you use the `Account` type in Anchor, adding an extra layer of security to your program.
|
||||
|
||||
|
|
|
@ -4,4 +4,4 @@ This section explains how you can use Anchor to build Solana programs. Each sect
|
|||
anchor init hello-anchor
|
||||
```
|
||||
|
||||
This sections begins with the essentials and then explains more intermediate content afterwards.
|
||||
This section begins with the essentials and then explains more intermediate content afterwards.
|
||||
|
|
|
@ -133,7 +133,7 @@ You can find information about all constraints in the reference. We will cover s
|
|||
|
||||
## Safety checks
|
||||
|
||||
Two of the Anchor account types, [AccountInfo](https://docs.rs/anchor-lang/latest/anchor_lang/accounts/account_info/index.html) and [UncheckedAccount](https://docs.rs/anchor-lang/latest/anchor_lang/accounts/unchecked_account/index.html) do not implement any checks on the account being passed. Anchor implements safety checks that encourage additional documentation describing why additional checks are not necesssary.
|
||||
Two of the Anchor account types, [AccountInfo](https://docs.rs/anchor-lang/latest/anchor_lang/accounts/account_info/index.html) and [UncheckedAccount](https://docs.rs/anchor-lang/latest/anchor_lang/accounts/unchecked_account/index.html) do not implement any checks on the account being passed. Anchor implements safety checks that encourage additional documentation describing why additional checks are not necessary.
|
||||
|
||||
Attempting to build a program containing the following excerpt with `anchor build`:
|
||||
|
||||
|
@ -164,4 +164,4 @@ pub struct Initialize<'info> {
|
|||
}
|
||||
```
|
||||
|
||||
Note the doc comment needs to be a [line or block doc comment](https://doc.rust-lang.org/reference/comments.html#doc-comments) (/// or /\*\*) to be interepreted as doc attribute by Rust. Double slash comments (//) are not interpreted as such.
|
||||
Note the doc comment needs to be a [line or block doc comment](https://doc.rust-lang.org/reference/comments.html#doc-comments) (/// or /\*\*) to be interpreted as doc attribute by Rust. Double slash comments (//) are not interpreted as such.
|
||||
|
|
Loading…
Reference in New Issue