pub async fn hard_prune_batches_range(
        &mut self,
        last_l1_batch_to_prune: L1BatchNumber,
        last_l2_block_to_prune: L2BlockNumber,
    ) -> DalResult<HardPruningStats> {
        let row = sqlx::query!(
            r#"
            SELECT
                MIN(number) AS first_miniblock_to_prune
            FROM
                miniblocks
            WHERE
                l1_batch_number <= $1
            "#,
            i64::from(last_l1_batch_to_prune.0),
        )
        .instrument("hard_prune_batches_range#get_miniblocks_range")
        .with_arg("last_l1_batch_to_prune", &last_l1_batch_to_prune)
        .report_latency()
        .fetch_one(self.storage)
        .await?;

        let Some(first_l2_block_to_prune) = row.first_miniblock_to_prune else {
            return Ok(HardPruningStats::default());
        };

        let first_l2_block_to_prune = L2BlockNumber(first_l2_block_to_prune as u32);

        let deleted_events = self
            .delete_events(first_l2_block_to_prune..=last_l2_block_to_prune)
            .await?;
        let deleted_l2_to_l1_logs = self
            .delete_l2_to_l1_logs(first_l2_block_to_prune..=last_l2_block_to_prune)
            .await?;
        let deleted_call_traces = self
            .delete_call_traces(first_l2_block_to_prune..=last_l2_block_to_prune)
            .await?;
        self.clear_transaction_fields(first_l2_block_to_prune..=last_l2_block_to_prune)
            .await?;

        let deleted_storage_logs = self
            .prune_storage_logs(first_l2_block_to_prune..=last_l2_block_to_prune)
            .await?;
        let deleted_l1_batches = self.delete_l1_batches(last_l1_batch_to_prune).await?;
        let deleted_l2_blocks = self.delete_l2_blocks(last_l2_block_to_prune).await?;

        let stats = HardPruningStats {
            deleted_l1_batches,
            deleted_l2_blocks,
            deleted_events,
            deleted_l2_to_l1_logs,
            deleted_call_traces,
            deleted_storage_logs,
        };
        Ok(stats)
    }
Does not insert pruning logs; the caller is responsible to do this!
core/lib/dal/src/pruning_dal/mod.rs