Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions crates/starknet_committer/src/db/forest_trait.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ use starknet_patricia_storage::storage_trait::{
DbOperationMap,
DbValue,
PatriciaStorageResult,
ReadOnlyStorage,
Storage,
};

Expand Down Expand Up @@ -98,8 +97,9 @@ pub(crate) async fn read_forest<'a, S, Layout>(
config: ReaderConfig,
) -> ForestResult<(OriginalSkeletonForest<'a>, HashMap<NodeIndex, ContractState>)>
where
S: ReadOnlyStorage,
S: Storage,
Layout: DbLayout,
Layout::NodeLayout: Send + 'static,
{
let (contracts_trie, original_contracts_trie_leaves) =
create_contracts_trie::<Layout::NodeLayout>(
Expand Down
2 changes: 1 addition & 1 deletion crates/starknet_committer/src/db/index_db/db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ where
// TODO(Ariel): define an IndexDbInitialRead empty type, and check whether each tree is empty inside
// create_xxx_trie.
#[async_trait]
impl<S: Storage, H: Send> ForestReader for IndexDb<S, H>
impl<S: Storage, H: Send + 'static> ForestReader for IndexDb<S, H>
where
H: IndexLayoutHasher,
{
Expand Down
38 changes: 25 additions & 13 deletions crates/starknet_committer/src/db/trie_traversal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ use starknet_patricia_storage::storage_trait::{
GatherableStorage,
ImmutableReadOnlyStorage,
ReadOnlyStorage,
Storage,
StorageTask,
StorageTaskOutput,
};
Expand Down Expand Up @@ -347,25 +348,37 @@ pub async fn create_original_skeleton_tree<'a, L: Leaf, Layout: NodeLayout<'a, L
Ok(skeleton_tree)
}

pub async fn create_storage_tries<'a, Layout: NodeLayoutFor<StarknetStorageValue>>(
storage: &mut impl ReadOnlyStorage,
actual_storage_updates: &HashMap<ContractAddress, LeafModifications<StarknetStorageValue>>,
pub async fn create_storage_tries<'a, Layout>(
storage: &mut impl Storage,
actual_storage_updates: &'a HashMap<ContractAddress, LeafModifications<StarknetStorageValue>>,
original_contracts_trie_leaves: &HashMap<NodeIndex, ContractState>,
config: &ReaderConfig,
storage_tries_sorted_indices: &HashMap<ContractAddress, SortedLeafIndices<'a>>,
storage_tries_sorted_indices: &'a HashMap<ContractAddress, SortedLeafIndices<'a>>,
) -> ForestResult<HashMap<ContractAddress, OriginalSkeletonTreeImpl<'a>>>
where
Layout: NodeLayoutFor<StarknetStorageValue> + Send + 'static,
<Layout as NodeLayoutFor<StarknetStorageValue>>::DbLeaf:
HasStaticPrefix<KeyContext = ContractAddress>,
{
create_storage_tries_sequentially::<Layout>(
storage,
actual_storage_updates,
original_contracts_trie_leaves,
config,
storage_tries_sorted_indices,
)
.await
if let Some(gatherable_storage) = storage.as_gatherable_storage() {
create_storage_tries_concurrently::<_, Layout>(
gatherable_storage,
actual_storage_updates,
original_contracts_trie_leaves,
config.warn_on_trivial_modifications(),
storage_tries_sorted_indices,
)
.await
} else {
create_storage_tries_sequentially::<Layout>(
storage,
actual_storage_updates,
original_contracts_trie_leaves,
config,
storage_tries_sorted_indices,
)
.await
}
}

/// Creates the contracts trie original skeleton.
Expand Down Expand Up @@ -505,7 +518,6 @@ where
}
}

#[expect(dead_code)]
async fn create_storage_tries_concurrently<'a, S, Layout>(
storage: &mut S,
actual_storage_updates: &'a HashMap<ContractAddress, LeafModifications<StarknetStorageValue>>,
Expand Down
Loading