Module storage

Source
Expand description

This file handles the storage gestion for the state replicator ; The data are stored on disk in a file, and this file provide functions to read the whole file (because producing a read proof requires the whole polynomial) and to update dispersed chunks of data.

Note: the encoding used for the conversion bytes <-> scalars is the full encoding, meaning that fields elements are encoded over F::size_in_bytes() bytes which is 32 for Pallas & Vesta. Using the 31 version leads currently to inconsistency when updating if the diff’s new values are greater than what is representable over 31 bytes.

Structs§

Data

Functions§

init
Creates a file at path and fill it with data TODO: For now, we assume the data vector is smaller than SRS_SIZE
read
read(path) loads the whole content of the file in path and stores it as bytes. This function raises an error when the path does not exist, or if there is an issue with reading.
update
Takes a valid diff and update the file accordingly, replacing the old values by the new ones at the specified indices ; the indices of the diff are specified by scalars (not by bytes) and the values of the diff are the new scalar value expected for the new data. Note that this only update the file, not the commitment