Skip to content
This repository has been archived by the owner on Aug 15, 2024. It is now read-only.

Crates.io 0.8.0 release #59

Merged
merged 6 commits into from
Aug 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ homepage = "https://github.com/matter-labs/bellman"
license = "MIT/Apache-2.0"
name = "bellman_ce"
repository = "https://github.com/matter-labs/bellman"
version = "0.7.0"
version = "0.8.0"
edition = "2018"

[lib]
Expand All @@ -33,8 +33,8 @@ tiny-keccak = {version = "1.5", optional = true}
blake2-rfc = {version = "0.2.18", optional = true}
blake2s_simd = {version = "0.5"}
lazy_static = {version = "1", optional = true}
blake2s_const = {version = "=0.7", optional = true, path = "./src/plonk/blake2_const/blake2s/"}
hex = "0.4.3"
blake2s_const = {version = "=0.8.0", optional = true, path = "./src/plonk/blake2_const/blake2s/"}
hex = "0.4"

[features]
default = ["multicore", "plonk"]
Expand Down
2 changes: 1 addition & 1 deletion src/plonk/better_better_cs/cs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@

pub trait Circuit<E: Engine> {
type MainGate: MainGate<E>;
fn synthesize<CS: ConstraintSystem<E>>(&self, cs: &mut CS) -> Result<(), SynthesisError>;
fn synthesize<CS: ConstraintSystem<E> + 'static>(&self, cs: &mut CS) -> Result<(), SynthesisError>;
fn declare_used_gates() -> Result<Vec<Box<dyn GateInternal<E>>>, SynthesisError> {
Ok(
vec![Self::MainGate::default().into_internal()]
Expand Down Expand Up @@ -519,14 +519,14 @@
let rotated = if let Some(lde) = lde_without_dilation.as_ref() {
let rotation_factor = dilation_value * lde_factor;
let f = lde.as_ref().clone_shifted_assuming_bitreversed(rotation_factor, worker)?;
drop(lde);

Check warning on line 522 in src/plonk/better_better_cs/cs.rs

View workflow job for this annotation

GitHub Actions / cargo build and test

calls to `std::mem::drop` with a reference instead of an owned value does nothing

Check warning on line 522 in src/plonk/better_better_cs/cs.rs

View workflow job for this annotation

GitHub Actions / cargo build and test

calls to `std::mem::drop` with a reference instead of an owned value does nothing

Some(f)
} else {
None
};

drop(lde_without_dilation);

Check warning on line 529 in src/plonk/better_better_cs/cs.rs

View workflow job for this annotation

GitHub Actions / cargo build and test

calls to `std::mem::drop` with a value that implements `Copy` does nothing

Check warning on line 529 in src/plonk/better_better_cs/cs.rs

View workflow job for this annotation

GitHub Actions / cargo build and test

calls to `std::mem::drop` with a value that implements `Copy` does nothing

if let Some(f) = rotated {
let proxy = PolynomialProxy::from_owned(f);
Expand Down
47 changes: 47 additions & 0 deletions src/plonk/better_better_cs/proof/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,53 @@ impl<E: Engine, C: Circuit<E>> Proof<E, C> {

Ok(new)
}

pub unsafe fn redefine_circuit<C2: Circuit<E, MainGate = C::MainGate>>(mut self) -> Proof<E, C2> {
let mut new = Proof::<E, C2>::empty();

// it's still possible that lookups are different
assert_eq!(C::declare_used_gates().unwrap(), C2::declare_used_gates().unwrap());

new.n = self.n;
new.inputs = std::mem::replace(&mut self.inputs, vec![]);
new.state_polys_commitments = std::mem::replace(&mut self.state_polys_commitments, vec![]);
new.witness_polys_commitments = std::mem::replace(&mut self.witness_polys_commitments, vec![]);
new.copy_permutation_grand_product_commitment = std::mem::replace(&mut self.copy_permutation_grand_product_commitment, E::G1Affine::zero());

new.lookup_s_poly_commitment = std::mem::replace(&mut self.lookup_s_poly_commitment, None);
new.lookup_grand_product_commitment = std::mem::replace(&mut self.lookup_grand_product_commitment, None);

new.quotient_poly_parts_commitments = std::mem::replace(&mut self.quotient_poly_parts_commitments, vec![]);

new.state_polys_openings_at_z = std::mem::replace(&mut self.state_polys_openings_at_z, vec![]);
new.state_polys_openings_at_dilations = std::mem::replace(&mut self.state_polys_openings_at_dilations, vec![]);
new.witness_polys_openings_at_z = std::mem::replace(&mut self.witness_polys_openings_at_z, vec![]);
new.witness_polys_openings_at_dilations = std::mem::replace(&mut self.witness_polys_openings_at_dilations, vec![]);

new.gate_setup_openings_at_z = std::mem::replace(&mut self.gate_setup_openings_at_z, vec![]);
new.gate_selectors_openings_at_z = std::mem::replace(&mut self.gate_selectors_openings_at_z, vec![]);

new.copy_permutation_polys_openings_at_z = std::mem::replace(&mut self.copy_permutation_polys_openings_at_z, vec![]);
new.copy_permutation_grand_product_opening_at_z_omega = std::mem::replace(&mut self.copy_permutation_grand_product_opening_at_z_omega, E::Fr::zero());

new.lookup_s_poly_opening_at_z_omega = std::mem::replace(&mut self.lookup_s_poly_opening_at_z_omega, None);
new.lookup_grand_product_opening_at_z_omega = std::mem::replace(&mut self.lookup_grand_product_opening_at_z_omega, None);

new.lookup_t_poly_opening_at_z = std::mem::replace(&mut self.lookup_t_poly_opening_at_z, None);
new.lookup_t_poly_opening_at_z_omega = std::mem::replace(&mut self.lookup_t_poly_opening_at_z_omega, None);

new.lookup_selector_poly_opening_at_z = std::mem::replace(&mut self.lookup_selector_poly_opening_at_z, None);
new.lookup_table_type_poly_opening_at_z = std::mem::replace(&mut self.lookup_table_type_poly_opening_at_z, None);

new.quotient_poly_opening_at_z = std::mem::replace(&mut self.quotient_poly_opening_at_z, E::Fr::zero());

new.linearization_poly_opening_at_z = std::mem::replace(&mut self.linearization_poly_opening_at_z, E::Fr::zero());

new.opening_proof_at_z = std::mem::replace(&mut self.opening_proof_at_z, E::G1Affine::zero());
new.opening_proof_at_z_omega = std::mem::replace(&mut self.opening_proof_at_z_omega, E::G1Affine::zero());

new
}
}

use super::cs::*;
Expand Down
5 changes: 4 additions & 1 deletion src/plonk/better_better_cs/setup/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use std::io::{Read, Write};

use crate::plonk::better_cs::keys::*;

#[derive(Clone, PartialEq, Eq)]
#[derive(Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub struct Setup<E: Engine, C: Circuit<E>> {
pub n: usize,
pub num_inputs: usize,
Expand All @@ -38,6 +38,9 @@ pub struct Setup<E: Engine, C: Circuit<E>> {

pub non_residues: Vec<E::Fr>,

#[serde(skip_serializing,skip_deserializing, default)]
#[serde(bound(serialize = ""))]
#[serde(bound(deserialize = ""))]
_marker: std::marker::PhantomData<C>
}

Expand Down
2 changes: 1 addition & 1 deletion src/plonk/blake2_const/blake2s/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "blake2s_const"
version = "0.7.0"
version = "0.8.0"
authors = ["Jack O'Connor"]
description = "a pure Rust BLAKE2s implementation with dynamic SIMD"
license = "MIT"
Expand Down
Loading