Skip to content

v2 API for compressed account proofs#10

Merged
SwenSchaeferjohann merged 9 commits intojorrit/feat-add-testfrom
sergey/photon-ref-tree-context
Feb 28, 2025
Merged

v2 API for compressed account proofs#10
SwenSchaeferjohann merged 9 commits intojorrit/feat-add-testfrom
sergey/photon-ref-tree-context

Conversation

@sergeytimoshin
Copy link

  • implement v2 API for compressed account proofs
  • refactored TreeAndQueue and tree heights helper

@sergeytimoshin sergeytimoshin changed the title * implement v2 API for compressed account proofs v2 API for compressed account proofs Feb 28, 2025
pub root_seq: u64,
}

impl MerkleProofWithContext {

Choose a reason for hiding this comment

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

can we add a unit test for this?

Copy link
Author

Choose a reason for hiding this comment

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

pub queue: SerializablePubkey,
pub root_seq: u64,
pub prove_by_index: bool,
pub tree_type: u16,

Choose a reason for hiding this comment

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

would it make sense to use the struct we defined for merkle_tree, queue, and tree_type?

Copy link
Author

Choose a reason for hiding this comment

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

Hm, depends on what's more convenient for the client @SwenSchaeferjohann wdyt?

Copy link
Author

Choose a reason for hiding this comment

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

));
};

// Enrich with account data if available

Choose a reason for hiding this comment

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

doesn't the call fail if no data is available?

Copy link
Author

Choose a reason for hiding this comment

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

if let Some(account) = account_map.get(&value.hash.to_vec()) {
value.tree_type = account.tree_type as u16;
value.queue = SerializablePubkey::try_from(account.queue.clone())?;
}

Choose a reason for hiding this comment

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

shouldn't this fail if there is no account?

Copy link
Author

Choose a reason for hiding this comment

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

#[derive(Debug, Clone)]
pub struct TreeInfo {
pub tree: Pubkey,
pub queue: Pubkey,

Choose a reason for hiding this comment

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

can we add cpi_context here?

Copy link
Author

Choose a reason for hiding this comment

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

Sure, but it always None for now, we can add it later

@sergeytimoshin sergeytimoshin force-pushed the sergey/photon-ref-tree-context branch from 4b9c802 to 14dfd6d Compare February 28, 2025 16:14
@SwenSchaeferjohann SwenSchaeferjohann merged commit 12cbda6 into jorrit/feat-add-test Feb 28, 2025
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.

3 participants