package tezos-dal-node-lib

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

This module instantiates the key value store to provide facilities for storing and retrieving the cells of the DAL skip list. The store maintains:

  • A mapping from hashes to cells, to allow retrieval of the cell associated with a hash. This is useful while constructing a DAL refutation proof.
  • A mapping from (attested) levels to hashes, to allow removing data related to a level once they cannot be used anymore for refutation games.

The store only supports storing values with a fixed-size encoding (as it uses the Key_value_store). Because the length of skip lists' cells slowly increases over time (because of new pointers), a sufficiently large maximum size is provided at initialization time; the binary representation of cells is padded accordingly before storing them.

type t
val init : node_store_dir:string -> skip_list_store_dir:string -> padded_encoded_cell_size:int -> encoded_hash_size:int -> number_of_slots:int -> t Tezos_base.TzPervasives.tzresult Lwt.t

init ~node_store_dir ~skip_list_store_dir ~padded_encoded_cell_size ~encoded_hash_size ~number_of_slots returns a new skip lists store under the path node_store_dir/skip_list_store_dir. The padded_encoded_cell_size parameter specifies the extended size of cells once encoded and stored as bytes in the key-value store. The encoded_hash_size parameter indicates the size of hashes once encoded as fixed-size bytes. The provided number_of_slots is used to know the number of expected cells (hashes) per attested level.

insert store ~attested_level values inserts the given list of values associated to the given attested_level in the store. Any existing value is overriden.

find store hash returns the cell associated to hash in the store, if any.

val remove : t -> attested_level:int32 -> (unit, Tezos_base.TzPervasives.Error_monad.tztrace) result Lwt.t

remove store ~attested_level removes any data related to attested_level from the store.

OCaml

Innovation. Community. Security.