From 8ee6e0646296ae15e48f190039a51452b0f4814f Mon Sep 17 00:00:00 2001 From: Nick Frostbutter <75431177+nickfrosty@users.noreply.github.com> Date: Fri, 13 Dec 2024 09:32:32 -0500 Subject: [PATCH] Assorted fixes (#666) * fix: typos * refactor: link and wording * refactor: assorted --- .../deserialize-custom-data-frontend.md | 2 +- .../onchain-development/intro-to-onchain.md | 16 ++++++++-------- .../program-security/account-data-matching.md | 6 ++++-- .../program-security/reinitialization-attacks.md | 7 ++++--- .../tokens-and-nfts/nfts-with-metaplex.md | 11 +++++------ 5 files changed, 22 insertions(+), 20 deletions(-) diff --git a/content/courses/native-onchain-development/deserialize-custom-data-frontend.md b/content/courses/native-onchain-development/deserialize-custom-data-frontend.md index 9d2bf2b27..2b18a47dc 100644 --- a/content/courses/native-onchain-development/deserialize-custom-data-frontend.md +++ b/content/courses/native-onchain-development/deserialize-custom-data-frontend.md @@ -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. diff --git a/content/courses/onchain-development/intro-to-onchain.md b/content/courses/onchain-development/intro-to-onchain.md index 9d90919ba..d8dfda257 100644 --- a/content/courses/onchain-development/intro-to-onchain.md +++ b/content/courses/onchain-development/intro-to-onchain.md @@ -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**. @@ -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 diff --git a/content/courses/program-security/account-data-matching.md b/content/courses/program-security/account-data-matching.md index 6ecb10f5a..1683cf3e4 100644 --- a/content/courses/program-security/account-data-matching.md +++ b/content/courses/program-security/account-data-matching.md @@ -224,11 +224,13 @@ The `insecure_withdraw` instruction handler transfers all the tokens in the -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`. +account on the `vault`. + + ```rust use anchor_lang::prelude::*; diff --git a/content/courses/program-security/reinitialization-attacks.md b/content/courses/program-security/reinitialization-attacks.md index 715e6cfe8..73e698c23 100644 --- a/content/courses/program-security/reinitialization-attacks.md +++ b/content/courses/program-security/reinitialization-attacks.md @@ -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. + For example, if the `authority` field is set in the instruction handler, ensure diff --git a/content/courses/tokens-and-nfts/nfts-with-metaplex.md b/content/courses/tokens-and-nfts/nfts-with-metaplex.md index f5b929b5c..060ac864d 100644 --- a/content/courses/tokens-and-nfts/nfts-with-metaplex.md +++ b/content/courses/tokens-and-nfts/nfts-with-metaplex.md @@ -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. Push your code to GitHub and