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

PeerDAS (EIP-7594) implementation #277

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
  •  
  •  
  •  
8 changes: 6 additions & 2 deletions .github/workflows/backend-benchmarks.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: benchmarks
on: [push, pull_request, workflow_dispatch]
env:
C_KZG_4844_GIT_HASH: '1bccee0878ffc80efe8741afdb5793ef9105aa35'
C_KZG_4844_GIT_HASH: '0894e3ded53d6f85f5aa146f4fe3e80afb411b94'

jobs:
benchmarks:
Expand Down Expand Up @@ -44,7 +44,7 @@ jobs:
- name: "constantine - install deps"
if: matrix.backend == 'constantine' && matrix.os == 'ubuntu-latest'
run: |
sudo DEBIAN_FRONTEND='noninteractive' apt-fast install \
sudo DEBIAN_FRONTEND='noninteractive' apt-get install \
--no-install-recommends -yq \
libgmp-dev \
llvm
Expand All @@ -53,6 +53,10 @@ jobs:
with:
go-version: ^1.19

- uses: actions/setup-dotnet@v4
with:
dotnet-version: '7.x.x'

- name: "${{ matrix.backend }} Benchmark"
uses: actions-rs/cargo@v1
with:
Expand Down
9 changes: 7 additions & 2 deletions .github/workflows/backend-tests.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: tests
on: [push, pull_request, workflow_dispatch]
env:
C_KZG_4844_GIT_HASH: '1bccee0878ffc80efe8741afdb5793ef9105aa35'
C_KZG_4844_GIT_HASH: '0894e3ded53d6f85f5aa146f4fe3e80afb411b94'

jobs:
kzg_ci:
Expand Down Expand Up @@ -110,15 +110,20 @@ jobs:
python -m pip install --upgrade pip
pip install py_ecc
pip install PyYAML
pip install build
- uses: actions/setup-go@v2
with:
go-version: ^1.19

- uses: actions/setup-dotnet@v4
with:
dotnet-version: '7.x.x'

# Install constantine backend deps
- name: "constantine - install deps"
if: matrix.backend == 'constantine' && matrix.os == 'ubuntu-latest'
run: |
sudo DEBIAN_FRONTEND='noninteractive' apt-fast install \
sudo DEBIAN_FRONTEND='noninteractive' apt-get install \
--no-install-recommends -yq \
libgmp-dev \
llvm
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
workflow_dispatch:

env:
C_KZG_4844_GIT_HASH: '1bccee0878ffc80efe8741afdb5793ef9105aa35'
C_KZG_4844_GIT_HASH: '0894e3ded53d6f85f5aa146f4fe3e80afb411b94'

jobs:
release-build:
Expand Down Expand Up @@ -39,7 +39,7 @@ jobs:
- name: "constantine - install deps"
if: matrix.backend == 'constantine'
run: |
sudo DEBIAN_FRONTEND='noninteractive' apt-fast install \
sudo DEBIAN_FRONTEND='noninteractive' apt-get install \
--no-install-recommends -yq \
libgmp-dev \
llvm
Expand Down
107 changes: 103 additions & 4 deletions Cargo.lock

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

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ members = [
"mcl/kzg",
"mcl/kzg-bench",
"zkcrypto",
"constantine"
"constantine",
"rust-eth-kzg-benches",
]


Expand Down
29 changes: 4 additions & 25 deletions arkworks/benches/fk_20.rs
Original file line number Diff line number Diff line change
@@ -1,36 +1,15 @@
use criterion::{criterion_group, criterion_main, Criterion};
use kzg_bench::benches::fk20::{bench_fk_multi_da, bench_fk_single_da};
use rust_kzg_arkworks::eip_7594::ArkBackend;
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::{ArkFp, ArkFr, ArkG1, ArkG1Affine, ArkG2};
use rust_kzg_arkworks::utils::PolyData;
use rust_kzg_arkworks::kzg_proofs::generate_trusted_setup;

fn bench_fk_single_da_(c: &mut Criterion) {
bench_fk_single_da::<
ArkFr,
ArkG1,
ArkG2,
PolyData,
FFTSettings,
KZGSettings,
KzgFK20SingleSettings,
ArkFp,
ArkG1Affine,
>(c, &generate_trusted_setup)
bench_fk_single_da::<ArkBackend, KzgFK20SingleSettings>(c, &generate_trusted_setup)
}

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

criterion_group! {
Expand Down
27 changes: 4 additions & 23 deletions arkworks/benches/kzg.rs
Original file line number Diff line number Diff line change
@@ -1,34 +1,15 @@
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::{ArkFp, ArkFr, ArkG1, ArkG1Affine, ArkG2};
use rust_kzg_arkworks::utils::PolyData;
use rust_kzg_arkworks::eip_7594::ArkBackend;
use rust_kzg_arkworks::kzg_proofs::generate_trusted_setup;

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

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

criterion_group! {
Expand Down
27 changes: 18 additions & 9 deletions arkworks/csharp.patch
Original file line number Diff line number Diff line change
@@ -1,25 +1,34 @@
From 86aa67b0e3775514cc484ddd2adf6b5dc6e26803 Mon Sep 17 00:00:00 2001
From 5b1ad0fd02016130dcfea5a7e84dcf4de2c67a43 Mon Sep 17 00:00:00 2001
From: sirse <artiom.tretjakovas2@gmail.com>
Date: Thu, 26 Oct 2023 13:40:30 +0300
Subject: [PATCH] Patch csharp binding
Date: Wed, 23 Oct 2024 11:13:11 +0000
Subject: [PATCH] Patch C# bindings

---
bindings/csharp/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
bindings/csharp/Makefile | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/bindings/csharp/Makefile b/bindings/csharp/Makefile
index 5158aad..af3b2a8 100644
index df1730c..f115db1 100644
--- a/bindings/csharp/Makefile
+++ b/bindings/csharp/Makefile
@@ -39,7 +39,7 @@ else
endif

INCLUDE_DIRS = ../../src ../../blst/bindings
-TARGETS = ckzg.c ../../src/c_kzg_4844.c ../../blst/$(BLST_OBJ)
+TARGETS = ckzg.c ../../../../target/release/rust_kzg_arkworks.a
-TARGETS = ckzg_wrap.c ../../src/ckzg.c ../../blst/$(BLST_OBJ)
+TARGETS = ckzg_wrap.c

CFLAGS += -O2 -Wall -Wextra -shared
CFLAGS += ${addprefix -I,${INCLUDE_DIRS}}
@@ -58,7 +58,7 @@ blst:

.PHONY: ckzg
ckzg: blst
- $(CLANG_EXECUTABLE) $(CFLAGS) -o $(CKZG_LIBRARY_PATH) $(TARGETS)
+ $(CLANG_EXECUTABLE) $(CFLAGS) -o $(CKZG_LIBRARY_PATH) $(TARGETS) -L ../../lib -lrust_kzg_arkworks -u verify_cell_kzg_proof_batch

.PHONY: ckzg-dotnet
ckzg-dotnet: ckzg
--
2.34.1
2.47.0

Loading
Loading