7 releases

new 0.13.0 Jul 2, 2025
0.12.0 Jun 30, 2025
0.11.4 Jun 16, 2025
0.11.1 May 29, 2025

#814 in Magic Beans

Download history 236/week @ 2025-05-19 424/week @ 2025-05-26 1956/week @ 2025-06-02 2915/week @ 2025-06-09 3038/week @ 2025-06-16 4321/week @ 2025-06-23 4827/week @ 2025-06-30

15,178 downloads per month
Used in 10 crates (3 directly)

MIT/Apache

525KB
11K SLoC

zkSync Era Consensus Layer

This repo implements the consensus layer for ZK Stack chains. We implement all the necessary components for a set of sequencers to reach consensus over blocks. The zkSync Era Consensus Layer is designed to be used as a library, providing consensus and networking services to an execution layer.

Prerequisites

In order for the project to run performantly (both as an application and a library), we need to disable TCP slow start on the machine operating system. This can be done in Linux with the following command:

sysctl -w net.ipv4.tcp_slow_start_after_idle=0

Architecture

This section provides a physical map of folders & files in this repository.

  • /infrastructure: Infrastructure scripts that are needed to test the zkSync Era Consensus Layer.
  • /node
    • /components: Crates that implement specific components. Each of them maintains its own separate state and communicate with each other through message passing.
      • /bft: Implements the logic for the consensus algorithm.
      • /executor: Responsible for parsing the configuration parameters given by the user, and initializing the components and the interface with the execution layer. It's basically the bootloader for the node.
      • /network: Handles communication with other nodes and maintains a pool of outbound and inbound connections. It also implements a syncing mechanism (for blocks, etc).
    • /lib: All the library crates used as dependencies of the component crates above.
      • /concurrency: Crate with essential primitives for structured concurrency.
      • /crypto: Cryptographic primitives used by the other crates.
      • /engine: Provides an interface to the execution layer.
      • /protobuf: Code generated from protobuf schema files and utilities for serialization used by the other crates.
      • /protobuf_build: Generates rust code from the proto files.
      • /roles: Implements the types necessary for each role in the network. We have just two roles: Node and Validator.
      • /utils: Collection of small utilities and primitives.
    • /tools: Utility binaries needed to work with and test the node.
  • /spec: Contains the specifications for the consensus algorithm.
    • /informal-spec: The pseudo-code specification that was used as the basis for the implementation.
    • /protocol-spec: The Quint specification that was used to formally verify the protocol.

Policies

License

zkSync Era is distributed under the terms of either

at your option.

Dependencies

~20–33MB
~571K SLoC