Crates.io | zksync_node_db_pruner |
lib.rs | zksync_node_db_pruner |
version | 0.1.0 |
source | src |
created_at | 2024-07-13 08:03:23.217541 |
updated_at | 2024-07-13 08:03:23.217541 |
description | ZKsync database pruner |
homepage | https://zksync.io/ |
repository | https://github.com/matter-labs/zksync-era |
max_upload_size | |
id | 1302126 |
size | 47,054 |
zksync_node_db_pruner
Database pruner is a component that regularly removes the oldest l1 batches from the database together with corresponding L2 blocks, events, etc.
There are two types of objects that are not fully cleaned:
BYTEA
fields cleaned as some components rely on transactions existence.(See node docs for a high-level pruning overview)
There are two phases of pruning an L1 batch, soft pruning and hard pruning. Every batch that would have its records removed if first soft-pruned. Soft-pruned batches cannot safely be used. One minute (this is configurable) after soft pruning, hard pruning is performed, where hard means physically removing data from the database.
The reasoning behind this split is to allow node components such as the API server to become aware of planned data pruning, and restrict access to the pruned data in advance. This ensures that data does not unexpectedly (from the component perspective) disappear from Postgres in a middle of an operation (like serving a Web3 request). At least in some case, like in VM-related Web3 methods, we cannot rely on database transactions for this purpose.