Skip to content

Commit

Permalink
Node: Update golang (wormhole-foundation#4161)
Browse files Browse the repository at this point in the history
* Node: Update golang

* node: Upgrade golangci-lint
  • Loading branch information
bruce-riley authored Nov 19, 2024
1 parent b0eb131 commit 772a715
Show file tree
Hide file tree
Showing 12 changed files with 41 additions and 31 deletions.
13 changes: 6 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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/[email protected]
- 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
Expand Down Expand Up @@ -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" ' ./...
Expand Down
2 changes: 1 addition & 1 deletion DEVELOP.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/) >=
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile.proto
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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

Expand Down
35 changes: 22 additions & 13 deletions docs/operations.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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".
Expand All @@ -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:

Expand All @@ -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.

Expand Down Expand Up @@ -174,24 +178,29 @@ 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
wget -O /path/to/wormchain/config/genesis.json https://raw.githubusercontent.com/wormhole-foundation/wormhole/main/wormchain/<network>/genesis.json
```

#### Generate wormchain keys

To generate wormchain keys, run the following command:

```bash
/path/to/wormchain/bin/wormchaind keys add <key-name> --keyring-backend file --home /path/to/wormchain/directory
```

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`

Expand Down Expand Up @@ -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.
Expand All @@ -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.

Expand All @@ -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:

Expand Down
2 changes: 1 addition & 1 deletion node/Dockerfile
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion node/go.mod
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion node/hack/query/ccqlistener/Dockerfile
Original file line number Diff line number Diff line change
@@ -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
Expand Down
3 changes: 2 additions & 1 deletion node/pkg/watchers/evm/connectors/finalizer_poller.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package connectors

import (
"context"
"errors"
"fmt"
"math/big"
"time"
Expand Down Expand Up @@ -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)
}
}
})
Expand Down
3 changes: 2 additions & 1 deletion node/pkg/watchers/evm/connectors/logpoller.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package connectors

import (
"context"
"errors"
"fmt"
"math/big"
"time"
Expand Down Expand Up @@ -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)
}
}
})
Expand Down
2 changes: 1 addition & 1 deletion scripts/Dockerfile.lint
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion scripts/update-go-version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
2 changes: 1 addition & 1 deletion sdk/vaa/payloads.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}
Expand Down

0 comments on commit 772a715

Please sign in to comment.