Skip to content

Commit

Permalink
cargo fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
pdtfh committed Sep 16, 2024
1 parent 609ae8b commit acbf2db
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
5 changes: 2 additions & 3 deletions benches/lazy_merkle_tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,18 +74,17 @@ fn bench_restore_dense_mmap_tree(criterion: &mut Criterion) {
create_values_for_tree(14),
];


let mut group = criterion.benchmark_group("bench_restore_dense_mmap_tree");

(0..3).zip(tree_values).for_each(|(id, value)| {

let file = tempfile::NamedTempFile::new().unwrap();
let path = file.path().to_str().unwrap();
{
let _tree = LazyMerkleTree::<PoseidonHash, Canonical>::new_mmapped_with_dense_prefix_with_init_values(value.depth, value.prefix_depth, &value.empty_value, &value.initial_values, path).unwrap();
let _root = _tree.root();
}

group.bench_with_input(
BenchmarkId::from_parameter(format!("restore_dense_mmap_tree_depth_{}", value.depth)),
&(id, value),
Expand Down
19 changes: 10 additions & 9 deletions src/packed_proof.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ use serde::{Deserialize, Deserializer, Serialize, Serializer};

use crate::util::{bytes_from_hex, bytes_to_hex, deserialize_bytes, serialize_bytes};

/// A packed proof is a representation of the ZKP in a single attribute (as opposed to array of arrays) which is easier to transport
/// A packed proof is a representation of the ZKP in a single attribute (as
/// opposed to array of arrays) which is easier to transport
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub struct PackedProof(pub [u8; 256]);

Expand Down Expand Up @@ -43,10 +44,10 @@ impl From<PackedProof> for Proof {
.collect::<Vec<U256>>();

let a = (decoded_uint_array[0], decoded_uint_array[1]);
let b = (
[decoded_uint_array[2], decoded_uint_array[3]],
[decoded_uint_array[4], decoded_uint_array[5]],
);
let b = ([decoded_uint_array[2], decoded_uint_array[3]], [
decoded_uint_array[4],
decoded_uint_array[5],
]);
let c = (decoded_uint_array[6], decoded_uint_array[7]);
Self(a, b, c)
}
Expand Down Expand Up @@ -92,10 +93,10 @@ pub mod test {
fn test_serializing_proof_into_packed_proof() {
let proof = Proof(
(U256::from(1), U256::from(2)),
(
[U256::from(3), U256::from(4)],
[U256::from(5), U256::from(6)],
),
([U256::from(3), U256::from(4)], [
U256::from(5),
U256::from(6),
]),
(U256::from(7), U256::from(8)),
);

Expand Down

0 comments on commit acbf2db

Please sign in to comment.