Skip to content

Commit

Permalink
rm ptr
Browse files Browse the repository at this point in the history
  • Loading branch information
ratankaliani committed Sep 18, 2023
1 parent ff32abd commit 2b952fd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions plonky2x/src/frontend/hash/keccak/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ impl<L: PlonkParameters<D>, const D: usize> CircuitBuilder<L, D> {
_phantom: PhantomData::<L>,
};
let output = generator.output;
self.add_simple_generator(generator.clone());
self.add_simple_generator(generator);
output
}

Expand All @@ -33,7 +33,7 @@ impl<L: PlonkParameters<D>, const D: usize> CircuitBuilder<L, D> {
length: Some(length),
_phantom: PhantomData::<L>,
};
self.add_simple_generator(generator.clone());
self.add_simple_generator(generator);
generator.output
}
}
Expand Down
14 changes: 7 additions & 7 deletions plonky2x/src/frontend/merkle/tendermint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ impl<L: PlonkParameters<D>, const D: usize> CircuitBuilder<L, D> {

pub fn hash_leaves<const LEAF_SIZE_BYTES: usize>(
&mut self,
leaves: &Vec<BytesVariable<LEAF_SIZE_BYTES>>,
leaves: Vec<BytesVariable<LEAF_SIZE_BYTES>>,
) -> Vec<Bytes32Variable> {
leaves
.iter()
Expand All @@ -123,8 +123,8 @@ impl<L: PlonkParameters<D>, const D: usize> CircuitBuilder<L, D> {

pub fn get_root_from_hashed_leaves<const NB_LEAVES: usize>(
&mut self,
leaf_hashes: &Vec<Bytes32Variable>,
leaves_enabled: &Vec<BoolVariable>,
leaf_hashes: Vec<Bytes32Variable>,
leaves_enabled: Vec<BoolVariable>,
) -> Bytes32Variable {
assert!(NB_LEAVES.is_power_of_two());

Expand All @@ -149,14 +149,14 @@ impl<L: PlonkParameters<D>, const D: usize> CircuitBuilder<L, D> {

pub fn compute_root_from_leaves<const NB_LEAVES: usize, const LEAF_SIZE_BYTES: usize>(
&mut self,
leaves: &Vec<BytesVariable<LEAF_SIZE_BYTES>>,
leaves_enabled: &Vec<BoolVariable>,
leaves: Vec<BytesVariable<LEAF_SIZE_BYTES>>,
leaves_enabled: Vec<BoolVariable>,
) -> Bytes32Variable {
// TODO: Remove, this is just for debugging.
assert_eq!(leaves.len(), NB_LEAVES);

let hashed_leaves = self.hash_leaves::<LEAF_SIZE_BYTES>(leaves);
self.get_root_from_hashed_leaves::<NB_LEAVES>(&hashed_leaves, leaves_enabled)
self.get_root_from_hashed_leaves::<NB_LEAVES>(hashed_leaves, leaves_enabled)
}
}

Expand Down Expand Up @@ -187,7 +187,7 @@ mod tests {

let leaves = builder.read::<ArrayVariable<BytesVariable<48>, 32>>();
let enabled = builder.read::<ArrayVariable<BoolVariable, 32>>();
let root = builder.compute_root_from_leaves::<32, 48>(&leaves.as_vec(), &enabled.as_vec());
let root = builder.compute_root_from_leaves::<32, 48>(leaves.as_vec(), enabled.as_vec());
builder.write::<Bytes32Variable>(root);
let circuit = builder.build();
circuit.test_default_serializers();
Expand Down

0 comments on commit 2b952fd

Please sign in to comment.