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

Merge Integration #253

Merged
merged 34 commits into from
Jan 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
7814294
add fp & affine traits, 256bit scalar type
lynxcs Nov 5, 2023
de6af3d
implement new traits for blst backend
lynxcs Nov 5, 2023
25c7976
implement parallel pippinger using traits
lynxcs Nov 6, 2023
c09f7ca
blst pippinger generic
lynxcs Dec 5, 2023
153a4e7
move generic arkmsm to separate folder
lynxcs Dec 12, 2023
728eff2
add arkmsm feature flag, update parallel flag
lynxcs Dec 12, 2023
11ad7c8
add func to fr to convert to scalar256
lynxcs Dec 14, 2023
dc1de7a
msm accept projective + fr & convert internally
lynxcs Dec 15, 2023
83ac784
add commented out old parallel pippenger impl
lynxcs Dec 15, 2023
addc41c
Added generic BGMW
ArtiomTr Dec 20, 2023
ee0803b
Support precomputations in C bindings
ArtiomTr Dec 21, 2023
279f3df
Switch to stable version
sauliusgrigaitis Dec 22, 2023
9e4babc
merge
sauliusgrigaitis Dec 25, 2023
7543e65
init commit
lynxcs Dec 1, 2023
acd3337
Partial constantine ecc backend
Armantidas Dec 16, 2023
792c5a4
Finish constantine base
Armantidas Dec 28, 2023
6f0ae50
Add mixed kzg settings, benchmarks/tests for constantine impls of eip…
lynxcs Dec 31, 2023
e8d7b01
bgmw + workflows
lynxcs Dec 31, 2023
7aef5bc
remove additional blst usage in g1,g2,fr where possible + clippy fixes
lynxcs Dec 31, 2023
72e7a5b
implement debug trait directly, clippy & fmt fixes
lynxcs Dec 31, 2023
f997010
switch constantine deps to repo
lynxcs Dec 31, 2023
2824ac3
workflow setup nim
lynxcs Dec 31, 2023
1a0ef97
mixed: use compute_kzg_proof_parallel
lynxcs Jan 3, 2024
30b1aa6
Constantine - use batch affine
Armantidas Jan 6, 2024
247e0f9
switch to constantine-public-sys branch
lynxcs Jan 7, 2024
595b20a
update constantine ver
lynxcs Jan 11, 2024
5ec4bbd
constantine g1,g2 mul remove blst usage
lynxcs Jan 11, 2024
dd32072
CtFr remove blst usage
Armantidas Jan 11, 2024
d08d3f9
fmt & clippy fixes
lynxcs Jan 11, 2024
e631953
constantine - remove usage of blst in from_bytes_unchecked
lynxcs Jan 11, 2024
5e48edd
Merge pull request #251 from lynxcs/feat/constantine
sauliusgrigaitis Jan 15, 2024
5fad77a
change ZERO to zero
lynxcs Jan 15, 2024
1e2faab
zkcrypto update - impl required traits
lynxcs Jan 15, 2024
02131ae
Merge pull request #252 from lynxcs/feat/zkcrypto_update
sauliusgrigaitis Jan 17, 2024
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
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
Loading