Skip to content

Commit

Permalink
Merge pull request #253 from sifraitech/integration
Browse files Browse the repository at this point in the history
Merge Integration
  • Loading branch information
sauliusgrigaitis authored Jan 18, 2024
2 parents 4b53ff2 + 02131ae commit 8290f80
Show file tree
Hide file tree
Showing 162 changed files with 12,902 additions and 544 deletions.
18 changes: 17 additions & 1 deletion .github/workflows/backend-benchmarks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
matrix:
os: [ubuntu-latest, windows-latest, macos-11]
# Excluding mcl for now due to they have different project layout
backend: [blst, zkcrypto, arkworks]
backend: [blst, zkcrypto, arkworks, constantine]
include:
# Setup exec_once_per_backend flag
- os: ubuntu-latest
Expand All @@ -23,6 +23,8 @@ jobs:
support_ckzg: true
- backend: arkworks
support_ckzg: true
- backend: constantine
support_ckzg: true

steps:
- uses: actions/checkout@v2
Expand All @@ -31,6 +33,20 @@ jobs:
distribution: "temurin"
java-version: "11"

- if: matrix.backend == 'constantine'
uses: jiro4989/setup-nim-action@v1
with:
nim-version: '1.6.14'

# Install constantine backend deps
- name: "constantine - install deps"
if: matrix.backend == 'constantine' && matrix.os == 'ubuntu-latest'
run: |
sudo DEBIAN_FRONTEND='noninteractive' apt-fast install \
--no-install-recommends -yq \
libgmp-dev \
llvm
- uses: actions/setup-go@v2
with:
go-version: ^1.19
Expand Down
21 changes: 20 additions & 1 deletion .github/workflows/backend-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
matrix:
os: [ubuntu-latest, windows-latest, macos-11]
# Excluding mcl for now due to they have different project layout
backend: [blst, zkcrypto, arkworks]
backend: [blst, zkcrypto, arkworks, constantine]
include:
# Set default clippy flag to all-features
- clippy-flag: --all-features
Expand All @@ -36,13 +36,23 @@ jobs:
- backend: arkworks
support_wasm: true
support_ckzg: true
- backend: constantine
# FIXME: Check for wasm support
support_wasm: false
support_ckzg: true

steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v3
with:
distribution: "temurin"
java-version: "11"

- if: matrix.backend == 'constantine'
uses: jiro4989/setup-nim-action@v1
with:
nim-version: '1.6.14'

- uses: actions/setup-python@v4
with:
python-version: '3.10'
Expand All @@ -55,6 +65,15 @@ jobs:
with:
go-version: ^1.19

# Install constantine backend deps
- name: "constantine - install deps"
if: matrix.backend == 'constantine' && matrix.os == 'ubuntu-latest'
run: |
sudo DEBIAN_FRONTEND='noninteractive' apt-fast install \
--no-install-recommends -yq \
libgmp-dev \
llvm
# Check kzg clippy
- name: "kzg clippy"
if: matrix.exec_once_overall
Expand Down
16 changes: 15 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
strategy:
fail-fast: false
matrix:
backend: [blst, zkcrypto, arkworks]
backend: [blst, zkcrypto, arkworks, constantine]
target: [windows, linux]
include:
# Set target-name for target builds
Expand All @@ -30,6 +30,20 @@ jobs:
steps:
- uses: actions/checkout@v2

- if: matrix.backend == 'constantine'
uses: jiro4989/setup-nim-action@v1
with:
nim-version: '1.6.14'

# Install constantine backend deps
- name: "constantine - install deps"
if: matrix.backend == 'constantine' && matrix.os == 'ubuntu-latest'
run: |
sudo DEBIAN_FRONTEND='noninteractive' apt-fast install \
--no-install-recommends -yq \
libgmp-dev \
llvm
- if: matrix.target == 'windows'
name: Install MinGW
run: |
Expand Down
52 changes: 51 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ members = [
"mcl/kzg",
"mcl/kzg-bench",
"zkcrypto",
"constantine"
]


Expand Down
10 changes: 8 additions & 2 deletions arkworks/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ version = "0.1.0"
edition = "2021"

[dependencies]
blst = {'git' = 'https://github.com/supranational/blst.git'}
blst = "0.3.11"
kzg = { path = "../kzg", default-features = false }
ark-std = { version = "^0.4.0", default-features = false }
ark-ff = { version = "^0.4.2", default-features = false }
ark-ff = { version = "^0.4.2", default-features = false, features = [ "asm" ] }
ark-ec = { version = "^0.4.2", default-features = false }
ark-poly = { version = "^0.4.2", default-features = false }
ark-bls12-381 = { version = "^0.4.0", default-features = false, features = [ "curve" ] }
Expand Down Expand Up @@ -40,6 +40,12 @@ rand = [
"dep:rand",
"kzg/rand",
]
bgmw = [
"kzg/bgmw"
]
arkmsm = [
"kzg/arkmsm"
]

[[bench]]
name = "fft"
Expand Down
4 changes: 2 additions & 2 deletions arkworks/benches/eip_4844.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ use kzg::eip_4844::{
use kzg_bench::benches::eip_4844::bench_eip_4844;
use rust_kzg_arkworks::eip_4844::load_trusted_setup_filename_rust;
use rust_kzg_arkworks::kzg_proofs::{FFTSettings, KZGSettings};
use rust_kzg_arkworks::kzg_types::{ArkFr, ArkG1, ArkG2};
use rust_kzg_arkworks::kzg_types::{ArkFp, ArkFr, ArkG1, ArkG1Affine, ArkG2};
use rust_kzg_arkworks::utils::PolyData;

fn bench_eip_4844_(c: &mut Criterion) {
bench_eip_4844::<ArkFr, ArkG1, ArkG2, PolyData, FFTSettings, KZGSettings>(
bench_eip_4844::<ArkFr, ArkG1, ArkG2, PolyData, FFTSettings, KZGSettings, ArkFp, ArkG1Affine>(
c,
&load_trusted_setup_filename_rust,
&blob_to_kzg_commitment_rust,
Expand Down
19 changes: 14 additions & 5 deletions arkworks/benches/fk_20.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use criterion::{criterion_group, criterion_main, Criterion};
use kzg_bench::benches::fk20::{bench_fk_multi_da, bench_fk_single_da};
use rust_kzg_arkworks::fk20_proofs::{KzgFK20MultiSettings, KzgFK20SingleSettings};
use rust_kzg_arkworks::kzg_proofs::{generate_trusted_setup, FFTSettings, KZGSettings};
use rust_kzg_arkworks::kzg_types::{ArkFr, ArkG1, ArkG2};
use rust_kzg_arkworks::kzg_types::{ArkFp, ArkFr, ArkG1, ArkG1Affine, ArkG2};
use rust_kzg_arkworks::utils::PolyData;

fn bench_fk_single_da_(c: &mut Criterion) {
Expand All @@ -14,14 +14,23 @@ fn bench_fk_single_da_(c: &mut Criterion) {
FFTSettings,
KZGSettings,
KzgFK20SingleSettings,
ArkFp,
ArkG1Affine,
>(c, &generate_trusted_setup)
}

fn bench_fk_multi_da_(c: &mut Criterion) {
bench_fk_multi_da::<ArkFr, ArkG1, ArkG2, PolyData, FFTSettings, KZGSettings, KzgFK20MultiSettings>(
c,
&generate_trusted_setup,
)
bench_fk_multi_da::<
ArkFr,
ArkG1,
ArkG2,
PolyData,
FFTSettings,
KZGSettings,
KzgFK20MultiSettings,
ArkFp,
ArkG1Affine,
>(c, &generate_trusted_setup)
}

criterion_group! {
Expand Down
30 changes: 21 additions & 9 deletions arkworks/benches/kzg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,33 @@ use criterion::{criterion_group, criterion_main, Criterion};
use kzg_bench::benches::kzg::{bench_commit_to_poly, bench_compute_proof_single};

use rust_kzg_arkworks::kzg_proofs::{generate_trusted_setup, FFTSettings, KZGSettings};
use rust_kzg_arkworks::kzg_types::{ArkFr, ArkG1, ArkG2};
use rust_kzg_arkworks::kzg_types::{ArkFp, ArkFr, ArkG1, ArkG1Affine, ArkG2};
use rust_kzg_arkworks::utils::PolyData;

fn bench_commit_to_poly_(c: &mut Criterion) {
bench_commit_to_poly::<ArkFr, ArkG1, ArkG2, PolyData, FFTSettings, KZGSettings>(
c,
&generate_trusted_setup,
);
bench_commit_to_poly::<
ArkFr,
ArkG1,
ArkG2,
PolyData,
FFTSettings,
KZGSettings,
ArkFp,
ArkG1Affine,
>(c, &generate_trusted_setup);
}

fn bench_compute_proof_single_(c: &mut Criterion) {
bench_compute_proof_single::<ArkFr, ArkG1, ArkG2, PolyData, FFTSettings, KZGSettings>(
c,
&generate_trusted_setup,
);
bench_compute_proof_single::<
ArkFr,
ArkG1,
ArkG2,
PolyData,
FFTSettings,
KZGSettings,
ArkFp,
ArkG1Affine,
>(c, &generate_trusted_setup);
}

criterion_group! {
Expand Down
4 changes: 2 additions & 2 deletions arkworks/benches/lincomb.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use criterion::{criterion_group, criterion_main, Criterion};
use kzg_bench::benches::lincomb::bench_g1_lincomb;
use rust_kzg_arkworks::fft_g1::g1_linear_combination;
use rust_kzg_arkworks::kzg_types::{ArkFr, ArkG1};
use rust_kzg_arkworks::kzg_types::{ArkFp, ArkFr, ArkG1, ArkG1Affine};

fn bench_g1_lincomb_(c: &mut Criterion) {
bench_g1_lincomb::<ArkFr, ArkG1>(c, &g1_linear_combination);
bench_g1_lincomb::<ArkFr, ArkG1, ArkFp, ArkG1Affine>(c, &g1_linear_combination);
}

criterion_group! {
Expand Down
2 changes: 2 additions & 0 deletions arkworks/src/eip_4844.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ fn kzg_settings_to_rust(c_settings: &CKZGSettings) -> Result<KZGSettings, String
fs: fft_settings_to_rust(c_settings)?,
secret_g1,
secret_g2,
// TODO:
precomputation: None,
})
}

Expand Down
Loading

0 comments on commit 8290f80

Please sign in to comment.