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

*: bump go version #2648

Merged
merged 5 commits into from
Oct 19, 2023
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
4 changes: 2 additions & 2 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ jobs:
# Config options can be found in README here: https://github.com/golangci/golangci-lint-action
- uses: actions/setup-go@v4
with:
go-version: '1.20.7'
go-version: '1.21.3'
- uses: actions/checkout@v3
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.52.2
version: v1.54.2
- name: notify failure
if: failure() && github.ref == 'refs/heads/main'
env:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/govulncheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: '1.20.7'
go-version: '1.21.3'
- run: go install golang.org/x/vuln/cmd/govulncheck@latest
- run: govulncheck -show=stacks -test ./...
2 changes: 1 addition & 1 deletion .github/workflows/nightly-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: '1.20.7'
go-version: '1.21.3'
- uses: actions/cache@v3
with:
path: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- uses: actions/setup-python@v2
- uses: actions/setup-go@v4
with:
go-version: '1.20.7'
go-version: '1.21.3'
- uses: pre-commit/[email protected]

- name: notify failure
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
fetch-depth: 0 # Disable shallow checkout
- uses: actions/setup-go@v4
with:
go-version: '1.20.7'
go-version: '1.21.3'
- run: go run . --help > cli-reference.txt
- run: go run testutil/genchangelog/main.go
- uses: softprops/action-gh-release@v1
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: '1.20.7'
go-version: '1.21.3'
- uses: actions/cache@v3
with:
path: |
Expand All @@ -33,7 +33,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: '1.20.7'
go-version: '1.21.3'
- uses: actions/cache@v3
with:
path: |
Expand All @@ -51,7 +51,7 @@ jobs:
- uses: docker/setup-buildx-action@v2 # For compose to build images
- uses: actions/setup-go@v4
with:
go-version: '1.20.7'
go-version: '1.21.3'
- uses: actions/cache@v3
with:
path: |
Expand All @@ -78,7 +78,7 @@ jobs:
- uses: docker/setup-buildx-action@v2 # For compose to build images
- uses: actions/setup-go@v4
with:
go-version: '1.20.7'
go-version: '1.21.3'
- uses: actions/cache@v3
with:
path: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/verify-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: '1.20.7'
go-version: '1.21.3'

- name: "Verify PR"
run: go run github.com/obolnetwork/charon/testutil/verifypr
14 changes: 12 additions & 2 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,23 @@
run:
timeout: 5m
go: "1.20.7"
go: "1.21.3"
linters-settings:
cyclop:
max-complexity: 15
skip-tests: true
dupl:
# tokens count to trigger issue, 150 by default
threshold: 400
depguard:
rules:
main:
deny:
- pkg: "github.com/pkg/errors"
desc: Prefer ./app/errors
- pkg: "github.com/golang/protobuf"
desc: Prefer google.golang.org/protobuf
- pkg: "github.com/gogo/protobuf/proto"
desc: Prefer google.golang.org/protobuf
exhaustive:
default-signifies-exhaustive: true
forbidigo:
Expand Down Expand Up @@ -89,7 +99,7 @@ linters-settings:
- "github.com/gogo/protobuf/proto" # Prefer google.golang.org/protobuf
- "github.com/prometheus/client_golang/prometheus/promauto" # Prefer ./app/promauto
staticcheck:
go: "1.20.7"
go: "1.21.3"
checks:
- "all"
- "-SA1019" # Ignoring since github.com/drand/kyber/sign/bls uses Proof Of Possession as does Ethereum.
Expand Down
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ repos:
rev: v0.0.2
hooks:
- id: check-go-version
args: [ -v=go1.20 ] # Only check minor version locally
args: [ -v=go1.21 ] # Only check minor version locally
pass_filenames: false
additional_dependencies: [ packaging ]
- id: check-licence-header
Expand All @@ -42,7 +42,7 @@ repos:
# Then run code validators (on the formatted code)

- repo: https://github.com/golangci/golangci-lint # See .golangci.yml for config
rev: v1.51.2
rev: v1.54.2
hooks:
- id: golangci-lint

Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Container for building Go binary.
FROM golang:1.20.7-bullseye AS builder
FROM golang:1.21.3-bullseye AS builder
# Install dependencies
RUN apt-get update && apt-get install -y build-essential git
# Prep and copy source
Expand Down
20 changes: 10 additions & 10 deletions cluster/definition.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,38 +105,38 @@ func NewDefinition(name string, numVals int, threshold int, feeRecipientAddresse
// - definition_hash: field ordering when calculating definition hash. Some fields are excluded indicated by `-`.
type Definition struct {
// UUID is a human-readable random unique identifier. Max 64 chars.
UUID string `json:"uuid" ssz:"ByteList[64]" config_hash:"0" definition_hash:"0"`
UUID string `config_hash:"0" definition_hash:"0" json:"uuid" ssz:"ByteList[64]"`

// Name is a human-readable cosmetic identifier. Max 256 chars.
Name string `json:"name" ssz:"ByteList[256]" config_hash:"1" definition_hash:"1"`
Name string `config_hash:"1" definition_hash:"1" json:"name" ssz:"ByteList[256]"`

// Version is the schema version of this definition. Max 16 chars.
Version string `json:"version" ssz:"ByteList[16]" config_hash:"2" definition_hash:"2"`
Version string `config_hash:"2" definition_hash:"2" json:"version" ssz:"ByteList[16]"`

// Timestamp is the human-readable timestamp of this definition. Max 32 chars.
// Note that this was added in v1.1.0, so may be empty for older versions.
Timestamp string `json:"timestamp" ssz:"ByteList[32]" config_hash:"3" definition_hash:"3"`
Timestamp string `config_hash:"3" definition_hash:"3" json:"timestamp" ssz:"ByteList[32]"`

// NumValidators is the number of DVs (n*32ETH) to be created in the cluster lock file.
NumValidators int `json:"num_validators" ssz:"uint64" config_hash:"4" definition_hash:"4"`
NumValidators int `config_hash:"4" definition_hash:"4" json:"num_validators" ssz:"uint64"`

// Threshold required for signature reconstruction. Defaults to safe value for number of nodes/peers.
Threshold int `json:"threshold" ssz:"uint64" config_hash:"5" definition_hash:"5"`
Threshold int `config_hash:"5" definition_hash:"5" json:"threshold" ssz:"uint64"`

// DKGAlgorithm to use for key generation. Max 32 chars.
DKGAlgorithm string `json:"dkg_algorithm" ssz:"ByteList[32]" config_hash:"6" definition_hash:"6"`
DKGAlgorithm string `config_hash:"6" definition_hash:"6" json:"dkg_algorithm" ssz:"ByteList[32]"`

// ForkVersion defines the cluster's 4 byte beacon chain fork version (network/chain identifier).
ForkVersion []byte `json:"fork_version,0xhex" ssz:"Bytes4" config_hash:"7" definition_hash:"7"`

// Operators define the charon nodes in the cluster and their operators. Max 256 operators.
Operators []Operator `json:"operators" ssz:"CompositeList[256]" config_hash:"8" definition_hash:"8"`
Operators []Operator `config_hash:"8" definition_hash:"8" json:"operators" ssz:"CompositeList[256]"`

// Creator identifies the creator of a cluster definition. They may also be an operator.
Creator Creator `json:"creator" ssz:"Composite" config_hash:"9" definition_hash:"9"`
Creator Creator `config_hash:"9" definition_hash:"9" json:"creator" ssz:"Composite"`

// ValidatorAddresses define addresses of each validator.
ValidatorAddresses []ValidatorAddresses `json:"validators" ssz:"CompositeList[65536]" config_hash:"10" definition_hash:"10"`
ValidatorAddresses []ValidatorAddresses `config_hash:"10" definition_hash:"10" json:"validators" ssz:"CompositeList[65536]"`

// ConfigHash uniquely identifies a cluster definition excluding operator ENRs and signatures.
ConfigHash []byte `json:"config_hash,0xhex" ssz:"Bytes32" config_hash:"-" definition_hash:"11"`
Expand Down
8 changes: 4 additions & 4 deletions cluster/deposit.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ package cluster
// https://github.com/ethereum/consensus-specs/blob/dev/specs/phase0/beacon-chain.md#depositdata
type DepositData struct {
// PubKey is the validator public key.
PubKey []byte `json:"pubkey" ssz:"Bytes48" lock_hash:"0"`
PubKey []byte `json:"pubkey" lock_hash:"0" ssz:"Bytes48"`

// WithdrawalCredentials included in the deposit.
WithdrawalCredentials []byte `json:"withdrawal_credentials" ssz:"Bytes32" lock_hash:"1"`
WithdrawalCredentials []byte `json:"withdrawal_credentials" lock_hash:"1" ssz:"Bytes32"`

// Amount is the amount in Gwei to be deposited.
Amount int `json:"amount" ssz:"uint64" lock_hash:"2"`
Amount int `json:"amount" lock_hash:"2" ssz:"uint64"`

// Signature is the BLS signature of the deposit message (above three fields).
Signature []byte `json:"signature" ssz:"Bytes96" lock_hash:"3"`
Signature []byte `json:"signature" lock_hash:"3" ssz:"Bytes96"`
}

// depositDataJSON is the json formatter of DepositData.
Expand Down
8 changes: 4 additions & 4 deletions cluster/distvalidator.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@ import (
// DistValidator is a distributed validator (1x32ETH) managed by the cluster.
type DistValidator struct {
// PubKey is the distributed validator group public key.
PubKey []byte `json:"distributed_public_key" ssz:"Bytes48" lock_hash:"0"`
PubKey []byte `json:"distributed_public_key" lock_hash:"0" ssz:"Bytes48"`

// PubShares are the public keys corresponding to each node's secret key share.
// It can be used to verify a partial signature created by any node in the cluster.
PubShares [][]byte `json:"public_shares,omitempty" ssz:"CompositeList[256],Bytes48" lock_hash:"1"`
PubShares [][]byte `json:"public_shares,omitempty" lock_hash:"1" ssz:"CompositeList[256],Bytes48"`

// DepositData is the validator deposit data.
DepositData DepositData `json:"deposit_data,omitempty" ssz:"Composite" lock_hash:"2"`
DepositData DepositData `json:"deposit_data,omitempty" lock_hash:"2" ssz:"Composite"`

// BuilderRegistration is the pre-generated signed validator builder registration.
BuilderRegistration BuilderRegistration `json:"builder_registration,omitempty" ssz:"Composite" lock_hash:"3"`
BuilderRegistration BuilderRegistration `json:"builder_registration,omitempty" lock_hash:"3" ssz:"Composite"`
}

// PublicKey returns the validator BLS group public key.
Expand Down
10 changes: 5 additions & 5 deletions cluster/lock.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,22 @@ import (
// Lock extends the cluster config Definition with bls threshold public keys and checksums.
type Lock struct {
// Definition is embedded and extended by Lock.
Definition `json:"cluster_definition" ssz:"Composite" lock_hash:"0"`
Definition `json:"cluster_definition" lock_hash:"0" ssz:"Composite"`

// Validators are the distributed validators (n*32ETH) managed by the cluster.
Validators []DistValidator `json:"distributed_validators" ssz:"Composite[65536]" lock_hash:"1"`
Validators []DistValidator `json:"distributed_validators" lock_hash:"1" ssz:"Composite[65536]"`

// LockHash uniquely identifies a cluster lock.
LockHash []byte `json:"lock_hash" ssz:"Bytes32" lock_hash:"-"`
LockHash []byte `json:"lock_hash" lock_hash:"-" ssz:"Bytes32"`

// SignatureAggregate is the bls aggregate signature of the lock hash signed by
// all the private key shares of all the distributed validators.
// It acts as an attestation by all the distributed validators
// of the charon cluster they are part of.
SignatureAggregate []byte `json:"signature_aggregate" ssz:"Bytes96" lock_hash:"-"`
SignatureAggregate []byte `json:"signature_aggregate" lock_hash:"-" ssz:"Bytes96"`

// NodeSignatures contains a signature of the lock hash for each operator defined in the Definition.
NodeSignatures [][]byte `json:"node_signatures" ssz:"Composite" lock_hash:"-"`
NodeSignatures [][]byte `json:"node_signatures" lock_hash:"-" ssz:"Composite"`
}

func (l Lock) MarshalJSON() ([]byte, error) {
Expand Down
2 changes: 1 addition & 1 deletion cluster/operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ type Operator struct {
Address string `json:"address,0xhex" ssz:"Bytes20" config_hash:"0" definition_hash:"0"`

// ENR identifies the charon node. Max 1024 chars.
ENR string `json:"enr" ssz:"ByteList[1024]" config_hash:"-" definition_hash:"1"`
ENR string `config_hash:"-" definition_hash:"1" json:"enr" ssz:"ByteList[1024]"`

// ConfigSignature is an EIP712 signature of the config_hash using privkey corresponding to operator Ethereum Address.
ConfigSignature []byte `json:"config_signature,0xhex" ssz:"Bytes65" config_hash:"-" definition_hash:"2"`
Expand Down
12 changes: 6 additions & 6 deletions cluster/registration.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@ import (

// BuilderRegistration defines pre-generated signed validator builder registration to be sent to builder network.
type BuilderRegistration struct {
Message Registration `json:"message" ssz:"Composite" lock_hash:"0"`
Signature []byte `json:"signature" ssz:"Bytes96" lock_hash:"1"`
Message Registration `json:"message" lock_hash:"0" ssz:"Composite"`
Signature []byte `json:"signature" lock_hash:"1" ssz:"Bytes96"`
}

// Registration defines unsigned validator registration message.
type Registration struct {
FeeRecipient []byte `json:"fee_recipient" ssz:"Bytes20" lock_hash:"0"`
GasLimit int `json:"gas_limit" ssz:"uint64" lock_hash:"1"`
Timestamp time.Time `json:"timestamp" ssz:"uint64" lock_hash:"2"`
PubKey []byte `json:"pubkey" ssz:"Bytes48" lock_hash:"3"`
FeeRecipient []byte `json:"fee_recipient" lock_hash:"0" ssz:"Bytes20"`
GasLimit int `json:"gas_limit" lock_hash:"1" ssz:"uint64"`
Timestamp time.Time `json:"timestamp" lock_hash:"2" ssz:"uint64"`
PubKey []byte `json:"pubkey" lock_hash:"3" ssz:"Bytes48"`
}

// builderRegistrationJSON is the json formatter of BuilderRegistration.
Expand Down
1 change: 1 addition & 0 deletions eth2util/keystore/keystore.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ func storeKeysInternal(secrets []tbls.PrivateKey, dir string, filenameFmt string
return nil, errors.Wrap(err, "store password", z.Str("filename", filename))
}

//nolint:nilnil
return nil, nil
},
forkjoin.WithWorkers(loadStoreWorkers),
Expand Down
23 changes: 11 additions & 12 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/obolnetwork/charon

go 1.20
go 1.21

require (
github.com/attestantio/go-eth2-client v0.17.0
Expand All @@ -15,9 +15,9 @@ require (
github.com/ipfs/go-log/v2 v2.5.1
github.com/jonboulle/clockwork v0.4.0
github.com/jsternberg/zap-logfmt v1.3.0
github.com/libp2p/go-libp2p v0.29.2
github.com/libp2p/go-libp2p v0.30.0
github.com/libp2p/go-msgio v0.3.0
github.com/multiformats/go-multiaddr v0.10.1
github.com/multiformats/go-multiaddr v0.11.0
github.com/prometheus/client_golang v1.16.0
github.com/prometheus/client_model v0.4.0
github.com/protolambda/eth2-shuffle v1.1.0
Expand All @@ -39,11 +39,11 @@ require (
go.uber.org/goleak v1.2.1
go.uber.org/zap v1.25.0
golang.org/x/crypto v0.12.0
golang.org/x/exp v0.0.0-20230713183714-613f0c0eb8a1 // Manually downgraded this to be compatible with libp2p v0.29.2
golang.org/x/exp v0.0.0-20230817173708-d852ddb80c63 // Manually downgraded this to be compatible with libp2p v0.29.2
golang.org/x/sync v0.3.0
golang.org/x/term v0.11.0
golang.org/x/time v0.3.0
golang.org/x/tools v0.11.0
golang.org/x/tools v0.12.1-0.20230815132531-74c255bcf846
google.golang.org/protobuf v1.31.0
)

Expand Down Expand Up @@ -93,7 +93,7 @@ require (
github.com/golang/protobuf v1.5.3 // indirect
github.com/google/go-containerregistry v0.15.2 // indirect
github.com/google/gopacket v1.1.19 // indirect
github.com/google/pprof v0.0.0-20230705174524-200ffdc848b8 // indirect
github.com/google/pprof v0.0.0-20230817174616-7a8ec2ada47b // indirect
github.com/gorilla/websocket v1.5.0 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/holiman/uint256 v1.2.2 // indirect
Expand All @@ -113,7 +113,7 @@ require (
github.com/libp2p/go-libp2p-asn-util v0.3.0 // indirect
github.com/libp2p/go-nat v0.2.0 // indirect
github.com/libp2p/go-netroute v0.2.1 // indirect
github.com/libp2p/go-reuseport v0.3.0 // indirect
github.com/libp2p/go-reuseport v0.4.0 // indirect
github.com/libp2p/go-yamux/v4 v4.0.1 // indirect
github.com/magiconair/properties v1.8.7 // indirect
github.com/marten-seemann/tcp v0.0.0-20210406111302-dfbc87cc63fd // indirect
Expand Down Expand Up @@ -141,7 +141,7 @@ require (
github.com/onsi/ginkgo/v2 v2.11.0 // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/opencontainers/image-spec v1.1.0-rc4 // indirect
github.com/opencontainers/runtime-spec v1.0.3-0.20210326190908-1c3f411f0417 // indirect
github.com/opencontainers/runtime-spec v1.1.0 // indirect
github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58 // indirect
github.com/pelletier/go-toml/v2 v2.0.8 // indirect
github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 // indirect
Expand All @@ -151,9 +151,8 @@ require (
github.com/prometheus/common v0.42.0 // indirect
github.com/prometheus/procfs v0.10.1 // indirect
github.com/quic-go/qpack v0.4.0 // indirect
github.com/quic-go/qtls-go1-19 v0.3.3 // indirect
github.com/quic-go/qtls-go1-20 v0.2.3 // indirect
github.com/quic-go/quic-go v0.36.4 // indirect
github.com/quic-go/qtls-go1-20 v0.3.2 // indirect
github.com/quic-go/quic-go v0.37.6 // indirect
github.com/quic-go/webtransport-go v0.5.3 // indirect
github.com/raulk/go-watchdog v1.3.0 // indirect
github.com/rs/cors v1.9.0 // indirect
Expand All @@ -174,7 +173,7 @@ require (
go.uber.org/fx v1.20.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/mod v0.12.0 // indirect
golang.org/x/net v0.12.0 // indirect
golang.org/x/net v0.14.0 // indirect
golang.org/x/sys v0.11.0 // indirect
golang.org/x/text v0.12.0 // indirect
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
Expand Down
Loading
Loading