Skip to content

Commit abe8638

Browse files
0x00101010nalepae
andauthored
feat: update ckzg lib to support ComputeCells (#15004)
* Update ckzg version to include ComputeCells * Minor fix * Run `bazel run //:gazelle -- update-repos -from_file=go.mod -to_macro=deps.bzl%prysm_deps -prune=true` --------- Co-authored-by: Manu NALEPA <[email protected]>
1 parent 0b5064b commit abe8638

File tree

4 files changed

+20
-6
lines changed

4 files changed

+20
-6
lines changed

beacon-chain/blockchain/kzg/kzg.go

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package kzg
22

33
import (
4-
"errors"
4+
"github.com/pkg/errors"
55

66
ckzg4844 "github.com/ethereum/c-kzg-4844/v2/bindings/go"
77
"github.com/ethereum/go-ethereum/crypto/kzg4844"
@@ -47,6 +47,20 @@ func BlobToKZGCommitment(blob *Blob) (Commitment, error) {
4747
return Commitment(comm), nil
4848
}
4949

50+
func ComputeCells(blob *Blob) ([]Cell, error) {
51+
ckzgBlob := (*ckzg4844.Blob)(blob)
52+
ckzgCells, err := ckzg4844.ComputeCells(ckzgBlob)
53+
if err != nil {
54+
return nil, errors.Wrap(err, "compute cells")
55+
}
56+
57+
cells := make([]Cell, len(ckzgCells))
58+
for i := range ckzgCells {
59+
cells[i] = Cell(ckzgCells[i])
60+
}
61+
return cells, nil
62+
}
63+
5064
func ComputeBlobKZGProof(blob *Blob, commitment Commitment) (Proof, error) {
5165
kzgBlob := kzg4844.Blob(*blob)
5266
proof, err := kzg4844.ComputeBlobProof(&kzgBlob, kzg4844.Commitment(commitment))

deps.bzl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -758,8 +758,8 @@ def prysm_deps():
758758
importpath = "github.com/ethereum/c-kzg-4844/v2",
759759
patch_args = ["-p1"],
760760
patches = ["//third_party:com_github_ethereum_c_kzg_4844.patch"],
761-
sum = "h1:NuErvd0Ha5gLvvZ1m9Id9UZ11kcqMBUUXsbm7yXcAYI=",
762-
version = "v2.0.1",
761+
sum = "h1:F7mxaaLUiWZ93qfjKHe4xUXZO5WQa0Mt2pXE1IF5Xx0=",
762+
version = "v2.0.2-0.20250227151419-2ec9138a5d97",
763763
)
764764
go_repository(
765765
name = "com_github_ethereum_go_ethereum",

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ require (
1414
github.com/dgraph-io/ristretto v0.0.4-0.20210318174700-74754f61e018
1515
github.com/dustin/go-humanize v1.0.0
1616
github.com/emicklei/dot v0.11.0
17-
github.com/ethereum/c-kzg-4844/v2 v2.0.1
17+
github.com/ethereum/c-kzg-4844/v2 v2.0.2-0.20250227151419-2ec9138a5d97
1818
github.com/ethereum/go-ethereum v1.15.0
1919
github.com/fsnotify/fsnotify v1.6.0
2020
github.com/ghodss/yaml v1.0.0

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,8 +237,8 @@ github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.m
237237
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
238238
github.com/ethereum/c-kzg-4844 v1.0.3-0.20240715192038-0e753e2603db h1:GR54UuHLwl7tCA527fdLSj2Rk0aUVK8bLJZPWSIv79Q=
239239
github.com/ethereum/c-kzg-4844 v1.0.3-0.20240715192038-0e753e2603db/go.mod h1:VewdlzQmpT5QSrVhbBuGoCdFJkpaJlO1aQputP83wc0=
240-
github.com/ethereum/c-kzg-4844/v2 v2.0.1 h1:NuErvd0Ha5gLvvZ1m9Id9UZ11kcqMBUUXsbm7yXcAYI=
241-
github.com/ethereum/c-kzg-4844/v2 v2.0.1/go.mod h1:urP+cLBtKCW4BS5bnA2IXYs1PRGPpXmdotqpBuU6/5s=
240+
github.com/ethereum/c-kzg-4844/v2 v2.0.2-0.20250227151419-2ec9138a5d97 h1:F7mxaaLUiWZ93qfjKHe4xUXZO5WQa0Mt2pXE1IF5Xx0=
241+
github.com/ethereum/c-kzg-4844/v2 v2.0.2-0.20250227151419-2ec9138a5d97/go.mod h1:xekiQpYbUjETEoLBT/i3IKtDBXQDvjytxGuxuox1RnA=
242242
github.com/ethereum/go-ethereum v1.15.0 h1:LLb2jCPsbJZcB4INw+E/MgzUX5wlR6SdwXcv09/1ME4=
243243
github.com/ethereum/go-ethereum v1.15.0/go.mod h1:4q+4t48P2C03sjqGvTXix5lEOplf5dz4CTosbjt5tGs=
244244
github.com/ethereum/go-verkle v0.2.2 h1:I2W0WjnrFUIzzVPwm8ykY+7pL2d4VhlsePn4j7cnFk8=

0 commit comments

Comments
 (0)