Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Abstract away Merkle trees with VectorCommitment scheme #179

Closed
irakliyk opened this issue Mar 26, 2023 · 1 comment · Fixed by #285
Closed

Abstract away Merkle trees with VectorCommitment scheme #179

irakliyk opened this issue Mar 26, 2023 · 1 comment · Fixed by #285
Labels
enhancement New feature or request

Comments

@irakliyk
Copy link
Collaborator

We currently make a hard assumption that for vector commitments (i.e., trace LDE commitment, constraint evaluation commitment, FRI layer commitments etc.) Merkle trees are used. It would be nice to abstract this assumption away and provide a way for the user to specify which vector commitment type to use.

This would help with such things as #38 and also would make #9 simpler as we could provide SaltedMerkleTree as one of the vector commitment types.

To make vector commitments fully generic, we could use something like this:

pub trait VectorCommitment: Sized {
    type Options;
    type Item: Clone + Serializable + Deserializable;
    type Commitment: Copy + Serializable + Deserializable;
    type Proof: Clone + Serializable + Deserializable;
    type MultiProof: Clone + Serializable + Deserializable;
    type Error: Debug;

    fn new(items: Vec<Self::Item>, options: Self::Options) -> Result<Self, Self::Error>;

    fn commitment(&self) -> Self::Commitment;

    fn open(&self, index: usize) -> Result<(Self::Item, Self::Proof), Self::Error>;
    fn open_many(&self, indexes: &[usize]) -> Result<(Vec<Self::Item>, Self::MultiProof), Self::Error>;

    fn verify(
        commitment: Self::Commitment,
        index: usize,
        item: Self::Item,
        proof: &Self::Proof
    ) -> Result<(), Self::Error>;

    fn verify_many(
        commitment: Self::Commitment,
        indexes: &[usize],
        items: &[Self::Item],
        proof: &Self::MultiProof
    ) -> Result<(), Self::Error>;
}

The first step for implementing this is probably to update our current MerkleTree implementation to comply with this interface.

@irakliyk irakliyk added the enhancement New feature or request label Mar 26, 2023
@irakliyk irakliyk mentioned this issue Mar 26, 2023
5 tasks
@irakliyk irakliyk linked a pull request Jun 22, 2024 that will close this issue
@irakliyk
Copy link
Collaborator Author

irakliyk commented Jul 8, 2024

Closed by #285.

@irakliyk irakliyk closed this as completed Jul 8, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant