Skip to content
Open
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
25 changes: 20 additions & 5 deletions crates/apollo_committer/src/committer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -398,11 +398,26 @@ where
to {last_committed_block}"
);
block_measurements.start_measurement(Action::Write);
let n_write_entries = self
.forest_storage
.write_with_metadata(&filled_forest, metadata, deleted_nodes)
.await
.map_err(|err| self.map_internal_error(err))?;
let n_write_entries = {
#[cfg(not(feature = "os_input"))]
{
self.forest_storage
.write_with_metadata(&filled_forest, metadata, deleted_nodes)
.await
}
#[cfg(feature = "os_input")]
{
self.forest_storage
.write_with_metadata_and_witnesses(
&filled_forest,
metadata,
deleted_nodes,
PatriciaProofsUpdate::Delete(height),
)
.await
}
}
.map_err(|err| self.map_internal_error(err))?;
block_measurements.attempt_to_stop_measurement(Action::Write, n_write_entries).ok();
block_measurements.attempt_to_stop_measurement(Action::EndToEnd, 0).ok();
update_metrics(height, &block_measurements.block_measurement);
Expand Down
18 changes: 18 additions & 0 deletions crates/starknet_committer/src/db/forest_trait.rs
Original file line number Diff line number Diff line change
Expand Up @@ -265,12 +265,30 @@ impl<T> ForestReaderWithEmptyContext for T where
///
/// Types that require external context (e.g., `FactsDb` which needs roots provided externally as
/// they are not part of the committer storage) should NOT implement this trait.
#[cfg(not(feature = "os_input"))]
pub trait ForestStorageWithEmptyReadContext:
ForestReaderWithEmptyContext + ForestWriterWithMetadata + StorageInitializer
{
}

#[cfg(not(feature = "os_input"))]
impl<T> ForestStorageWithEmptyReadContext for T where
T: ForestReaderWithEmptyContext + ForestWriterWithMetadata + StorageInitializer
{
}

#[cfg(feature = "os_input")]
pub trait ForestStorageWithEmptyReadContext:
ForestReaderWithEmptyContext
+ forest_trait_witnesses::ForestWriterWithMetadataAndWitnesses
+ StorageInitializer
{
}

#[cfg(feature = "os_input")]
impl<T> ForestStorageWithEmptyReadContext for T where
T: ForestReaderWithEmptyContext
+ forest_trait_witnesses::ForestWriterWithMetadataAndWitnesses
+ StorageInitializer
{
}
Loading