Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 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
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions groth16-framework/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ itertools.workspace = true
rand.workspace = true
serial_test.workspace = true
sha2.workspace = true
mp2_test = { path = "../mp2-test" }

recursion_framework = { path = "../recursion-framework" }
verifiable-db = { path = "../verifiable-db" }
6 changes: 5 additions & 1 deletion groth16-framework/tests/common/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
use super::{NUM_PREPROCESSING_IO, NUM_QUERY_IO};
use groth16_framework::{compile_and_generate_assets, utils::clone_circuit_data};
use mp2_common::{C, D, F};
use mp2_test::circuit::TestDummyCircuit;
use recursion_framework::framework_testing::TestingRecursiveCircuits;
use verifiable_db::{
api::WrapCircuitParams,
query::pi_len,
revelation::api::Parameters as RevelationParameters,
test_utils::{
INDEX_TREE_MAX_DEPTH, MAX_NUM_COLUMNS, MAX_NUM_ITEMS_PER_OUTPUT, MAX_NUM_OUTPUTS,
Expand Down Expand Up @@ -40,6 +42,8 @@ impl TestContext {

// Generate a fake query circuit set.
let query_circuits = TestingRecursiveCircuits::<F, C, D, NUM_QUERY_IO>::default();
let dummy_universal_circuit =
TestDummyCircuit::<{ pi_len::<MAX_NUM_ITEMS_PER_OUTPUT>() }>::build();

// Create the revelation parameters.
let revelation_params = RevelationParameters::<
Expand All @@ -53,7 +57,7 @@ impl TestContext {
MAX_NUM_PLACEHOLDERS,
>::build(
query_circuits.get_recursive_circuit_set(), // unused, so we provide a dummy one
query_circuits.get_recursive_circuit_set(),
dummy_universal_circuit.circuit_data().verifier_data(),
preprocessing_circuits.get_recursive_circuit_set(),
preprocessing_circuits
.verifier_data_for_input_proofs::<1>()
Expand Down
7 changes: 1 addition & 6 deletions groth16-framework/tests/common/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,7 @@ impl TestContext {
.unwrap();
let revelation_proof = self
.revelation_params
.generate_proof(
input,
self.query_circuits.get_recursive_circuit_set(),
self.query_circuits.get_recursive_circuit_set(),
None,
)
.generate_proof(input, self.query_circuits.get_recursive_circuit_set(), None)
.unwrap();
let revelation_proof = ProofWithVK::deserialize(&revelation_proof).unwrap();
let (revelation_proof_with_pi, _) = revelation_proof.clone().into();
Expand Down
1 change: 0 additions & 1 deletion mp2-v1/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,3 @@ parsil = { path = "../parsil" }

[features]
original_poseidon = ["mp2_common/original_poseidon"]
batching_circuits = ["verifiable-db/batching_circuits"]
2 changes: 1 addition & 1 deletion mp2-v1/src/query/batching_planner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use ryhope::{
Epoch,
};
use verifiable_db::query::{
batching::{NodePath, RowInput, TreePathInputs},
api::{NodePath, RowInput, TreePathInputs},
computational_hash_ids::ColumnIDs,
universal_circuit::universal_circuit_inputs::{ColumnCell, RowCells},
};
Expand Down
48 changes: 2 additions & 46 deletions mp2-v1/src/query/planner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ use ryhope::{
use std::{fmt::Debug, future::Future};
use tokio_postgres::{row::Row as PsqlRow, types::ToSql, NoTls};
use verifiable_db::query::{
aggregation::{ChildPosition, NodeInfo, QueryBounds},
batching::TreePathInputs,
api::TreePathInputs,
utils::{ChildPosition, NodeInfo, QueryBounds},
};

use crate::indexing::{
Expand Down Expand Up @@ -375,50 +375,6 @@ impl<
}
}

/// Returns the proving plan to prove the non existence of node of the query in this row tree at
/// the epoch primary. It also returns the leaf node chosen.
///
/// The row tree is given and specialized to psql storage since that is the only official storage
/// supported.
/// The `table_name` must be the one given to parsil settings, it is the human friendly table
/// name, i.e. the vTable name.
/// The pool is to issue specific query
/// Primary is indicating the primary index over which this row tree is looked at.
/// Settings are the parsil settings corresponding to the current SQL and current table looked at.
/// Pis contain the bounds and placeholders values.
/// TODO: we should extend ryhope to offer this API directly on the tree since it's very related.
pub async fn proving_plan_for_non_existence<C>(
row_tree: &MerkleTreeKvDb<RowTree, RowPayload<BlockPrimaryIndex>, DBRowStorage>,
table_name: String,
pool: &DBPool,
primary: BlockPrimaryIndex,
settings: &ParsilSettings<C>,
bounds: &QueryBounds,
) -> anyhow::Result<(RowTreeKey, UpdateTree<RowTreeKey>)>
where
C: ContextProvider,
{
let to_be_proven_node = {
let input = NonExistenceInput {
row_tree,
table_name,
pool,
settings,
bounds: bounds.clone(),
};
input.find_row_node_for_non_existence(primary).await
}?;

let path = row_tree
// since the epoch starts at genesis we can directly give the block number !
.lineage_at(&to_be_proven_node, primary as Epoch)
.await
.expect("node doesn't have a lineage?")
.into_full_path()
.collect_vec();
let proving_tree = UpdateTree::from_paths([path], primary as Epoch);
Ok((to_be_proven_node.clone(), proving_tree))
}
/// Fetch a key `k` from a tree, assuming that the key is in the
/// tree. Therefore, it handles differently the case when `k` is not found:
/// - If `T::WIDE_LINEAGE` is true, then `k` might not be found because the
Expand Down
1 change: 0 additions & 1 deletion mp2-v1/tests/common/cases/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ use super::table::Table;

pub mod contract;
pub mod indexing;
pub mod planner;
pub mod query;
pub mod table_source;

Expand Down
Loading