State management#
This document aims to explain how the X Layer protocol manages the layer 2 rollup’s states while providing state transition verifiability and security.
Trustless layer 2 state management#
The trusted sequencer generates batches for quick layer 2 transaction finality. Instead of waiting for the next layer 1 block, these batches are shared with layer 2 nodes through a broadcast channel. Each node processes the batches locally to compute the layer 2 state. After the trusted sequencer commits batch sequences from layer 1, layer 2 nodes independently re-execute them, eliminating the need for complete trust. Off-chain batch execution is later verified on-chain using zero-knowledge proofs, and the resulting layer 2 state root is committed. With ZKEVM advancements, layer 2 nodes sync new layer 2 state roots directly from layer 1.
In the diagram above, layer 2 nodes receive batch data through three methods:
- From the trusted sequencer: before batches are committed to layer 1
- Directly from layer 1: after the batches are sequenced
- After verification: once execution correctness is proven by the aggregator and verified by the
ZkEVM.sol
contract
Worth noting, these three batch data formats arrive in the order mentioned above.