arkworks-rs / crypto-primitives

Interfaces and implementations of cryptographic primitives, along with R1CS constraints for them
https://www.arkworks.rs
Apache License 2.0
167 stars 79 forks source link

Make all the subcomponents of `Path` public or serializable #47

Closed weikengchen closed 3 years ago

weikengchen commented 3 years ago

Based on the discussion from Telegram, one would likely want to serialize/deserialize a Merkle tree path, and currently, this cannot be done.

https://github.com/arkworks-rs/crypto-primitives/blob/main/src/merkle_tree/mod.rs#L33

This is because our Merkle tree path is of the following structure:

pub struct Path<P: Config> {
    pub(crate) leaf_sibling_hash: LeafDigest<P>,    
    /// The sibling of path node ordered from higher layer to lower layer (does not include root node).
    pub(crate) auth_path: Vec<TwoToOneDigest<P>>;,
    /// stores the leaf index of the node
    pub(crate) leaf_index: size,
}

We will need to make a trade-off here and a change that likely could be in the next release. I suggest:

Thoughts? @tsunrise

weikengchen commented 3 years ago

Based on the discussion with @zhenfeizhang.

tsunrise commented 3 years ago

Sounds good : )