Commit ba1a5942 authored by Adrian Sutton's avatar Adrian Sutton Committed by GitHub

Update to golang 1.20.7 and alpine 3.18 (#6969)

* Update to golang 1.20.7 and alpine 3.18

* Update go version in go.mod files.

* Use crypto/rand.Read instead of math/read.Read

* Handle error response
parent c868c9b2
FROM golang:1.19.9-alpine3.16 as builder FROM golang:1.20.7-alpine3.18 as builder
RUN apk --no-cache add make jq bash git alpine-sdk RUN apk --no-cache add make jq bash git alpine-sdk
...@@ -16,7 +16,7 @@ RUN go mod download ...@@ -16,7 +16,7 @@ RUN go mod download
RUN make build RUN make build
FROM alpine:3.16 FROM alpine:3.18
RUN apk --no-cache add ca-certificates RUN apk --no-cache add ca-certificates
RUN addgroup -S app && adduser -S app -G app RUN addgroup -S app && adduser -S app -G app
......
module github.com/ethereum-optimism/optimism module github.com/ethereum-optimism/optimism
go 1.19 go 1.20
require ( require (
github.com/BurntSushi/toml v1.3.2 github.com/BurntSushi/toml v1.3.2
......
FROM --platform=$BUILDPLATFORM golang:1.19.9-alpine3.16 as builder FROM --platform=$BUILDPLATFORM golang:1.20.7-alpine3.18 as builder
RUN apk add --no-cache make gcc musl-dev linux-headers git jq bash RUN apk add --no-cache make gcc musl-dev linux-headers git jq bash
...@@ -18,7 +18,7 @@ RUN go mod download ...@@ -18,7 +18,7 @@ RUN go mod download
RUN make indexer RUN make indexer
FROM alpine:3.16 FROM alpine:3.18
COPY --from=builder /app/indexer/indexer /usr/local/bin COPY --from=builder /app/indexer/indexer /usr/local/bin
......
FROM --platform=$BUILDPLATFORM golang:1.19.9-alpine3.16 as builder FROM --platform=$BUILDPLATFORM golang:1.20.7-alpine3.18 as builder
ARG VERSION=v0.0.0 ARG VERSION=v0.0.0
...@@ -23,7 +23,7 @@ ARG TARGETOS TARGETARCH ...@@ -23,7 +23,7 @@ ARG TARGETOS TARGETARCH
RUN make op-batcher VERSION="$VERSION" GOOS=$TARGETOS GOARCH=$TARGETARCH RUN make op-batcher VERSION="$VERSION" GOOS=$TARGETOS GOARCH=$TARGETARCH
FROM alpine:3.16 FROM alpine:3.18
COPY --from=builder /app/op-batcher/bin/op-batcher /usr/local/bin COPY --from=builder /app/op-batcher/bin/op-batcher /usr/local/bin
......
...@@ -3,8 +3,8 @@ package compressor_test ...@@ -3,8 +3,8 @@ package compressor_test
import ( import (
"bytes" "bytes"
"compress/zlib" "compress/zlib"
"crypto/rand"
"io" "io"
"math/rand"
"testing" "testing"
"github.com/ethereum-optimism/optimism/op-batcher/compressor" "github.com/ethereum-optimism/optimism/op-batcher/compressor"
......
package state_test package state_test
import ( import (
crand "crypto/rand"
"math/big" "math/big"
"math/rand" "math/rand"
"testing" "testing"
...@@ -47,7 +48,8 @@ func TestCode(t *testing.T) { ...@@ -47,7 +48,8 @@ func TestCode(t *testing.T) {
require.Nil(t, pre) require.Nil(t, pre)
code := make([]byte, rand.Intn(1024)) code := make([]byte, rand.Intn(1024))
rand.Read(code) _, err := crand.Read(code)
require.NoError(t, err)
db.SetCode(addr, code) db.SetCode(addr, code)
......
FROM --platform=$BUILDPLATFORM golang:1.19.0-alpine3.15 as builder FROM --platform=$BUILDPLATFORM golang:1.20.7-alpine3.18 as builder
ARG VERSION=v0.0.0 ARG VERSION=v0.0.0
...@@ -27,7 +27,7 @@ ARG TARGETOS TARGETARCH ...@@ -27,7 +27,7 @@ ARG TARGETOS TARGETARCH
RUN make op-challenger VERSION="$VERSION" GOOS=$TARGETOS GOARCH=$TARGETARCH RUN make op-challenger VERSION="$VERSION" GOOS=$TARGETOS GOARCH=$TARGETARCH
FROM alpine:3.15 FROM alpine:3.18
COPY --from=builder /app/op-challenger/bin/op-challenger /usr/local/bin COPY --from=builder /app/op-challenger/bin/op-challenger /usr/local/bin
......
FROM golang:1.19.9-alpine3.16 as builder FROM golang:1.20.7-alpine3.18 as builder
# build from root of repo # build from root of repo
COPY ./op-exporter /app COPY ./op-exporter /app
...@@ -7,7 +7,7 @@ WORKDIR /app/ ...@@ -7,7 +7,7 @@ WORKDIR /app/
RUN apk --no-cache add make bash jq git RUN apk --no-cache add make bash jq git
RUN make build RUN make build
FROM alpine:3.16 FROM alpine:3.18
RUN apk --no-cache add ca-certificates RUN apk --no-cache add ca-certificates
WORKDIR /root/ WORKDIR /root/
COPY --from=builder /app/op-exporter /usr/local/bin/ COPY --from=builder /app/op-exporter /usr/local/bin/
......
module github.com/ethereum-optimism/optimism/op-exporter module github.com/ethereum-optimism/optimism/op-exporter
go 1.18 go 1.20
require ( require (
github.com/ethereum/go-ethereum v1.10.17 github.com/ethereum/go-ethereum v1.10.17
......
FROM golang:1.19.9-alpine3.16 as builder FROM golang:1.20.7-alpine3.18 as builder
RUN apk add --no-cache make gcc musl-dev linux-headers git jq bash RUN apk add --no-cache make gcc musl-dev linux-headers git jq bash
...@@ -15,7 +15,7 @@ WORKDIR /app/op-heartbeat ...@@ -15,7 +15,7 @@ WORKDIR /app/op-heartbeat
RUN make op-heartbeat RUN make op-heartbeat
FROM alpine:3.16 FROM alpine:3.18
COPY --from=builder /app/op-heartbeat/bin/op-heartbeat /usr/local/bin COPY --from=builder /app/op-heartbeat/bin/op-heartbeat /usr/local/bin
......
FROM --platform=$BUILDPLATFORM golang:1.19.9-alpine3.16 as builder FROM --platform=$BUILDPLATFORM golang:1.20.7-alpine3.18 as builder
ARG VERSION=v0.0.0 ARG VERSION=v0.0.0
...@@ -21,7 +21,7 @@ ARG TARGETOS TARGETARCH ...@@ -21,7 +21,7 @@ ARG TARGETOS TARGETARCH
RUN make op-node VERSION="$VERSION" GOOS=$TARGETOS GOARCH=$TARGETARCH RUN make op-node VERSION="$VERSION" GOOS=$TARGETOS GOARCH=$TARGETARCH
FROM alpine:3.16 FROM alpine:3.18
COPY --from=builder /app/op-node/bin/op-node /usr/local/bin COPY --from=builder /app/op-node/bin/op-node /usr/local/bin
......
package derive package derive
import ( import (
crand "crypto/rand"
"math/big" "math/big"
"math/rand" "math/rand"
"testing" "testing"
...@@ -97,7 +98,7 @@ func TestParseL1InfoDepositTxData(t *testing.T) { ...@@ -97,7 +98,7 @@ func TestParseL1InfoDepositTxData(t *testing.T) {
info := testutils.MakeBlockInfo(nil)(rng) info := testutils.MakeBlockInfo(nil)(rng)
depTx, err := L1InfoDeposit(randomSeqNr(rng), info, randomL1Cfg(rng, info), false) depTx, err := L1InfoDeposit(randomSeqNr(rng), info, randomL1Cfg(rng, info), false)
require.NoError(t, err) require.NoError(t, err)
_, err = rand.Read(depTx.Data[0:4]) _, err = crand.Read(depTx.Data[0:4])
require.NoError(t, err) require.NoError(t, err)
_, err = L1InfoDepositTxData(depTx.Data) _, err = L1InfoDepositTxData(depTx.Data)
require.ErrorContains(t, err, "function signature") require.ErrorContains(t, err, "function signature")
......
...@@ -2,8 +2,8 @@ package sources ...@@ -2,8 +2,8 @@ package sources
import ( import (
"context" "context"
crand "crypto/rand"
"math/big" "math/big"
"math/rand"
"testing" "testing"
"github.com/stretchr/testify/mock" "github.com/stretchr/testify/mock"
...@@ -56,7 +56,7 @@ var testEthClientConfig = &EthClientConfig{ ...@@ -56,7 +56,7 @@ var testEthClientConfig = &EthClientConfig{
} }
func randHash() (out common.Hash) { func randHash() (out common.Hash) {
rand.Read(out[:]) _, _ = crand.Read(out[:])
return out return out
} }
......
FROM --platform=$BUILDPLATFORM golang:1.19.9-alpine3.16 as builder FROM --platform=$BUILDPLATFORM golang:1.20.7-alpine3.18 as builder
ARG VERSION=v0.0.0 ARG VERSION=v0.0.0
...@@ -23,7 +23,7 @@ ARG TARGETOS TARGETARCH ...@@ -23,7 +23,7 @@ ARG TARGETOS TARGETARCH
RUN make op-program VERSION="$VERSION" GOOS=$TARGETOS GOARCH=$TARGETARCH RUN make op-program VERSION="$VERSION" GOOS=$TARGETOS GOARCH=$TARGETARCH
FROM alpine:3.16 FROM alpine:3.18
COPY --from=builder /app/op-program/bin/op-program /usr/local/bin COPY --from=builder /app/op-program/bin/op-program /usr/local/bin
......
FROM --platform=$BUILDPLATFORM golang:1.19.9-alpine3.16 as builder FROM --platform=$BUILDPLATFORM golang:1.20.7-alpine3.18 as builder
ARG VERSION=v0.0.0 ARG VERSION=v0.0.0
...@@ -22,7 +22,7 @@ ARG TARGETOS TARGETARCH ...@@ -22,7 +22,7 @@ ARG TARGETOS TARGETARCH
RUN make op-proposer VERSION="$VERSION" GOOS=$TARGETOS GOARCH=$TARGETARCH RUN make op-proposer VERSION="$VERSION" GOOS=$TARGETOS GOARCH=$TARGETARCH
FROM alpine:3.16 FROM alpine:3.18
COPY --from=builder /app/op-proposer/bin/op-proposer /usr/local/bin COPY --from=builder /app/op-proposer/bin/op-proposer /usr/local/bin
......
FROM golang:1.19.9-alpine3.16 as builder FROM golang:1.20.7-alpine3.18 as builder
RUN apk add --no-cache make gcc musl-dev linux-headers RUN apk add --no-cache make gcc musl-dev linux-headers
...@@ -14,7 +14,7 @@ WORKDIR /app/op-wheel ...@@ -14,7 +14,7 @@ WORKDIR /app/op-wheel
RUN go build -o op-wheel ./cmd/main.go RUN go build -o op-wheel ./cmd/main.go
FROM alpine:3.16 FROM alpine:3.18
COPY --from=builder /app/op-wheel/op-wheel /usr/local/bin COPY --from=builder /app/op-wheel/op-wheel /usr/local/bin
......
module github.com/ethereum-optimism/optimism/packages/contracts-bedrock/ctb-test-case-generator module github.com/ethereum-optimism/optimism/packages/contracts-bedrock/ctb-test-case-generator
go 1.19 go 1.20
require github.com/ethereum/go-ethereum v1.10.26 require github.com/ethereum/go-ethereum v1.10.26
......
module github.com/ethereum-optimism/optimism/proxyd module github.com/ethereum-optimism/optimism/proxyd
go 1.18 go 1.20
require ( require (
github.com/BurntSushi/toml v1.2.0 github.com/BurntSushi/toml v1.2.0
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment