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

Commit

Permalink
Crates.io 0.8.0 release (#59)
Browse files Browse the repository at this point in the history
# What ❔

<!-- What are the changes this PR brings about? -->
<!-- Example: This PR adds a PR template to the repo. -->
<!-- (For bigger PRs adding more context is appreciated) -->

## Why ❔

<!-- Why are these changes done? What goal do they contribute to? What
are the principles behind them? -->
<!-- Example: PR templates ensure PR reviewers, observers, and future
iterators are in context about the evolution of repos. -->

## Checklist

<!-- Check your PR fulfills the following items. -->
<!-- For draft PRs check the boxes as you complete them. -->

- [ ] PR title corresponds to the body of PR (we generate changelog
entries from PRs).
- [ ] Tests for the changes have been added / updated.
- [ ] Documentation comments have been added / updated.
- [ ] Code has been formatted via `zk fmt` and `zk lint`.

---------

Co-authored-by: Oles Holembovskyy <oh@matterlabs.dev>
Co-authored-by: Yury Akudovich <ya@matterlabs.dev>
  • Loading branch information
3 people authored Aug 5, 2024
1 parent d1bcfdf commit 5b4107e
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 6 deletions.
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 @@ impl SynthesisMode for SynthesisModeTesting {

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

0 comments on commit 5b4107e

Please sign in to comment.