-
Notifications
You must be signed in to change notification settings - Fork 53
Change jubjub and poseidon backend from Dusk to MidnightZK #2898
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
Conversation
mithril-stm/src/signature_scheme/schnorr_signature/jubjub/curve_points.rs
Fixed
Show fixed
Hide fixed
mithril-stm/src/signature_scheme/schnorr_signature/jubjub/curve_points.rs
Fixed
Show fixed
Hide fixed
mithril-stm/src/signature_scheme/schnorr_signature/jubjub/poseidon_digest.rs
Fixed
Show fixed
Hide fixed
mithril-stm/src/signature_scheme/schnorr_signature/jubjub/poseidon_digest.rs
Fixed
Show fixed
Hide fixed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This pull request migrates the cryptographic backend for Jubjub curve operations and Poseidon hash functions from Dusk Network's implementation (dusk-jubjub, dusk-poseidon) to Input Output's Midnight implementation (midnight-circuits, midnight-curves). This represents a significant change in the underlying cryptographic dependencies for the Schnorr signature scheme.
Key Changes
- Replaced Dusk cryptographic libraries with Midnight equivalents (versions 6.0.0 and 0.2.0)
- Updated Poseidon hash to return
BaseFieldElementinstead ofScalarFieldElementwith type conversion added for signature operations - Implemented SHA256 pre-hashing for hash-to-curve operations using the Midnight HashToCurveGadget
- Updated all golden test values to reflect the new backend's outputs
Reviewed changes
Copilot reviewed 10 out of 11 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| mithril-stm/Cargo.toml | Replaced dusk dependencies with midnight-circuits and midnight-curves; added sha2 dependency |
| Cargo.lock | Updated dependency tree with new midnight crates and their transitive dependencies |
| mithril-stm/src/signature_scheme/schnorr_signature/jubjub/poseidon_digest.rs | Migrated from Dusk's Hash::digest_truncated to Midnight's PoseidonChip::hash; changed return type to BaseFieldElement |
| mithril-stm/src/signature_scheme/schnorr_signature/jubjub/field_elements.rs | Added BaseFieldElement serialization methods, from_raw and from_base_field conversion methods for ScalarFieldElement |
| mithril-stm/src/signature_scheme/schnorr_signature/jubjub/curve_points.rs | Replaced Dusk's hash_to_point with Midnight's HashToCurveGadget using SHA256 pre-hashing; updated type aliases |
| mithril-stm/src/signature_scheme/schnorr_signature/signature.rs | Changed challenge field type from ScalarFieldElement to BaseFieldElement; added type conversion in verification |
| mithril-stm/src/signature_scheme/schnorr_signature/signing_key.rs | Updated to use new Poseidon digest function and added BaseFieldElement to ScalarFieldElement conversion |
| mithril-stm/src/signature_scheme/schnorr_signature/verification_key.rs | Reordered imports to follow Rust conventions |
| mithril-stm/src/signature_scheme/schnorr_signature/error.rs | Added BaseFieldElementSerialization error variant |
| mithril-stm/src/signature_scheme/schnorr_signature/jubjub/mod.rs | Added serde implementation for BaseFieldElement |
| mithril-stm/benches/schnorr_sig.rs | Updated benchmark names and implementation to use Midnight's PoseidonChip |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
mithril-stm/src/signature_scheme/unique_schnorr_signature/jubjub/field_elements.rs
Outdated
Show resolved
Hide resolved
mithril-stm/src/signature_scheme/unique_schnorr_signature/jubjub/curve_points.rs
Outdated
Show resolved
Hide resolved
mithril-stm/src/signature_scheme/unique_schnorr_signature/jubjub/field_elements.rs
Show resolved
Hide resolved
5b5546d to
c16ada3
Compare
mithril-stm/src/signature_scheme/unique_schnorr_signature/jubjub/field_elements.rs
Fixed
Show fixed
Hide fixed
mithril-stm/src/signature_scheme/unique_schnorr_signature/jubjub/field_elements.rs
Fixed
Show fixed
Hide fixed
mithril-stm/src/signature_scheme/unique_schnorr_signature/jubjub/field_elements.rs
Fixed
Show fixed
Hide fixed
mithril-stm/src/signature_scheme/unique_schnorr_signature/jubjub/field_elements.rs
Fixed
Show fixed
Hide fixed
mithril-stm/src/signature_scheme/unique_schnorr_signature/jubjub/field_elements.rs
Fixed
Show fixed
Hide fixed
mithril-stm/src/signature_scheme/unique_schnorr_signature/jubjub/field_elements.rs
Fixed
Show fixed
Hide fixed
mithril-stm/src/signature_scheme/unique_schnorr_signature/jubjub/field_elements.rs
Fixed
Show fixed
Hide fixed
mithril-stm/src/signature_scheme/unique_schnorr_signature/jubjub/field_elements.rs
Fixed
Show fixed
Hide fixed
mithril-stm/src/signature_scheme/unique_schnorr_signature/jubjub/poseidon_digest.rs
Show resolved
Hide resolved
hjeljeli32
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM ✅
I left 3 small non-blocking comments.
mithril-stm/src/signature_scheme/unique_schnorr_signature/jubjub/curve_points.rs
Outdated
Show resolved
Hide resolved
mithril-stm/src/signature_scheme/unique_schnorr_signature/jubjub/field_elements.rs
Show resolved
Hide resolved
mithril-stm/src/signature_scheme/unique_schnorr_signature/signature.rs
Outdated
Show resolved
Hide resolved
jpraynaud
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
38cea02 to
5076a93
Compare
curiecrypt
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
2b1155f to
34e95e8
Compare
Content
Change the backend used for the Jubjub curve and Poseidon hash function from the Dusk implementation to the newly released Midnight crates.
Pre-submit checklist
Comments
Issue(s)
Relates to #2888