Skip to content

Commit cc78b2a

Browse files
committed
starknet_committer: delete patricia paths on reverts
1 parent a48fffb commit cc78b2a

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
@@ -155,7 +155,7 @@ where
155155
impl<S, ForestDB> Committer<S, ForestDB>
156156
where
157157
S: StorageConstructor,
158-
ForestDB: ForestStorageWithEmptyReadContext<Storage = S>,
158+
ForestDB: ForestStorageWithEmptyReadContext<Storage = S> + ForestWriterWithMetadataAndWitnesses,
159159
{
160160
pub async fn new(config: CommitterConfig<S::Config>) -> Self {
161161
let storage = S::create_storage(config.db_path.clone(), config.storage_config.clone());
@@ -382,10 +382,25 @@ where
382382
to {last_committed_block}"
383383
);
384384
block_measurements.start_measurement(Action::Write);
385-
let n_write_entries = self
386-
.forest_storage
385+
let n_write_entries = {
386+
#[cfg(not(feature = "os_input"))]
387+
{
388+
self.forest_storage
387389
.write_with_metadata(&filled_forest, metadata, deleted_nodes)
388390
.await
391+
}
392+
#[cfg(feature = "os_input")]
393+
{
394+
self.forest_storage
395+
.write_with_metadata_and_witnesses(
396+
&filled_forest,
397+
metadata,
398+
deleted_nodes,
399+
PatriciaProofsUpdates::Delete(height),
400+
)
401+
.await
402+
}
403+
}
389404
.map_err(|err| self.map_internal_error(err))?;
390405
block_measurements.attempt_to_stop_measurement(Action::Write, n_write_entries).ok();
391406
block_measurements.attempt_to_stop_measurement(Action::EndToEnd, 0).ok();

0 commit comments

Comments
 (0)