Skip to content

Latest commit

 

History

352 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ZKsync OS

Logo

ZKsync OS is a state transition function implementation that enables multiple execution environments (EVM, EraVM, Wasm, etc.) to operate within a unified ecosystem. It is implemented in Rust and compiled into a RISC-V binary, which can later be proven using ZKsync Airbender.

Documentation

The most recent documentation can be found here:

How to build

One-time setup

Run the following commands to prepare your environment (only needed once):

rustup target add riscv32i-unknown-none-elf
cargo install cargo-binutils && rustup component add llvm-tools-preview

ZKsync OS is built for two targets:

  • Your host platform, used by the sequencer to execute blocks/batches.
  • RISC-V, used to produce a binary that is later proved by a RISC-V prover (Airbender).

Build for host platform

cargo build --workspace

Build for RISC-V

Reproducible build

To build RISC-V binaries in a reproducible way, use the following command (requires Docker):

./zksync_os/reproduce/reproduce.sh

Manual build

Navigate to the zksync_os directory and run:

./dump_bin.sh --type for-tests

For other build modes, check zksync_os/dump_bin.sh.

Testing

Integration and unit tests

Build zksync_os first for tests that execute the proof-running path:

cd zksync_os && ./dump_bin.sh --type for-tests

Run workspace tests:

cargo test --workspace

Note: cargo test --workspace does not include directories excluded in root Cargo.toml (for example zksync_os, tests/fuzzer, tests/evm_tester, tests/instances/eth_runner).

Integration tests are mainly organized in tests/instances/ using the rig in tests/rig/.

Examples:

cargo test -p transactions -- --nocapture
cargo test -p precompiles -- --nocapture

Unit tests are organized in corresponding modules.

Proving-enabled test execution

By default, many tests execute the RISC-V simulator to validate the behavior of the RISC-V-compiled ZKsync OS binary, but they do not generate full proofs. You can run proving by enabling the e2e_proving feature while running tests, for example:

cargo test --features e2e_proving -p transactions -- --nocapture

Alternatively, you can prove tests manually using this guide: Proving tests with CLI.

EVM tester

The repository also contains the EVM tester setup in tests/evm_tester.

Prepare fixtures once:

cd tests/evm_tester && ./download_ethereum_fixtures.sh

Run the tester:

cd tests/evm_tester && cargo run --bin evm-tester --release --features zksync_os_forward_system/no_print

Policies

License

ZKsync OS is distributed under the terms of either

at your option.

Official Links

About

Generalized RISC-V based state transition function for the ZKsync protocol

Topics

Resources

Contributing

Security policy

Stars

41 stars

Watchers

6 watching

Forks

Releases

Packages

Used by

Contributors

Languages