Skip to content

Commit ea60323

Browse files
starknet_committer: create storage tries based on config
1 parent def1c3c commit ea60323

File tree

1 file changed

+22
-10
lines changed

1 file changed

+22
-10
lines changed

crates/starknet_committer/src/db/trie_traversal.rs

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -349,14 +349,28 @@ where
349349
<Layout as NodeLayoutFor<StarknetStorageValue>>::DbLeaf:
350350
HasStaticPrefix<KeyContext = ContractAddress>,
351351
{
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
352+
match config.build_storage_tries_concurrently() {
353+
true => {
354+
create_storage_tries_concurrently::<Layout>(
355+
storage,
356+
actual_storage_updates,
357+
original_contracts_trie_leaves,
358+
config,
359+
storage_tries_sorted_indices,
360+
)
361+
.await
362+
}
363+
false => {
364+
create_storage_tries_sequentially::<Layout>(
365+
storage,
366+
actual_storage_updates,
367+
original_contracts_trie_leaves,
368+
config,
369+
storage_tries_sorted_indices,
370+
)
371+
.await
372+
}
373+
}
360374
}
361375

362376
/// Creates the contracts trie original skeleton.
@@ -449,8 +463,6 @@ where
449463
Ok(storage_tries)
450464
}
451465

452-
// TODO(Nimrod): Remove the `allow(dead_code)` once we use this function.
453-
#[allow(dead_code)]
454466
async fn create_storage_tries_concurrently<'a, Layout: NodeLayoutFor<StarknetStorageValue>>(
455467
storage: &impl Storage,
456468
actual_storage_updates: &HashMap<ContractAddress, LeafModifications<StarknetStorageValue>>,

0 commit comments

Comments
 (0)