Module Tezos_dal_node_lib.Store_cleanup

val clean_up_store_and_catch_up : Node_context.t -> Rpc_context.t -> last_processed_level:int32 -> first_seen_level:int32 option -> head_level:int32 -> Tezos_dal_node_services.Types.proto_parameters -> unit Tezos_base.TzPervasives.tzresult Lwt.t

clean_up_store_and_catch_up ctxt cctxt ~last_processed_level ~first_seen_level ~head_level proto_parameters performs the store clean-up and catch-up operations needed when starting or restarting the DAL node.

Depending on whether the node supports refutation games, it removes outdated slot/shard data from the DAL store to reduce disk usage and ensure only relevant data is kept. It may also populate the skip list store for levels required by refutation mechanisms.

  • last_processed_level is the most recent level processed by the L1 crawler.
  • first_seen_level is the first L1 level the node has seen (used to determine profile-specific retention).
  • head_level is the current L1 head level used to compute the clean-up range.

This function emits events to track progress and updates the last processed level in the store.