Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
98 changes: 3 additions & 95 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,42 +23,10 @@ jobs:
rustup set profile minimal
- name: Compile
run: cargo build --verbose
# - name: tests
# run: cargo test --profile cli -- --nocapture

transpiler_tests:
name: transpiler tests
runs-on: [matterlabs-ci-runner-c3d]
steps:
- uses: actions/checkout@v3
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
rustflags: ""
- name: Setup
run: |
rustup set profile minimal
- name: Test
- name: Unit tests (CI)
env:
RUST_MIN_STACK: 67108864
run: |
set -euo pipefail
TESTS=(
"jit::tests::test_few_instr"
"jit::tests::test_jit_simple_fibonacci"
"jit::tests::test_jit_recursive_verifier"
"jit::tests::test_ensure_proof_correctness"
"jit::tests::test_jit_full_block"
"jit::tests::test_reference_block_exec"
"jit::tests::run_and_compare"
"replayer::test::test_replay_keccak_f1600"
"vm::test::test_keccak_f1600"
"vm::test::test_reference_block_exec"
"vm::test::test_simple_fibonacci"
)
for test_name in "${TESTS[@]}"; do
echo "Running ${test_name}"
cargo test -p riscv_transpiler -- --nocapture --exact "${test_name}"
done
CI: "true"
run: cargo test --profile cli -- --nocapture

formatting:
name: cargo fmt
Expand All @@ -75,66 +43,6 @@ jobs:
- name: Rustfmt Check
uses: actions-rust-lang/rustfmt@v1

simulator_isa_tests:
name: ISA tests for simulator
runs-on: [matterlabs-ci-runner-c3d]
steps:
- uses: actions/checkout@v3
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
rustflags: ""
- name: Setup
run: |
rustup set profile minimal
- name: tests
working-directory: ./risc_v_simulator
run: cargo test --release --features=delegation

full_recursion_fast:
name: full_recursion_fast
runs-on: [matterlabs-ci-runner-c3d]
steps:
- uses: actions/checkout@v3
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
rustflags: ""

- name: Display CPU Info
run: |
echo "Checking CPU capabilities..."
lscpu | grep avx512 || echo "AVX-512 not supported on this runner"

- name: Setup
run: |
rustup set profile minimal
- name: Run Blake(fibonacci) and prove
working-directory: execution_utils
run: cargo test --release -- --nocapture --exact test_prove_fib
- name: Run base layer recursive verifier over Blake(fibonacci) and prove
working-directory: execution_utils
run: cargo test --release -- --nocapture --exact test_prove_recursion_over_base
- name: Run recursive layer verifier over base layer verifier and prove
working-directory: execution_utils
run: cargo test --release -- --nocapture --exact test_prove_recursion_over_recursion

risc_v_test_delegations:
name: risc_v_tests_delegations
runs-on: [matterlabs-ci-runner]
steps:
- uses: actions/checkout@v3
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
rustflags: ""
- name: Setup
run: |
rustup set profile minimal
- name: Compile
working-directory: ./risc_v_simulator
run: cargo build --features delegation --verbose
- name: test
working-directory: ./risc_v_simulator
run: cargo test --features delegation

circuits_generated:
name: circuits_generated
runs-on: [matterlabs-ci-runner-c3d]
Expand Down
3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ members = [
"trace_holder",
"fft",
"worker",
"test_utils",
"transcript",
"non_determinism_source",
"risc_v_simulator",
Expand Down Expand Up @@ -89,6 +90,7 @@ default-members = [
"prover",
"reduced_keccak",
"risc_v_simulator",
"riscv_transpiler",
# "tools/cli",
"tools/generator",
"trace_holder",
Expand Down Expand Up @@ -127,6 +129,7 @@ common_constants = { path = "./common_constants" }
riscv_common = { path = "./riscv_common", default-features = false }
trace_holder = { path = "./trace_holder" }
worker = { path = "./worker" }
test_utils = { path = "./test_utils" }
fft = { path = "./fft" }
prover = { path = "./prover", default-features = false }
cs = { path = "./cs", default-features = false }
Expand Down
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,15 @@ The most recent documentation can be found here:
- [CLI tool](./tools/cli/README.md)
- [Examples](./examples/)

## Test Modes

- Default local tests:
- `cargo test --profile cli`
- CI-oriented test lane (excludes codegen/legacy-only tests):
- `CI=1 cargo test --profile cli`
- Legacy/manual test lane:
- `cargo test --profile cli --features legacy_tests`

## Policies

- [Security policy](SECURITY.md)
Expand Down Expand Up @@ -55,4 +64,4 @@ Details on third-party notices can be found in [NOTICE.md](./NOTICE.md), in `ACK
Unless you explicitly state otherwise, any contribution intentionally
submitted for inclusion in the work by you, as defined in the Apache-2.0
license, shall be dual licensed as above, without any additional terms or
conditions.
conditions.
7 changes: 6 additions & 1 deletion circuit_defs/bigint_with_control/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,9 @@ prover = { workspace = true, features = ["prover"] }
verifier_generator = { workspace = true }
common_constants = { workspace = true }
serde = { workspace = true }
serde_json = "*"
serde_json = "*"

[features]

[dev-dependencies]
test_utils = { workspace = true }
3 changes: 3 additions & 0 deletions circuit_defs/bigint_with_control/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,13 @@ pub fn generate_artifacts() {

#[cfg(test)]
mod test {
use test_utils::skip_if_ci;

use super::*;

#[test]
fn generate() {
skip_if_ci!();
generate_artifacts();
}
}
2 changes: 2 additions & 0 deletions circuit_defs/bigint_with_control/verifier/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,12 @@ proof_utils = ["verifier_common/proof_utils"]

# If enabled, allows passing custom values into CSR.
replace_csr = ["verifier_common/replace_csr"]
legacy_tests = []

default = ["security_80", "blake2_with_compression"]

[dev-dependencies]
test_utils = { workspace = true }
serde = "1"
serde_json = "*"
prover = {workspace = true, default-features = true}
Expand Down
30 changes: 25 additions & 5 deletions circuit_defs/bigint_with_control/verifier/src/tests.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
use core::mem::offset_of;
use std::collections::VecDeque;

use super::*;
#[cfg(test)]
use prover::prover_stages::Proof;
#[cfg(feature = "legacy_tests")]
use verifier_common::proof_flattener::*;
use verifier_common::prover::nd_source_std::*;
use verifier_common::{
Expand All @@ -20,8 +21,14 @@ fn deserialize_from_file<T: serde::de::DeserializeOwned>(filename: &str) -> T {
serde_json::from_reader(src).unwrap()
}

#[cfg(test)]
use test_utils::skip_if_ci;

#[cfg(test)]
#[ignore = "manual unified/delegation verifier fixture test"]
#[test]
fn test_unified_cycle_or_delegation() {
skip_if_ci!();
// create an oracle to feed into verifier and look at the transcript values

// let proof: Proof = deserialize_from_file("../../zksync-airbender/prover/delegation_proof");
Expand Down Expand Up @@ -138,12 +145,16 @@ fn test_unrolled_circuit() {
}
}

use risc_v_simulator::{
abstractions::non_determinism::QuasiUARTSourceState,
cycle::IWithoutByteAccessIsaConfigWithDelegation,
};
#[cfg(feature = "legacy_tests")]
use risc_v_simulator::abstractions::non_determinism::QuasiUARTSourceState;
#[cfg(feature = "legacy_tests")]
use risc_v_simulator::cycle::IWithoutByteAccessIsaConfigWithDelegation;
#[cfg(feature = "legacy_tests")]
use std::collections::VecDeque;
#[cfg(feature = "legacy_tests")]
struct VectorBasedNonDeterminismSource(VecDeque<u32>, QuasiUARTSourceState);

#[cfg(feature = "legacy_tests")]
impl
risc_v_simulator::abstractions::non_determinism::NonDeterminismCSRSource<
risc_v_simulator::abstractions::memory::VectorMemoryImpl,
Expand All @@ -161,7 +172,10 @@ impl
}
}

#[cfg(feature = "legacy_tests")]
#[ignore = "legacy fixture format drifts; run manually when fixtures are refreshed"]
#[test]
// TODO(legacy-cleanup): determine whether the legacy code path exercised here can be removed.
fn test_full_machine_verifier_out_of_simulator() {
let proof: Proof = deserialize_from_file("../prover/delegation_proof");
let compiled_circuit: CompiledCircuitArtifact<Mersenne31Field> =
Expand Down Expand Up @@ -207,7 +221,10 @@ fn test_full_machine_verifier_out_of_simulator() {
.unwrap();
}

#[cfg(feature = "legacy_tests")]
#[ignore = "legacy fixture format drifts; run manually when fixtures are refreshed"]
#[test]
// TODO(legacy-cleanup): determine whether the legacy code path exercised here can be removed.
fn test_reduced_machine_verifier_out_of_simulator() {
let proof: Proof = deserialize_from_file("../prover/reduced_machine_proof");
let compiled_circuit: CompiledCircuitArtifact<Mersenne31Field> =
Expand Down Expand Up @@ -254,7 +271,10 @@ fn test_reduced_machine_verifier_out_of_simulator() {
}

// #[ignore = "Requires ZKsyncOS app bin"]
#[cfg(feature = "legacy_tests")]
#[ignore = "manual simulator integration test"]
#[test]
// TODO(legacy-cleanup): determine whether the legacy code path exercised here can be removed.
fn test_verifier_in_simulator() {
let proof: Proof = deserialize_from_file("../../zksync-airbender/prover/delegation_proof");
let compiled_circuit: CompiledCircuitArtifact<Mersenne31Field> =
Expand Down
7 changes: 6 additions & 1 deletion circuit_defs/blake2_with_compression/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,9 @@ prover = { workspace = true, features = ["prover"] }
verifier_generator = { workspace = true }
common_constants = { workspace = true }
serde = { workspace = true }
serde_json = "*"
serde_json = "*"

[features]

[dev-dependencies]
test_utils = { workspace = true }
3 changes: 3 additions & 0 deletions circuit_defs/blake2_with_compression/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,13 @@ pub fn generate_artifacts() {

#[cfg(test)]
mod test {
use test_utils::skip_if_ci;

use super::*;

#[test]
fn generate() {
skip_if_ci!();
generate_artifacts();
}
}
2 changes: 2 additions & 0 deletions circuit_defs/blake2_with_compression/verifier/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,12 @@ proof_utils = ["verifier_common/proof_utils"]

# If enabled, allows passing custom values into CSR.
replace_csr = ["verifier_common/replace_csr"]
legacy_tests = []

default = ["security_80", "blake2_with_compression"]

[dev-dependencies]
test_utils = { workspace = true }
serde = "1"
serde_json = "*"
prover = {workspace = true, default-features = true}
Expand Down
30 changes: 25 additions & 5 deletions circuit_defs/blake2_with_compression/verifier/src/tests.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
use core::mem::offset_of;
use std::collections::VecDeque;

use super::*;
#[cfg(test)]
use prover::prover_stages::Proof;
#[cfg(feature = "legacy_tests")]
use verifier_common::proof_flattener::*;
use verifier_common::prover::nd_source_std::*;
use verifier_common::{
Expand All @@ -20,8 +21,14 @@ fn deserialize_from_file<T: serde::de::DeserializeOwned>(filename: &str) -> T {
serde_json::from_reader(src).unwrap()
}

#[cfg(test)]
use test_utils::skip_if_ci;

#[cfg(test)]
#[ignore = "manual unified/delegation verifier fixture test"]
#[test]
fn test_unified_cycle_or_delegation() {
skip_if_ci!();
// create an oracle to feed into verifier and look at the transcript values

// let proof: Proof = deserialize_from_file("../../zksync-airbender/prover/delegation_proof");
Expand Down Expand Up @@ -138,12 +145,16 @@ fn test_unrolled_circuit() {
}
}

use risc_v_simulator::{
abstractions::non_determinism::QuasiUARTSourceState,
cycle::IWithoutByteAccessIsaConfigWithDelegation,
};
#[cfg(feature = "legacy_tests")]
use risc_v_simulator::abstractions::non_determinism::QuasiUARTSourceState;
#[cfg(feature = "legacy_tests")]
use risc_v_simulator::cycle::IWithoutByteAccessIsaConfigWithDelegation;
#[cfg(feature = "legacy_tests")]
use std::collections::VecDeque;
#[cfg(feature = "legacy_tests")]
struct VectorBasedNonDeterminismSource(VecDeque<u32>, QuasiUARTSourceState);

#[cfg(feature = "legacy_tests")]
impl
risc_v_simulator::abstractions::non_determinism::NonDeterminismCSRSource<
risc_v_simulator::abstractions::memory::VectorMemoryImpl,
Expand All @@ -161,7 +172,10 @@ impl
}
}

#[cfg(feature = "legacy_tests")]
#[ignore = "legacy fixture format drifts; run manually when fixtures are refreshed"]
#[test]
// TODO(legacy-cleanup): determine whether the legacy code path exercised here can be removed.
fn test_full_machine_verifier_out_of_simulator() {
let proof: Proof = deserialize_from_file("../prover/delegation_proof");
let compiled_circuit: CompiledCircuitArtifact<Mersenne31Field> =
Expand Down Expand Up @@ -207,7 +221,10 @@ fn test_full_machine_verifier_out_of_simulator() {
.unwrap();
}

#[cfg(feature = "legacy_tests")]
#[ignore = "legacy fixture format drifts; run manually when fixtures are refreshed"]
#[test]
// TODO(legacy-cleanup): determine whether the legacy code path exercised here can be removed.
fn test_reduced_machine_verifier_out_of_simulator() {
let proof: Proof = deserialize_from_file("../prover/reduced_machine_proof");
let compiled_circuit: CompiledCircuitArtifact<Mersenne31Field> =
Expand Down Expand Up @@ -254,7 +271,10 @@ fn test_reduced_machine_verifier_out_of_simulator() {
}

// #[ignore = "Requires ZKsyncOS app bin"]
#[cfg(feature = "legacy_tests")]
#[ignore = "manual simulator integration test"]
#[test]
// TODO(legacy-cleanup): determine whether the legacy code path exercised here can be removed.
fn test_verifier_in_simulator() {
let proof: Proof = deserialize_from_file("../../zksync-airbender/prover/delegation_proof");
let compiled_circuit: CompiledCircuitArtifact<Mersenne31Field> =
Expand Down
Loading