Pārlūkot izejas kodu

Node: Update golang (#4161)

* Node: Update golang

* node: Upgrade golangci-lint
bruce-riley 1 gadu atpakaļ
vecāks
revīzija
772a715998

+ 6 - 7
.github/workflows/build.yml

@@ -48,7 +48,7 @@ jobs:
       - uses: actions/checkout@v2
       - uses: actions/setup-go@v2
         with:
-          go-version: "1.21.9"
+          go-version: "1.23.3"
       - run: make node
 
   algorand:
@@ -186,8 +186,7 @@ jobs:
           done
 
           cargo test --workspace --features "nft-bridge/instructions token-bridge/instructions wormhole-bridge-solana/instructions"
-        shell:
-          bash
+        shell: bash
 
   aptos:
     name: Aptos
@@ -271,7 +270,7 @@ jobs:
       - uses: actions/checkout@v2
       - uses: actions/setup-go@v2
         with:
-          go-version: "1.21.9"
+          go-version: "1.23.3"
       - run: cd sdk/vaa && go test && go test -v -fuzz FuzzCalculateQuorum -run FuzzCalculateQuorum -fuzztime 15s
 
   # Run Go linters
@@ -288,13 +287,13 @@ jobs:
       - uses: actions/checkout@v2
       - uses: actions/setup-go@v2
         with:
-          go-version: "1.21.9"
+          go-version: "1.23.3"
       - name: Install formatter
         run: go install golang.org/x/tools/cmd/goimports@v0.8.0
       - name: Formatting checks
         run: ./scripts/lint.sh -l -g format
       - name: Install linters
-        run: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.57.2
+        run: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.60.1
       - name: Run linters
         run: make generate && golangci-lint --version && ./scripts/lint.sh -g lint
       - name: Ensure generated proto matches
@@ -330,7 +329,7 @@ jobs:
       - uses: actions/checkout@v2
       - uses: actions/setup-go@v2
         with:
-          go-version: "1.21.9"
+          go-version: "1.23.3"
       # The go-ethereum and celo-blockchain packages both implement secp256k1 using the exact same header, but that causes duplicate symbols.
       - name: Run golang tests
         run: cd node && go test -v -timeout 5m -race -ldflags '-extldflags "-Wl,--allow-multiple-definition" ' ./...

+ 1 - 1
DEVELOP.md

@@ -4,7 +4,7 @@
 
 The following dependencies are required for local development:
 
-- [Go](https://golang.org/dl/) >= 1.21.9 (latest minor release is recommended)
+- [Go](https://golang.org/dl/) >= 1.23.3 (latest minor release is recommended)
 - [Tilt](http://tilt.dev/) >= 0.20.8
 - Any of the local Kubernetes clusters supported by Tilt.
   We strongly recommend [minikube](https://kubernetes.io/docs/setup/learning-environment/minikube/) >=

+ 2 - 2
Dockerfile.proto

@@ -1,5 +1,5 @@
 # syntax=docker.io/docker/dockerfile:1.3@sha256:42399d4635eddd7a9b8a24be879d2f9a930d0ed040a61324cfdf59ef1357b3b2
-FROM docker.io/golang:1.21.9-bullseye@sha256:311468bffa9fa4747a334b94e6ce3681b564126d653675a6adc46698b2b88d35 AS go-tools
+FROM docker.io/golang:1.23.3-bullseye@sha256:bc1b90c2a8eb0ffb62325e02a85d51031ad3afae15b3df4b6a48b7929b00badb AS go-tools
 
 RUN mkdir /app
 
@@ -10,7 +10,7 @@ RUN --mount=type=cache,target=/root/.cache --mount=type=cache,target=/go \
 	cd /app/tools && CGO_ENABLED=0 ./build.sh
 
 # syntax=docker.io/docker/dockerfile:1.3@sha256:42399d4635eddd7a9b8a24be879d2f9a930d0ed040a61324cfdf59ef1357b3b2
-FROM docker.io/golang:1.21.9-bullseye@sha256:311468bffa9fa4747a334b94e6ce3681b564126d653675a6adc46698b2b88d35 AS go-build
+FROM docker.io/golang:1.23.3-bullseye@sha256:bc1b90c2a8eb0ffb62325e02a85d51031ad3afae15b3df4b6a48b7929b00badb AS go-build
 
 COPY --from=go-tools /app /app
 

+ 22 - 13
docs/operations.md

@@ -17,7 +17,7 @@ so you can test changes for your mainnet full nodes and gain operational experie
 ### Solana node requirements
 
 Refer to the [Solana documentation](https://docs.solanalabs.com/operations/setup-an-rpc-node) on how to run an RPC
-(full) node.  [Solana's Discord server](https://solana.com/community) is a great resource for questions regarding
+(full) node. [Solana's Discord server](https://solana.com/community) is a great resource for questions regarding
 operations.
 
 The `#rpc-server-operators` channel is especially useful for setting up Solana RPC nodes.
@@ -91,7 +91,6 @@ since only very few nodes support the light client protocol.
 Running a full node typically requires ~500G of SSD storage, 8G of RAM and 4-8 CPU threads (depending on clock
 frequency). Light clients have much lower hardware requirements.
 
-
 ### Terra
 
 Terra is also sometimes referred to as Terra 2, but the correct name is just simply "Terra". The previous version was renamed to "Terra Classic".
@@ -102,17 +101,18 @@ Refer to the [Terra documentation](https://docs.terra.money/full-node/run-a-full
 
 Refer to the [Terra Classic documentation](https://classic-docs.terra.money/docs/full-node/run-a-full-terra-node/README.html) on how to run a full node.
 
-
 ### Wormchain
 
 All guardians **must run validators for wormchain**, the codename of [Wormhole Gateway](https://wormhole.com/gateway/).
 
 #### Pre-requisites
-- Ensure you have [Go](https://golang.org/dl/) >= 1.21.9 installed.
+
+- Ensure you have [Go](https://golang.org/dl/) >= 1.23.3 installed.
 
 #### Building wormchaind binary
+
 There is not a pre-built binary available. You need to check out the repo and build the
-wormchaind binary from source: 
+wormchaind binary from source:
 
 First, check out the version of the Wormhole repo that you want to deploy:
 
@@ -125,18 +125,22 @@ Then, compile the release binary as an unprivileged build user:
 ```bash
 make build/wormchaind
 ```
+
 You'll find `wormchaind` binary in `wormchain/build/wormchaind`.
 
 #### Initialize environment
+
 Initialize the Wormchain environment with the necessary configuration.
 
 ```bash
 /path/to/wormchain/bin/wormchaind init <your-node-name> --chain-id wormchain --home /path/to/wormchain/directory
 ```
+
 This command will generate the private validator key. That key should be backed up.
 This key is set in `config.toml` file under the `priv_validator_key_file` field.
 
 #### Generate configuration files
+
 The `--wormchainURL` argument to the guardian node should point to `<validator address>:9090` which is the `grpc` port
 in the app.toml.
 
@@ -174,6 +178,7 @@ For signing, consider setting up a remote threshold signer such as
 in front of your wormchain validator.
 
 #### Retrieve the Genesis File
+
 Download the genesis file from the wormhole repository.
 
 ```bash
@@ -181,6 +186,7 @@ wget -O /path/to/wormchain/config/genesis.json https://raw.githubusercontent.com
 ```
 
 #### Generate wormchain keys
+
 To generate wormchain keys, run the following command:
 
 ```bash
@@ -188,10 +194,13 @@ To generate wormchain keys, run the following command:
 ```
 
 This command will create a `<key-name>.info` file. To extract the key, run the following command:
+
 ```bash
 wormchaind keys export <key_name> --home /path/to/wormchain/directory --keyring-dir . --keyring-backend file
 ```
+
 This command will ask for a passphrase to be created for it. Both `wormchain.key` and `passphrase` will be used by the following `guardiand` flags:
+
 - `--accountantKeyPath`
 - `--accountantKeyPassPhrase`
 
@@ -262,9 +271,9 @@ to function correctly. By default in geth, [historical state is only kept in mem
 After 128 blocks, older states are garbage collected. Many of these chains are forks of geth that maintain this
 historical limitation.
 
-* Arbitrum
-* Base
-* Optimism
+- Arbitrum
+- Base
+- Optimism
 
 Newer execution clients such as [reth](https://github.com/paradigmxyz/reth) lack this limitation and are worth
 investigating once they are stable.
@@ -279,10 +288,10 @@ All modern Cosmos integrations happen by Wormhole observing IBC transactions on
 
 The following Cosmos based nodes were added prior to Gateway and guardians need to run full nodes:
 
-* Injective
-* Terra
-* Terra Classic
-* XPLA
+- Injective
+- Terra
+- Terra Classic
+- XPLA
 
 **NOTE**: All guardians must run validators for wormchain.
 
@@ -291,7 +300,7 @@ The following Cosmos based nodes were added prior to Gateway and guardians need
 For security reasons, we do not provide a pre-built binary. You need to check out the repo and build the
 guardiand binary from source. A Git repo is much harder to tamper with than release binaries.
 
-To build the Wormhole node, you need [Go](https://golang.org/dl/) >= 1.21.9
+To build the Wormhole node, you need [Go](https://golang.org/dl/) >= 1.23.3
 
 First, check out the version of the Wormhole repo that you want to deploy:
 

+ 1 - 1
node/Dockerfile

@@ -1,5 +1,5 @@
 # syntax=docker.io/docker/dockerfile:1.3@sha256:42399d4635eddd7a9b8a24be879d2f9a930d0ed040a61324cfdf59ef1357b3b2
-FROM --platform=linux/amd64 docker.io/golang:1.21.9-bullseye@sha256:311468bffa9fa4747a334b94e6ce3681b564126d653675a6adc46698b2b88d35 AS dev
+FROM --platform=linux/amd64 docker.io/golang:1.23.3-bullseye@sha256:bc1b90c2a8eb0ffb62325e02a85d51031ad3afae15b3df4b6a48b7929b00badb AS dev
 # libwasmvm.so is not compatible with arm
 
 FROM dev AS build

+ 1 - 1
node/go.mod

@@ -1,6 +1,6 @@
 module github.com/certusone/wormhole/node
 
-go 1.21.9
+go 1.23.3
 
 require (
 	github.com/celo-org/celo-blockchain v1.5.5

+ 1 - 1
node/hack/query/ccqlistener/Dockerfile

@@ -1,5 +1,5 @@
 # syntax=docker.io/docker/dockerfile:1.3@sha256:42399d4635eddd7a9b8a24be879d2f9a930d0ed040a61324cfdf59ef1357b3b2
-FROM --platform=linux/amd64 docker.io/golang:1.21.9-bullseye@sha256:311468bffa9fa4747a334b94e6ce3681b564126d653675a6adc46698b2b88d35 AS build
+FROM --platform=linux/amd64 docker.io/golang:1.23.3-bullseye@sha256:bc1b90c2a8eb0ffb62325e02a85d51031ad3afae15b3df4b6a48b7929b00badb AS build
 # libwasmvm.so is not compatible with arm
 
 WORKDIR /app

+ 2 - 1
node/pkg/watchers/evm/connectors/finalizer_poller.go

@@ -2,6 +2,7 @@ package connectors
 
 import (
 	"context"
+	"errors"
 	"fmt"
 	"math/big"
 	"time"
@@ -68,7 +69,7 @@ func (b *FinalizerPollConnector) SubscribeForBlocks(ctx context.Context, errC ch
 				sub.unsubDone <- struct{}{}
 				return nil
 			case v := <-innerErrSink:
-				sub.err <- fmt.Errorf(v)
+				sub.err <- errors.New(v)
 			}
 		}
 	})

+ 2 - 1
node/pkg/watchers/evm/connectors/logpoller.go

@@ -2,6 +2,7 @@ package connectors
 
 import (
 	"context"
+	"errors"
 	"fmt"
 	"math/big"
 	"time"
@@ -94,7 +95,7 @@ func (l *LogPollConnector) WatchLogMessagePublished(ctx context.Context, errC ch
 				sub.unsubDone <- struct{}{}
 				return nil
 			case v := <-innerErrSink:
-				sub.err <- fmt.Errorf(v)
+				sub.err <- errors.New(v)
 			}
 		}
 	})

+ 1 - 1
scripts/Dockerfile.lint

@@ -1,5 +1,5 @@
 # syntax=docker.io/docker/dockerfile:1.3@sha256:42399d4635eddd7a9b8a24be879d2f9a930d0ed040a61324cfdf59ef1357b3b2
-FROM docker.io/golang:1.21.9-bullseye@sha256:311468bffa9fa4747a334b94e6ce3681b564126d653675a6adc46698b2b88d35
+FROM docker.io/golang:1.23.3-bullseye@sha256:bc1b90c2a8eb0ffb62325e02a85d51031ad3afae15b3df4b6a48b7929b00badb
 
 RUN useradd -u 1000 -U -m -d /home/lint lint
 USER 1000

+ 1 - 1
scripts/update-go-version.sh

@@ -64,7 +64,7 @@ function update_our_dockerfiles() {
     local image=docker.io/golang
 
     # shellcheck disable=SC2207
-    local wormhole_dockerfiles=($(git grep -lEi 'FROM.*go(lang)' | grep -Ev '^(wormchain/D|third_party|algorand|terra)'))
+    local wormhole_dockerfiles=($(git grep -lEi 'FROM.*go(lang)' | grep -Ev '^(wormchain/D|third_party|algorand|terra|docs)'))
 
     # shellcheck disable=SC2155
     local digest=$(get_docker_image_digest "$version" "docker.io/golang")

+ 1 - 1
sdk/vaa/payloads.go

@@ -502,7 +502,7 @@ func LeftPadBytes(payload string, length int) (*bytes.Buffer, error) {
 	}
 
 	if len(payload) > length {
-		return nil, fmt.Errorf(fmt.Sprintf("payload longer than %d bytes", length))
+		return nil, fmt.Errorf("payload longer than %d bytes", length)
 	}
 
 	buf := &bytes.Buffer{}