Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generalized state compression #470

Merged

Conversation

danielAsaboro
Copy link
Contributor

Problem

The documentation initially contained complex language and passive voice, making it difficult for beginners to understand. However, the code was functioning correctly once the dependencies were updated to their latest versions.

Summary of Changes

  • Improved Clarity: Revised the text to enhance readability and clarity for beginners. Removed passive voice and simplified explanations.
  • Updated Code Samples: Adjusted the code examples to be compatible with the latest versions of dependencies.
  • Fixes: Addressed any identified issues related to clarity and code compatibility.

…a Note-Taking App with Generalized State Compression
…ection for Building a Note-Taking App with Generalized State Compression
…section for Building a Note-Taking App with Generalized State Compression
…s section for buiding a Note-Taking App with Generalized State Compression
…on for Building a Note-Taking App with Generalized State Compression
…n for Building a Note-Taking App with Generalized State Compression
…n for Building a Note-Taking App with Generalized State Compression
@danielAsaboro
Copy link
Contributor Author

Zero update on this?
I think it's also worth noting that's it's for the Update Solana Developer Lessons

@mikemaccana
Copy link
Collaborator

@danielAsaboro we had a live course in NY with 24 people learning new material, then Rustconf then Breakpoint! Reviewing this now.

@danielAsaboro
Copy link
Contributor Author

Hi Mike, i've implemented the changes you suggested,
and also made the test section more explanatory as a lot of people (including myself) get confused easily with it
Could you please take another look at it so i know if there are edits to be made -- thank you

@mikemaccana
Copy link
Collaborator

mikemaccana commented Sep 30, 2024

@danielAsaboro I'm going to do a final review of this now, but can you also please fix the recent conflicts? Thanks!

please also remove changes to the package.lock and other unrelated files.

@danielAsaboro
Copy link
Contributor Author

@danielAsaboro I'm going to do a final review of this now, but can you also please fix the recent conflicts? Thanks!

please also remove changes to the package.lock and other unrelated files.

Hi Mike, it's great to hear from you again.

To be clear, when you say 'remove changes to the package.lock and other unrelated files', do you mean i should revert the PR i made to unbox?

Copy link
Collaborator

@mikemaccana mikemaccana left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great! Lots of small things but they're pretty easy. Give me a buzz once done and we'll get this in!

To be clear, when you say 'remove changes to the package.lock and other unrelated files', do you mean i should revert the PR i made to unbox?

No, this I mean you shoudl remove the two files that aren't .md files in this PR

Your code is now in https://github.com/solana-developers/anchor-compressed-notes. Note that I think you're just using 'main' rather than 'solution' for your changes. We can get rid of the 'solution' branch if you're not using it (as long as the URL in this lesson is correct).

BTW @danielAsaboro I'm on telegram and twitter as mikemaccana if you want to communicate faster.


### Key Parameters for Configuring a Concurrent Merkle Tree

As a program architect, you are responsible for controlling three key parameters
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
As a program architect, you are responsible for controlling three key parameters
As a developer, you are responsible for controlling three key parameters

1. **Default Anchor Setup**: Configure the basic environment for Anchor testing.
2. **Merkle Tree Keypair**: Generate a keypair for the Merkle tree.
3. **Tree Authority**: Create a keypair for the authority of the Merkle tree.
4. **Notes**: Define some sample notes to use in the tests.

```typescript
describe("compressed-notes", () => {
const provider = anchor.AnchorProvider.env();
anchor.setProvider(provider);
const connection = new Connection(
provider.connection.rpcEndpoint,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can spl-account-compression work against localhost?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, they are designed to work local development environments..
please correct me if i'm are wrong

});
```

Next, we'll create the `Add Max Size Note` test. It is the same as the previous
test, but with the second note.
Next, let's create the `Add Max Size Note` test. This test will be similar to
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The name of this test is now adds max size note to the Merkle tree. Please update the tests names used in your text to match your new and better names.

});
```

Lastly, we'll create the `Update First Note` test. This is slightly more complex
than adding a note. We'll do the following:
Lastly, let’s create the `Update First Note` test. This test involves a few more
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Eg updates the first note in the Merkle tree - go through all of them

const noteLog = await getNoteLog(connection, txSignature);
const hash = getHash(updatedNote, provider.publicKey);
// Instruction to initialize the tree through the Note program
const ix = await program.methods
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use instruction, transaction, signature etc. See CONTRIBUTING.md


If you'd like a very simple example of a delete function, check out the
For a straightforward example of how to implement a delete function, check out
the
[`solution` branch on GitHub](https://github.com/Unboxed-Software/anchor-compressed-notes/tree/solution).
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Per the superteam bounty, this repo should be updated to the latest version of Anchor and you should test it still works

@danielAsaboro
Copy link
Contributor Author

hmmm, this one took my tiime...I had an issue with checks when i remove my package json and yarn lock out;

perhaps, anyone could help fix

@danielAsaboro
Copy link
Contributor Author

Great! Lots of small things but they're pretty easy. Give me a buzz once done and we'll get this in!

To be clear, when you say 'remove changes to the package.lock and other unrelated files', do you mean i should revert the PR i made to unbox?

No, this I mean you shoudl remove the two files that aren't .md files in this PR

Your code is now in https://github.com/solana-developers/anchor-compressed-notes. Note that I think you're just using 'main' rather than 'solution' for your changes. We can get rid of the 'solution' branch if you're not using it (as long as the URL in this lesson is correct).

BTW @danielAsaboro I'm on telegram and twitter as mikemaccana if you want to communicate faster.

Hi Mike, I already reached out to you through Twitter 💙

@mikemaccana mikemaccana merged commit cd05d15 into solana-foundation:main Oct 4, 2024
8 checks passed
adpthegreat pushed a commit to adpthegreat/developer-content that referenced this pull request Oct 23, 2024
* chore: updated lesson title, and summary

* chore: updated lesson and theoretical overview of state compression

* chore: updated lesson on concurrent merkle tree and broke it down into smaller sections for easy understanding

* chore: updated lesson on data access in a state-compressed program and tooling

* chore: updated lesson on indexing data for easy lookup

* chore: updated lesson on creating rust types for compression development process

* chore: updated lesson on initializing a new tree for compression development process

* chore: updated lesson on adding hashes to the tree for compression development process

* chore: updated lesson on adding hashes for compression development process

* chore: updated lesson on updating and deleting hashes for compression development process

* chore: updated lesson on updating and deleting hashes for compression development process

* chore: updated lesson on accessing data from a client for compression development process

* chore: update project setup in Lab section for Building a Note-Taking App with Generalized State Compression

* chore: update step 2: define note schema in Lab section for Building a Note-Taking App with Generalized State Compression

* chore: update step 3: define input account and constraints - in Lab section for Building a Note-Taking App with Generalized State Compression

* chore: update step 4: create "create_note_tree" instruction - in Lab section for Building a Note-Taking App with Generalized State Compression

* chore: update step 5: create "append_note_tree" instructuion - in Labs section for buiding a Note-Taking App with Generalized State Compression

* chore: update step 6: create "update_note" instruction - in Lab section for Building a Note-Taking App with Generalized State Compression

* chore: update step 7: "client test setup" instruction - in Lab section for Building a Note-Taking App with Generalized State Compression

* fix: update step 7 for more info into the utility file provided

* chore: update step 8: "write client test" instruction - in Lab section for Building a Note-Taking App with Generalized State Compression

* chore: update challenge section in Lab section for Building a Note-Taking App with Generalized State Compression

* fix: fixed content formatting issues

* fix: used grammarly to fix grammar issues

* fix: fixed on-chain to onchain

* fix: fixed lack of objectives semantic tag after title section

* fix: fixed description semantic tag issue

* Update content/courses/state-compression/generalized-state-compression.md

Fixed Merkle tree description summary

Co-authored-by: Mike MacCana <[email protected]>

* fix: fixed concurrent tree explanation markdown

* fix: fixed grammar issue in last intro to theoretical overview of state compression

* fix deterministic with predictably

* Update content/courses/state-compression/generalized-state-compression.md

Co-authored-by: Mike MacCana <[email protected]>

* Update content/courses/state-compression/generalized-state-compression.md

Co-authored-by: Mike MacCana <[email protected]>

* Update content/courses/state-compression/generalized-state-compression.md

Co-authored-by: Mike MacCana <[email protected]>

* Update content/courses/state-compression/generalized-state-compression.md

Made the intro more clearer

Co-authored-by: Mike MacCana <[email protected]>

* Update content/courses/state-compression/generalized-state-compression.md

reinforce that the final hash is called a Merkle root

Co-authored-by: Mike MacCana <[email protected]>

* Update content/courses/state-compression/generalized-state-compression.md

removed redundant explanation of merkle tree

Co-authored-by: Mike MacCana <[email protected]>

* Update content/courses/state-compression/generalized-state-compression.md

fixed redundant word "entire"

Co-authored-by: Mike MacCana <[email protected]>

* Update content/courses/state-compression/generalized-state-compression.md

called out the concurrent modifier in a merkle tree

Co-authored-by: Mike MacCana <[email protected]>

* Update content/courses/state-compression/generalized-state-compression.md

removed redundant establishment of concurrent merkle tree as the solution to dealing with multiple transactions in the same slot

Co-authored-by: Mike MacCana <[email protected]>

* Update content/courses/state-compression/generalized-state-compression.md

remove redundant explanation of a concurrent merkle tree

Co-authored-by: Mike MacCana <[email protected]>

* Update content/courses/state-compression/generalized-state-compression.md

corrected incorrect information of what is logged to the Noop Program

Co-authored-by: Mike MacCana <[email protected]>

* Update content/courses/state-compression/generalized-state-compression.md

clarified what the Solana Noop Program is to the reader

Co-authored-by: Mike MacCana <[email protected]>

* Update content/courses/state-compression/generalized-state-compression.md

added code blocks to file names, config option, and package names

Co-authored-by: Mike MacCana <[email protected]>

* Update content/courses/state-compression/generalized-state-compression.md

rename functions that handle instructions as function handlers as per the CONTRIBUTING.md guidelines

Co-authored-by: Mike MacCana <[email protected]>

* fix: fixed formatting issues

* fix: broke down content

* fix: reflected Mikes suggestion

* fix: fixed all rust content and addded extra documentation

* fix: updated the client side test, and made more explicit for clarity

* fix: fixed grammar issues with header semantic tag content

* fix: rephrased what state compression is per mikes suggestion

* fix: fix grammar and vocab issues

* fix: fixed instructional handler issue

* fix: fixed redundancies in test files

* fix: redirected them to main branch from solution branch

* fix: added package.json  and yarn lock

* revert: revert package json and yarn lock to main state

---------

Co-authored-by: Mike MacCana <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants