Skip to content

Commit

Permalink
Merge pull request #94 from BoostryJP/upgrade-go-1-23
Browse files Browse the repository at this point in the history
all: Upgrade Go to 1.23.1
  • Loading branch information
YoshihitoAso authored Sep 18, 2024
2 parents d8073f3 + a7739a5 commit d21f5b8
Show file tree
Hide file tree
Showing 20 changed files with 136 additions and 108 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '1.22'
go-version: '1.23'

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- '**.md'
- .gitignore
env:
GO_VERSION: 1.22.1
GO_VERSION: 1.23.1
jobs:
lint:
name: 'Code linters'
Expand Down
8 changes: 2 additions & 6 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,6 @@
run:
timeout: 20m
tests: true
# default is true. Enables skipping of directories:
# vendor$, third_party$, testdata$, examples$, Godeps$, builtin$
skip-dirs-use-default: true
skip-files:
- core/genesis_alloc.go

linters:
disable-all: true
Expand All @@ -23,7 +18,6 @@ linters:
- staticcheck
- bidichk
- durationcheck
- exportloopref
- whitespace

# - structcheck # lots of false positives
Expand All @@ -43,6 +37,8 @@ linters-settings:
min-occurrences: 6 # minimum number of occurrences

issues:
exclude-files:
- core/genesis_alloc.go
exclude-rules:
- path: crypto/bn256/cloudflare/optate.go
linters:
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ ARG VERSION=""
ARG BUILDNUM=""

# Build Geth in a stock Go builder container
FROM golang:1.22-alpine as builder
FROM golang:1.23-alpine as builder

RUN apk add --no-cache gcc musl-dev linux-headers git

Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.alltools
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ ARG VERSION=""
ARG BUILDNUM=""

# Build Geth in a stock Go builder container
FROM golang:1.22-alpine as builder
FROM golang:1.23-alpine as builder

RUN apk add --no-cache gcc musl-dev linux-headers git

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ The version control policy of this project follows that of ibet-Network.
Currently, the ibet Network is built using a node client based on v24.4.0 of GoQuorum.
However, it has been variously patched to be optimized for ibet Network. For example:
- The default block generation interval is set to 1 second.
- Fully supports Go 1.22 and applies new 3rd party packages from a security perspective.
- Fully supports Go 1.23 and applies new 3rd party packages from a security perspective.
- Made temporary fixes for bugs before they were fixed in the original GoQuorum.

## Building the source
Building quorum requires both a Go (version 1.22) and a C compiler.
Building quorum requires both a Go (version 1.23) and a C compiler.
You can install them using your favourite package manager.
Once the dependencies are installed, run
```
Expand Down
2 changes: 1 addition & 1 deletion accounts/abi/unpack_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -909,7 +909,7 @@ func TestOOMMaliciousInput(t *testing.T) {
}
encb, err := hex.DecodeString(test.enc)
if err != nil {
t.Fatalf("invalid hex: %s" + test.enc)
t.Fatalf("invalid hex: %s", test.enc)
}
_, err = abi.Methods["method"].Outputs.UnpackValues(encb)
if err == nil {
Expand Down
168 changes: 104 additions & 64 deletions build/checksums.txt

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions build/ci.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ var (
// This is the version of go that will be downloaded by
//
// go run ci.go install -dlgo
dlgoVersion = "1.22.1"
dlgoVersion = "1.23.1"
)

var GOBIN, _ = filepath.Abs(filepath.Join("build", "bin"))
Expand Down Expand Up @@ -327,7 +327,7 @@ func doLint(cmdline []string) {

// downloadLinter downloads and unpacks golangci-lint.
func downloadLinter(cachedir string) string {
const version = "1.56.2"
const version = "1.61.0"

csdb := build.MustLoadChecksums("build/checksums.txt")
arch := runtime.GOARCH
Expand Down
1 change: 0 additions & 1 deletion cmd/geth/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,6 @@ func geth(ctx *cli.Context) error {
// miner.
func startNode(ctx *cli.Context, stack *node.Node, backend ethapi.Backend) {
log.DoEmitCheckpoints = ctx.Bool(utils.EmitCheckpointsFlag.Name)
debug.Memsize.Add("node", stack)

// raft mode does not support --exitwhensynced
if ctx.Bool(utils.ExitWhenSyncedFlag.Name) && ctx.Bool(utils.RaftModeFlag.Name) {
Expand Down
16 changes: 8 additions & 8 deletions core/rawdb/accessors_chain_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ func TestBlockReceiptStorage(t *testing.T) {
t.Fatalf("no receipts returned")
} else {
if err := checkReceiptsRLP(rs, receipts); err != nil {
t.Fatalf(err.Error())
t.Fatalf("%s", err.Error())
}
// check that the raw data does not contain the quorumExtraData array (since the prepared receipts do not have any quorumExtraData)
receiptData := ReadReceiptsRLP(db, hash, 0)
Expand All @@ -408,7 +408,7 @@ func TestBlockReceiptStorage(t *testing.T) {
}
// Ensure that receipts without metadata can be returned without the block body too
if err := checkReceiptsRLP(ReadRawReceipts(db, hash, 0), receipts); err != nil {
t.Fatalf(err.Error())
t.Fatalf("%s", err.Error())
}
// Sanity check that body alone without the receipt is a full purge
WriteBody(db, hash, 0, body)
Expand Down Expand Up @@ -486,7 +486,7 @@ func TestBlockReceiptStorageWithLegacyMPSV1EncodingWithMPSData(t *testing.T) {
t.Fatalf("no receipts returned")
} else {
if err := checkReceiptsRLP(rs, receipts); err != nil {
t.Fatalf(err.Error())
t.Fatalf("%s", err.Error())
}
rec2 := rs[1]
assert.Len(t, rec2.PSReceipts, 1)
Expand All @@ -500,7 +500,7 @@ func TestBlockReceiptStorageWithLegacyMPSV1EncodingWithMPSData(t *testing.T) {
}
// Ensure that receipts without metadata can be returned without the block body too
if err := checkReceiptsRLP(ReadRawReceipts(db, hash, 0), receipts); err != nil {
t.Fatalf(err.Error())
t.Fatalf("%s", err.Error())
}
}

Expand Down Expand Up @@ -556,7 +556,7 @@ func TestBlockReceiptStorageWithLegacyMPSV1EncodingWithoutMPSData(t *testing.T)
t.Fatalf("no receipts returned")
} else {
if err := checkReceiptsRLP(rs, receipts); err != nil {
t.Fatalf(err.Error())
t.Fatalf("%s", err.Error())
}
rec2 := rs[1]
assert.Len(t, rec2.PSReceipts, 0)
Expand All @@ -568,7 +568,7 @@ func TestBlockReceiptStorageWithLegacyMPSV1EncodingWithoutMPSData(t *testing.T)
}
// Ensure that receipts without metadata can be returned without the block body too
if err := checkReceiptsRLP(ReadRawReceipts(db, hash, 0), receipts); err != nil {
t.Fatalf(err.Error())
t.Fatalf("%s", err.Error())
}
}

Expand Down Expand Up @@ -644,7 +644,7 @@ func TestBlockReceiptStorageWithQuorumExtraData(t *testing.T) {
t.Fatalf("no receipts returned")
} else {
if err := checkReceiptsRLP(rs, receipts); err != nil {
t.Fatalf(err.Error())
t.Fatalf("%s", err.Error())
}
rec2 := rs[1]
assert.Len(t, rec2.PSReceipts, 1)
Expand All @@ -659,7 +659,7 @@ func TestBlockReceiptStorageWithQuorumExtraData(t *testing.T) {
}
// Ensure that receipts without metadata can be returned without the block body too
if err := checkReceiptsRLP(ReadRawReceipts(db, hash, 0), receipts); err != nil {
t.Fatalf(err.Error())
t.Fatalf("%s", err.Error())
}
// Sanity check that body alone without the receipt is a full purge
WriteBody(db, hash, 0, body)
Expand Down
2 changes: 1 addition & 1 deletion core/types/receipt.go
Original file line number Diff line number Diff line change
Expand Up @@ -703,7 +703,7 @@ func (r *QuorumReceiptExtraData) EncodeRLP(w io.Writer) error {
}

func (r *QuorumReceiptExtraData) IsEmpty() bool {
return (r.PSReceipts == nil || len(r.PSReceipts) == 0) && r.RevertReason == nil
return len(r.PSReceipts) == 0 && r.RevertReason == nil
}

// LEGACY STRUCTURES TO COPE WITH MPS RECEIPT RLP ENCODING
Expand Down
4 changes: 2 additions & 2 deletions crypto/bn256/cloudflare/gfp_decl.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ import (
"golang.org/x/sys/cpu"
)

// nolint:varcheck,unused,deadcode
//nolint:varcheck,unused,deadcode
var hasBMI2 = cpu.X86.HasBMI2

// go:noescape
//go:noescape
func gfpNeg(c, a *gfP)

//go:noescape
Expand Down
3 changes: 1 addition & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/ethereum/go-ethereum

go 1.22
go 1.23.1

// Quorum - Replace Go modules that use modifications done by us
replace github.com/coreos/etcd => github.com/Consensys/etcd v3.3.13-quorum197+incompatible
Expand All @@ -27,7 +27,6 @@ require (
github.com/dop251/goja v0.0.0-20200721192441-a695b0cdd498
github.com/eapache/channels v1.1.0
github.com/fatih/color v1.17.0
github.com/fjl/memsize v0.0.2
github.com/fsnotify/fsnotify v1.7.0
github.com/gballet/go-libpcsclite v0.0.0-20191108122812-4678299bea08
github.com/go-stack/stack v1.8.1
Expand Down
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,6 @@ github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
github.com/fatih/color v1.17.0 h1:GlRw1BRJxkpqUCBKzKOw098ed57fEsKeNjpTe3cSjK4=
github.com/fatih/color v1.17.0/go.mod h1:YZ7TlrGPkiz6ku9fK3TLD/pl3CpsiFyu8N92HLgmosI=
github.com/fjl/memsize v0.0.2 h1:27txuSD9or+NZlnOWdKUxeBzTAUkWCVh+4Gf2dWFOzA=
github.com/fjl/memsize v0.0.2/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0=
github.com/fogleman/gg v1.2.1-0.20190220221249-0403632d5b90/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k=
github.com/franela/goblin v0.0.0-20200105215937-c9ffbefa60db/go.mod h1:7dvUGVsVBjqR7JHJk0brhHOZYGmfBYOrK0ZhYMEtBr4=
github.com/franela/goreq v0.0.0-20171204163338-bcd34c9993f8/go.mod h1:ZhphrRTfi2rbfLwlschooIH4+wKKDR4Pdxhh+TRoA20=
Expand Down
4 changes: 0 additions & 4 deletions internal/debug/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,11 @@ import (
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/metrics"
"github.com/ethereum/go-ethereum/metrics/exp"
"github.com/fjl/memsize/memsizeui"
"github.com/mattn/go-colorable"
"github.com/mattn/go-isatty"
"github.com/urfave/cli/v2"
)

var Memsize memsizeui.Handler

var (
verbosityFlag = &cli.IntFlag{
Name: "verbosity",
Expand Down Expand Up @@ -255,7 +252,6 @@ func StartPProf(address string, withMetrics bool) {
if withMetrics {
exp.Exp(metrics.DefaultRegistry)
}
http.Handle("/memsize/", http.StripPrefix("/memsize", &Memsize))
log.Info("Starting pprof server", "addr", fmt.Sprintf("http://%s/debug/pprof", address))
go func() {
if err := http.ListenAndServe(address, nil); err != nil {
Expand Down
2 changes: 1 addition & 1 deletion metrics/json_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ func TestRegistryMarshallJSON(t *testing.T) {
r.Register("counter", NewCounter())
enc.Encode(r)
if s := b.String(); s != "{\"counter\":{\"count\":0}}\n" {
t.Fatalf(s)
t.Fatalf("%s", s)
}
}

Expand Down
4 changes: 2 additions & 2 deletions plugin/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ func TestIsValidTargetURL(t *testing.T) {
assert.Error(t, isValidTargetURL("https://localhost", "http://localhost.com"))

if err := isValidTargetURL("http://localhost.com", "http://localhost.com"); err != nil {
t.Errorf(err.Error())
t.Errorf("%s", err.Error())
}

if err := isValidTargetURL("https://localhost.com/../../", "https://localhost.com"); err != nil {
t.Errorf(err.Error())
t.Errorf("%s", err.Error())
}
}

Expand Down
8 changes: 4 additions & 4 deletions rlp/decode.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,13 +153,13 @@ func makeDecoder(typ reflect.Type, tags tags) (dec decoder, err error) {
switch {
case typ == rawValueType:
return decodeRawValue, nil
case typ.AssignableTo(reflect.PtrTo(bigInt)):
case typ.AssignableTo(reflect.PointerTo(bigInt)):
return decodeBigInt, nil
case typ.AssignableTo(bigInt):
return decodeBigIntNoPtr, nil
case kind == reflect.Ptr:
return makePtrDecoder(typ, tags)
case reflect.PtrTo(typ).Implements(decoderInterface):
case reflect.PointerTo(typ).Implements(decoderInterface):
return decodeDecoder, nil
case isUint(kind):
return decodeUint, nil
Expand Down Expand Up @@ -239,7 +239,7 @@ func decodeBigInt(s *Stream, val reflect.Value) error {

func makeListDecoder(typ reflect.Type, tag tags) (decoder, error) {
etype := typ.Elem()
if etype.Kind() == reflect.Uint8 && !reflect.PtrTo(etype).Implements(decoderInterface) {
if etype.Kind() == reflect.Uint8 && !reflect.PointerTo(etype).Implements(decoderInterface) {
if typ.Kind() == reflect.Array {
return decodeByteArray, nil
}
Expand Down Expand Up @@ -439,7 +439,7 @@ func makeSimplePtrDecoder(etype reflect.Type, etypeinfo *typeinfo) decoder {
//
// This decoder is used for pointer-typed struct fields with struct tag "nil".
func makeNilPtrDecoder(etype reflect.Type, etypeinfo *typeinfo, nilKind Kind) decoder {
typ := reflect.PtrTo(etype)
typ := reflect.PointerTo(etype)
nilPtr := reflect.Zero(typ)
return func(s *Stream, val reflect.Value) (err error) {
kind, size, err := s.Kind()
Expand Down
4 changes: 2 additions & 2 deletions rlp/encode.go
Original file line number Diff line number Diff line change
Expand Up @@ -332,13 +332,13 @@ func makeWriter(typ reflect.Type, ts tags) (writer, error) {
switch {
case typ == rawValueType:
return writeRawValue, nil
case typ.AssignableTo(reflect.PtrTo(bigInt)):
case typ.AssignableTo(reflect.PointerTo(bigInt)):
return writeBigIntPtr, nil
case typ.AssignableTo(bigInt):
return writeBigIntNoPtr, nil
case kind == reflect.Ptr:
return makePtrWriter(typ, ts)
case reflect.PtrTo(typ).Implements(encoderInterface):
case reflect.PointerTo(typ).Implements(encoderInterface):
return makeEncoderWriter(typ), nil
case isUint(kind):
return writeUint, nil
Expand Down

0 comments on commit d21f5b8

Please sign in to comment.