@@ -221,12 +221,12 @@ pub fn get_batch_address_append_circuit_inputs<const HEIGHT: usize>(
221221 }
222222 let new_element_values = & new_element_values[ ..zkp_batch_size] ;
223223 let mut new_root = [ 0u8 ; 32 ] ;
224- let mut low_element_circuit_merkle_proofs = Vec :: with_capacity ( new_element_values . len ( ) ) ;
225- let mut new_element_circuit_merkle_proofs = Vec :: with_capacity ( new_element_values . len ( ) ) ;
226- let mut patched_low_element_next_values = Vec :: with_capacity ( new_element_values . len ( ) ) ;
227- let mut patched_low_element_next_indices = Vec :: with_capacity ( new_element_values . len ( ) ) ;
228- let mut patched_low_element_values = Vec :: with_capacity ( new_element_values . len ( ) ) ;
229- let mut patched_low_element_indices = Vec :: with_capacity ( new_element_values . len ( ) ) ;
224+ let mut low_element_circuit_merkle_proofs = Vec :: with_capacity ( zkp_batch_size ) ;
225+ let mut new_element_circuit_merkle_proofs = Vec :: with_capacity ( zkp_batch_size ) ;
226+ let mut patched_low_element_next_values = Vec :: with_capacity ( zkp_batch_size ) ;
227+ let mut patched_low_element_next_indices = Vec :: with_capacity ( zkp_batch_size ) ;
228+ let mut patched_low_element_values = Vec :: with_capacity ( zkp_batch_size ) ;
229+ let mut patched_low_element_indices = Vec :: with_capacity ( zkp_batch_size ) ;
230230
231231 let computed_hashchain = create_hash_chain_from_slice ( new_element_values) . map_err ( |e| {
232232 ProverClientError :: GenericError ( format ! ( "Failed to compute hashchain: {}" , e) )
@@ -261,7 +261,7 @@ pub fn get_batch_address_append_circuit_inputs<const HEIGHT: usize>(
261261 let is_first_batch = indexed_changelog. is_empty ( ) ;
262262 let mut expected_root_for_low = current_root;
263263
264- for i in 0 ..new_element_values . len ( ) {
264+ for i in 0 ..zkp_batch_size {
265265 let mut changelog_index = 0 ;
266266 let low_element_index = low_element_indices[ i] . try_into ( ) . map_err ( |_| {
267267 ProverClientError :: IntegerConversion ( format ! (
@@ -342,7 +342,7 @@ pub fn get_batch_address_append_circuit_inputs<const HEIGHT: usize>(
342342 let ( computed_root, _) = compute_root_from_merkle_proof :: < HEIGHT > (
343343 old_low_leaf_hash,
344344 & merkle_proof,
345- low_element. index as u32 ,
345+ low_element. index ,
346346 ) ?;
347347 if computed_root != expected_root_for_low {
348348 let low_value_bytes = bigint_to_be_bytes_array :: < 32 > ( & low_element. value )
@@ -383,7 +383,7 @@ pub fn get_batch_address_append_circuit_inputs<const HEIGHT: usize>(
383383 compute_root_from_merkle_proof :: < HEIGHT > (
384384 new_low_leaf_hash,
385385 & merkle_proof,
386- new_low_element. index as u32 ,
386+ new_low_element. index ,
387387 ) ?;
388388
389389 patcher. push_changelog_entry :: < HEIGHT > ( changelog, changelog_entry) ;
@@ -424,7 +424,7 @@ pub fn get_batch_address_append_circuit_inputs<const HEIGHT: usize>(
424424 let ( updated_root, changelog_entry) = compute_root_from_merkle_proof (
425425 new_element_leaf_hash,
426426 & merkle_proof_array,
427- current_index as u32 ,
427+ current_index,
428428 ) ?;
429429
430430 if i == 0 && changelog. len ( ) == 1 {
@@ -451,7 +451,7 @@ pub fn get_batch_address_append_circuit_inputs<const HEIGHT: usize>(
451451 let ( root_with_zero, _) = compute_root_from_merkle_proof :: < HEIGHT > (
452452 zero_hash,
453453 & merkle_proof_array,
454- current_index as u32 ,
454+ current_index,
455455 ) ?;
456456 if root_with_zero != intermediate_root {
457457 tracing:: error!(
0 commit comments