Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Brush up repo for publishing #58

Merged
merged 7 commits into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 24 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,25 @@
# zksync-era-vm2
# High-Performance ZKsync Era VM

A high-performance rewrite of the zksync-era VM.
A high-performance rewrite of the out-of-circuit VM for ZKsync Era.

## Overview

This repository contains the following crates:

- [`zksync_vm2_interface`](crates/vm2-interface): stable VM interface for tracers
- [`zksync_vm2`](crates/vm2): VM implementation itself
- [`zksync_vm2_afl_fuzz`](tests/afl-fuzz): [AFL](https://crates.io/crates/afl)-based fuzzing for the VM.

## Policies

- [Security policy](SECURITY.md)
- [Contribution policy](CONTRIBUTING.md)

## License

ZKsync Era VM is distributed under the terms of either

- Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or <http://www.apache.org/licenses/LICENSE-2.0>)
- MIT license ([LICENSE-MIT](LICENSE-MIT) or <https://opensource.org/blog/license/mit/>)

at your option.
2 changes: 2 additions & 0 deletions crates/vm2-interface/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
[package]
name = "zksync_vm2_interface"
description = "Stable interface for ZKsync VM tracers"
readme = "README.md"
version.workspace = true
edition.workspace = true
authors.workspace = true
Expand Down
1 change: 1 addition & 0 deletions crates/vm2-interface/LICENSE-APACHE
1 change: 1 addition & 0 deletions crates/vm2-interface/LICENSE-MIT
12 changes: 12 additions & 0 deletions crates/vm2-interface/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Stable Interface for ZKsync Era VM

This library provides a stable interface for the EraVM. It defines an interface for tracers that will never change but may be extended.

## License

ZKsync Era VM is distributed under the terms of either

- Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or <http://www.apache.org/licenses/LICENSE-2.0>)
- MIT license ([LICENSE-MIT](LICENSE-MIT) or <https://opensource.org/blog/license/mit/>)

at your option.
6 changes: 3 additions & 3 deletions crates/vm2-interface/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//! not necessary. In fact, tracers should depend on the oldest version that has the required
//! features.
//!
//! A struct implementing [Tracer] may read and mutate the VM's state via [StateInterface]
//! A struct implementing [`Tracer`] may read and mutate the VM's state via [`StateInterface`]
//! when particular opcodes are executed.
//!
//! ## Why is extreme backwards compatibility required here?
Expand All @@ -23,9 +23,9 @@
//! version that you publish and import it from the previous version instead.
//!
//! This is how you would add a new method to StateInterface and a new opcode.
//!
//! ```
//! # use eravm_stable_interface as eravm_stable_interface_v1;
joonazan marked this conversation as resolved.
Show resolved Hide resolved
//! use eravm_stable_interface_v1::{StateInterface as StateInterfaceV1, Tracer as TracerV1, opcodes::NearCall};
//! use zksync_vm2_interface::{StateInterface as StateInterfaceV1, Tracer as TracerV1, opcodes::NearCall};
//!
//! trait StateInterface: StateInterfaceV1 {
//! fn get_some_new_field(&self) -> u32;
Expand Down
2 changes: 2 additions & 0 deletions crates/vm2/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
[package]
name = "zksync_vm2"
description = "High-performance rewrite of the out-of-circuit VM for ZKsync Era"
readme = "README.md"
version.workspace = true
edition.workspace = true
authors.workspace = true
Expand Down
1 change: 1 addition & 0 deletions crates/vm2/LICENSE-APACHE
1 change: 1 addition & 0 deletions crates/vm2/LICENSE-MIT
12 changes: 12 additions & 0 deletions crates/vm2/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# High-Performance ZKsync Era VM

A high-performance rewrite of the out-of-circuit VM for ZKsync Era.

## License

ZKsync Era VM is distributed under the terms of either

- Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or <http://www.apache.org/licenses/LICENSE-2.0>)
- MIT license ([LICENSE-MIT](LICENSE-MIT) or <https://opensource.org/blog/license/mit/>)

at your option.
4 changes: 2 additions & 2 deletions tests/afl-fuzz/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ Finds divergences and instructions that put vm2 in an invalid state.

Setup: `cargo install cargo-afl`

Use `sh fuzz.sh` (or customize the command to your liking) to start fuzzing.
Use `sh fuzz.sh` (or customize the command to your liking) to start fuzzing.
`show_crash.sh` can be used to quickly run one of the found crashes and display all the necessary information
for fixing it.

The size of the search space is relatively small due to tricks explained in the single_instruction_test module.
`cargo run --bin check_input_size` prints out an estimate of the amount of information in the state in bytes.
`cargo run --bin check_input_size` prints out an estimate of the amount of information in the state in bytes.