diff --git a/.github/workflows/csharp-bindings-build.yml b/.github/workflows/csharp-bindings-build.yml
index 663dda5..50b88ae 100644
--- a/.github/workflows/csharp-bindings-build.yml
+++ b/.github/workflows/csharp-bindings-build.yml
@@ -13,20 +13,15 @@ jobs:
strategy:
matrix:
target:
- - clang: x86_64-linux
- native: linux-x64
+ - native: linux-x64
host: ubuntu-latest
- - clang: arm64-linux
- native: linux-arm64
+ - native: linux-arm64
host: ubuntu-latest
- - clang: arm64-darwin
- native: osx-arm64
+ - native: osx-arm64
host: macos-latest
- - clang: x86_64-darwin
- native: osx-x64
+ - native: osx-x64
host: macos-latest
- - clang: x86_64-win
- native: win-x64
+ - native: win-x64
host: windows-latest
steps:
- uses: ilammy/msvc-dev-cmd@v1
@@ -34,7 +29,7 @@ jobs:
with:
submodules: recursive
- name: Build native library for ${{ matrix.target.native }}
- run: cd bindings/csharp && make -B ckzg CSHARP_PLATFORM=${{ matrix.target.native }} CLANG_PLATFORM=${{ matrix.target.clang }}
+ run: cd bindings/csharp && make -B ckzg CSHARP_PLATFORM=${{ matrix.target.native }}
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
@@ -76,7 +71,7 @@ jobs:
- name: Test
run: cd bindings/csharp && dotnet test --configuration Release --no-restore
- name: Build
- run: cd bindings/csharp && dotnet build -p:Version=0.1.1.${{github.run_number}} --configuration Release --no-restore -o build
+ run: cd bindings/csharp && dotnet build -p:Version=0.1.1.${{github.run_number}} --configuration Release --no-restore
- name: Upload package
uses: actions/upload-artifact@v3
with:
diff --git a/bindings/csharp/Ckzg.Bindings/Ckzg.cs b/bindings/csharp/Ckzg.Bindings/Ckzg.cs
index 8511589..9d37ade 100644
--- a/bindings/csharp/Ckzg.Bindings/Ckzg.cs
+++ b/bindings/csharp/Ckzg.Bindings/Ckzg.cs
@@ -5,10 +5,18 @@ namespace Ckzg;
public class Ckzg
{
- public const int CommitmentLength = 48;
- public const int BlobElementLength = 32;
- public const int BlobLength = BlobElementLength * 4096;
- public const int ProofLength = 48;
+ public const int BytesPerFieldElement = 32;
+ public const int BytesPerBlob = BytesPerFieldElement * 4096;
+ public const int BytesPerCommitment = 48;
+ public const int BytesPerProof = 48;
+
+ public enum Ret
+ {
+ Ok,
+ BadArgs,
+ Error,
+ Malloc
+ }
static Ckzg() => AssemblyLoadContext.Default.ResolvingUnmanagedDll += (assembly, path) => NativeLibrary.Load($"runtimes/{(
RuntimeInformation.IsOSPlatform(OSPlatform.Linux) ? "linux" :
@@ -20,59 +28,12 @@ public class Ckzg
_ => ""
}}/native/{path}.{(RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "dll" : "so")}");
- ///
- /// Calculates commitment for the blob
- ///
- /// Preallocated buffer of bytes to receive the commitment
- /// Flatten array of blob elements
- /// Trusted setup settings
- /// Returns error code or 0 if successful
- [DllImport("ckzg", EntryPoint = "blob_to_kzg_commitment", CallingConvention = CallingConvention.Cdecl)]
- public unsafe static extern int BlobToKzgCommitment(byte* commitment, byte* blob, IntPtr ts);
-
-
- ///
- /// Calculates aggregated proof for the blobs
- ///
- /// Preallocated buffer of bytes to receive the proof
- /// Blobs as a flatten byte array
- /// Blobs count
- /// Trusted setup settings
- /// Returns error code or 0 if successful
- [DllImport("ckzg", EntryPoint = "compute_aggregate_kzg_proof", CallingConvention = CallingConvention.Cdecl)]
- public unsafe static extern int ComputeAggregatedKzgProof(byte* proof, byte* blobs, int count, IntPtr ts);
-
-
- ///
- /// Verify aggregated proof and commitments for the given blobs
- ///
- /// Blobs as a flatten byte array
- /// Commitments as a flatten byte array
- /// Blobs and commitments count
- ///
- /// Trusted setup settings
- /// Returns error code or 0 if the proof is correct
- [DllImport("ckzg", EntryPoint = "verify_aggregate_kzg_proof_wrap", CallingConvention = CallingConvention.Cdecl)]
- public unsafe static extern int VerifyAggregatedKzgProof(byte* blobs, byte* commitments_bytes, int count, byte* aggregated_proof_bytes, IntPtr ts);
-
- ///
- /// Verify the proof by point evaluation for the given commitment
- ///
- /// Commitment
- /// Z
- /// Y
- /// Proof
- /// Trusted setup settings
- /// Returns error code or 0 if the proof is correct
- [DllImport("ckzg", EntryPoint = "verify_kzg_proof_wrap", CallingConvention = CallingConvention.Cdecl)]
- public unsafe static extern int VerifyKzgProof(byte* commitment_bytes, byte* z_bytes, byte* y_bytes, byte* proof_bytes, IntPtr ts);
-
///
/// Load trusted setup settings from file
///
/// Settings file path
/// Trusted setup settings as a pointer or 0 in case of failure
- [DllImport("ckzg", EntryPoint = "load_trusted_setup_wrap")] // free result with free_trusted_setup()
+ [DllImport("ckzg", EntryPoint = "load_trusted_setup_wrap")]
public static extern IntPtr LoadTrustedSetup(string filename);
///
@@ -81,5 +42,74 @@ public class Ckzg
/// Trusted setup settings
[DllImport("ckzg", EntryPoint = "free_trusted_setup_wrap", CallingConvention = CallingConvention.Cdecl)]
public static extern void FreeTrustedSetup(IntPtr ts);
+
+ ///
+ /// Calculates commitment for the blob
+ ///
+ /// Preallocated buffer of bytes to receive the commitment
+ /// Flatten array of blob elements
+ /// Trusted setup settings
+ /// Returns error code or 0 if successful
+ [DllImport("ckzg", EntryPoint = "blob_to_kzg_commitment", CallingConvention = CallingConvention.Cdecl)]
+ public unsafe static extern Ret BlobToKzgCommitment(byte* commitment, byte* blob, IntPtr ts);
+
+ ///
+ /// Compute KZG proof at point `z` for the polynomial represented by `blob`.
+ ///
+ /// Preallocated buffer of bytes to receive the proof
+ /// Blob byte array
+ ///
+ /// Trusted setup settings
+ /// Returns error code or 0 if successful
+ [DllImport("ckzg", EntryPoint = "compute_kzg_proof", CallingConvention = CallingConvention.Cdecl)]
+ public unsafe static extern Ret ComputeKzgProof(byte* proof, byte* blob, byte* z_bytes, IntPtr ts);
+
+ ///
+ /// Given a blob, return the KZG proof that is used to verify it against the commitment.
+ ///
+ /// Preallocated buffer of bytes to receive the proof
+ /// Blob byte array
+ /// Trusted setup settings
+ /// Returns error code or 0 if successful
+ [DllImport("ckzg", EntryPoint = "compute_blob_kzg_proof", CallingConvention = CallingConvention.Cdecl)]
+ public unsafe static extern Ret ComputeBlobKzgProof(byte* proof, byte* blob, IntPtr ts);
+
+ ///
+ ///
+ ///
+ /// True if the proof is valid
+ ///
+ ///
+ ///
+ ///
+ /// Trusted setup settings
+ ///
+ [DllImport("ckzg", EntryPoint = "verify_kzg_proof", CallingConvention = CallingConvention.Cdecl)]
+ public unsafe static extern Ret VerifyKzgProof(bool* result, byte* commitment_bytes, byte* z_bytes, byte* y_bytes, byte* proof_bytes, IntPtr ts);
+
+ ///
+ /// Given a blob and a KZG proof, verify that the blob data corresponds to the provided commitment.
+ ///
+ /// True if the proof is valid
+ ///
+ ///
+ ///
+ /// Trusted setup settings
+ ///
+ [DllImport("ckzg", EntryPoint = "verify_blob_kzg_proof", CallingConvention = CallingConvention.Cdecl)]
+ public unsafe static extern Ret VerifyBlobKzgProof(bool* result, byte* blob, byte* commitment_bytes, byte* proof_bytes, IntPtr ts);
+
+ ///
+ /// Given a list of blobs and blob KZG proofs, verify that they correspond to the provided commitments.
+ ///
+ /// True if the proofs are valid
+ /// Blobs as a flattened byte array
+ /// Commitments as a flattened byte array
+ /// Proofs as a flattened byte array
+ /// The number of blobs/commitments/proofs
+ /// Trusted setup settings
+ ///
+ [DllImport("ckzg", EntryPoint = "verify_blob_kzg_proof_batch", CallingConvention = CallingConvention.Cdecl)]
+ public unsafe static extern Ret VerifyBlobKzgProofBatch(bool* result, byte* blobs, byte* commitments_bytes, byte* proofs_bytes, int count, IntPtr ts);
}
diff --git a/bindings/csharp/Ckzg.Test/Ckzg.Test.csproj b/bindings/csharp/Ckzg.Test/Ckzg.Test.csproj
index c41d633..dd34fe9 100644
--- a/bindings/csharp/Ckzg.Test/Ckzg.Test.csproj
+++ b/bindings/csharp/Ckzg.Test/Ckzg.Test.csproj
@@ -24,6 +24,6 @@
Always
-
+
diff --git a/bindings/csharp/Ckzg.Test/E2eTests.cs b/bindings/csharp/Ckzg.Test/E2eTests.cs
index 1391ee0..526e187 100644
--- a/bindings/csharp/Ckzg.Test/E2eTests.cs
+++ b/bindings/csharp/Ckzg.Test/E2eTests.cs
@@ -1,57 +1,218 @@
using NUnit.Framework;
+using System.IO;
namespace Ckzg.Test;
[TestFixture]
public class BasicKzgTests
{
- private IntPtr _ts;
+ private IntPtr ts;
+
+ const string TestDir = "../../../../../../tests";
+ string BlobToKZGCommitmentTests = Path.Join(TestDir, "blob_to_kzg_commitment");
+ string ComputeKzgProofTests = Path.Join(TestDir, "compute_kzg_proof");
+ string ComputeBlobKzgProofTests = Path.Join(TestDir, "compute_blob_kzg_proof");
+ string VerifyKzgProofTests = Path.Join(TestDir, "verify_kzg_proof");
+ string VerifyBlobKzgProofTests = Path.Join(TestDir, "verify_blob_kzg_proof");
+ string VerifyBlobKzgProofBatchTests = Path.Join(TestDir, "verify_blob_kzg_proof_batch");
+
+ public static byte[] StringToByteArray(string hex)
+ {
+ return Enumerable.Range(0, hex.Length)
+ .Where(x => x % 2 == 0)
+ .Select(x => Convert.ToByte(hex.Substring(x, 2), 16))
+ .ToArray();
+ }
+
+ public static byte[] GetBytes(String path)
+ {
+ string hex = System.IO.File.ReadAllText(path);
+ return StringToByteArray(hex);
+ }
+
+ public static byte[] GetFlatBytes(String path)
+ {
+ List files = Directory.GetFiles(path).ToList();
+ files.Sort();
+ List filesBytes = new List();
+ foreach (String file in files)
+ {
+ filesBytes.Add(GetBytes(file));
+ }
+
+ byte[] flatBytes = new byte[filesBytes.Sum(b => b.Length)];
+ int offset = 0;
+ foreach (byte[] bytes in filesBytes)
+ {
+ System.Buffer.BlockCopy(bytes, 0, flatBytes, offset, bytes.Length);
+ offset += bytes.Length;
+ }
+
+ return flatBytes;
+ }
+
+ public static bool GetBoolean(String path)
+ {
+ return System.IO.File.ReadAllText(path).Contains("true");
+ }
[SetUp]
public void Setup()
{
- _ts = Ckzg.LoadTrustedSetup("trusted_setup.txt");
- Assert.That(_ts, Is.Not.EqualTo(IntPtr.Zero));
+ ts = Ckzg.LoadTrustedSetup("trusted_setup.txt");
+ Assert.That(ts, Is.Not.EqualTo(IntPtr.Zero));
}
- [TestCase(0xff, 1, -1)]
- [TestCase(0x73, 1, -1)]
- [TestCase(0x72, 0, 0)]
- [TestCase(0x00, 0, 0)]
- public unsafe void Test_Computes_And_Verifies(byte highByteValue, int expectedProofComputed, int expectedProofVerified)
+ [TearDown]
+ public void Teardown()
{
- byte[] blob = Enumerable.Range(0, 4096 * 32).Select(x => x % 32 == 31 ? highByteValue : (byte)(x % 256)).ToArray();
+ Ckzg.FreeTrustedSetup(ts);
+ }
- byte[] proof = new byte[48];
- byte[] commitment = new byte[48];
- fixed (byte* commitmentPtr = commitment, blobPtr = blob, proofPtr = proof)
+ [TestCase]
+ public unsafe void TestBlobToKzgCommitment()
+ {
+ foreach (String test in Directory.GetDirectories(BlobToKZGCommitmentTests))
{
- int proofComputed = Ckzg.ComputeAggregatedKzgProof(proofPtr, blobPtr, 1, _ts);
- Assert.That(proofComputed, Is.EqualTo(expectedProofComputed));
-
- Ckzg.BlobToKzgCommitment(commitmentPtr, blobPtr, _ts);
- int proofVerified = Ckzg.VerifyAggregatedKzgProof(blobPtr, commitmentPtr, 1, proofPtr, _ts);
- Assert.That(proofVerified, Is.EqualTo(expectedProofVerified));
-
- Ckzg.FreeTrustedSetup(_ts);
+ byte[] commitment = new byte[48];
+ byte[] blob = GetBytes(Path.Join(test, "blob.txt"));
+ fixed (byte *pCommitment = commitment, pBlob = blob)
+ {
+ Ckzg.Ret ret = Ckzg.BlobToKzgCommitment(pCommitment, pBlob, ts);
+ if (ret == Ckzg.Ret.Ok)
+ {
+ byte[] expectedCommitment = GetBytes(Path.Join(test, "commitment.txt"));
+ Assert.That(commitment, Is.EqualTo(expectedCommitment));
+ }
+ else
+ {
+ Assert.False(System.IO.File.Exists(Path.Join(test, "commitment.txt")));
+ }
+ }
}
}
[TestCase]
- public unsafe void Test_PointEvaluationPrecompile_Verifies()
+ public unsafe void TestComputeKzgProof()
{
- byte[] commitment = new byte[48];
- commitment[0] = 0xc0;
- byte[] x = new byte[32];
- byte[] y = new byte[32];
- byte[] proof = new byte[48];
- proof[0] = 0xc0;
-
- fixed (byte* commitmentPtr = commitment, xPtr = x, yPtr = y, proofPtr = proof)
+ foreach (String test in Directory.GetDirectories(ComputeKzgProofTests))
{
- int result = Ckzg.VerifyKzgProof(commitmentPtr, xPtr, yPtr, proofPtr, _ts);
- Ckzg.FreeTrustedSetup(_ts);
- Assert.That(result, Is.EqualTo(0));
+ byte[] proof = new byte[48];
+ byte[] blob = GetBytes(Path.Join(test, "blob.txt"));
+ byte[] inputPoint = GetBytes(Path.Join(test, "input_point.txt"));
+ fixed (byte *pProof = proof, pBlob = blob, pInputPoint = inputPoint)
+ {
+ Ckzg.Ret ret = Ckzg.ComputeKzgProof(pProof, pBlob, pInputPoint, ts);
+ if (ret == Ckzg.Ret.Ok)
+ {
+ byte[] expectedProof = GetBytes(Path.Join(test, "proof.txt"));
+ Assert.That(proof, Is.EqualTo(expectedProof));
+ }
+ else
+ {
+ Assert.False(System.IO.File.Exists(Path.Join(test, "proof.txt")));
+ }
+ }
+ }
+ }
+
+ [TestCase]
+ public unsafe void TestComputeBlobKzgProof()
+ {
+ foreach (String test in Directory.GetDirectories(ComputeBlobKzgProofTests))
+ {
+ byte[] proof = new byte[48];
+ byte[] blob = GetBytes(Path.Join(test, "blob.txt"));
+ fixed (byte *pProof = proof, pBlob = blob)
+ {
+ Ckzg.Ret ret = Ckzg.ComputeBlobKzgProof(pProof, pBlob, ts);
+ if (ret == Ckzg.Ret.Ok)
+ {
+ byte[] expectedProof = GetBytes(Path.Join(test, "proof.txt"));
+ Assert.That(proof, Is.EqualTo(expectedProof));
+ }
+ else
+ {
+ Assert.False(System.IO.File.Exists(Path.Join(test, "proof.txt")));
+ }
+ }
+ }
+ }
+
+ [TestCase]
+ public unsafe void TestVerifyKzgProof()
+ {
+ foreach (String test in Directory.GetDirectories(VerifyKzgProofTests))
+ {
+ bool ok = false;
+ byte[] commitment = GetBytes(Path.Join(test, "commitment.txt"));
+ byte[] inputPoint = GetBytes(Path.Join(test, "input_point.txt"));
+ byte[] claimedValue = GetBytes(Path.Join(test, "claimed_value.txt"));
+ byte[] proof = GetBytes(Path.Join(test, "proof.txt"));
+ fixed (byte *pCommitment = commitment, pInputPoint = inputPoint, pClaimedValue = claimedValue, pProof = proof)
+ {
+ Ckzg.Ret ret = Ckzg.VerifyKzgProof(&ok, pCommitment, pInputPoint, pClaimedValue, pProof, ts);
+ if (ret == Ckzg.Ret.Ok)
+ {
+ bool expectedOk = GetBoolean(Path.Join(test, "ok.txt"));
+ Assert.That(ok, Is.EqualTo(expectedOk));
+ }
+ else
+ {
+ Assert.False(System.IO.File.Exists(Path.Join(test, "ok.txt")));
+ }
+ }
+ }
+ }
+
+ [TestCase]
+ public unsafe void TestVerifyBlobKzgProof()
+ {
+ foreach (String test in Directory.GetDirectories(VerifyBlobKzgProofTests))
+ {
+ bool ok = false;
+ byte[] blob = GetBytes(Path.Join(test, "blob.txt"));
+ byte[] commitment = GetBytes(Path.Join(test, "commitment.txt"));
+ byte[] proof = GetBytes(Path.Join(test, "proof.txt"));
+ fixed (byte *pBlob = blob, pCommitment = commitment, pProof = proof)
+ {
+ Ckzg.Ret ret = Ckzg.VerifyBlobKzgProof(&ok, pBlob, pCommitment, pProof, ts);
+ if (ret == Ckzg.Ret.Ok)
+ {
+ bool expectedOk = GetBoolean(Path.Join(test, "ok.txt"));
+ Assert.That(ok, Is.EqualTo(expectedOk));
+ }
+ else
+ {
+ Assert.False(System.IO.File.Exists(Path.Join(test, "ok.txt")));
+ }
+ }
+ }
+ }
+
+ [TestCase]
+ public unsafe void TestVerifyBlobKzgProofBatch()
+ {
+ foreach (String test in Directory.GetDirectories(VerifyBlobKzgProofBatchTests))
+ {
+ bool ok = false;
+ byte[] blobs = GetFlatBytes(Path.Join(test, "blobs"));
+ byte[] commitments = GetFlatBytes(Path.Join(test, "commitments"));
+ byte[] proofs = GetFlatBytes(Path.Join(test, "proofs"));
+ int count = blobs.Length / Ckzg.BytesPerBlob;
+ fixed (byte *pBlobs = blobs, pCommitments = commitments, pProofs = proofs)
+ {
+ Ckzg.Ret ret = Ckzg.VerifyBlobKzgProofBatch(&ok, pBlobs, pCommitments, pProofs, count, ts);
+ if (ret == Ckzg.Ret.Ok)
+ {
+ bool expectedOk = GetBoolean(Path.Join(test, "ok.txt"));
+ Assert.That(ok, Is.EqualTo(expectedOk));
+ }
+ else
+ {
+ Assert.False(System.IO.File.Exists(Path.Join(test, "ok.txt")));
+ }
+ }
}
}
}
\ No newline at end of file
diff --git a/bindings/csharp/Makefile b/bindings/csharp/Makefile
index b94e455..d5fa3dc 100644
--- a/bindings/csharp/Makefile
+++ b/bindings/csharp/Makefile
@@ -1,54 +1,54 @@
-INCLUDE_DIRS = ../../src ../../blst/bindings
-
-FIELD_ELEMENTS_PER_BLOB ?= 4096
-
ifeq ($(OS),Windows_NT)
- BLST_BUILDSCRIPT=./build.bat
- BLST_OBJ=blst.lib
- TESTS_EXECUTABLE=test_ckzg.exe
- CSHARP_PLATFORM?=win-x64
- CLANG_PLATFROM?=x86_64-win
- CLANG_FLAGS=
- CLANG_EXECUTABLE=clang
- CKZG_LIBRARY_PATH=Ckzg.Bindings\runtimes\$(CSHARP_PLATFORM)\native\ckzg.dll
+ BLST_BUILDSCRIPT = ./build.bat
+ BLST_OBJ = blst.lib
+ CSHARP_PLATFORM ?= win-x64
+ CLANG_EXECUTABLE = clang
+ CKZG_LIBRARY_PATH = Ckzg.Bindings\runtimes\$(CSHARP_PLATFORM)\native\ckzg.dll
else
- BLST_BUILDSCRIPT=./build.sh
- BLST_OBJ=libblst.a
- TESTS_EXECUTABLE=./test_ckzg
- CSHARP_PLATFORM?=linux-x64
- CLANG_PLATFORM?=x86_64-linux
- CLANG_FLAGS=-fPIC
- CLANG_EXECUTABLE=cc
- CKZG_LIBRARY_PATH=Ckzg.Bindings/runtimes/$(CSHARP_PLATFORM)/native/ckzg.so
+ BLST_BUILDSCRIPT = ./build.sh
+ BLST_OBJ = libblst.a
+ CLANG_EXECUTABLE = clang
+
+ UNAME_S := $(shell uname -s)
+ UNAME_M := $(shell uname -m)
+ ifeq ($(UNAME_S),Linux)
+ ifeq ($(UNAME_M),x86_64)
+ CSHARP_PLATFORM ?= linux-x64
+ else
+ CSHARP_PLATFORM ?= linux-arm64
+ endif
+ endif
+ ifeq ($(UNAME_S),Darwin)
+ ifeq ($(UNAME_M),arm64)
+ CSHARP_PLATFORM ?= osx-arm64
+ else
+ CSHARP_PLATFORM ?= osx-x64
+ endif
+ endif
+
+ CKZG_LIBRARY_PATH = Ckzg.Bindings/runtimes/$(CSHARP_PLATFORM)/native/ckzg.so
endif
-CLANG_FLAGS += -DFIELD_ELEMENTS_PER_BLOB=$(FIELD_ELEMENTS_PER_BLOB)
+FIELD_ELEMENTS_PER_BLOB ?= 4096
+INCLUDE_DIRS = ../../src ../../blst/bindings
+TARGETS = ckzg.c ../../src/c_kzg_4844.c ../../blst/$(BLST_OBJ)
-TARGETS=ckzg.c ../../src/c_kzg_4844.c ../../blst/$(BLST_OBJ)
+CFLAGS += -O2 -Wall -Wextra -shared
+CFLAGS += -DFIELD_ELEMENTS_PER_BLOB=$(FIELD_ELEMENTS_PER_BLOB)
+CFLAGS += ${addprefix -I,${INCLUDE_DIRS}}
-.blst:
+.PHONY: all
+all: blst ckzg ckzg-dotnet
+
+.PHONY: blst
+blst:
cd ../../blst && $(BLST_BUILDSCRIPT)
-.ckzg:
- $(CLANG_EXECUTABLE) -O -Wall -shared $(CLANG_FLAGS) ${addprefix -I,${INCLUDE_DIRS}} -o $(CKZG_LIBRARY_PATH) $(TARGETS)
+.PHONY: ckzg
+ckzg: blst
+ $(CLANG_EXECUTABLE) $(CFLAGS) -o $(CKZG_LIBRARY_PATH) $(TARGETS)
-# Ckzg library
-ckzg:
- @make .blst
- @make .ckzg
-
-# E2e tests as an executable
-test:
- @make .blst
- $(CLANG_EXECUTABLE) -O -w -Wall $(CLANG_FLAGS) ${addprefix -I,${INCLUDE_DIRS}} -o $(TESTS_EXECUTABLE) kzg_tests.c $(TARGETS)
-
-# E2e tests are built and run
-run-test:
- @make test
- $(TESTS_EXECUTABLE)
-
-# Makes a build and a nuget package just for windows or linux
-# To build full package - use ckzg command on every plaform and dotnet build
-ckzg-dotnet:
- @make ckzg
+.PHONY: ckzg-dotnet
+ckzg-dotnet: ckzg
dotnet build
+ dotnet test
diff --git a/bindings/csharp/ckzg.c b/bindings/csharp/ckzg.c
index a297733..c8a34d5 100644
--- a/bindings/csharp/ckzg.c
+++ b/bindings/csharp/ckzg.c
@@ -23,19 +23,3 @@ void free_trusted_setup_wrap(KZGSettings *s) {
free_trusted_setup(s);
free(s);
}
-
-int verify_aggregate_kzg_proof_wrap(const Blob *blobs, const Bytes48 *commitments_bytes, size_t n, const Bytes48 *aggregated_proof_bytes, const KZGSettings *s) {
- bool b;
- C_KZG_RET ret = verify_aggregate_kzg_proof(&b, blobs, commitments_bytes, n, aggregated_proof_bytes, s);
- if (ret != C_KZG_OK) return -1;
-
- return b ? 0 : 1;
-}
-
-int verify_kzg_proof_wrap(const Bytes48 *commitment_bytes, const Bytes32 *z_bytes, const Bytes32 *y_bytes, const Bytes48 *proof_bytes, KZGSettings *s) {
- bool out;
- if (verify_kzg_proof(&out, commitment_bytes, z_bytes, y_bytes, proof_bytes, s) != C_KZG_OK)
- return -2;
-
- return out ? 0 : 1;
-}
diff --git a/bindings/csharp/ckzg.h b/bindings/csharp/ckzg.h
index 9a5e5d9..8b7e565 100644
--- a/bindings/csharp/ckzg.h
+++ b/bindings/csharp/ckzg.h
@@ -15,8 +15,12 @@ DLLEXPORT void free_trusted_setup_wrap(KZGSettings *s);
DLLEXPORT C_KZG_RET blob_to_kzg_commitment(KZGCommitment *out, const Blob *blob, const KZGSettings *s);
-DLLEXPORT int verify_aggregate_kzg_proof_wrap(const Blob blobs[], const Bytes48 *commitments_bytes, size_t n, const Bytes48 *aggregated_proof_bytes, const KZGSettings *s);
+DLLEXPORT C_KZG_RET compute_kzg_proof(KZGProof *out, const Blob *blob, const Bytes32 *z_bytes, const KZGSettings *s);
-DLLEXPORT C_KZG_RET compute_aggregate_kzg_proof(KZGProof *out, const Blob blobs[], size_t n, const KZGSettings *s);
+DLLEXPORT C_KZG_RET compute_blob_kzg_proof(KZGProof *out, const Blob *blob, const KZGSettings *s);
-DLLEXPORT int verify_kzg_proof_wrap(const Bytes48 *commitment_bytes, const Bytes32 *z_bytes, const Bytes32 *y_bytes, const Bytes48 *proof_bytes, KZGSettings *s);
+DLLEXPORT C_KZG_RET verify_kzg_proof(bool *result, const Bytes48 *commitments_bytes, const Bytes32 *z_bytes, const Bytes32 *y_bytes, const Bytes48 *proof_bytes, const KZGSettings *s);
+
+DLLEXPORT C_KZG_RET verify_blob_kzg_proof(bool *result, const Blob *blob, const Bytes48 *commitment_bytes, const Bytes48 *proof_bytes, const KZGSettings *s);
+
+DLLEXPORT C_KZG_RET verify_blob_kzg_proof_batch(bool *result, const Blob *blobs, const Bytes48 *commitments_bytes, const Bytes48 *proofs_bytes, size_t count, const KZGSettings *s);