-
Notifications
You must be signed in to change notification settings - Fork 271
Compression integration (draft) [JOLT-191] #1134
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
| fn commit_compressed( | ||
| poly: &MultilinearPolynomial<ark_bn254::Fr>, | ||
| setup: &Self::ProverSetup, | ||
| ) -> (Self::CompressedCommitment, Self::OpeningProofHint) { | ||
| let _span = trace_span!("DoryCommitmentScheme::commit").entered(); | ||
|
|
||
| let num_cols = DoryGlobals::get_num_columns(); | ||
| let num_rows = DoryGlobals::get_max_num_rows(); | ||
| let sigma = num_cols.log_2(); | ||
| let nu = num_rows.log_2(); | ||
|
|
||
| todo!() | ||
| // let (tier_2, row_commitments) = <MultilinearPolynomial<ark_bn254::Fr> as Polynomial< | ||
| // ArkFr, | ||
| // >>::commit_compressed::<ArkBn254, JoltG1Routines>( | ||
| // poly, nu, sigma, setup | ||
| // ) | ||
| // .expect("commitment should succeed"); | ||
|
|
||
| // (tier_2, row_commitments) | ||
| } |
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.
The commit_compressed method currently contains a todo!() statement that will panic at runtime if called. Before this PR can be merged, this method needs to be fully implemented. Consider uncommenting and completing the code below the todo!() statement, which appears to be the intended implementation path. This is particularly important since the compressed commitment functionality is a core part of this integration.
| fn commit_compressed( | |
| poly: &MultilinearPolynomial<ark_bn254::Fr>, | |
| setup: &Self::ProverSetup, | |
| ) -> (Self::CompressedCommitment, Self::OpeningProofHint) { | |
| let _span = trace_span!("DoryCommitmentScheme::commit").entered(); | |
| let num_cols = DoryGlobals::get_num_columns(); | |
| let num_rows = DoryGlobals::get_max_num_rows(); | |
| let sigma = num_cols.log_2(); | |
| let nu = num_rows.log_2(); | |
| todo!() | |
| // let (tier_2, row_commitments) = <MultilinearPolynomial<ark_bn254::Fr> as Polynomial< | |
| // ArkFr, | |
| // >>::commit_compressed::<ArkBn254, JoltG1Routines>( | |
| // poly, nu, sigma, setup | |
| // ) | |
| // .expect("commitment should succeed"); | |
| // (tier_2, row_commitments) | |
| } | |
| fn commit_compressed( | |
| poly: &MultilinearPolynomial<ark_bn254::Fr>, | |
| setup: &Self::ProverSetup, | |
| ) -> (Self::CompressedCommitment, Self::OpeningProofHint) { | |
| let _span = trace_span!("DoryCommitmentScheme::commit").entered(); | |
| let num_cols = DoryGlobals::get_num_columns(); | |
| let num_rows = DoryGlobals::get_max_num_rows(); | |
| let sigma = num_cols.log_2(); | |
| let nu = num_rows.log_2(); | |
| let (tier_2, row_commitments) = <MultilinearPolynomial<ark_bn254::Fr> as Polynomial< | |
| ArkFr, | |
| >>::commit_compressed::<ArkBn254, JoltG1Routines>(poly, nu, sigma, setup) | |
| .expect("commitment should succeed"); | |
| (tier_2, row_commitments) | |
| } |
Spotted by Graphite Agent
Is this helpful? React 👍 or 👎 to let us know.
Cargo.toml
Outdated
| ark-ec = { git = "https://github.com/a16z/arkworks-algebra", branch = "dev/twist-shout" } | ||
| ark-serialize = { git = "https://github.com/a16z/arkworks-algebra", branch = "dev/twist-shout" } | ||
| allocative = { git = "https://github.com/facebookexperimental/allocative", rev = "85b773d85d526d068ce94724ff7a7b81203fc95e" } | ||
| dory-pcs = { git = "https://github.com/a16z/dory", branch = "dev/twist-shout" } |
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.
Inconsistency between Cargo.toml and Cargo.lock for dory-pcs dependency. Cargo.toml adds a patch pointing to a16z/dory branch dev/twist-shout, but Cargo.lock shows the dependency is resolved from JuI3s/dory branch compression-integration. This mismatch will cause build issues and dependency resolution failures.
# Cargo.toml line 130 adds:
dory-pcs = { git = "https://github.com/a16z/dory", branch = "dev/twist-shout" }
# But Cargo.lock shows:
source = "git+https://github.com/JuI3s/dory?branch=compression-integration#..."Update Cargo.toml to match the actual dependency being used:
dory-pcs = { git = "https://github.com/JuI3s/dory", branch = "compression-integration" }| dory-pcs = { git = "https://github.com/a16z/dory", branch = "dev/twist-shout" } | |
| dory-pcs = { git = "https://github.com/JuI3s/dory", branch = "compression-integration" } |
Spotted by Graphite Agent
Is this helpful? React 👍 or 👎 to let us know.
Cargo.toml
Outdated
| # Cryptography and Math | ||
| ark-bn254 = { git = "https://github.com/a16z/arkworks-algebra", branch = "dev/twist-shout", default-features = false } | ||
| ark-grumpkin = { git = "https://github.com/a16z/arkworks-algebra", branch = "dev/twist-shout", default-features = false } | ||
| ark-grumpkin = { git = "https://github.com/JuI3s/arkworks-algebra", branch = "compression", default-features = false } | ||
| ark-ec = { git = "https://github.com/a16z/arkworks-algebra", branch = "dev/twist-shout", default-features = false } | ||
| ark-ff = { git = "https://github.com/a16z/arkworks-algebra", branch = "dev/twist-shout", default-features = false } |
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.
Inconsistent arkworks-algebra sources will cause version conflicts. Most dependencies use a16z/arkworks-algebra branch dev/twist-shout (lines 136, 138-140) while ark-grumpkin uses JuI3s/arkworks-algebra branch compression (line 137). Since these packages are tightly coupled, mixing sources will lead to type incompatibilities and compilation failures.
# Line 136: a16z repo
ark-bn254 = { git = "https://github.com/a16z/arkworks-algebra", branch = "dev/twist-shout", ... }
# Line 137: JuI3s repo (different!)
ark-grumpkin = { git = "https://github.com/JuI3s/arkworks-algebra", branch = "compression", ... }
# Lines 138-140: back to a16z repo
ark-ec = { git = "https://github.com/a16z/arkworks-algebra", branch = "dev/twist-shout", ... }All arkworks dependencies should use the same repository and branch to ensure compatibility.
| # Cryptography and Math | |
| ark-bn254 = { git = "https://github.com/a16z/arkworks-algebra", branch = "dev/twist-shout", default-features = false } | |
| ark-grumpkin = { git = "https://github.com/a16z/arkworks-algebra", branch = "dev/twist-shout", default-features = false } | |
| ark-grumpkin = { git = "https://github.com/JuI3s/arkworks-algebra", branch = "compression", default-features = false } | |
| ark-ec = { git = "https://github.com/a16z/arkworks-algebra", branch = "dev/twist-shout", default-features = false } | |
| ark-ff = { git = "https://github.com/a16z/arkworks-algebra", branch = "dev/twist-shout", default-features = false } | |
| # Cryptography and Math | |
| ark-bn254 = { git = "https://github.com/a16z/arkworks-algebra", branch = "dev/twist-shout", default-features = false } | |
| ark-grumpkin = { git = "https://github.com/a16z/arkworks-algebra", branch = "dev/twist-shout", default-features = false } | |
| ark-ec = { git = "https://github.com/a16z/arkworks-algebra", branch = "dev/twist-shout", default-features = false } | |
| ark-ff = { git = "https://github.com/a16z/arkworks-algebra", branch = "dev/twist-shout", default-features = false } | |
Spotted by Graphite Agent
Is this helpful? React 👍 or 👎 to let us know.
6489b2a to
d1b6d0c
Compare
d1b6d0c to
b31cb94
Compare
* change default guest opt level to 3. Add env var for specifying opt level * make clippy happy
``` feat(zkvm): add proof size tracking and testing infrastructure Add comprehensive JoltProofFieldSizeTracker for measuring serialized sizes of proof components. Replace unimplemented serialization stub with no-op for testing. Minor code style improvements. ```
jolt-core/src/zkvm/verifier.rs
Outdated
| pub fn uncompressed_commitments(mut self) -> Self { | ||
| match self.proof.commitments { | ||
| JoltProofCommitments::Compressed(commitments) => { | ||
| let uncompressed_commitments = commitments | ||
| .into_iter() | ||
| .map(|commitment| commitment.into()) | ||
| .collect(); | ||
| self.proof.commitments = | ||
| JoltProofCommitments::Uncompressed(uncompressed_commitments); | ||
| self | ||
| } | ||
| JoltProofCommitments::Uncompressed(_) => self, | ||
| } | ||
| } | ||
|
|
||
| #[tracing::instrument(skip_all)] | ||
| pub fn verify(mut self) -> Result<(), anyhow::Error> { | ||
| // Uncompress commitments if they are compressed | ||
| self = self.uncompressed_commitments(); | ||
|
|
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.
Critical transcript mismatch bug: The verifier converts compressed commitments to uncompressed before appending them to the transcript (lines 157-158), but the prover appends the original compressed commitments to the transcript (lines 476-479 in prover.rs). This causes a transcript mismatch that will always fail verification.
Fix: The transcript must append the same commitment representation that the prover used:
pub fn verify(mut self) -> Result<(), anyhow::Error> {
let _pprof_verify = pprof_scope!("verify");
// Append commitments to transcript BEFORE uncompressing
match &self.proof.commitments {
JoltProofCommitments::Compressed(commitments) => {
for commitment in commitments {
self.transcript.append_serializable(commitment);
}
}
JoltProofCommitments::Uncompressed(commitments) => {
for commitment in commitments {
self.transcript.append_serializable(commitment);
}
}
};
// NOW uncompress for verification
self = self.uncompressed_commitments();
// ... rest of verification
}Remove the duplicate transcript appending at lines 179-188 since commitments are now appended above.
| pub fn uncompressed_commitments(mut self) -> Self { | |
| match self.proof.commitments { | |
| JoltProofCommitments::Compressed(commitments) => { | |
| let uncompressed_commitments = commitments | |
| .into_iter() | |
| .map(|commitment| commitment.into()) | |
| .collect(); | |
| self.proof.commitments = | |
| JoltProofCommitments::Uncompressed(uncompressed_commitments); | |
| self | |
| } | |
| JoltProofCommitments::Uncompressed(_) => self, | |
| } | |
| } | |
| #[tracing::instrument(skip_all)] | |
| pub fn verify(mut self) -> Result<(), anyhow::Error> { | |
| // Uncompress commitments if they are compressed | |
| self = self.uncompressed_commitments(); | |
| pub fn uncompressed_commitments(mut self) -> Self { | |
| match self.proof.commitments { | |
| JoltProofCommitments::Compressed(commitments) => { | |
| let uncompressed_commitments = commitments | |
| .into_iter() | |
| .map(|commitment| commitment.into()) | |
| .collect(); | |
| self.proof.commitments = | |
| JoltProofCommitments::Uncompressed(uncompressed_commitments); | |
| self | |
| } | |
| JoltProofCommitments::Uncompressed(_) => self, | |
| } | |
| } | |
| #[tracing::instrument(skip_all)] | |
| pub fn verify(mut self) -> Result<(), anyhow::Error> { | |
| let _pprof_verify = pprof_scope!("verify"); | |
| // Append commitments to transcript BEFORE uncompressing | |
| match &self.proof.commitments { | |
| JoltProofCommitments::Compressed(commitments) => { | |
| for commitment in commitments { | |
| self.transcript.append_serializable(commitment); | |
| } | |
| } | |
| JoltProofCommitments::Uncompressed(commitments) => { | |
| for commitment in commitments { | |
| self.transcript.append_serializable(commitment); | |
| } | |
| } | |
| }; | |
| // NOW uncompress for verification | |
| self = self.uncompressed_commitments(); |
Spotted by Graphite Agent
Is this helpful? React 👍 or 👎 to let us know.
Implement torus-based compression for GT elements in Dory PCS, reducing proof and commitment sizes. NOTE: More changes are pending. Changes: - Add CompressedArkDoryProof with custom CanonicalSerialize/Deserialize that uses ArkGTCompressed instead of ArkGT for GT elements - Add ArkGTCompressed wrapper around CompressedFq12 with DorySerialize/ DoryDeserialize and Valid trait implementations - Add CompressedCommitmentScheme trait to CommitmentScheme for schemes that support compressed proofs - Implement CompressedPairingCurve for JoltBn254 with compressed multi- pairing - Fix Valid::check() for ArkGTCompressed by checking inner Fq2 elements since CompressedFq12 doesn't implement ark_serialize::Valid This enables smaller proof sizes by using torus compression for GT elements in the BN254 pairing, which compresses 12 field elements down to 4 field elements.
No description provided.