Skip to content

Commit

Permalink
Merge branch 'main' into refactor/conversion-error-decimal-variant
Browse files Browse the repository at this point in the history
  • Loading branch information
Dustin-Ray authored Jun 25, 2024
2 parents bf23f3d + 55816c3 commit 198c2d3
Show file tree
Hide file tree
Showing 3 changed files with 81 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ arrow-csv = { version = "45.0" }
bit-iter = { version = "1.1.1" }
bigdecimal = { version = "0.4.5", features = ["serde"] }
blake3 = { version = "1.3.3" }
blitzar = { version = "3.0.1" }
blitzar = { version = "3.0.2" }
bumpalo = { version = "3.11.0" }
bytemuck = {version = "1.14.2" }
byte-slice-cast = { version = "1.2.1" }
Expand Down
5 changes: 1 addition & 4 deletions crates/proof-of-sql/src/sql/ast/add_subtract_expr_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,10 +167,7 @@ fn overflow_in_nonselected_rows_doesnt_error_out() {
// select a, b from sxt.t where a + b >= 0
#[test]
fn overflow_in_where_clause_doesnt_error_out() {
let data = owned_table([
bigint("a", [i64::MAX, i64::MIN + 1]),
smallint("b", [1_i16, 0]),
]);
let data = owned_table([bigint("a", [i64::MAX, i64::MIN]), smallint("b", [1_i16, 0])]);
let t = "sxt.t".parse().unwrap();
let accessor = OwnedTableTestAccessor::<InnerProductProof>::new_from_table(t, data, 0, ());
let ast: ProofPlan<RistrettoPoint> = dense_filter(
Expand Down
79 changes: 79 additions & 0 deletions crates/proof-of-sql/tests/integration_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,85 @@ fn we_can_prove_a_basic_inequality_query_with_curve25519() {
assert_eq!(owned_table_result, expected_result);
}

#[test]
#[cfg(feature = "blitzar")]
fn we_can_prove_a_basic_query_containing_extrema_with_curve25519() {
let mut accessor = OwnedTableTestAccessor::<InnerProductProof>::new_empty_with_setup(());
accessor.add_table(
"sxt.table".parse().unwrap(),
owned_table([
smallint("smallint", [i16::MIN, 0, i16::MAX]),
int("int", [i32::MIN, 0, i32::MAX]),
bigint("bigint", [i64::MIN, 0, i64::MAX]),
int128("int128", [i128::MIN, 0, i128::MAX]),
]),
0,
);
let query = QueryExpr::try_new(
"SELECT * FROM table".parse().unwrap(),
"sxt".parse().unwrap(),
&accessor,
)
.unwrap();
let (proof, serialized_result) =
QueryProof::<InnerProductProof>::new(query.proof_expr(), &accessor, &());
let owned_table_result = proof
.verify(query.proof_expr(), &accessor, &serialized_result, &())
.unwrap()
.table;
let expected_result = owned_table([
smallint("smallint", [i16::MIN, 0, i16::MAX]),
int("int", [i32::MIN, 0, i32::MAX]),
bigint("bigint", [i64::MIN, 0, i64::MAX]),
int128("int128", [i128::MIN, 0, i128::MAX]),
]);
assert_eq!(owned_table_result, expected_result);
}

#[test]
#[cfg(feature = "blitzar")]
fn we_can_prove_a_basic_query_containing_extrema_with_dory() {
let dory_prover_setup = DoryProverPublicSetup::rand(4, 3, &mut test_rng());
let dory_verifier_setup = (&dory_prover_setup).into();
let mut accessor = OwnedTableTestAccessor::<DoryEvaluationProof>::new_empty_with_setup(
dory_prover_setup.clone(),
);
accessor.add_table(
"sxt.table".parse().unwrap(),
owned_table([
smallint("smallint", [i16::MIN, 0, i16::MAX]),
int("int", [i32::MIN, 0, i32::MAX]),
bigint("bigint", [i64::MIN, 0, i64::MAX]),
int128("int128", [i128::MIN, 0, i128::MAX]),
]),
0,
);
let query = QueryExpr::try_new(
"SELECT * FROM table".parse().unwrap(),
"sxt".parse().unwrap(),
&accessor,
)
.unwrap();
let (proof, serialized_result) =
QueryProof::<DoryEvaluationProof>::new(query.proof_expr(), &accessor, &dory_prover_setup);
let owned_table_result = proof
.verify(
query.proof_expr(),
&accessor,
&serialized_result,
&dory_verifier_setup,
)
.unwrap()
.table;
let expected_result = owned_table([
smallint("smallint", [i16::MIN, 0, i16::MAX]),
int("int", [i32::MIN, 0, i32::MAX]),
bigint("bigint", [i64::MIN, 0, i64::MAX]),
int128("int128", [i128::MIN, 0, i128::MAX]),
]);
assert_eq!(owned_table_result, expected_result);
}

#[test]
#[cfg(feature = "blitzar")]
fn we_can_prove_a_query_with_arithmetic_in_where_clause_with_curve25519() {
Expand Down

0 comments on commit 198c2d3

Please sign in to comment.