@@ -20,6 +20,7 @@ use starknet_patricia::patricia_merkle_tree::original_skeleton_tree::tree::{
2020} ;
2121use starknet_patricia:: patricia_merkle_tree:: traversal:: SubTreeTrait ;
2222use starknet_patricia:: patricia_merkle_tree:: types:: { NodeIndex , SortedLeafIndices } ;
23+ use starknet_patricia_storage:: db_object:: HasStaticPrefix ;
2324use starknet_patricia_storage:: storage_trait:: Storage ;
2425use tracing:: warn;
2526
@@ -48,13 +49,15 @@ async fn fetch_nodes<'a, L: Leaf>(
4849 leaf_modifications : & LeafModifications < L > ,
4950 config : & impl OriginalSkeletonTreeConfig < L > ,
5051 mut previous_leaves : Option < & mut HashMap < NodeIndex , L > > ,
52+ key_context : & <L as HasStaticPrefix >:: KeyContext ,
5153) -> OriginalSkeletonTreeResult < ( ) > {
5254 let mut current_subtrees = subtrees;
5355 let mut next_subtrees = Vec :: new ( ) ;
5456 while !current_subtrees. is_empty ( ) {
5557 let should_fetch_modified_leaves =
5658 config. compare_modified_leaves ( ) || previous_leaves. is_some ( ) ;
57- let filled_roots = calculate_subtrees_roots :: < L > ( & current_subtrees, storage) . await ?;
59+ let filled_roots =
60+ calculate_subtrees_roots :: < L > ( & current_subtrees, storage, key_context) . await ?;
5861 for ( filled_root, subtree) in filled_roots. into_iter ( ) . zip ( current_subtrees. iter ( ) ) {
5962 match filled_root. data {
6063 // Binary node.
@@ -150,6 +153,7 @@ pub async fn create_original_skeleton_tree<'a, L: Leaf>(
150153 sorted_leaf_indices : SortedLeafIndices < ' a > ,
151154 config : & impl OriginalSkeletonTreeConfig < L > ,
152155 leaf_modifications : & LeafModifications < L > ,
156+ key_context : & <L as HasStaticPrefix >:: KeyContext ,
153157) -> OriginalSkeletonTreeResult < OriginalSkeletonTreeImpl < ' a > > {
154158 if sorted_leaf_indices. is_empty ( ) {
155159 return Ok ( OriginalSkeletonTreeImpl :: create_unmodified ( root_hash) ) ;
@@ -171,6 +175,7 @@ pub async fn create_original_skeleton_tree<'a, L: Leaf>(
171175 leaf_modifications,
172176 config,
173177 None ,
178+ key_context,
174179 )
175180 . await ?;
176181 Ok ( skeleton_tree)
@@ -182,6 +187,7 @@ pub async fn create_original_skeleton_tree_and_get_previous_leaves<'a, L: Leaf>(
182187 sorted_leaf_indices : SortedLeafIndices < ' a > ,
183188 leaf_modifications : & LeafModifications < L > ,
184189 config : & impl OriginalSkeletonTreeConfig < L > ,
190+ key_context : & <L as HasStaticPrefix >:: KeyContext ,
185191) -> OriginalSkeletonTreeResult < ( OriginalSkeletonTreeImpl < ' a > , HashMap < NodeIndex , L > ) > {
186192 if sorted_leaf_indices. is_empty ( ) {
187193 let unmodified = OriginalSkeletonTreeImpl :: create_unmodified ( root_hash) ;
@@ -203,6 +209,7 @@ pub async fn create_original_skeleton_tree_and_get_previous_leaves<'a, L: Leaf>(
203209 leaf_modifications,
204210 config,
205211 Some ( & mut leaves) ,
212+ key_context,
206213 )
207214 . await ?;
208215 Ok ( ( skeleton_tree, leaves) )
@@ -212,6 +219,7 @@ pub async fn get_leaves<'a, L: Leaf>(
212219 storage : & mut impl Storage ,
213220 root_hash : HashOutput ,
214221 sorted_leaf_indices : SortedLeafIndices < ' a > ,
222+ key_context : & <L as HasStaticPrefix >:: KeyContext ,
215223) -> OriginalSkeletonTreeResult < HashMap < NodeIndex , L > > {
216224 let config = NoCompareOriginalSkeletonTrieConfig :: default ( ) ;
217225 let leaf_modifications = LeafModifications :: new ( ) ;
@@ -221,6 +229,7 @@ pub async fn get_leaves<'a, L: Leaf>(
221229 sorted_leaf_indices,
222230 & leaf_modifications,
223231 & config,
232+ key_context,
224233 )
225234 . await ?;
226235 Ok ( previous_leaves)
0 commit comments