Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(go): upgrade go to 1.23 #18

Merged
merged 4 commits into from
Aug 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ jobs:
lint_test:
uses: babylonlabs-io/.github/.github/workflows/[email protected]
with:
go-version: '1.23'
go-lint-version: 'v1.60.2'
run-unit-tests: true
run-integration-tests: true
run-lint: true
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ jobs:
lint_test:
uses: babylonlabs-io/.github/.github/workflows/[email protected]
with:
go-version: '1.23'
go-lint-version: 'v1.60.2'
run-unit-tests: true
run-integration-tests: true
run-lint: true
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## Image for building
FROM golang:1.21-alpine AS build-env
FROM golang:1.23-alpine AS build-env


# TARGETPLATFORM should be one of linux/amd64 or linux/arm64.
Expand Down Expand Up @@ -46,7 +46,7 @@
RUN apk add bash curl jq

# Label should match your github repo
LABEL org.opencontainers.image.source="https://github.com/babylonlabs-io/vigilante:${VERSION}"

Check warning on line 49 in Dockerfile

View workflow job for this annotation

GitHub Actions / docker_pipeline / docker_build

Variables should be defined before their use

UndefinedVar: Usage of undefined variable '$VERSION' More info: https://docs.docker.com/go/dockerfile/rule/undefined-var/

COPY --from=build-env /go/src/github.com/babylonlabs-io/vigilante/build/vigilante /bin/vigilante

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ There are four vigilante programs:

## Requirements

- Go 1.21
- Go 1.23
- Package [libzmq](https://github.com/zeromq/libzmq)
- [btcd](https://github.com/btcsuite/btcd/tree/master?tab=readme-ov-file#installation) binaries (only for testing)

Expand Down
6 changes: 2 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
module github.com/babylonlabs-io/vigilante

go 1.21

toolchain go1.21.4
go 1.23

require (
cosmossdk.io/errors v1.0.1
Expand All @@ -19,7 +17,6 @@ require (
github.com/cometbft/cometbft v0.38.7
github.com/cosmos/cosmos-sdk v0.50.6
github.com/cosmos/relayer/v2 v2.5.1
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0
github.com/gogo/protobuf v1.3.3
github.com/golang/mock v1.6.0
github.com/grpc-ecosystem/go-grpc-middleware v1.4.0
Expand Down Expand Up @@ -118,6 +115,7 @@ require (
github.com/danieljoos/wincred v1.1.2 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/decred/dcrd/crypto/blake256 v1.0.1 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect
github.com/decred/dcrd/lru v1.0.0 // indirect
github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f // indirect
github.com/dgraph-io/badger/v2 v2.2007.4 // indirect
Expand Down
11 changes: 7 additions & 4 deletions monitor/monitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,10 @@ func (m *Monitor) GetCurrentEpoch() uint64 {
func (m *Monitor) VerifyCheckpoint(btcCkpt *checkpointingtypes.RawCheckpoint) error {
// check whether the epoch number of the checkpoint equals to the current epoch number
if m.GetCurrentEpoch() != btcCkpt.EpochNum {
return errors.Wrapf(types.ErrInvalidEpochNum, fmt.Sprintf("found a checkpoint with epoch %v, but the monitor expects epoch %v",
btcCkpt.EpochNum, m.GetCurrentEpoch()))
return errors.Wrapf(types.ErrInvalidEpochNum,
"found a checkpoint with epoch %v, but the monitor expects epoch %v",
btcCkpt.EpochNum, m.GetCurrentEpoch())

}
// verify BLS sig of the BTC checkpoint
err := m.curEpoch.VerifyMultiSig(btcCkpt)
Expand All @@ -221,8 +223,9 @@ func (m *Monitor) VerifyCheckpoint(btcCkpt *checkpointingtypes.RawCheckpoint) er
}
// check whether the checkpoint from Babylon has the same BlockHash of the BTC checkpoint
if !ckpt.BlockHash.Equal(*btcCkpt.BlockHash) {
return errors.Wrapf(types.ErrInconsistentBlockHash, fmt.Sprintf("Babylon checkpoint's BlockHash %s, BTC checkpoint's BlockHash %s",
ckpt.BlockHash.String(), btcCkpt.BlockHash))
return errors.Wrapf(types.ErrInconsistentBlockHash,
"Babylon checkpoint's BlockHash %s, BTC checkpoint's BlockHash %s",
ckpt.BlockHash.String(), btcCkpt.BlockHash)
}
return nil
}
Expand Down
4 changes: 1 addition & 3 deletions tools/go.mod
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
module github.com/babylonlabs-io/vigilante/tools

go 1.21

toolchain go1.21.4
go 1.23

require github.com/babylonlabs-io/babylon v0.9.1

Expand Down
6 changes: 2 additions & 4 deletions types/epoch_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ package types

import (
"bytes"
"fmt"

"github.com/babylonlabs-io/babylon/crypto/bls12381"
ckpttypes "github.com/babylonlabs-io/babylon/x/checkpointing/types"
"github.com/boljen/go-bitmap"
Expand Down Expand Up @@ -65,10 +63,10 @@ func (ei *EpochInfo) Equal(epochInfo *EpochInfo) bool {
func (ei *EpochInfo) VerifyMultiSig(ckpt *ckpttypes.RawCheckpoint) error {
signerKeySet, sumPower, err := ei.GetSignersKeySetWithPowerSum(ckpt.Bitmap)
if sumPower*3 <= ei.GetTotalPower()*2 {
return errors.Wrapf(ErrInsufficientPower, fmt.Sprintf("expected to be greater than %v, got %v", ei.GetTotalPower()*2/3, sumPower))
return errors.Wrapf(ErrInsufficientPower, "expected to be greater than %v, got %v", ei.GetTotalPower()*2/3, sumPower)
}
if err != nil {
return errors.Wrapf(ErrInvalidMultiSig, fmt.Sprintf("failed to get signer set: %s", err.Error()))
return errors.Wrapf(ErrInvalidMultiSig, "failed to get signer set: %s", err.Error())
}
msgBytes := ckpt.SignedMsg()
valid, err := bls12381.VerifyMultiSig(*ckpt.BlsMultiSig, signerKeySet, msgBytes)
Expand Down
Loading