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

refactor: move proof pieces used by ProofExprs and ProofPlans to proof_gadgets #433

Merged
merged 2 commits into from
Dec 16, 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
1 change: 1 addition & 0 deletions crates/proof-of-sql/src/sql/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ pub mod parse;
pub mod postprocessing;
pub mod proof;
pub mod proof_exprs;
pub mod proof_gadgets;
pub mod proof_plans;
12 changes: 7 additions & 5 deletions crates/proof-of-sql/src/sql/proof_exprs/inequality_expr.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
use super::{
prover_evaluate_equals_zero, prover_evaluate_or, prover_evaluate_sign,
result_evaluate_equals_zero, result_evaluate_or, result_evaluate_sign,
scale_and_add_subtract_eval, scale_and_subtract, verifier_evaluate_equals_zero,
verifier_evaluate_or, verifier_evaluate_sign, DynProofExpr, ProofExpr,
prover_evaluate_equals_zero, prover_evaluate_or, result_evaluate_equals_zero,
result_evaluate_or, scale_and_add_subtract_eval, scale_and_subtract,
verifier_evaluate_equals_zero, verifier_evaluate_or, DynProofExpr, ProofExpr,
};
use crate::{
base::{
Expand All @@ -11,7 +10,10 @@ use crate::{
proof::ProofError,
scalar::Scalar,
},
sql::proof::{FinalRoundBuilder, VerificationBuilder},
sql::{
proof::{FinalRoundBuilder, VerificationBuilder},
proof_gadgets::{prover_evaluate_sign, result_evaluate_sign, verifier_evaluate_sign},
},
utils::log,
};
use alloc::boxed::Box;
Expand Down
10 changes: 0 additions & 10 deletions crates/proof-of-sql/src/sql/proof_exprs/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,6 @@ use multiply_expr::MultiplyExpr;
#[cfg(all(test, feature = "blitzar"))]
mod multiply_expr_test;

mod bitwise_verification;
use bitwise_verification::{verify_constant_abs_decomposition, verify_constant_sign_decomposition};
#[cfg(test)]
mod bitwise_verification_test;

mod dyn_proof_expr;
pub(crate) use dyn_proof_expr::DynProofExpr;

Expand Down Expand Up @@ -69,11 +64,6 @@ use equals_expr::{
#[cfg(all(test, feature = "blitzar"))]
mod equals_expr_test;

mod sign_expr;
use sign_expr::{prover_evaluate_sign, result_evaluate_sign, verifier_evaluate_sign};
#[cfg(all(test, feature = "blitzar"))]
mod sign_expr_test;

mod table_expr;
pub(crate) use table_expr::TableExpr;

Expand Down
12 changes: 12 additions & 0 deletions crates/proof-of-sql/src/sql/proof_gadgets/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
//! This module contains shared proof logic for multiple `ProofExpr` / `ProofPlan` implementations.
mod bitwise_verification;
use bitwise_verification::{verify_constant_abs_decomposition, verify_constant_sign_decomposition};
#[cfg(test)]
mod bitwise_verification_test;
mod sign_expr;
pub(crate) use sign_expr::{prover_evaluate_sign, result_evaluate_sign, verifier_evaluate_sign};
pub mod range_check;
#[cfg(all(test, feature = "blitzar"))]
pub mod range_check_test;
#[cfg(all(test, feature = "blitzar"))]
mod sign_expr_test;
Original file line number Diff line number Diff line change
Expand Up @@ -403,12 +403,10 @@ where

#[cfg(test)]
mod tests {
use super::*;
use crate::{
base::scalar::{Curve25519Scalar as S, Scalar},
sql::{
proof::FinalRoundBuilder,
proof_plans::range_check::{decompose_scalar_to_words, get_logarithmic_derivative},
},
sql::proof::FinalRoundBuilder,
};
use bumpalo::Bump;
use num_traits::Inv;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,15 +92,13 @@ impl ProofPlan for RangeCheckTestPlan {

#[cfg(all(test, feature = "blitzar"))]
mod tests {

use super::*;
use crate::{
base::database::{
owned_table_utility::{owned_table, scalar},
ColumnRef, ColumnType, OwnedTableTestAccessor,
},
sql::{
proof::VerifiableQueryResult, proof_plans::range_check_test_plan::RangeCheckTestPlan,
},
sql::proof::VerifiableQueryResult,
};
use blitzar::proof::InnerProductProof;

Expand Down
4 changes: 0 additions & 4 deletions crates/proof-of-sql/src/sql/proof_plans/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,3 @@ pub use dyn_proof_plan::DynProofPlan;

#[cfg(test)]
mod demo_mock_plan;

pub mod range_check;
#[cfg(all(test, feature = "blitzar"))]
pub mod range_check_test_plan;
Loading