From fb2df6ff88a90b569423c6c8b433c958184de25c Mon Sep 17 00:00:00 2001 From: tdelabro Date: Mon, 11 Dec 2023 11:47:02 +0000 Subject: [PATCH] deploy: f30acea8af7e28e956e771928130e12bfc084832 --- .../merkle_patricia_tree/merkle_node.rs.html | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/mp_commitments/merkle_patricia_tree/merkle_node.rs.html b/src/mp_commitments/merkle_patricia_tree/merkle_node.rs.html index 0f665afc67..6a1f6f316e 100644 --- a/src/mp_commitments/merkle_patricia_tree/merkle_node.rs.html +++ b/src/mp_commitments/merkle_patricia_tree/merkle_node.rs.html @@ -300,6 +300,7 @@ 300 301 302 +303
//! Contains constructs for describing the nodes in a Binary Merkle Patricia Tree
 //! used by Starknet.
 //!
@@ -309,6 +310,7 @@
 use bitvec::order::Msb0;
 use bitvec::prelude::BitVec;
 use bitvec::slice::BitSlice;
+use bitvec::view::BitView;
 use mp_felt::Felt252Wrapper;
 use mp_hashers::HasherT;
 use starknet_api::stdlib::collections::HashMap;
@@ -589,10 +591,10 @@
             None => unreachable!("child node not found"),
         };
 
-        let mut temp_path = self.path.clone();
-        temp_path.force_align();
+        let mut bytes = [0u8; 32];
+        bytes.view_bits_mut::<Msb0>()[256 - self.path.len()..].copy_from_bitslice(&self.path);
 
-        let path = Felt252Wrapper::try_from(temp_path.into_vec().as_slice()).unwrap();
+        let path = Felt252Wrapper::try_from(&bytes).unwrap();
         let mut length = [0; 32];
         // Safe as len() is guaranteed to be <= 251
         length[31] = self.path.len() as u8;