package tezos-store

  1. Overview
  2. Docs

Storage reconstruction

The storage reconstruction feature aims to re-compute the contexts (ledger state) and the blocks metadata of a full mode storage, and thus, migrate a storage from a full history mode to an archive one.

To do so, it is needed to re-validate the whole chain, by applying (using the standard validation method: Tezos_validation.Block_validation.apply) all the blocks from the genesis on empty context. As a storage running a full history mode will not store all the ledger state but keeps all the blocks (and operations), it is the only mode that can be reconstructed. The operation consist of two major steps:

  • Reconstructing the cemented block store: for each cemented cycle, the context of each block along with their associated metadatas are restored.
  • Reconstructing the floating block stores: this step is only necessary if the store was recently imported from a snapshot as some metadata will be missing.

As the reconstruction procedure changes the state of the storage, it cannot be run while a node is running on the storage to reconstruct. If the reconstruction is interrupted, it will be resumed if restarted.

type failure_kind =
  1. | Nothing_to_reconstruct
  2. | Context_hash_mismatch of Tezos_base.Block_header.t * Tezos_crypto.Context_hash.t * Tezos_crypto.Context_hash.t
  3. | Cannot_read_block_hash of Tezos_crypto.Block_hash.t
  4. | Cannot_read_block_level of Stdlib.Int32.t
type Tezos_base__TzPervasives.error +=
  1. | Reconstruction_failure of failure_kind
type Tezos_base__TzPervasives.error +=
  1. | Cannot_reconstruct of Tezos_shell_services.History_mode.t
val reconstruct : ?patch_context: (Tezos_context.Context.t -> (Tezos_context.Context.t, Tezos_error_monad.TzCore.error list) Stdlib.result Lwt.t) -> store_dir:string -> context_dir:string -> Tezos_base.Genesis.t -> user_activated_upgrades:Tezos_base.User_activated.upgrades -> user_activated_protocol_overrides: Tezos_base.User_activated.protocol_overrides -> operation_metadata_size_limit:int option -> (unit, Tezos_error_monad.TzCore.error list) Stdlib.result Lwt.t

reconstruct ?patch_context ~store_dir ~context_dir genesis uau uapo omsl reconstructs the storage located in store_dir and context_dir. The resulting storage will see its history mode changed to archive.

OCaml

Innovation. Community. Security.