From 18507877ccc932445df19fff56bd4c1600fcf178 Mon Sep 17 00:00:00 2001 From: Mehul Mathur Date: Thu, 3 Oct 2024 16:23:34 +0000 Subject: [PATCH] chore: run cargo fmt --- .../src/base/commitment/column_bounds.rs | 5 +-- .../arrow_array_to_column_conversion.rs | 5 ++- .../src/base/encode/varint_trait_test.rs | 39 ++++++++++++++++--- .../src/base/encode/zigzag_test.rs | 5 ++- .../verifiable_query_result_test_utility.rs | 5 ++- .../src/sql/proof_exprs/multiply_expr_test.rs | 20 ++++++++-- 6 files changed, 63 insertions(+), 16 deletions(-) diff --git a/crates/proof-of-sql/src/base/commitment/column_bounds.rs b/crates/proof-of-sql/src/base/commitment/column_bounds.rs index d960d05b2..bd56bf0c0 100644 --- a/crates/proof-of-sql/src/base/commitment/column_bounds.rs +++ b/crates/proof-of-sql/src/base/commitment/column_bounds.rs @@ -107,9 +107,8 @@ where (Bounds::Sharp(bounds_a), Bounds::Sharp(bounds_b)) => { Bounds::Sharp(bounds_a.union(bounds_b)) } - (Bounds::Bounded(bounds_a) | Bounds::Sharp(bounds_a), -Bounds::Bounded(bounds_b)) | -(Bounds::Bounded(bounds_a), Bounds::Sharp(bounds_b)) => { + (Bounds::Bounded(bounds_a) | Bounds::Sharp(bounds_a), Bounds::Bounded(bounds_b)) + | (Bounds::Bounded(bounds_a), Bounds::Sharp(bounds_b)) => { Bounds::Bounded(bounds_a.union(bounds_b)) } (bounds, Bounds::Empty) | (Bounds::Empty, bounds) => bounds, diff --git a/crates/proof-of-sql/src/base/database/arrow_array_to_column_conversion.rs b/crates/proof-of-sql/src/base/database/arrow_array_to_column_conversion.rs index 0e62022f1..f33485f97 100644 --- a/crates/proof-of-sql/src/base/database/arrow_array_to_column_conversion.rs +++ b/crates/proof-of-sql/src/base/database/arrow_array_to_column_conversion.rs @@ -903,7 +903,10 @@ mod tests { #[test] fn we_can_build_an_empty_column_from_an_empty_range_decimal128() { let alloc = Bump::new(); - let decimal_values = vec![12_345_678_901_234_567_890_i128, -12_345_678_901_234_567_890_i128]; + let decimal_values = vec![ + 12_345_678_901_234_567_890_i128, + -12_345_678_901_234_567_890_i128, + ]; let array: ArrayRef = Arc::new( Decimal128Array::from(decimal_values) .with_precision_and_scale(38, 0) diff --git a/crates/proof-of-sql/src/base/encode/varint_trait_test.rs b/crates/proof-of-sql/src/base/encode/varint_trait_test.rs index c30443485..94ff26e37 100644 --- a/crates/proof-of-sql/src/base/encode/varint_trait_test.rs +++ b/crates/proof-of-sql/src/base/encode/varint_trait_test.rs @@ -319,8 +319,17 @@ fn we_can_encode_and_decode_large_positive_u128() { let value: u128 = 0b110_0010101_1111111_1111111_1111111_1111111_1111111_1111111_1111111_1111111_0011100; let expected_result: &[u8] = &[ - 0b1001_1100, 0b1111_1111, 0b1111_1111, 0b1111_1111, 0b1111_1111, 0b1111_1111, 0b1111_1111, - 0b1111_1111, 0b1111_1111, 0b1001_0101, 0b0000_0110, + 0b1001_1100, + 0b1111_1111, + 0b1111_1111, + 0b1111_1111, + 0b1111_1111, + 0b1111_1111, + 0b1111_1111, + 0b1111_1111, + 0b1111_1111, + 0b1001_0101, + 0b0000_0110, ]; let result: &mut [u8] = &mut [0; 11]; assert_eq!(value.required_space(), 11); @@ -335,8 +344,17 @@ fn we_can_encode_and_decode_large_positive_i128() { let value: i128 = 0b110_0010101_1111111_1111111_1111111_1111111_1111111_1111111_1111111_1111111_001110; let expected_result: &[u8] = &[ - 0b1001_1100, 0b1111_1111, 0b1111_1111, 0b1111_1111, 0b1111_1111, 0b1111_1111, 0b1111_1111, - 0b1111_1111, 0b1111_1111, 0b1001_0101, 0b0000_0110, + 0b1001_1100, + 0b1111_1111, + 0b1111_1111, + 0b1111_1111, + 0b1111_1111, + 0b1111_1111, + 0b1111_1111, + 0b1111_1111, + 0b1111_1111, + 0b1001_0101, + 0b0000_0110, ]; let result: &mut [u8] = &mut [0; 11]; assert_eq!(value.required_space(), 11); @@ -351,8 +369,17 @@ fn we_can_encode_and_decode_large_negative_i128() { let value: i128 = -1 - 0b110_0010101_1111111_1111111_1111111_1111111_1111111_1111111_1111111_1111111_001110; let expected_result: &[u8] = &[ - 0b1001_1101, 0b1111_1111, 0b1111_1111, 0b1111_1111, 0b1111_1111, 0b1111_1111, 0b1111_1111, - 0b1111_1111, 0b1111_1111, 0b1001_0101, 0b0000_0110, + 0b1001_1101, + 0b1111_1111, + 0b1111_1111, + 0b1111_1111, + 0b1111_1111, + 0b1111_1111, + 0b1111_1111, + 0b1111_1111, + 0b1111_1111, + 0b1001_0101, + 0b0000_0110, ]; let result: &mut [u8] = &mut [0; 11]; assert_eq!(value.required_space(), 11); diff --git a/crates/proof-of-sql/src/base/encode/zigzag_test.rs b/crates/proof-of-sql/src/base/encode/zigzag_test.rs index c0860bb25..026f9502d 100644 --- a/crates/proof-of-sql/src/base/encode/zigzag_test.rs +++ b/crates/proof-of-sql/src/base/encode/zigzag_test.rs @@ -94,5 +94,8 @@ fn big_additive_inverses_that_are_smaller_than_the_input_scalars_are_encoded_as_ high: 0x1_u128, }) .into(); - assert!((-val).zigzag() == U256::from_words(0xffff_ffff_ffff_ffff_ffff_ffff_ffff_ffff_u128, 0x1_u128)); + assert!( + (-val).zigzag() + == U256::from_words(0xffff_ffff_ffff_ffff_ffff_ffff_ffff_ffff_u128, 0x1_u128) + ); } diff --git a/crates/proof-of-sql/src/sql/proof/verifiable_query_result_test_utility.rs b/crates/proof-of-sql/src/sql/proof/verifiable_query_result_test_utility.rs index db0f4f1bc..ea3b0e6e6 100644 --- a/crates/proof-of-sql/src/sql/proof/verifiable_query_result_test_utility.rs +++ b/crates/proof-of-sql/src/sql/proof/verifiable_query_result_test_utility.rs @@ -44,7 +44,10 @@ pub fn exercise_verification( // try changing intermediate commitments let commit_p = RistrettoPoint::compute_commitments( - &[CommittableColumn::BigInt(&[353_453_245_i64, 93_402_346_i64])], + &[CommittableColumn::BigInt(&[ + 353_453_245_i64, + 93_402_346_i64, + ])], 0_usize, &(), )[0]; diff --git a/crates/proof-of-sql/src/sql/proof_exprs/multiply_expr_test.rs b/crates/proof-of-sql/src/sql/proof_exprs/multiply_expr_test.rs index fbc90f75d..d76c62098 100644 --- a/crates/proof-of-sql/src/sql/proof_exprs/multiply_expr_test.rs +++ b/crates/proof-of-sql/src/sql/proof_exprs/multiply_expr_test.rs @@ -191,8 +191,14 @@ fn result_expr_can_overflow_more() { #[test] fn where_clause_can_wrap_around() { let data = owned_table([ - bigint("a", [2_357_878_470_324_616_199_i64, 2_657_439_699_204_141, 884]), - bigint("b", [31_194_601_778_911_687_i64, 1_644_425_323_726_039, 884]), + bigint( + "a", + [2_357_878_470_324_616_199_i64, 2_657_439_699_204_141, 884], + ), + bigint( + "b", + [31_194_601_778_911_687_i64, 1_644_425_323_726_039, 884], + ), bigint("c", [500_213_946_116_239_i64, 1_570_568_673_569_987, 884]), bigint("d", [211_980_999_383_887_i64, 1_056_107_792_886_999, 884]), bigint("e", [927_908_842_441_i64, 998_426_626_609_497, 884]), @@ -222,8 +228,14 @@ fn where_clause_can_wrap_around() { exercise_verification(&verifiable_res, &ast, &accessor, t); let res = verifiable_res.verify(&ast, &accessor, &()).unwrap().table; let expected_res = owned_table([ - bigint("a", [2_357_878_470_324_616_199_i64, 2_657_439_699_204_141, 884]), - bigint("b", [31_194_601_778_911_687_i64, 1_644_425_323_726_039, 884]), + bigint( + "a", + [2_357_878_470_324_616_199_i64, 2_657_439_699_204_141, 884], + ), + bigint( + "b", + [31_194_601_778_911_687_i64, 1_644_425_323_726_039, 884], + ), bigint("c", [500_213_946_116_239_i64, 1_570_568_673_569_987, 884]), bigint("d", [211_980_999_383_887_i64, 1_056_107_792_886_999, 884]), bigint("e", [927_908_842_441_i64, 998_426_626_609_497, 884]),