From e91b21ce2bce623a11a3e992587c20181c3b3e7b Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Sat, 12 Aug 2023 00:21:46 +0200 Subject: [PATCH] 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. --- build/ci.go | 19 ++++++++++++++----- build/deb/ethereum/deb.rules | 2 +- go.mod | 2 +- go.sum | 4 ++-- internal/build/env.go | 14 ++++++++------ internal/build/gotool.go | 4 ++-- 6 files changed, 28 insertions(+), 17 deletions(-) diff --git a/build/ci.go b/build/ci.go index 78b8bc6972..242f4d841e 100644 --- a/build/ci.go +++ b/build/ci.go @@ -200,6 +200,7 @@ func doInstall(cmdline []string) { staticlink = flag.Bool("static", false, "Create statically-linked executable") ) flag.CommandLine.Parse(cmdline) + env := build.Env() // Configure the toolchain. tc := build.GoToolchain{GOARCH: *arch, CC: *cc} @@ -207,12 +208,16 @@ func doInstall(cmdline []string) { csdb := build.MustLoadChecksums("build/checksums.txt") tc.Root = build.DownloadGo(csdb, dlgoVersion) } - // Disable CLI markdown doc generation in release builds and enable linking - // the CKZG library since we can make it portable here. - buildTags := []string{"urfave_cli_no_docs", "ckzg"} + + // Disable CLI markdown doc generation in release builds. + buildTags := []string{"urfave_cli_no_docs"} + + // Enable linking the CKZG library since we can make it work with additional flags. + if env.UbuntuVersion != "trusty" { + buildTags = append(buildTags, "ckzg") + } // Configure the build. - env := build.Env() gobuild := tc.Go("build", buildFlags(env, *staticlink, buildTags)...) // arm64 CI builders are memory-constrained and can't handle concurrent builds, @@ -298,10 +303,14 @@ func doTest(cmdline []string) { csdb := build.MustLoadChecksums("build/checksums.txt") tc.Root = build.DownloadGo(csdb, dlgoVersion) } - gotest := tc.Go("test", "-tags=ckzg") + gotest := tc.Go("test") + // CI needs a bit more time for the statetests (default 10m). gotest.Args = append(gotest.Args, "-timeout=20m") + // Enable CKZG backend in CI. + gotest.Args = append(gotest.Args, "-tags=ckzg") + // Test a single package at a time. CI builders are slow // and some tests run into timeouts under load. gotest.Args = append(gotest.Args, "-p", "1") diff --git a/build/deb/ethereum/deb.rules b/build/deb/ethereum/deb.rules index 475e628b2f..daca793e55 100644 --- a/build/deb/ethereum/deb.rules +++ b/build/deb/ethereum/deb.rules @@ -28,7 +28,7 @@ override_dh_auto_build: mv .mod $(GOPATH)/pkg/mod # A fresh Go was built, all dependency downloads faked, hope build works now - ../.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}} + ../.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}} override_dh_auto_test: diff --git a/go.mod b/go.mod index e4273ef5b0..d62f4ebfd5 100644 --- a/go.mod +++ b/go.mod @@ -19,7 +19,7 @@ require ( github.com/deckarep/golang-set/v2 v2.1.0 github.com/docker/docker v1.6.2 github.com/dop251/goja v0.0.0-20230605162241-28ee0ee714f3 - github.com/ethereum/c-kzg-4844 v0.3.0 + github.com/ethereum/c-kzg-4844 v0.3.1 github.com/fatih/color v1.7.0 github.com/fjl/gencodec v0.0.0-20230517082657-f9840df7b83e github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5 diff --git a/go.sum b/go.sum index 50271e857f..8f91afee82 100644 --- a/go.sum +++ b/go.sum @@ -125,8 +125,8 @@ github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.m github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/etcd-io/bbolt v1.3.3/go.mod h1:ZF2nL25h33cCyBtcyWeZ2/I3HQOfTP+0PIEvHjkjCrw= -github.com/ethereum/c-kzg-4844 v0.3.0 h1:3Y3hD6l5i0dEYsBL50C+Om644kve3pNqoAcvE26o9zI= -github.com/ethereum/c-kzg-4844 v0.3.0/go.mod h1:WI2Nd82DMZAAZI1wV2neKGost9EKjvbpQR9OqE5Qqa8= +github.com/ethereum/c-kzg-4844 v0.3.1 h1:sR65+68+WdnMKxseNWxSJuAv2tsUrihTpVBTfM/U5Zg= +github.com/ethereum/c-kzg-4844 v0.3.1/go.mod h1:VewdlzQmpT5QSrVhbBuGoCdFJkpaJlO1aQputP83wc0= github.com/fasthttp-contrib/websocket v0.0.0-20160511215533-1f3b11f56072/go.mod h1:duJ4Jxv5lDcvg4QuQr0oowTf7dz4/CR8NtyCooz9HL8= github.com/fatih/color v1.7.0 h1:DkWD4oS2D8LGGgTQ6IvwJJXSL5Vp2ffcQg58nFV38Ys= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= diff --git a/internal/build/env.go b/internal/build/env.go index d70c0d50a4..9cfcbb69b3 100644 --- a/internal/build/env.go +++ b/internal/build/env.go @@ -28,12 +28,13 @@ import ( var ( // These flags override values in build env. - GitCommitFlag = flag.String("git-commit", "", `Overrides git commit hash embedded into executables`) - GitBranchFlag = flag.String("git-branch", "", `Overrides git branch being built`) - GitTagFlag = flag.String("git-tag", "", `Overrides git tag being built`) - BuildnumFlag = flag.String("buildnum", "", `Overrides CI build number`) - PullRequestFlag = flag.Bool("pull-request", false, `Overrides pull request status of the build`) - CronJobFlag = flag.Bool("cron-job", false, `Overrides cron job status of the build`) + GitCommitFlag = flag.String("git-commit", "", `Overrides git commit hash embedded into executables`) + GitBranchFlag = flag.String("git-branch", "", `Overrides git branch being built`) + GitTagFlag = flag.String("git-tag", "", `Overrides git tag being built`) + BuildnumFlag = flag.String("buildnum", "", `Overrides CI build number`) + PullRequestFlag = flag.Bool("pull-request", false, `Overrides pull request status of the build`) + CronJobFlag = flag.Bool("cron-job", false, `Overrides cron job status of the build`) + UbuntuVersionFlag = flag.String("ubuntu", "", `Sets the ubuntu version being built for`) ) // Environment contains metadata provided by the build environment. @@ -43,6 +44,7 @@ type Environment struct { Repo string // name of GitHub repo Commit, Date, Branch, Tag string // Git info Buildnum string + UbuntuVersion string // Ubuntu version being built for IsPullRequest bool IsCronJob bool } diff --git a/internal/build/gotool.go b/internal/build/gotool.go index b5452f80cc..296ba8c36e 100644 --- a/internal/build/gotool.go +++ b/internal/build/gotool.go @@ -54,8 +54,8 @@ func (g *GoToolchain) Go(command string, args ...string) *exec.Cmd { tool.Env = append(tool.Env, "CC="+os.Getenv("CC")) } // CKZG by default is not portable, append the necessary build flags to make - // it not rely on modern CPU instructions and enable linking against - tool.Env = append(tool.Env, "CGO_CFLAGS=-D__BLST_PORTABLE__") + // it not rely on modern CPU instructions and enable linking against. + tool.Env = append(tool.Env, "CGO_CFLAGS=-O2 -g -D__BLST_PORTABLE__") return tool }