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

experiment(ark-zkey): Use rkyv for faster loading #118

Closed
wants to merge 1 commit into from

Conversation

oskarth
Copy link
Collaborator

@oskarth oskarth commented Mar 23, 2024

Naive experiment for #25

Doesn't currently work due to:

error[E0277]: the trait bound `ProvingKey<ark_ec::models::bn::Bn<ark_bn254::Config>>: Archive` is not satisfied
  --> ark-zkey/src/lib.rs:22:30
   |
22 | #[derive(Archive, Serialize, Deserialize, Clone, Debug, PartialEq)]
   |                              ^^^^^^^^^^^ the trait `Archive` is not implemented for `ProvingKey<ark_ec::models::bn::Bn<ark_bn254::Config>>`
   |
   = help: the following other types implement trait `Archive`:
             bool
             char
             isize
             i8
             i16
             i32
             i64
             i128
           and 139 others
   = help: see issue #48214
   = note: this error originates in the derive macro `Deserialize` (in Nightly builds, run with -Z macro-backtrace for more info)

Unclear how complex it is to fix, need to either:

  • Implement Archive manually for ProvingKey<ark_ec::models::bn::Bn<ark_bn254::Config>>
  • Use a wrapper type
  • Or a combination thereof

ProverKey is:

/// The prover key for for the Groth16 zkSNARK.
#[derive(Clone, Debug, PartialEq, CanonicalSerialize, CanonicalDeserialize)]
pub struct ProvingKey<E: Pairing> {
    /// The underlying verification key.
    pub vk: VerifyingKey<E>,
    /// The element `beta * G` in `E::G1`.
    pub beta_g1: E::G1Affine,
    /// The element `delta * G` in `E::G1`.
    pub delta_g1: E::G1Affine,
    /// The elements `a_i * G` in `E::G1`.
    pub a_query: Vec<E::G1Affine>,
    /// The elements `b_i * G` in `E::G1`.
    pub b_g1_query: Vec<E::G1Affine>,
    /// The elements `b_i * H` in `E::G2`.
    pub b_g2_query: Vec<E::G2Affine>,
    /// The elements `h_i * G` in `E::G1`.
    pub h_query: Vec<E::G1Affine>,
    /// The elements `l_i * G` in `E::G1`.
    pub l_query: Vec<E::G1Affine>,
}

Doesn't currently work due to:

error[E0277]: the trait bound `ProvingKey<ark_ec::models::bn::Bn<ark_bn254::Config>>: Archive` is not satisfied
  --> ark-zkey/src/lib.rs:22:30
   |
22 | #[derive(Archive, Serialize, Deserialize, Clone, Debug, PartialEq)]
   |                              ^^^^^^^^^^^ the trait `Archive` is not implemented for `ProvingKey<ark_ec::models::bn::Bn<ark_bn254::Config>>`
   |
   = help: the following other types implement trait `Archive`:
             bool
             char
             isize
             i8
             i16
             i32
             i64
             i128
           and 139 others
   = help: see issue #48214
   = note: this error originates in the derive macro `Deserialize` (in Nightly builds, run with -Z macro-backtrace for more info)

Unclear how complex it is to fix, need to either:
- Implement Archive manually for `ProvingKey<ark_ec::models::bn::Bn<ark_bn254::Config>>`
- Use a wrapper type
@oskarth
Copy link
Collaborator Author

oskarth commented May 22, 2024

Less relevant now, see #118 though

@oskarth oskarth closed this May 22, 2024
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.

1 participant