-
Notifications
You must be signed in to change notification settings - Fork 305
Native onchain development - Updated program state management lesson #413
Native onchain development - Updated program state management lesson #413
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few changes are required, see the comments above, but this looks good. 👍 Note multiple people are competing for this lessons s competition is hot!
- A Program Derived Address (PDA) is derived from a program ID and optional | ||
seeds, and it is used as the address for a storage account. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is better than the old version but we can improve it by starting with the purpose (storing data).
- A Program Derived Address (PDA) is derived from a program ID and optional | |
seeds, and it is used as the address for a storage account. | |
- State is stored in a Program Derived Address (PDA) accounts. A PDA is derived from a program ID and optional seeds, and the data inside is determined by the programmer. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Improved this as per suggestions.
This model is flexible but can be challenging if you're unfamiliar with it. In | ||
this lesson, we'll start simple and gradually introduce more complex programs. | ||
You'll learn the basics of state management in a Solana program, including | ||
representing the state as a Rust type, creating accounts using PDAs, and | ||
serializing account data. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This model is flexible but can be challenging if you're unfamiliar with it. In | |
this lesson, we'll start simple and gradually introduce more complex programs. | |
You'll learn the basics of state management in a Solana program, including | |
representing the state as a Rust type, creating accounts using PDAs, and | |
serializing account data. | |
This model is simple, providing an easy-to-use key-value store to store data, and allowing programs to be upgraded without affecting their data, but can be challenging if you're familiar with older blockchains. In | |
this lesson, we'll start simple and gradually introduce more complex programs. | |
You'll learn the basics of state management in a Solana program, including | |
representing the state as a Rust type, creating accounts using PDAs, and | |
serializing account data. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again yours was better than the old one, but we can go even further. PDAs are simple, they're generally only hard for Eth people.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated for better readability and clarity. Let me know if it needs further improvement.
All Solana accounts have a data field that holds a byte array, making accounts | ||
as flexible as files on a computer. You can store anything in an account, as | ||
long as it has the necessary storage space. | ||
|
||
All Solana accounts have a `data` field that holds a byte array. This makes | ||
accounts as flexible as files on a computer. You can store literally anything in | ||
an account (so long as the account has the storage space for it). | ||
Just like files in a traditional filesystem conform to specific formats like PDF | ||
or MP3, data stored in a Solana account must follow a pattern to be retrieved | ||
and deserialized into something usable. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent, concise simple explanation.
content/courses/native-onchain-development/program-state-management.md
Outdated
Show resolved
Hide resolved
[first part of this lesson](basic-program-pt-1), this is very similar to what we | ||
did when we created an enum to represent discrete instructions. | ||
Rust data type. This is similar to how we created an enum to represent discrete | ||
instructions in the [first part of this lesson](basic-program-pt-1). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this link is bad. Previous lesson should be deserialize-instruction-data
. See CONTRIBUTING for how to do links (it's unusual, but there's. reason for it)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed link as per guidelines to point to the enum section.
content/courses/native-onchain-development/program-state-management.md
Outdated
Show resolved
Hide resolved
content/courses/native-onchain-development/program-state-management.md
Outdated
Show resolved
Hide resolved
content/courses/native-onchain-development/program-state-management.md
Outdated
Show resolved
Hide resolved
content/courses/native-onchain-development/program-state-management.md
Outdated
Show resolved
Hide resolved
content/courses/native-onchain-development/program-state-management.md
Outdated
Show resolved
Hide resolved
Thanks! @mikemaccana I have updated the content and resolved all the comments. Please review and let me know if there is any additional feedback. |
More excellent work and another winner. 🏆 |
Thanks! @mikemaccana |
Problem
Summary of Changes
Fixes #
Updated program code - https://beta.solpg.io/66d67458cffcf4b13384d331