Эх сурвалжийг харах

Node: Update golang (#4161)

* Node: Update golang

* node: Upgrade golangci-lint
bruce-riley 1 жил өмнө
parent
commit
772a715998

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

@@ -48,7 +48,7 @@ jobs:
       - uses: actions/checkout@v2
       - uses: actions/checkout@v2
       - uses: actions/setup-go@v2
       - uses: actions/setup-go@v2
         with:
         with:
-          go-version: "1.21.9"
+          go-version: "1.23.3"
       - run: make node
       - run: make node
 
 
   algorand:
   algorand:
@@ -186,8 +186,7 @@ jobs:
           done
           done
 
 
           cargo test --workspace --features "nft-bridge/instructions token-bridge/instructions wormhole-bridge-solana/instructions"
           cargo test --workspace --features "nft-bridge/instructions token-bridge/instructions wormhole-bridge-solana/instructions"
-        shell:
-          bash
+        shell: bash
 
 
   aptos:
   aptos:
     name: Aptos
     name: Aptos
@@ -271,7 +270,7 @@ jobs:
       - uses: actions/checkout@v2
       - uses: actions/checkout@v2
       - uses: actions/setup-go@v2
       - uses: actions/setup-go@v2
         with:
         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: cd sdk/vaa && go test && go test -v -fuzz FuzzCalculateQuorum -run FuzzCalculateQuorum -fuzztime 15s
 
 
   # Run Go linters
   # Run Go linters
@@ -288,13 +287,13 @@ jobs:
       - uses: actions/checkout@v2
       - uses: actions/checkout@v2
       - uses: actions/setup-go@v2
       - uses: actions/setup-go@v2
         with:
         with:
-          go-version: "1.21.9"
+          go-version: "1.23.3"
       - name: Install formatter
       - name: Install formatter
         run: go install golang.org/x/tools/cmd/goimports@v0.8.0
         run: go install golang.org/x/tools/cmd/goimports@v0.8.0
       - name: Formatting checks
       - name: Formatting checks
         run: ./scripts/lint.sh -l -g format
         run: ./scripts/lint.sh -l -g format
       - name: Install linters
       - 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
       - name: Run linters
         run: make generate && golangci-lint --version && ./scripts/lint.sh -g lint
         run: make generate && golangci-lint --version && ./scripts/lint.sh -g lint
       - name: Ensure generated proto matches
       - name: Ensure generated proto matches
@@ -330,7 +329,7 @@ jobs:
       - uses: actions/checkout@v2
       - uses: actions/checkout@v2
       - uses: actions/setup-go@v2
       - uses: actions/setup-go@v2
         with:
         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.
       # The go-ethereum and celo-blockchain packages both implement secp256k1 using the exact same header, but that causes duplicate symbols.
       - name: Run golang tests
       - name: Run golang tests
         run: cd node && go test -v -timeout 5m -race -ldflags '-extldflags "-Wl,--allow-multiple-definition" ' ./...
         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:
 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
 - [Tilt](http://tilt.dev/) >= 0.20.8
 - Any of the local Kubernetes clusters supported by Tilt.
 - Any of the local Kubernetes clusters supported by Tilt.
   We strongly recommend [minikube](https://kubernetes.io/docs/setup/learning-environment/minikube/) >=
   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
 # 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
 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
 	cd /app/tools && CGO_ENABLED=0 ./build.sh
 
 
 # syntax=docker.io/docker/dockerfile:1.3@sha256:42399d4635eddd7a9b8a24be879d2f9a930d0ed040a61324cfdf59ef1357b3b2
 # 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
 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
 ### Solana node requirements
 
 
 Refer to the [Solana documentation](https://docs.solanalabs.com/operations/setup-an-rpc-node) on how to run an RPC
 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.
 operations.
 
 
 The `#rpc-server-operators` channel is especially useful for setting up Solana RPC nodes.
 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
 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.
 frequency). Light clients have much lower hardware requirements.
 
 
-
 ### Terra
 ### 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".
 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.
 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
 ### Wormchain
 
 
 All guardians **must run validators for wormchain**, the codename of [Wormhole Gateway](https://wormhole.com/gateway/).
 All guardians **must run validators for wormchain**, the codename of [Wormhole Gateway](https://wormhole.com/gateway/).
 
 
 #### Pre-requisites
 #### 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
 #### Building wormchaind binary
+
 There is not a pre-built binary available. You need to check out the repo and build the
 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:
 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
 ```bash
 make build/wormchaind
 make build/wormchaind
 ```
 ```
+
 You'll find `wormchaind` binary in `wormchain/build/wormchaind`.
 You'll find `wormchaind` binary in `wormchain/build/wormchaind`.
 
 
 #### Initialize environment
 #### Initialize environment
+
 Initialize the Wormchain environment with the necessary configuration.
 Initialize the Wormchain environment with the necessary configuration.
 
 
 ```bash
 ```bash
 /path/to/wormchain/bin/wormchaind init <your-node-name> --chain-id wormchain --home /path/to/wormchain/directory
 /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 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.
 This key is set in `config.toml` file under the `priv_validator_key_file` field.
 
 
 #### Generate configuration files
 #### Generate configuration files
+
 The `--wormchainURL` argument to the guardian node should point to `<validator address>:9090` which is the `grpc` port
 The `--wormchainURL` argument to the guardian node should point to `<validator address>:9090` which is the `grpc` port
 in the app.toml.
 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.
 in front of your wormchain validator.
 
 
 #### Retrieve the Genesis File
 #### Retrieve the Genesis File
+
 Download the genesis file from the wormhole repository.
 Download the genesis file from the wormhole repository.
 
 
 ```bash
 ```bash
@@ -181,6 +186,7 @@ wget -O /path/to/wormchain/config/genesis.json https://raw.githubusercontent.com
 ```
 ```
 
 
 #### Generate wormchain keys
 #### Generate wormchain keys
+
 To generate wormchain keys, run the following command:
 To generate wormchain keys, run the following command:
 
 
 ```bash
 ```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:
 This command will create a `<key-name>.info` file. To extract the key, run the following command:
+
 ```bash
 ```bash
 wormchaind keys export <key_name> --home /path/to/wormchain/directory --keyring-dir . --keyring-backend file
 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:
 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`
 - `--accountantKeyPath`
 - `--accountantKeyPassPhrase`
 - `--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
 After 128 blocks, older states are garbage collected. Many of these chains are forks of geth that maintain this
 historical limitation.
 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
 Newer execution clients such as [reth](https://github.com/paradigmxyz/reth) lack this limitation and are worth
 investigating once they are stable.
 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:
 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.
 **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
 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.
 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:
 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
 # 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
 # libwasmvm.so is not compatible with arm
 
 
 FROM dev AS build
 FROM dev AS build

+ 1 - 1
node/go.mod

@@ -1,6 +1,6 @@
 module github.com/certusone/wormhole/node
 module github.com/certusone/wormhole/node
 
 
-go 1.21.9
+go 1.23.3
 
 
 require (
 require (
 	github.com/celo-org/celo-blockchain v1.5.5
 	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
 # 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
 # libwasmvm.so is not compatible with arm
 
 
 WORKDIR /app
 WORKDIR /app

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

@@ -2,6 +2,7 @@ package connectors
 
 
 import (
 import (
 	"context"
 	"context"
+	"errors"
 	"fmt"
 	"fmt"
 	"math/big"
 	"math/big"
 	"time"
 	"time"
@@ -68,7 +69,7 @@ func (b *FinalizerPollConnector) SubscribeForBlocks(ctx context.Context, errC ch
 				sub.unsubDone <- struct{}{}
 				sub.unsubDone <- struct{}{}
 				return nil
 				return nil
 			case v := <-innerErrSink:
 			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 (
 import (
 	"context"
 	"context"
+	"errors"
 	"fmt"
 	"fmt"
 	"math/big"
 	"math/big"
 	"time"
 	"time"
@@ -94,7 +95,7 @@ func (l *LogPollConnector) WatchLogMessagePublished(ctx context.Context, errC ch
 				sub.unsubDone <- struct{}{}
 				sub.unsubDone <- struct{}{}
 				return nil
 				return nil
 			case v := <-innerErrSink:
 			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
 # 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
 RUN useradd -u 1000 -U -m -d /home/lint lint
 USER 1000
 USER 1000

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

@@ -64,7 +64,7 @@ function update_our_dockerfiles() {
     local image=docker.io/golang
     local image=docker.io/golang
 
 
     # shellcheck disable=SC2207
     # 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
     # shellcheck disable=SC2155
     local digest=$(get_docker_image_digest "$version" "docker.io/golang")
     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 {
 	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{}
 	buf := &bytes.Buffer{}