@@ -393,29 +393,30 @@ pub async fn create_contracts_trie<'a, Layout: NodeLayoutFor<ContractState>>(
393393 storage : & impl Storage ,
394394 contracts_trie_root_hash : HashOutput ,
395395 contracts_trie_sorted_indices : SortedLeafIndices < ' a > ,
396- ) -> ForestResult < ( OriginalSkeletonTreeImpl < ' a > , HashMap < NodeIndex , ContractState > ) >
396+ ) -> ForestResult < ( OriginalSkeletonTreeImpl < ' a > , HashMap < NodeIndex , ContractState > , DbHashMap ) >
397397where
398398 <Layout as NodeLayoutFor < ContractState > >:: DbLeaf : HasStaticPrefix < KeyContext = EmptyKeyContext > ,
399399{
400400 let config = OriginalSkeletonTrieConfig :: new_for_contracts_trie ( ) ;
401401
402402 let mut leaves = HashMap :: new ( ) ;
403+ let mut siblings_map = DbHashMap :: new ( ) ;
403404 let skeleton_tree = create_original_skeleton_tree :: < Layout :: DbLeaf , Layout > (
404405 storage,
405406 contracts_trie_root_hash,
406407 contracts_trie_sorted_indices,
407408 & config,
408409 & HashMap :: new ( ) ,
409410 Some ( & mut leaves) ,
410- None ,
411+ Some ( & mut siblings_map ) ,
411412 & EmptyKeyContext ,
412413 )
413414 . await ?;
414415
415416 let leaves: HashMap < NodeIndex , ContractState > =
416417 leaves. into_iter ( ) . map ( |( idx, leaf) | ( idx, leaf. into ( ) ) ) . collect ( ) ;
417418
418- Ok ( ( skeleton_tree, leaves) )
419+ Ok ( ( skeleton_tree, leaves, siblings_map ) )
419420}
420421
421422pub async fn create_classes_trie < ' a , Layout : NodeLayoutFor < CompiledClassHash > > (
@@ -424,31 +425,35 @@ pub async fn create_classes_trie<'a, Layout: NodeLayoutFor<CompiledClassHash>>(
424425 classes_trie_root_hash : HashOutput ,
425426 config : & ReaderConfig ,
426427 contracts_trie_sorted_indices : SortedLeafIndices < ' a > ,
427- ) -> ForestResult < OriginalSkeletonTreeImpl < ' a > >
428+ ) -> ForestResult < ( OriginalSkeletonTreeImpl < ' a > , DbHashMap ) >
428429where
429430 <Layout as NodeLayoutFor < CompiledClassHash > >:: DbLeaf :
430431 HasStaticPrefix < KeyContext = EmptyKeyContext > ,
431432{
432433 let config = OriginalSkeletonTrieConfig :: new_for_classes_or_storage_trie (
433434 config. warn_on_trivial_modifications ( ) ,
434435 ) ;
436+ let mut siblings_map = DbHashMap :: new ( ) ;
435437
436- Ok ( create_original_skeleton_tree :: < Layout :: DbLeaf , Layout > (
437- storage,
438- classes_trie_root_hash,
439- contracts_trie_sorted_indices,
440- & config,
441- // TODO(Ariel): Change `actual_classes_updates` to be an iterator over borrowed data so
442- // that the conversion below is costless.
443- & actual_classes_updates
444- . iter ( )
445- . map ( |( idx, value) | ( * idx, Layout :: DbLeaf :: from ( * value) ) )
446- . collect ( ) ,
447- None ,
448- None ,
449- & EmptyKeyContext ,
450- )
451- . await ?)
438+ Ok ( (
439+ create_original_skeleton_tree :: < Layout :: DbLeaf , Layout > (
440+ storage,
441+ classes_trie_root_hash,
442+ contracts_trie_sorted_indices,
443+ & config,
444+ // TODO(Ariel): Change `actual_classes_updates` to be an iterator over borrowed data so
445+ // that the conversion below is costless.
446+ & actual_classes_updates
447+ . iter ( )
448+ . map ( |( idx, value) | ( * idx, Layout :: DbLeaf :: from ( * value) ) )
449+ . collect ( ) ,
450+ None ,
451+ Some ( & mut siblings_map) ,
452+ & EmptyKeyContext ,
453+ )
454+ . await ?,
455+ siblings_map,
456+ ) )
452457}
453458
454459async fn create_storage_tries_sequentially < ' a , Layout : NodeLayoutFor < StarknetStorageValue > > (
0 commit comments