Skip to content

Commit

Permalink
PST/SQRT + Benches (#35)
Browse files Browse the repository at this point in the history
* first version of the sqrt PST without the MIPP

* snarkpack integration

* snarkpack integration

* adding mipp as submodule directly

* snarkpack integration

* finalizing

* snarkpack integration

* update mipp with latestest optimisations and add preliminary
documentation

* improve codebase documentation

* remove unused imports and apply cargo fix changes

* passing v0.4

* adding gh action

* correct workflow item

* correct working dir and msrv

* remove unnecessary stuff

* wip

* wip

* remove circuit in fq as it's not needed now

* done for tonight

* wip

* wip

* sip

* prallelise commitment and groth16 verification

* finalise comments for mipp

* wip

* finalise comments

* wip

* compiling but test failing

* putting back non random blinds

* using absorb when we can

* absorbing scalar

* with bls12-381

* stuff

* trying to bring ark-blst to testudo

* correcting random implementation

* with square in place

* works with blst

* works with blst

* fix: don't require nightly Rust

With removing the `test` feature, it can also be built with a stable
Rust release and don't require a nightly Rust version.

* using ark-blst main branch

* started cleanup and added testudo benchmark

* add testudo snark and nizk in separate files

* rename functions that perform setups and add comments

* prototyping

* explain testudo-nizk

* add support for odd case in sqrt_pst

* add missing constraints and correct proof size for benchmarks

* add support for odd case in sqrt_pst

* fix typo in comment

* Documentation #31

* fix typo in comment

* Fix Cargo.toml and add benchmark for sqrt pst (#34)

* add benchmark for sqrt pst

* fix typo in comment

* add README

* comment from readme not executing

---------

Co-authored-by: Mara Mihali <[email protected]>
Co-authored-by: Mara Mihali <[email protected]>
Co-authored-by: Volker Mische <[email protected]>
  • Loading branch information
4 people authored Mar 22, 2023
1 parent bae8104 commit 7db2d30
Show file tree
Hide file tree
Showing 40 changed files with 9,773 additions and 8,339 deletions.
5 changes: 1 addition & 4 deletions .cargo/config
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
[build]
rustflags = [
"-C", "target-cpu=native",
]

52 changes: 21 additions & 31 deletions .github/workflows/testudo.yml
Original file line number Diff line number Diff line change
@@ -1,37 +1,27 @@
name: Build and Test Testudo

on:
push:
branches: [master]
pull_request:
branches: [master]
# The crate ark-ff uses the macro llvm_asm! when emitting asm which returns an
# error because it was deprecated in favour of asm!. We temporarily overcome
# this problem by setting the environment variable below (until the crate
# is updated).
env:
RUSTFLAGS: "--emit asm -C llvm-args=-x86-asm-syntax=intel"
on: [push, pull_request]

jobs:
build_nightly:
cargo-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install
run: rustup default nightly
- name: Install rustfmt Components
run: rustup component add rustfmt
# - name: Install clippy
# run: rustup component add clippy
- name: Build
run: cargo build --verbose
- name: Run tests
run: cargo test --verbose
- name: Build examples
run: cargo build --examples --verbose
- name: Check Rustfmt Code Style
run: cargo fmt --all -- --check
# cargo clippy uses cargo check which returns an error when asm is emitted
# we want to emit asm for ark-ff operations so we avoid using clippy for # now
# - name: Check clippy warnings
# run: cargo clippy --all-targets --all-features
- name: Checkout sources
uses: actions/checkout@v2
with:
submodules: recursive

- name: Install toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true

- uses: Swatinem/rust-cache@v2
with:
shared-key: cache-${{ hashFiles('**/Cargo.lock') }}
cache-on-failure: true

- name: cargo test
run: RUST_LOG=info cargo test --all --all-features -- --nocapture
63 changes: 32 additions & 31 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,26 @@ itertools = "0.10.0"
colored = "2.0.0"
thiserror = "1.0"
json = "0.12.4"
ark-ff = { version = "^0.3.0", default-features = false }
ark-ec = { version = "^0.3.0", default-features = false }
ark-std = { version = "^0.3.0"}
ark-bls12-377 = { version = "^0.3.0", features = ["r1cs","curve"] }
ark-serialize = { version = "^0.3.0", features = ["derive"] }
ark-sponge = { version = "^0.3.0" , features = ["r1cs"] }
ark-crypto-primitives = { version = "^0.3.0", default-features = true }
ark-r1cs-std = { version = "^0.3.0", default-features = false }
ark-nonnative-field = { version = "0.3.0", default-features = false }
ark-relations = { version = "^0.3.0", default-features = false, optional = true }
ark-groth16 = { version = "^0.3.0", features = ["r1cs"] }
ark-bw6-761 = { version = "^0.3.0" }
ark-poly-commit = { version = "^0.3.0" }
ark-poly = {version = "^0.3.0"}
ark-ff = { version = "0.4.0", default-features = false }
ark-ec = { version = "0.4.0", default-features = false }
ark-std = { version = "0.4.0"}
ark-bls12-377 = { version = "0.4.0", features = ["r1cs","curve"] }
ark-bls12-381 = { version = "0.4.0", features = ["curve"] }
ark-blst = { git = "https://github.com/nikkolasg/ark-blst" }
ark-serialize = { version = "0.4.0", features = ["derive"] }
ark-crypto-primitives = {version = "0.4.0", features = ["sponge","r1cs","snark"] }
ark-r1cs-std = { version = "0.4.0", default-features = false }
ark-relations = { version = "0.4.0", default-features = false, optional = true }
ark-snark = { version = "0.4.0", default-features = false }
ark-groth16 = { version = "0.3.0" }
ark-bw6-761 = { version = "0.4.0" }
ark-poly-commit = { version = "0.4.0" }
ark-poly = {version = "0.4.0"}

poseidon-paramgen = { git = "https://github.com/nikkolasg/poseidon377", branch = "feat/v0.4" }
poseidon-parameters = { git = "https://github.com/nikkolasg/poseidon377", branch = "feat/v0.4" }
# Needed for ark-blst
blstrs = { version = "^0.6.1", features = ["__private_bench"] }

lazy_static = "1.4.0"
rand = { version = "0.8", features = [ "std", "std_rng" ] }
Expand All @@ -46,29 +52,20 @@ csv = "1.1.5"
criterion = "0.3.6"

[lib]
name = "libspartan"
name = "libtestudo"
path = "src/lib.rs"

[[bin]]
name = "snark"
path = "profiler/snark.rs"

[[bin]]
name = "nizk"
path = "profiler/nizk.rs"

[[bench]]
name = "snark"
harness = false
name = "testudo"
path = "profiler/testudo.rs"

[[bench]]
name = "nizk"
name = "testudo"
harness = false

[[bench]]
name = "r1cs"
name = "pst"
harness = false
debug = true

[features]
multicore = ["rayon"]
Expand All @@ -79,6 +76,10 @@ parallel = [ "std", "ark-ff/parallel", "ark-std/parallel", "ark-ec/parallel", "a
std = ["ark-ff/std", "ark-ec/std", "ark-std/std", "ark-relations/std", "ark-serialize/std"]

[patch.crates-io]
ark-r1cs-std = { git = "https://github.com/arkworks-rs/r1cs-std/", rev = "a2a5ac491ae005ba2afd03fd21b7d3160d794a83"}
ark-poly-commit = {git = "https://github.com/maramihali/poly-commit"}

ark-poly-commit = {git = "https://github.com/cryptonetlab/ark-polycommit", branch="feat/variable-crs"}
ark-groth16 = { git = "https://github.com/arkworks-rs/groth16" }
blstrs = { git = "https://github.com/nikkolasg/blstrs", branch = "feat/arkwork" }
ark-ec = { git = "https://github.com/vmx/algebra", branch="affine-repr-xy-owned" }
ark-ff = { git = "https://github.com/vmx/algebra", branch="affine-repr-xy-owned" }
ark-poly = { git = "https://github.com/vmx/algebra", branch="affine-repr-xy-owned" }
ark-serialize = { git = "https://github.com/vmx/algebra", branch="affine-repr-xy-owned" }
Loading

0 comments on commit 7db2d30

Please sign in to comment.