diff --git a/crates/apollo_committer/src/committer.rs b/crates/apollo_committer/src/committer.rs index e8f38aa9244..35f47befa87 100644 --- a/crates/apollo_committer/src/committer.rs +++ b/crates/apollo_committer/src/committer.rs @@ -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); diff --git a/crates/starknet_committer/src/db/forest_trait.rs b/crates/starknet_committer/src/db/forest_trait.rs index 1806f106c5e..61ad9505649 100644 --- a/crates/starknet_committer/src/db/forest_trait.rs +++ b/crates/starknet_committer/src/db/forest_trait.rs @@ -265,12 +265,30 @@ impl 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 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 ForestStorageWithEmptyReadContext for T where + T: ForestReaderWithEmptyContext + + forest_trait_witnesses::ForestWriterWithMetadataAndWitnesses + + StorageInitializer +{ +}