Skip to content

Commit

Permalink
chore: run cargo fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
mehulmathur16 committed Oct 3, 2024
1 parent 9dae31d commit 1850787
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 16 deletions.
5 changes: 2 additions & 3 deletions crates/proof-of-sql/src/base/commitment/column_bounds.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
39 changes: 33 additions & 6 deletions crates/proof-of-sql/src/base/encode/varint_trait_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand Down
5 changes: 4 additions & 1 deletion crates/proof-of-sql/src/base/encode/zigzag_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down
20 changes: 16 additions & 4 deletions crates/proof-of-sql/src/sql/proof_exprs/multiply_expr_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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]),
Expand Down Expand Up @@ -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]),
Expand Down

0 comments on commit 1850787

Please sign in to comment.