Skip to content
Draft
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
280 changes: 140 additions & 140 deletions Cargo.lock

Large diffs are not rendered by default.

5 changes: 1 addition & 4 deletions mp2-common/src/digest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,10 +189,7 @@ mod test {
};
use crate::utils::TryIntoBool;
use mp2_test::circuit::{run_circuit, UserCircuit};
use plonky2::{
field::types::Sample,
iop::witness::PartialWitness,
};
use plonky2::{field::types::Sample, iop::witness::PartialWitness};
use plonky2_ecgfp5::{
curve::curve::Point,
gadgets::curve::{CircuitBuilderEcGFp5, PartialWitnessCurve},
Expand Down
11 changes: 3 additions & 8 deletions mp2-common/src/group_hashing/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -234,11 +234,8 @@ pub fn cond_field_hashed_scalar_mul(cond: bool, mul: Point, base: Point) -> Poin
#[cfg(test)]
mod test {

use plonky2::{
field::types::Sample,
iop::witness::PartialWitness,
};

use plonky2::{field::types::Sample, iop::witness::PartialWitness};

use plonky2_ecgfp5::{
curve::curve::{Point, WeierstrassPoint},
gadgets::curve::{CircuitBuilderEcGFp5, CurveTarget, PartialWitnessCurve},
Expand All @@ -251,9 +248,7 @@ mod test {
};
use mp2_test::circuit::{run_circuit, UserCircuit};

use super::{
circuit_hashed_scalar_mul, field_hashed_scalar_mul, weierstrass_to_point,
};
use super::{circuit_hashed_scalar_mul, field_hashed_scalar_mul, weierstrass_to_point};

#[derive(Clone, Debug)]
struct TestScalarMul {
Expand Down
1 change: 1 addition & 0 deletions mp2-common/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
//! Utility functions and gadgets

#![allow(incomplete_features)]
#![feature(generic_const_exprs)]
#![feature(generic_arg_infer)]
#![feature(const_for)]
Expand Down
1 change: 1 addition & 0 deletions mp2-v1/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
//! Circuits for v1 of Lagrange Proof Network (LPN)

#![allow(incomplete_features)]
// Add this to allow generic const expressions, e.g. `PAD_LEN(NODE_LEN)`.
#![feature(generic_const_exprs)]
// Add this so we don't need to always specify const generic in generic
Expand Down
6 changes: 3 additions & 3 deletions mp2-v1/tests/common/cases/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

use contract::Contract;
use mp2_v1::values_extraction::{
identifier_for_mapping_key_column, identifier_for_mapping_value_column,
identifier_single_var_column,
};
identifier_for_mapping_key_column, identifier_for_mapping_value_column,
identifier_single_var_column,
};
use table_source::{ContractExtractionArgs, TableSource};

use super::table::Table;
Expand Down
1 change: 1 addition & 0 deletions recursion-framework/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// #![warn(missing_docs)]
#![allow(incomplete_features)]
#![feature(generic_const_exprs)]

//! This crate provides a framework to build circuits that needs to recursively verify proofs
Expand Down
3 changes: 2 additions & 1 deletion verifiable-db/src/cells_tree/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ use serde::{Deserialize, Serialize};
use std::array;

type LeafInput = LeafCircuit;
type ChildInput = ProofInputSerialized<Cell>;
pub type ChildInput = ProofInputSerialized<Cell>;

/// CircuitInput is a wrapper around the different specialized circuits that can
/// be used to prove a node recursively.
Expand Down Expand Up @@ -204,6 +204,7 @@ impl PublicParameters {
}

/// Get the proof of an empty node.
#[allow(dead_code)]
pub(crate) fn empty_node_proof(&self) -> &ProofWithVK {
&self.empty_node_proof
}
Expand Down
5 changes: 4 additions & 1 deletion verifiable-db/src/cells_tree/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ pub use public_inputs::PublicInputs;
/// A cell represents a column || value tuple. it can be given in the cells tree or as the
/// secondary index value in the row tree.
#[derive(Clone, Debug, Serialize, Deserialize, Constructor)]
pub(crate) struct Cell {
pub struct Cell {
/// identifier of the column for the secondary index
pub(crate) identifier: F,
/// secondary index value
Expand All @@ -48,13 +48,16 @@ impl Cell {
pw.set_target(wires.identifier, self.identifier);
pw.set_bool_target(wires.is_multiplier, self.is_multiplier);
}
#[allow(dead_code)]
pub(crate) fn digest(&self) -> Digest {
map_to_curve_point(&self.to_fields())
}
#[allow(dead_code)]
pub(crate) fn split_digest(&self) -> SplitDigestPoint {
let digest = self.digest();
SplitDigestPoint::from_single_digest_point(digest, self.is_multiplier)
}
#[allow(dead_code)]
pub(crate) fn split_and_accumulate_digest(
&self,
child_digest: SplitDigestPoint,
Expand Down
1 change: 1 addition & 0 deletions verifiable-db/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Add this to allow generic const expressions, e.g. `PAD_LEN(NODE_LEN)`.

#![allow(incomplete_features)]
#![feature(generic_const_exprs)]
// Add this to allow generic const items, e.g. `const IO_LEN<const MAX_NUM: usize>`
#![feature(generic_const_items)]
Expand Down
35 changes: 7 additions & 28 deletions verifiable-db/src/query/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -839,12 +839,6 @@ mod tests {
const MAX_NUM_PREDICATE_OPS: usize = 20;
const MAX_NUM_RESULT_OPS: usize = 20;
const MAX_NUM_RESULTS: usize = 10;
let column_ids = (0..NUM_COLUMNS)
.map(|_| {
let id: u32 = rng.gen();
id as u64
})
.collect_vec();
let column_ids = ColumnIDs::new(
F::rand().to_canonical_u64(),
F::rand().to_canonical_u64(),
Expand Down Expand Up @@ -1392,11 +1386,6 @@ mod tests {
column_values[0][0],
);
let hash_0 = node_info_0.compute_node_hash(primary_index_id);
let column_cells = column_values[0]
.iter()
.zip(column_ids.to_vec().iter())
.map(|(&value, &id)| ColumnCell::new(id.to_canonical_u64(), value))
.collect_vec();
// compute hashes associated to query, which are needed as inputs
let query_hashes = QueryHashNonExistenceCircuits::new::<
MAX_NUM_COLUMNS,
Expand Down Expand Up @@ -1501,11 +1490,6 @@ mod tests {

// generate non-existence proof starting from intermediate node (i.e., node 1) rather than a leaf node
// generate proof with non-existence circuit for node 1
let column_cells = column_values[1]
.iter()
.zip(column_ids.to_vec().iter())
.map(|(&value, &id)| ColumnCell::new(id.to_canonical_u64(), value))
.collect_vec();
// compute hashes associated to query, which are needed as inputs
let query_hashes = QueryHashNonExistenceCircuits::new::<
MAX_NUM_COLUMNS,
Expand Down Expand Up @@ -1604,11 +1588,6 @@ mod tests {
column_values[2][1],
);
let hash_2 = node_info_2.compute_node_hash(secondary_index_id);
let column_cells = column_values[2]
.iter()
.zip(column_ids.to_vec().iter())
.map(|(&value, &id)| ColumnCell::new(id.to_canonical_u64(), value))
.collect_vec();
// compute hashes associated to query, which are needed as inputs
let query_hashes = QueryHashNonExistenceCircuits::new::<
MAX_NUM_COLUMNS,
Expand Down Expand Up @@ -1679,28 +1658,28 @@ mod tests {
assert_eq!(hash_1, get_tree_hash_from_proof(&proof_1),);

// generate proof for node A (leaf of index tree)
let node_info_A = NodeInfo::new(
let node_info_a = NodeInfo::new(
&HashOutput::try_from(hash_1.to_bytes()).unwrap(),
None,
None,
column_values[0][0],
column_values[0][0],
column_values[0][0],
);
let hash_A = node_info_A.compute_node_hash(primary_index_id);
let hash_a = node_info_a.compute_node_hash(primary_index_id);
let subtree_proof = SubProof::new_embedded_tree_proof(proof_1).unwrap();
let input = Input::new_single_path(
subtree_proof,
None,
None,
node_info_A.clone(),
node_info_a.clone(),
false,
&query_bounds,
)
.unwrap();
let proof_A = params.generate_proof(input).unwrap();
let proof_a = params.generate_proof(input).unwrap();
// check hash
assert_eq!(hash_A, get_tree_hash_from_proof(&proof_A),);
assert_eq!(hash_a, get_tree_hash_from_proof(&proof_a),);

// generate proof for node B rows tree
// all the nodes are in the range, so we generate proofs for each of the nodes
Expand Down Expand Up @@ -1730,14 +1709,14 @@ mod tests {
// generate proof for node B of the index tree (root node)
let node_info_root = NodeInfo::new(
&HashOutput::try_from(hash_4.to_bytes()).unwrap(),
Some(&HashOutput::try_from(hash_A.to_bytes()).unwrap()),
Some(&HashOutput::try_from(hash_a.to_bytes()).unwrap()),
None,
column_values[4][0],
column_values[0][0],
column_values[5][0],
);
let input = Input::new_partial_node(
proof_A,
proof_a,
proof_4,
None,
ChildPosition::Left,
Expand Down
1 change: 1 addition & 0 deletions verifiable-db/src/query/computational_hash_ids.rs
Original file line number Diff line number Diff line change
Expand Up @@ -632,6 +632,7 @@ impl<F: RichField> FromFields<F> for AggregationOperation {

impl AggregationOperation {
/// Return the identity value for `self` operation
#[allow(dead_code)]
pub(crate) fn identity_value(&self) -> Vec<F> {
match self {
AggregationOperation::SumOp => U256::ZERO.to_fields(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,6 @@ mod tests {
utils::{gen_random_field_hash, gen_random_u256},
};
use plonky2::{
field::types::Field,
iop::{
target::{BoolTarget, Target},
witness::{PartialWitness, WitnessWrite},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,7 @@ impl ResultStructure {
/// `column_values` as the operands for the operations having `InputOperand::Column`
/// operands, and the provided `placeholders` for the operations having `InputOperand::Placeholder`
/// operands.
#[cfg(test)]
pub(crate) fn compute_output_values(
&self,
column_values: &[U256],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -967,14 +967,6 @@ fn dummy_placeholder(placeholders: &Placeholders) -> Placeholder {
}
}

fn dummy_placeholder_from_query_bounds(query_bounds: &QueryBounds) -> Placeholder {
let placeholders = Placeholders::new_empty(
query_bounds.min_query_primary(),
query_bounds.max_query_primary(),
);
dummy_placeholder(&placeholders)
}

pub(crate) fn dummy_placeholder_id() -> PlaceholderId {
PlaceholderIdentifier::default()
}
Expand Down Expand Up @@ -1169,7 +1161,7 @@ mod tests {
utils::gen_random_u256,
};
use plonky2::{
field::types::{Field, PrimeField64, Sample},
field::types::{PrimeField64, Sample},
hash::hashing::hash_n_to_hash_no_pad,
iop::witness::PartialWitness,
plonk::{circuit_builder::CircuitBuilder, config::GenericHashOut},
Expand Down
9 changes: 2 additions & 7 deletions verifiable-db/src/row_tree/full_node.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
use derive_more::{From, Into};
use mp2_common::{
default_config,
poseidon::H,
proof::ProofWithVK,
public_inputs::PublicInputCommon,
u256::CircuitBuilderU256,
utils::ToTargets,
C, D, F,
default_config, poseidon::H, proof::ProofWithVK, public_inputs::PublicInputCommon,
u256::CircuitBuilderU256, utils::ToTargets, C, D, F,
};
use plonky2::{
iop::{target::Target, witness::PartialWitness},
Expand Down
5 changes: 1 addition & 4 deletions verifiable-db/src/row_tree/leaf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@ use mp2_common::{
C, D, F,
};
use plonky2::{
iop::{
target::Target,
witness::PartialWitness,
},
iop::{target::Target, witness::PartialWitness},
plonk::{circuit_builder::CircuitBuilder, proof::ProofWithPublicInputsTarget},
};
use recursion_framework::{
Expand Down
1 change: 0 additions & 1 deletion verifiable-db/src/row_tree/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

mod api;
mod full_node;
mod leaf;
Expand Down