sideprotocol/plonky2-gpu

Why MerkleTree needs its field under Arc?

Opened this issue · 1 comments

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?