-
Notifications
You must be signed in to change notification settings - Fork 36
Feature/bls12 381 dory pc #96
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
base: main
Are you sure you want to change the base?
Conversation
|
@microsoft-github-policy-service agree |
| Ok(DoryBlind) | ||
| } | ||
|
|
||
| fn prove( |
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.
We need a PCS evaluation argument where claimed values are committed.
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.
Current understanding:
- Spartan stores
eval_Win plaintext inSpartanSNARKstruct (line 107, spartan.rs) - Spartan recomputes
comm_eval_W = PCS::commit([eval_W])in verifier - My current
DoryEvaluationArgumentduplicates the value invalue_bytes
Question: Should I:
- Remove
value_bytesfromDoryEvaluationArgumententirely? - If so, how should
verify()obtain the value to callquarks-zk::verify_eval(value, ...)? - Should I deserialize from
comm_evalparameter, or is the value expected to come from Spartan's proof struct?
Looking at Hyrax-PC, the IPA.verify() implicitly validates the value through the inner product check. Dory's verify_eval() explicitly needs the value parameter.
Could you clarify the expected flow for getting the evaluation value to the PCS verifier?
Thanks
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.
Current implementation stores the claimed value in DoryEvaluationArgument.value (native ArkFr).
The value is implicitly committed through the comm_eval parameter:
- Prover computes comm_eval = PCS::commit([eval_W], blind) (spartan.rs:306)
- Verifier receives both comm_eval and arg.value
- Verifier can check commit([arg.value]) == comm_eval for binding
Is this the pattern you're expecting, or should we handle it differently?
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.
Spartan ZK variant does not store evaluation values in plaintext.
Addresses review comment microsoft#1 from @srinathsetty Changes: - Updated quarks-zk to v0.1.2 with rerandomization support - Implemented rerandomize_commitment using Vega paper approach - Added h_gt generator to DoryCommitmentKey for rerandomization - Added 3 rigorous tests validating unlinkability and correctness Reference: Vega paper (eprint 2025/2094) Section 2.1
…ument - Store DoryPCSEvaluationProof and ArkFr natively (not Vec<u8>) - Custom serde implementation using ark_serialize - Addresses review microsoft#3: no hacky manual serialization
Apologies for the noise. Removed: - examples/benchmarks/** (criterion-generated files) - PR_DESCRIPTION.md (local reference) These were included unintentionally in the previous commit.
Add BLS12-381 Curve Provider and Dory-PC Backend
Summary
This PR adds support for:
Motivation
BLS12-381 is widely used in production systems (Ethereum 2.0, Zcash) and offers strong security guarantees. Dory-PC provides O(1) commitment size and O(log n) verification.
Changes
New Files
src/provider/bls12_381.rs- BLS12-381 curve implementation viahalo2curvessrc/provider/pcs/dory_pc.rs- Dory-PC adapter wrappingquarks-zkcratebenches/pcs_comparison.rs- Benchmark comparing Hyrax vs Doryexamples/sha256_bls12_381_dory.rs- SHA-256 circuit example with Dory-PCexamples/BENCHMARK_RESULTS.md- Benchmark resultsModified Files
src/provider/mod.rs- RegisterBLS12381HyraxEngineandBLS12381DoryEnginesrc/provider/pcs/mod.rs- Exportdory_pcmoduleCargo.toml- Add dependencies (quarks-zk,ark-*crates)New Engines
Benchmark Results (Simple Circuit)
SHA-256 Circuit Results (Heavy Circuit, 131K+ constraints)
Performance Observations
What works well:
Current bottlenecks:
Potential optimizations (not in scope for this PR):
Assessment
This is a research-grade implementation. The numbers are expected for:
For production use, significant optimization work would be needed.
Testing
cargo test --features dory cargo bench --bench pcs_comparison --features dory cargo run --release --example sha256_bls12_381_dory --features doryDependencies
New optional