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

chore: cleanup and docs batched Merkle tree & system program #1491

Merged
merged 2 commits into from
Jan 19, 2025

Conversation

ananas-block
Copy link
Contributor

@ananas-block ananas-block commented Jan 18, 2025

Changes:

  1. light-batched-merkle-tree
    1. remove .store_value() it wrapped a vector push which is unnecessary
    2. refactor batch.insert, ie replace for loop with split_at`
    3. move MerkleTreeMetadata from merkle_tree.rs to merkle_tree_metadata.rs
    4. add convenience wrappers get_state_root_by_index and get_address_root_by_index for integrating zk
      programs which only need the root as proof input
    5. rename leaf_index_could_exist_in_batches -> check_leaf_index_could_exist_in_batches
  2. System program
    1. derive_new_addresses refactor invoking_program_id_bytes from [u8;32] to Option<[u8;32]>
    2. rename verify_state_proof.rs -> verify_proof.rs
    3. rename fetch_* -> read_* (these functions read roots from Merkle tree accounts)

@ananas-block ananas-block force-pushed the jorrit/chore-handoff-batched-cleanup-5 branch from 34e5e01 to afbcf23 Compare January 18, 2025 23:32
…y_proof.rs, replace ok_or() with ok_or_else()
@ananas-block ananas-block force-pushed the jorrit/chore-handoff-batched-cleanup-5 branch from afbcf23 to bd67a99 Compare January 18, 2025 23:42
@@ -760,8 +760,8 @@ async fn only_test_create_pda() {
assert_rpc_error(
result,
0,
UtilsError::AccountNotMutable.into(),
// AccountCompressionErrorCode::AddressMerkleTreeAccountDiscriminatorMismatch.into(),
// UtilsError::AccountNotMutable.into(),
Copy link
Contributor

Choose a reason for hiding this comment

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

leftover - since it's tests we can merge regardless imo

Copy link
Contributor

@SwenSchaeferjohann SwenSchaeferjohann left a comment

Choose a reason for hiding this comment

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

lgtm!

@SwenSchaeferjohann SwenSchaeferjohann merged commit 896a8f4 into main Jan 19, 2025
20 checks passed
@SwenSchaeferjohann SwenSchaeferjohann deleted the jorrit/chore-handoff-batched-cleanup-5 branch January 19, 2025 15:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants