Skip to content

Conversation

@JuI3s
Copy link
Contributor

@JuI3s JuI3s commented Nov 26, 2025

No description provided.

Comment on lines 77 to 97
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)
}
Copy link
Contributor

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.

Suggested change
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

Fix in Graphite


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" }
Copy link
Contributor

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" }
Suggested change
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

Fix in Graphite


Is this helpful? React 👍 or 👎 to let us know.

Cargo.toml Outdated
Comment on lines 136 to 140
# 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 }
Copy link
Contributor

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.

Suggested change
# 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

Fix in Graphite


Is this helpful? React 👍 or 👎 to let us know.

@JuI3s JuI3s force-pushed the compression-integration branch from 6489b2a to d1b6d0c Compare November 27, 2025 17:59
@JuI3s JuI3s force-pushed the compression-integration branch from d1b6d0c to b31cb94 Compare November 27, 2025 18:00
@0xAndoroid 0xAndoroid changed the title Compression integration (draft) Compression integration (draft) [JOLT-191] Dec 1, 2025
@markosg04 markosg04 self-requested a review December 1, 2025 16:30
mathmasterzach and others added 6 commits December 1, 2025 22:27
* 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.
```
Comment on lines 140 to 159
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();

Copy link
Contributor

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.

Suggested change
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

Fix in Graphite


Is this helpful? React 👍 or 👎 to let us know.

JuI3s added 6 commits December 2, 2025 20:04
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.
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