@@ -338,6 +338,9 @@ pub async fn create_original_skeleton_tree<'a, L: Leaf, Layout: NodeLayout<'a, L
338338 Ok ( skeleton_tree)
339339}
340340
341+ /// Creates the original skeleton trees of the storage tries of modified contracts.
342+ /// If [ReaderConfig::build_storage_tries_concurrently] is true, the tries are created concurrently.
343+ /// Otherwise, they are created sequentially.
341344pub async fn create_storage_tries < ' a , Layout : NodeLayoutFor < StarknetStorageValue > > (
342345 storage : & impl Storage ,
343346 actual_storage_updates : & HashMap < ContractAddress , LeafModifications < StarknetStorageValue > > ,
@@ -349,14 +352,28 @@ where
349352 <Layout as NodeLayoutFor < StarknetStorageValue > >:: DbLeaf :
350353 HasStaticPrefix < KeyContext = ContractAddress > ,
351354{
352- create_storage_tries_sequentially :: < Layout > (
353- storage,
354- actual_storage_updates,
355- original_contracts_trie_leaves,
356- config,
357- storage_tries_sorted_indices,
358- )
359- . await
355+ match config. build_storage_tries_concurrently ( ) {
356+ true => {
357+ create_storage_tries_concurrently :: < Layout > (
358+ storage,
359+ actual_storage_updates,
360+ original_contracts_trie_leaves,
361+ config,
362+ storage_tries_sorted_indices,
363+ )
364+ . await
365+ }
366+ false => {
367+ create_storage_tries_sequentially :: < Layout > (
368+ storage,
369+ actual_storage_updates,
370+ original_contracts_trie_leaves,
371+ config,
372+ storage_tries_sorted_indices,
373+ )
374+ . await
375+ }
376+ }
360377}
361378
362379/// Creates the contracts trie original skeleton.
@@ -449,8 +466,6 @@ where
449466 Ok ( storage_tries)
450467}
451468
452- // TODO(Nimrod): Remove the `allow(dead_code)` once we use this function.
453- #[ allow( dead_code) ]
454469async fn create_storage_tries_concurrently < ' a , Layout : NodeLayoutFor < StarknetStorageValue > > (
455470 storage : & impl Storage ,
456471 actual_storage_updates : & HashMap < ContractAddress , LeafModifications < StarknetStorageValue > > ,
0 commit comments