Implement all needed KZG wrappers for peerDAS in the kzg package. (#15186)

* Implement all needed KZG wrappers for peerDAS in the `kzg` package.

This way, If we need to change the KZG backend, the only package to
modify is the `kzg` package.

* `.bazelrc`: Add `build --compilation_mode=opt`

* Remove --compilation_mode=opt, use supranational blst headers.

* Fix Terence's comment.

* Fix Terence`s comments.

---------

Co-authored-by: Preston Van Loon <preston@pvl.dev>
This commit is contained in:
Manu NALEPA
2025-04-18 00:43:41 +02:00
committed by GitHub
parent 9c00b06966
commit ab5505e13e
9 changed files with 4310 additions and 16 deletions

View File

@@ -7,7 +7,7 @@ index 7e49df7..1d476f7 100644
name = "go",
srcs = ["main.go"],
+ cdeps = [
+ "//bindings/go/blst_headers:hdrs",
+ "@com_github_supranational_blst//:blst",
+ "//src:kzg",
+ ],
cgo = True,
@@ -15,9 +15,10 @@ index 7e49df7..1d476f7 100644
- "-Ibindings/go/src",
- "-Ibindings/go/bindings/go/blst_headers",
+ "-Iexternal/com_github_ethereum_c_kzg_4844/src",
+ "-Iexternal/com_github_ethereum_c_kzg_4844/bindings/go/blst_headers",
+ "-Iexternal/com_github_supranational_blst/bindings/blst_headers",
],
importpath = "github.com/ethereum/c-kzg-4844/bindings/go",
importpath = "github.com/ethereum/c-kzg-4844/v2/bindings/go",
importpath_aliases = ["github.com/ethereum/c-kzg-4844/bindings/go"],
visibility = ["//visibility:public"],
diff --git a/bindings/go/blst_headers/BUILD.bazel b/bindings/go/blst_headers/BUILD.bazel
new file mode 100644
@@ -35,12 +36,9 @@ new file mode 100644
index 0000000..b3f845d
--- /dev/null
+++ b/src/BUILD.bazel
@@ -0,0 +1,8 @@
@@ -0,0 +1,5 @@
+cc_library(
+ name = "kzg",
+ hdrs = [
+ "c_kzg_4844.c",
+ "c_kzg_4844.h",
+ ],
+ hdrs = glob(["ckzg.*", "*/*.c", "*/*.h"]),
+ visibility = ["//visibility:public"],
+)