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

Hash as input #137

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
Open

Hash as input #137

wants to merge 11 commits into from

Conversation

rrtoledo
Copy link
Collaborator

@rrtoledo rrtoledo commented Jan 28, 2025

Content

This PR aims at updating protocols to support different hashes, input by the user.

Pre-submit checklist

  • Branch
    • Tests are provided (if possible)
    • Commit sequence broadly makes sense
    • Key commits have useful messages
  • PR
    • No clippy warnings in the CI
    • Self-reviewed the diff
    • Useful pull request description
    • Reviewer requested
  • Documentation
    • Update README file (if relevant)
    • Update documentation website (if relevant)

Comments

I have kept Blake2bVar when generating data, but changed to Sha256 in tests, benches and examples as it is faster on my machine.

I also fixed some old Clippy warnings.

Issue(s)

Relates to #36

@rrtoledo rrtoledo added the enhancement New feature or request label Jan 28, 2025
@rrtoledo rrtoledo added this to the 1.0 milestone Jan 28, 2025
@rrtoledo rrtoledo self-assigned this Jan 28, 2025
@rrtoledo rrtoledo force-pushed the raph@hash branch 2 times, most recently from c7f3f3d to d32faa8 Compare January 28, 2025 17:10
@rrtoledo rrtoledo linked an issue Jan 29, 2025 that may be closed by this pull request
/// Numbers of retries done to find the proof
pub retry_counter: u64,
/// Index of the searched subtree to find the proof
pub search_counter: u64,
/// Sequence of elements from prover's set
pub element_sequence: Vec<Element>,
// Phantom type to link the tree with its hasher
hasher: PhantomData<H>,
Copy link
Member

Choose a reason for hiding this comment

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

Alternatively, you can remove generics from this type and only introduce generics to the relevant methods.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This was done similarly to Mithril code base to keep a link between a proof and the underlying hash function.
Of course, in practice this is 0 byte but it keeps the code safe when compiling.

src/centralized_telescope/proof.rs Outdated Show resolved Hide resolved
tests/common/mod.rs Outdated Show resolved Hide resolved
tests/centralized_telescope.rs Outdated Show resolved Hide resolved
Copy link
Collaborator

@curiecrypt curiecrypt left a comment

Choose a reason for hiding this comment

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

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

User provided hash function
3 participants