Skip to content

Commit dcafcad

Browse files
committed
starknet_committer: delete patricia paths on reverts
1 parent 7bd77dd commit dcafcad

1 file changed

Lines changed: 18 additions & 3 deletions

File tree

crates/apollo_committer/src/committer.rs

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ where
158158
impl<S, ForestDB> Committer<S, ForestDB>
159159
where
160160
S: StorageConstructor,
161-
ForestDB: ForestStorageWithEmptyReadContext<Storage = S>,
161+
ForestDB: ForestStorageWithEmptyReadContext<Storage = S> + ForestWriterWithMetadataAndWitnesses,
162162
{
163163
pub async fn new(config: CommitterConfig<S::Config>) -> Self {
164164
let storage = S::create_storage(config.db_path.clone(), config.storage_config.clone());
@@ -392,10 +392,25 @@ where
392392
to {last_committed_block}"
393393
);
394394
block_measurements.start_measurement(Action::Write);
395-
let n_write_entries = self
396-
.forest_storage
395+
let n_write_entries = {
396+
#[cfg(not(feature = "os_input"))]
397+
{
398+
self.forest_storage
397399
.write_with_metadata(&filled_forest, metadata, deleted_nodes)
398400
.await
401+
}
402+
#[cfg(feature = "os_input")]
403+
{
404+
self.forest_storage
405+
.write_with_metadata_and_witnesses(
406+
&filled_forest,
407+
metadata,
408+
deleted_nodes,
409+
PatriciaProofsUpdates::Delete(height),
410+
)
411+
.await
412+
}
413+
}
399414
.map_err(|err| self.map_internal_error(err))?;
400415
block_measurements.attempt_to_stop_measurement(Action::Write, n_write_entries).ok();
401416
block_measurements.attempt_to_stop_measurement(Action::EndToEnd, 0).ok();

0 commit comments

Comments
 (0)