Validium in ZK Stack
This section provides an in-depth exploration of validiums in ZK Stack. For more general overview of validiums, see here.
Understanding Validiums
There are 3 different types of validiums based on the level of data availability they provide:
- Stage 0 - the simplest type of validium that only stores its pubdata in the database of the node(s) running the chain.
- Stage 1 - a validium that only sends its pubdata to the DA layer, but doesn’t verify its inclusion onchain.
- Stage 2 - a validium that sends its pubdata to the DA layer, and also verifies its inclusion on the L1, either by using verification bridges or ZK proofs directly.
There are multiple DA layers that ZK Stack will be integrated with, however the first on the list are: Avail, Celestia, and EigenDA.
Working with Validiums
Server-related details
Getting a bit deeper into the technicalities, the process of persisting the pubdata in the different DA layers is handled by two components: DA dispatcher and DA client:
- DA client’s role is to abstract the access to the DA layer and generalize it to 2 functions:
dispatch_blob
andget_inclusion_data
. Clients are a part of thezksync-era
repository, see the code here. - DA dispatcher is responsible for periodically fetching the pubdata from the database, and calling the DA client either to dispatch a blob or get an inclusion proofs. It also handles retries in case the client function call failed with a retryable error.
The DA related information is stored in the data_availability
table in the database.
A Validium’s new batches can’t be
committed if their inclusion data in that table is NULL.
Configuration
The Validium chain is required to have the following configuration:
- Set a pubdata sending mode general.yaml
pubdata_sending_mode: CUSTOM
- Configure DA dispatcher (reference values below) general.yaml
da_dispatcher: polling_interval_ms: 5000 max_rows_to_dispatch: 100 max_retries: 5
- Add DA client’s config and secrets, see FAQ for details.
All the configs can also be set using environment variables instead of .yaml
files, but it is less preferred.