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

Why MerkleTree needs its field under Arc? #5

Open
vivekvpandya opened this issue Feb 12, 2024 · 1 comment
Open

Why MerkleTree needs its field under Arc? #5

vivekvpandya opened this issue Feb 12, 2024 · 1 comment

Comments

@vivekvpandya
Copy link

I see following modification in code

#[derive(Clone, Debug)]
pub struct MerkleTree<F: RichField, H: Hasher<F>> {
    /// The data in the leaves of the Merkle tree.
    pub leaves: Vec<Vec<F>>,

    /// The digests in the tree. Consists of `cap.len()` sub-trees, each corresponding to one
    /// element in `cap`. Each subtree is contiguous and located at
    /// `digests[digests.len() / cap.len() * i..digests.len() / cap.len() * (i + 1)]`.
    /// Within each subtree, siblings are stored next to each other. The layout is,
    /// left_child_subtree || left_child_digest || right_child_digest || right_child_subtree, where
    /// left_child_digest and right_child_digest are H::Hash and left_child_subtree and
    /// right_child_subtree recurse. Observe that the digest of a node is stored by its _parent_.
    /// Consequently, the digests of the roots are not stored here (they can be found in `cap`).
    pub digests: Vec<H::Hash>,

    /// The Merkle cap.
    pub cap: MerkleCap<F, H>,

    pub my_leaf_len: usize,
    pub my_leaves: Arc<Vec<F>>,
    pub my_leaves_len: usize,
    pub my_leaves_dev_offset: isize,
    pub my_digests: Arc<Vec<H::Hash>>,
}

Here in CUDA optimised version I see leaves and digests are not used instead my_leaves and my_digests are used.
Is this part of optimising the results or its required for correct results?

@vivekvpandya
Copy link
Author

@liangping

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

No branches or pull requests

1 participant