Skip to content

Commit

Permalink
chore(go): upgrade go to 1.23 (#18)
Browse files Browse the repository at this point in the history
- Upgrades go to 1.23
  • Loading branch information
Lazar955 authored Aug 21, 2024
1 parent e9a1e24 commit cf21c32
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 17 deletions.
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
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

0 comments on commit cf21c32

Please sign in to comment.