@@ -396,29 +396,30 @@ pub async fn create_contracts_trie<'a, Layout: NodeLayoutFor<ContractState>>(
396396 storage : & impl Storage ,
397397 contracts_trie_root_hash : HashOutput ,
398398 contracts_trie_sorted_indices : SortedLeafIndices < ' a > ,
399- ) -> ForestResult < ( OriginalSkeletonTreeImpl < ' a > , HashMap < NodeIndex , ContractState > ) >
399+ ) -> ForestResult < ( OriginalSkeletonTreeImpl < ' a > , HashMap < NodeIndex , ContractState > , DbHashMap ) >
400400where
401401 <Layout as NodeLayoutFor < ContractState > >:: DbLeaf : HasStaticPrefix < KeyContext = EmptyKeyContext > ,
402402{
403403 let config = OriginalSkeletonTrieConfig :: new_for_contracts_trie ( ) ;
404404
405405 let mut leaves = HashMap :: new ( ) ;
406+ let mut siblings_map = DbHashMap :: new ( ) ;
406407 let skeleton_tree = create_original_skeleton_tree :: < Layout :: DbLeaf , Layout > (
407408 storage,
408409 contracts_trie_root_hash,
409410 contracts_trie_sorted_indices,
410411 & config,
411412 & HashMap :: new ( ) ,
412413 Some ( & mut leaves) ,
413- None ,
414+ Some ( & mut siblings_map ) ,
414415 & EmptyKeyContext ,
415416 )
416417 . await ?;
417418
418419 let leaves: HashMap < NodeIndex , ContractState > =
419420 leaves. into_iter ( ) . map ( |( idx, leaf) | ( idx, leaf. into ( ) ) ) . collect ( ) ;
420421
421- Ok ( ( skeleton_tree, leaves) )
422+ Ok ( ( skeleton_tree, leaves, siblings_map ) )
422423}
423424
424425pub async fn create_classes_trie < ' a , Layout : NodeLayoutFor < CompiledClassHash > > (
@@ -427,31 +428,35 @@ pub async fn create_classes_trie<'a, Layout: NodeLayoutFor<CompiledClassHash>>(
427428 classes_trie_root_hash : HashOutput ,
428429 config : & ReaderConfig ,
429430 contracts_trie_sorted_indices : SortedLeafIndices < ' a > ,
430- ) -> ForestResult < OriginalSkeletonTreeImpl < ' a > >
431+ ) -> ForestResult < ( OriginalSkeletonTreeImpl < ' a > , DbHashMap ) >
431432where
432433 <Layout as NodeLayoutFor < CompiledClassHash > >:: DbLeaf :
433434 HasStaticPrefix < KeyContext = EmptyKeyContext > ,
434435{
435436 let config = OriginalSkeletonTrieConfig :: new_for_classes_or_storage_trie (
436437 config. warn_on_trivial_modifications ( ) ,
437438 ) ;
439+ let mut siblings_map = DbHashMap :: new ( ) ;
438440
439- Ok ( 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- None ,
452- & EmptyKeyContext ,
453- )
454- . await ?)
441+ Ok ( (
442+ create_original_skeleton_tree :: < Layout :: DbLeaf , Layout > (
443+ storage,
444+ classes_trie_root_hash,
445+ contracts_trie_sorted_indices,
446+ & config,
447+ // TODO(Ariel): Change `actual_classes_updates` to be an iterator over borrowed data so
448+ // that the conversion below is costless.
449+ & actual_classes_updates
450+ . iter ( )
451+ . map ( |( idx, value) | ( * idx, Layout :: DbLeaf :: from ( * value) ) )
452+ . collect ( ) ,
453+ None ,
454+ Some ( & mut siblings_map) ,
455+ & EmptyKeyContext ,
456+ )
457+ . await ?,
458+ siblings_map,
459+ ) )
455460}
456461
457462async fn create_storage_tries_sequentially < ' a , Layout : NodeLayoutFor < StarknetStorageValue > > (
0 commit comments