Skip to content

Commit f298ec4

Browse files
committed
go.mod, build: upgrade c-kzg-4844 (#27907)
This upgrades to the latest release of ckzg, and also attempts to fix some blst-related build errors that occur on launchpad.net.
1 parent 811a674 commit f298ec4

File tree

6 files changed

+28
-17
lines changed

6 files changed

+28
-17
lines changed

build/ci.go

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -200,19 +200,24 @@ func doInstall(cmdline []string) {
200200
staticlink = flag.Bool("static", false, "Create statically-linked executable")
201201
)
202202
flag.CommandLine.Parse(cmdline)
203+
env := build.Env()
203204

204205
// Configure the toolchain.
205206
tc := build.GoToolchain{GOARCH: *arch, CC: *cc}
206207
if *dlgo {
207208
csdb := build.MustLoadChecksums("build/checksums.txt")
208209
tc.Root = build.DownloadGo(csdb, dlgoVersion)
209210
}
210-
// Disable CLI markdown doc generation in release builds and enable linking
211-
// the CKZG library since we can make it portable here.
212-
buildTags := []string{"urfave_cli_no_docs", "ckzg"}
211+
212+
// Disable CLI markdown doc generation in release builds.
213+
buildTags := []string{"urfave_cli_no_docs"}
214+
215+
// Enable linking the CKZG library since we can make it work with additional flags.
216+
if env.UbuntuVersion != "trusty" {
217+
buildTags = append(buildTags, "ckzg")
218+
}
213219

214220
// Configure the build.
215-
env := build.Env()
216221
gobuild := tc.Go("build", buildFlags(env, *staticlink, buildTags)...)
217222

218223
// arm64 CI builders are memory-constrained and can't handle concurrent builds,
@@ -298,10 +303,14 @@ func doTest(cmdline []string) {
298303
csdb := build.MustLoadChecksums("build/checksums.txt")
299304
tc.Root = build.DownloadGo(csdb, dlgoVersion)
300305
}
301-
gotest := tc.Go("test", "-tags=ckzg")
306+
gotest := tc.Go("test")
307+
302308
// CI needs a bit more time for the statetests (default 10m).
303309
gotest.Args = append(gotest.Args, "-timeout=20m")
304310

311+
// Enable CKZG backend in CI.
312+
gotest.Args = append(gotest.Args, "-tags=ckzg")
313+
305314
// Test a single package at a time. CI builders are slow
306315
// and some tests run into timeouts under load.
307316
gotest.Args = append(gotest.Args, "-p", "1")

build/deb/ethereum/deb.rules

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ override_dh_auto_build:
2828
mv .mod $(GOPATH)/pkg/mod
2929

3030
# A fresh Go was built, all dependency downloads faked, hope build works now
31-
../.go/bin/go run build/ci.go install -git-commit={{.Env.Commit}} -git-branch={{.Env.Branch}} -git-tag={{.Env.Tag}} -buildnum={{.Env.Buildnum}} -pull-request={{.Env.IsPullRequest}}
31+
../.go/bin/go run build/ci.go install -git-commit={{.Env.Commit}} -git-branch={{.Env.Branch}} -git-tag={{.Env.Tag}} -buildnum={{.Env.Buildnum}} -pull-request={{.Env.IsPullRequest}} -ubuntu {{.Distro}}
3232

3333
override_dh_auto_test:
3434

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ require (
1919
github.com/deckarep/golang-set/v2 v2.1.0
2020
github.com/docker/docker v1.6.2
2121
github.com/dop251/goja v0.0.0-20230605162241-28ee0ee714f3
22-
github.com/ethereum/c-kzg-4844 v0.3.0
22+
github.com/ethereum/c-kzg-4844 v0.3.1
2323
github.com/fatih/color v1.7.0
2424
github.com/fjl/gencodec v0.0.0-20230517082657-f9840df7b83e
2525
github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,8 @@ github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.m
125125
github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk=
126126
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
127127
github.com/etcd-io/bbolt v1.3.3/go.mod h1:ZF2nL25h33cCyBtcyWeZ2/I3HQOfTP+0PIEvHjkjCrw=
128-
github.com/ethereum/c-kzg-4844 v0.3.0 h1:3Y3hD6l5i0dEYsBL50C+Om644kve3pNqoAcvE26o9zI=
129-
github.com/ethereum/c-kzg-4844 v0.3.0/go.mod h1:WI2Nd82DMZAAZI1wV2neKGost9EKjvbpQR9OqE5Qqa8=
128+
github.com/ethereum/c-kzg-4844 v0.3.1 h1:sR65+68+WdnMKxseNWxSJuAv2tsUrihTpVBTfM/U5Zg=
129+
github.com/ethereum/c-kzg-4844 v0.3.1/go.mod h1:VewdlzQmpT5QSrVhbBuGoCdFJkpaJlO1aQputP83wc0=
130130
github.com/fasthttp-contrib/websocket v0.0.0-20160511215533-1f3b11f56072/go.mod h1:duJ4Jxv5lDcvg4QuQr0oowTf7dz4/CR8NtyCooz9HL8=
131131
github.com/fatih/color v1.7.0 h1:DkWD4oS2D8LGGgTQ6IvwJJXSL5Vp2ffcQg58nFV38Ys=
132132
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=

internal/build/env.go

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,13 @@ import (
2828

2929
var (
3030
// These flags override values in build env.
31-
GitCommitFlag = flag.String("git-commit", "", `Overrides git commit hash embedded into executables`)
32-
GitBranchFlag = flag.String("git-branch", "", `Overrides git branch being built`)
33-
GitTagFlag = flag.String("git-tag", "", `Overrides git tag being built`)
34-
BuildnumFlag = flag.String("buildnum", "", `Overrides CI build number`)
35-
PullRequestFlag = flag.Bool("pull-request", false, `Overrides pull request status of the build`)
36-
CronJobFlag = flag.Bool("cron-job", false, `Overrides cron job status of the build`)
31+
GitCommitFlag = flag.String("git-commit", "", `Overrides git commit hash embedded into executables`)
32+
GitBranchFlag = flag.String("git-branch", "", `Overrides git branch being built`)
33+
GitTagFlag = flag.String("git-tag", "", `Overrides git tag being built`)
34+
BuildnumFlag = flag.String("buildnum", "", `Overrides CI build number`)
35+
PullRequestFlag = flag.Bool("pull-request", false, `Overrides pull request status of the build`)
36+
CronJobFlag = flag.Bool("cron-job", false, `Overrides cron job status of the build`)
37+
UbuntuVersionFlag = flag.String("ubuntu", "", `Sets the ubuntu version being built for`)
3738
)
3839

3940
// Environment contains metadata provided by the build environment.
@@ -43,6 +44,7 @@ type Environment struct {
4344
Repo string // name of GitHub repo
4445
Commit, Date, Branch, Tag string // Git info
4546
Buildnum string
47+
UbuntuVersion string // Ubuntu version being built for
4648
IsPullRequest bool
4749
IsCronJob bool
4850
}

internal/build/gotool.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ func (g *GoToolchain) Go(command string, args ...string) *exec.Cmd {
5454
tool.Env = append(tool.Env, "CC="+os.Getenv("CC"))
5555
}
5656
// CKZG by default is not portable, append the necessary build flags to make
57-
// it not rely on modern CPU instructions and enable linking against
58-
tool.Env = append(tool.Env, "CGO_CFLAGS=-D__BLST_PORTABLE__")
57+
// it not rely on modern CPU instructions and enable linking against.
58+
tool.Env = append(tool.Env, "CGO_CFLAGS=-O2 -g -D__BLST_PORTABLE__")
5959

6060
return tool
6161
}

0 commit comments

Comments
 (0)