Skip to content

Commit

Permalink
refactor: move proof pieces used by ProofExprs and ProofPlans to …
Browse files Browse the repository at this point in the history
…`proof_gadgets`
  • Loading branch information
iajoiner committed Dec 16, 2024
1 parent c8ac34f commit 80e5ebc
Show file tree
Hide file tree
Showing 11 changed files with 23 additions and 22 deletions.
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};
#[cfg(all(test, feature = "blitzar"))]
mod sign_expr_test;
pub mod range_check;
#[cfg(all(test, feature = "blitzar"))]
pub mod range_check_test_plan;
Original file line number Diff line number Diff line change
Expand Up @@ -403,11 +403,11 @@ 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},
},
};
use bumpalo::Bump;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,14 @@ 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,
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;

0 comments on commit 80e5ebc

Please sign in to comment.