Skip to content

Commit

Permalink
Assorted fixes (#666)
Browse files Browse the repository at this point in the history
* fix: typos

* refactor: link and wording

* refactor: assorted
  • Loading branch information
nickfrosty authored Dec 13, 2024
1 parent 2bd171d commit 8ee6e06
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Solana, but the pattern is familiar:
- You can also consider PDAs as records in a database, with the address being
the primary key used to look up the values inside.

PDAs combine a program addresss and some developer-chosen seeds to create
PDAs combine a program address and some developer-chosen seeds to create
addresses that store individual pieces of data. Since PDAs are addresses that
lie _off_ the Ed25519 Elliptic curve, PDAs don't have secret keys. Instead, PDAs
can be signed for by the program address used to create them.
Expand Down
16 changes: 8 additions & 8 deletions content/courses/onchain-development/intro-to-onchain.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ synchronized system:
- **devnet**: For application development
- **localnet**: For local testing

The program that run on Solana - the ones that create tokens, swap tokens, art
The programs that run on Solana - the ones that create tokens, swap tokens, art
marketplaces, escrows, market makers, DePIN apps, auctions, retail payments
platforms, etc - are called **Solana apps**.

Expand Down Expand Up @@ -131,17 +131,17 @@ to store any form of data as required by the program.
is a `PublicKey`, PDA addresses are not public keys and do not have a
matching private key.
- A program's PDAs are unique so, they won't conflict with other programs.
- PDAs can also act as signer in an instruction. We'll learn more about this
- PDAs can also act as signers in an instruction. We'll learn more about this
in further lessons.

#### Examples of PDA Usage

| Purpose | Seeds | Resulting PDA |
| ----------------- | -------------------------- | ---------------------------- |
| Exchange Rate | `"USD"`, `"AUD"` | Stores USD to AUD rate |
| User Relationship | User1 wallet, User2 wallet | Stores relationship data |
| Product Review | User wallet, Product ID | Stores user's review |
| Global Config | `"config"` | Stores program-wide settings |
| Use Case | Seeds | PDA (Key) | Value (Data Stored) |
| ----------------- | ------------------------------ | --------------- | ------------------------------------------ |
| Exchange Rate | `["USD", "AUD"]` | Derived address | Current USD to AUD exchange rate |
| User Relationship | `[user1_wallet, user2_wallet]` | Derived address | Relationship data (e.g., friends, blocked) |
| Movie Review | `[reviewer_wallet, "titanic"]` | Derived address | Review text, rating, timestamp |
| Global Config | `["config"]` | Derived address | Program-wide settings |

#### Benefits

Expand Down
6 changes: 4 additions & 2 deletions content/courses/program-security/account-data-matching.md
Original file line number Diff line number Diff line change
Expand Up @@ -224,11 +224,13 @@ The `insecure_withdraw` instruction handler transfers all the tokens in the

<Callout>

Notice that this instruction handler \***\*does\*\*** have a signer check for
Notice that this instruction handler **does** have a signer check for
`authority` and an owner check for `vault`. However, nowhere in the account
validation or instruction handler logic is there code that checks that the
`authority` account passed into the instruction handler matches the `authority`
account on the `vault`. </Callout>
account on the `vault`.

</Callout>

```rust
use anchor_lang::prelude::*;
Expand Down
7 changes: 4 additions & 3 deletions content/courses/program-security/reinitialization-attacks.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,9 +186,10 @@ pub struct User {
[Anchor's `init_if_needed` constraint](https://www.anchor-lang.com/docs/account-constraints),
guarded by a feature flag, should be used with caution.It initializes an account
only if it hasn't been initialized yet. If the account is already initialized,
the instruction handler will still execute, so
it's \***\*\*\*\***extremely\***\*\*\*\*** important to include checks in your
instruction handler to prevent resetting the account to its initial state.
the instruction handler will still execute, so it's **extremely** important to
include checks in your instruction handler to prevent resetting the account to
its initial state.

</Callout>

For example, if the `authority` field is set in the instruction handler, ensure
Expand Down
11 changes: 5 additions & 6 deletions content/courses/tokens-and-nfts/nfts-with-metaplex.md
Original file line number Diff line number Diff line change
Expand Up @@ -899,13 +899,12 @@ endless!

The steps covered above for creating an NFT would be incredibly tedious to
execute for thousands of NFTs in one go. Many providers, including Metaplex,
Magic Eden, and Tensor have so-called 'fair launch' tools that take care of
MagicEden, and Tensor have so-called 'fair launch' tools that take care of
minting large quantities of NFTs and ensuring they are sold within the
parameters set by their creators. Dive into fair launch platforms on the
[Digital Collectables](https://solana.com/ecosystem/explore?categories=digital%20collectibles)
page. This hands-on experience will not only reinforce your understanding of the
tools but also boost your confidence in your ability to use them effectively in
the future.
parameters set by their creators. Dive into one of these fair launch platforms
and create an NFT. This hands-on experience will not only reinforce your
understanding of the tools but also boost your confidence in your ability to use
them effectively in the future.

<Callout type="success" title="Completed the lab?">
Push your code to GitHub and
Expand Down

0 comments on commit 8ee6e06

Please sign in to comment.