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

feat: make the hash type generic #57

Merged
merged 1 commit into from
Oct 18, 2024

Conversation

Davidson-Souza
Copy link
Collaborator

See keep-starknet-strange/raito#248 for context

Currently, we only support using our internal hash type, that is the 32-bytes representation of a sha512-256 hash digest. However, we may want to give callers the possibility to use other hash types, or store them in other ways. This commit modifies Pollard, Proof and Stump to take in a generic parameter Hash that implements the trait NodeHash and defaults to BitcoinNodeHash, the one used by Bitcoin consensus as defined by the utreexo spec.

This is part of a project to support a Cairo prover for Bitcoin. To reduce the circuit size, we need to use an algebraic hash function like Poseidon, which tends to reduce the circuit significantly. With this commit, the caller can use our data structures with Poseidon without needing to change anything in rustreexo.

@Davidson-Souza Davidson-Souza force-pushed the trait-node-hash branch 2 times, most recently from c37ab75 to 508339e Compare October 9, 2024 00:54
@Davidson-Souza Davidson-Souza marked this pull request as ready for review October 9, 2024 00:58
src/accumulator/node_hash.rs Outdated Show resolved Hide resolved
Currently, we only support using our internal hash type, that is the
32-bytes representation of a sha512-256 hash digest. However, we may
want to give callers the possibility to use other hash types, or store
them in other ways. This commit modifies `Pollard`, `Proof` and `Stump`
to take in a generic parameter `Hash` that implements the trait
`NodeHash` and defaults to `BitcoinNodeHash`, the one used by Bitcoin
consensus as defined by the utreexo spec.

This is part of a project to support a Cairo prover for Bitcoin. To
reduce the circuit size, we need to use an algebraic hash function like
Poseidon, which tends to reduce the circuit significantly. With this
commit the caller can use our data structures with Poseidon without
needing to change anything in rustreexo.
@Davidson-Souza Davidson-Souza changed the title [WIP] feat: make the hash type generic feat: make the hash type generic Oct 18, 2024
@Davidson-Souza Davidson-Souza merged commit 9890fa7 into mit-dci:main Oct 18, 2024
20 checks passed
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

Successfully merging this pull request may close these issues.

2 participants