Skip to content

Commit

Permalink
chore: upgrade cosmovisor and go (#3345)
Browse files Browse the repository at this point in the history
* chore: upgrade cosmovisor

* upgrade to go 1.23

* go mod tidy

* upgrade golangci-lint

* fix lint failures and disable golangci-lint gosec for now
  • Loading branch information
gartnera authored Jan 13, 2025
1 parent bddce4e commit 8559390
Show file tree
Hide file tree
Showing 11 changed files with 20 additions and 21 deletions.
2 changes: 1 addition & 1 deletion .github/actions/install-dependencies/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ runs:
- uses: actions/setup-go@v5
if: ${{ inputs.skip_go == 'false' }}
with:
go-version: '1.22'
go-version: '1.23'
cache: false

- uses: actions/setup-python@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.22'
go-version: '1.23'
- name: go get node
working-directory: contrib/rpcimportable
run: go get github.com/zeta-chain/node@${{github.event.pull_request.head.sha || github.sha}}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/sast-linters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.22'
go-version: '1.23'

- name: Run golangci-lint
uses: golangci/golangci-lint-action@v6
with:
version: v1.59
version: v1.63.4
skip-cache: true

nosec_alert:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/sim.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.22'
go-version: '1.23'

- name: Install dependencies
run: make runsim
Expand Down
1 change: 0 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ linters:
- misspell
- goimports
- govet
- gosec
- stylecheck
- typecheck
- misspell
Expand Down
8 changes: 4 additions & 4 deletions Dockerfile-localnet
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# syntax=ghcr.io/zeta-chain/docker-dockerfile:1.9-labs
# check=error=true
FROM ghcr.io/zeta-chain/golang:1.22.7-bookworm AS base-build
FROM ghcr.io/zeta-chain/golang:1.23.3-bookworm AS base-build

ENV GOPATH=/go
ENV GOOS=linux
Expand All @@ -27,10 +27,10 @@ RUN --mount=type=cache,target="/root/.cache/go-build" \
NODE_COMMIT=${NODE_COMMIT} \
make install install-zetae2e

FROM ghcr.io/zeta-chain/golang:1.22.7-bookworm AS cosmovisor-build
RUN go install cosmossdk.io/tools/cosmovisor/cmd/cosmovisor@v1.6.0
FROM ghcr.io/zeta-chain/golang:1.23.3-bookworm AS cosmovisor-build
RUN go install cosmossdk.io/tools/cosmovisor/cmd/cosmovisor@v1.7.0

FROM ghcr.io/zeta-chain/golang:1.22.7-bookworm AS base-runtime
FROM ghcr.io/zeta-chain/golang:1.23.3-bookworm AS base-runtime

RUN apt update && \
apt install -yq jq yq curl tmux python3 openssh-server iputils-ping iproute2 bind9-host && \
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ GOFLAGS := ""
GOPATH ?= '$(HOME)/go'

# common goreaser command definition
GOLANG_CROSS_VERSION ?= v1.22.7@sha256:24b2d75007f0ec8e35d01f3a8efa40c197235b200a1a91422d78b851f67ecce4
GOLANG_CROSS_VERSION ?= v1.23.3@sha256:380420abb74844aaebca5bf9e2d00b1d7c78f59ce9e6d47cdb3276281702ca23
GORELEASER := $(DOCKER) run \
--rm \
--privileged \
Expand Down
6 changes: 3 additions & 3 deletions pkg/graceful/graceful.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,9 @@ func (p *Process) ShutdownNow() {
}
}

// panicToErr converts panic to error WITH exact line of panic.
// panicToErr converts recoverVal to error WITH exact line of panic.
// Note the offset should be determined empirically.
func panicToErr(panic any, offset int) error {
func panicToErr(recoverVal any, offset int) error {
stack := string(debug.Stack())
lines := strings.Split(stack, "\n")
line := ""
Expand All @@ -158,7 +158,7 @@ func panicToErr(panic any, offset int) error {
line = strings.TrimSpace(lines[offset])
}

return fmt.Errorf("panic: %v at %s", panic, line)
return fmt.Errorf("panic: %v at %s", recoverVal, line)
}

// NewSigChan creates a new signal channel.
Expand Down
8 changes: 4 additions & 4 deletions rpc/types/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -303,9 +303,9 @@ func BaseFeeFromEvents(events []abci.Event) *big.Int {

// CheckTxFee is an internal function used to check whether the fee of
// the given transaction is _reasonable_(under the cap).
func CheckTxFee(gasPrice *big.Int, gas uint64, cap float64) error {
func CheckTxFee(gasPrice *big.Int, gas uint64, feeCap float64) error {
// Short circuit if there is no cap for transaction fee at all.
if cap == 0 {
if feeCap == 0 {
return nil
}
totalfee := new(big.Float).SetInt(new(big.Int).Mul(gasPrice, new(big.Int).SetUint64(gas)))
Expand All @@ -315,8 +315,8 @@ func CheckTxFee(gasPrice *big.Int, gas uint64, cap float64) error {
feeEth := new(big.Float).Quo(totalfee, oneToken)
// no need to check error from parsing
feeFloat, _ := feeEth.Float64()
if feeFloat > cap {
return fmt.Errorf("tx fee (%.2f ether) exceeds the configured cap (%.2f ether)", feeFloat, cap)
if feeFloat > feeCap {
return fmt.Errorf("tx fee (%.2f ether) exceeds the configured cap (%.2f ether)", feeFloat, feeCap)
}
return nil
}
Expand Down
2 changes: 1 addition & 1 deletion scripts/fmt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ set -e
if ! command -v golangci-lint &> /dev/null
then
echo "golangci-lint is not found, installing..."
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.59.1
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.63.4
fi

if ! command -v golines &> /dev/null
Expand Down
4 changes: 2 additions & 2 deletions x/observer/types/ballot.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ func (m Ballot) IsFinalizingVote() (Ballot, bool) {
return m, false
}

func CreateVotes(len int) []VoteType {
voterList := make([]VoteType, len)
func CreateVotes(listSize int) []VoteType {
voterList := make([]VoteType, listSize)
for i := range voterList {
voterList[i] = VoteType_NotYetVoted
}
Expand Down

0 comments on commit 8559390

Please sign in to comment.