* chore: fix actions badge

* test: fix assertion

* chore: fix array method and fmt actions
This commit is contained in:
ashWhiteHat 2024-09-20 03:19:57 +09:00 коммит произвёл GitHub
Родитель f30375e498
Коммит 1e60918472
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
3 изменённых файлов: 8 добавлений и 21 удалений

13
.github/workflows/rust.yml поставляемый
Просмотреть файл

@ -12,7 +12,7 @@ jobs:
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: Install - name: Install
run: rustup default stable run: rustup default stable
- name: Install rustfmt Components - name: Install rustfmt Components
run: rustup component add rustfmt run: rustup component add rustfmt
- name: Install clippy - name: Install clippy
@ -28,30 +28,21 @@ jobs:
- name: Check clippy warnings - name: Check clippy warnings
run: cargo clippy --all-targets --all-features -- -D warnings run: cargo clippy --all-targets --all-features -- -D warnings
build_wasm: build_wasm:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: Install - name: Install
run: rustup default stable run: rustup default stable
- name: Build without std - name: Build without std
run: cargo build --no-default-features --verbose run: cargo build --no-default-features --verbose
- name: Run tests without std - name: Run tests without std
run: cargo test --no-default-features --verbose run: cargo test --no-default-features --verbose
- name: Build examples without std - name: Build examples without std
run: cargo build --examples --no-default-features --verbose run: cargo build --examples --no-default-features --verbose
- name: Install wasm32-wasi target - name: Install wasm32-wasi target
run: rustup target add wasm32-wasi run: rustup target add wasm32-wasi
- name: Install wasm32-unknown-unknown target - name: Install wasm32-unknown-unknown target
run: rustup target add wasm32-unknown-unknown run: rustup target add wasm32-unknown-unknown
- name: Build for target wasm-wasi - name: Build for target wasm-wasi
run: RUSTFLAGS="" cargo build --target=wasm32-wasi --no-default-features --verbose run: RUSTFLAGS="" cargo build --target=wasm32-wasi --no-default-features --verbose

Просмотреть файл

@ -1,6 +1,6 @@
# Spartan: High-speed zkSNARKs without trusted setup # Spartan: High-speed zkSNARKs without trusted setup
![Rust](https://github.com/microsoft/Spartan/workflows/Rust/badge.svg) ![Rust](https://github.com/microsoft/Spartan/actions/workflows/rust.yml/badge.svg)
[![](https://img.shields.io/crates/v/spartan.svg)](<(https://crates.io/crates/spartan)>) [![](https://img.shields.io/crates/v/spartan.svg)](<(https://crates.io/crates/spartan)>)
Spartan is a high-speed zero-knowledge proof system, a cryptographic primitive that enables a prover to prove a mathematical statement to a verifier without revealing anything besides the validity of the statement. This repository provides `libspartan,` a Rust library that implements a zero-knowledge succinct non-interactive argument of knowledge (zkSNARK), which is a type of zero-knowledge proof system with short proofs and fast verification times. The details of the Spartan proof system are described in our [paper](https://eprint.iacr.org/2019/550) published at [CRYPTO 2020](https://crypto.iacr.org/2020/). The security of the Spartan variant implemented in this library is based on the discrete logarithm problem in the random oracle model. Spartan is a high-speed zero-knowledge proof system, a cryptographic primitive that enables a prover to prove a mathematical statement to a verifier without revealing anything besides the validity of the statement. This repository provides `libspartan,` a Rust library that implements a zero-knowledge succinct non-interactive argument of knowledge (zkSNARK), which is a type of zero-knowledge proof system with short proofs and fast verification times. The details of the Spartan proof system are described in our [paper](https://eprint.iacr.org/2019/550) published at [CRYPTO 2020](https://crypto.iacr.org/2020/). The security of the Spartan variant implemented in this library is based on the discrete logarithm problem in the random oracle model.

Просмотреть файл

@ -1234,10 +1234,8 @@ impl ProductLayerProof {
let (row_eval_init, row_eval_read, row_eval_write, row_eval_audit) = &self.eval_row; let (row_eval_init, row_eval_read, row_eval_write, row_eval_audit) = &self.eval_row;
assert_eq!(row_eval_write.len(), num_instances); assert_eq!(row_eval_write.len(), num_instances);
assert_eq!(row_eval_read.len(), num_instances); assert_eq!(row_eval_read.len(), num_instances);
let ws: Scalar = (0..row_eval_write.len()) let ws: Scalar = row_eval_write.iter().product();
.map(|i| row_eval_write[i]) let rs: Scalar = row_eval_read.iter().product();
.product();
let rs: Scalar = (0..row_eval_read.len()).map(|i| row_eval_read[i]).product();
assert_eq!(row_eval_init * ws, rs * row_eval_audit); assert_eq!(row_eval_init * ws, rs * row_eval_audit);
row_eval_init.append_to_transcript(b"claim_row_eval_init", transcript); row_eval_init.append_to_transcript(b"claim_row_eval_init", transcript);
@ -1249,10 +1247,8 @@ impl ProductLayerProof {
let (col_eval_init, col_eval_read, col_eval_write, col_eval_audit) = &self.eval_col; let (col_eval_init, col_eval_read, col_eval_write, col_eval_audit) = &self.eval_col;
assert_eq!(col_eval_write.len(), num_instances); assert_eq!(col_eval_write.len(), num_instances);
assert_eq!(col_eval_read.len(), num_instances); assert_eq!(col_eval_read.len(), num_instances);
let ws: Scalar = (0..col_eval_write.len()) let ws: Scalar = col_eval_write.iter().product();
.map(|i| col_eval_write[i]) let rs: Scalar = col_eval_read.iter().product();
.product();
let rs: Scalar = (0..col_eval_read.len()).map(|i| col_eval_read[i]).product();
assert_eq!(col_eval_init * ws, rs * col_eval_audit); assert_eq!(col_eval_init * ws, rs * col_eval_audit);
col_eval_init.append_to_transcript(b"claim_col_eval_init", transcript); col_eval_init.append_to_transcript(b"claim_col_eval_init", transcript);
@ -1262,7 +1258,7 @@ impl ProductLayerProof {
// verify the evaluation of the sparse polynomial // verify the evaluation of the sparse polynomial
let (eval_dotp_left, eval_dotp_right) = &self.eval_val; let (eval_dotp_left, eval_dotp_right) = &self.eval_val;
assert_eq!(eval_dotp_left.len(), eval_dotp_left.len()); assert_eq!(eval_dotp_left.len(), eval_dotp_right.len());
assert_eq!(eval_dotp_left.len(), num_instances); assert_eq!(eval_dotp_left.len(), num_instances);
let mut claims_dotp_circuit: Vec<Scalar> = Vec::new(); let mut claims_dotp_circuit: Vec<Scalar> = Vec::new();
for i in 0..num_instances { for i in 0..num_instances {