Skip to content
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/auto-generated-checker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: '~1.19.12'
go-version: '~1.20.8'
check-latest: true
- uses: bufbuild/buf-setup-action@v1.26.1
- shell: bash
Expand All @@ -30,7 +30,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: '~1.19.12'
go-version: '~1.20.8'
check-latest: true
- shell: bash
run: scripts/mock.gen.sh
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: '~1.19.12'
go-version: '~1.20.8'
check-latest: true
- name: build_test
shell: bash
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build-linux-binaries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:

- uses: actions/setup-go@v3
with:
go-version: '~1.19.12'
go-version: '~1.20.8'
check-latest: true

- run: go version
Expand Down Expand Up @@ -81,7 +81,7 @@ jobs:

- uses: actions/setup-go@v3
with:
go-version: '~1.19.12'
go-version: '~1.20.8'
check-latest: true

- run: go version
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-macos-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: '~1.19.12'
go-version: '~1.20.8'
check-latest: true
- run: go version

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-public-ami.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: '~1.19.12'
go-version: '~1.20.8'
check-latest: true
- run: go version

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build-ubuntu-amd64-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: '~1.19.12'
go-version: '~1.20.8'
check-latest: true
- run: go version

Expand Down Expand Up @@ -78,7 +78,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: '~1.19.12'
go-version: '~1.20.8'
check-latest: true
- run: go version

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build-ubuntu-arm64-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: '~1.19.12'
go-version: '~1.20.8'
check-latest: true
- run: go version

Expand Down Expand Up @@ -78,7 +78,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: '~1.19.12'
go-version: '~1.20.8'
check-latest: true
- run: go version

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-win-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:

- uses: actions/setup-go@v3
with:
go-version: '~1.19.12'
go-version: '~1.20.8'
check-latest: true

- run: go version
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/fuzz.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: '~1.19.12'
go-version: '~1.20.8'
check-latest: true
- name: Run fuzz tests
shell: bash
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: '~1.19.12'
go-version: '~1.20.8'
check-latest: true
- name: Run static analysis tests
shell: bash
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.e2e.persistent.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: '~1.19.12'
go-version: '~1.20.8'
check-latest: true
- name: Build the avalanchego binary
shell: bash
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: '~1.19.12'
go-version: '~1.20.8'
check-latest: true
- name: Build the avalanchego binary
shell: bash
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.upgrade.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: '~1.19.12'
go-version: '~1.20.8'
check-latest: true
- name: Build the avalanchego binary
shell: bash
Expand Down
4 changes: 2 additions & 2 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ linters:
- bodyclose
- depguard
- errcheck
- errorlint
- exportloopref
- forbidigo
- goconst
Expand All @@ -44,7 +45,6 @@ linters:
- unparam
- unused
- whitespace
# - errorlint (TODO: re-enable in go1.20 migration)
# - goerr113
# - gomnd
# - lll
Expand Down Expand Up @@ -121,7 +121,7 @@ linters-settings:
- name: useless-break
disabled: false
staticcheck:
go: "1.19"
go: "1.20"
# https://staticcheck.io/docs/options#checks
checks:
- "all"
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

To start developing on AvalancheGo, you'll need a few things installed.

- Golang version >= 1.19.12
- Golang version >= 1.20.8
- gcc
- g++

Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# README.md
# go.mod
# ============= Compilation Stage ================
FROM golang:1.19.12-bullseye AS builder
FROM golang:1.20.8-bullseye AS builder

WORKDIR /build
# Copy and download avalanche dependencies using go mod
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ The minimum recommended hardware specification for nodes connected to Mainnet is

If you plan to build AvalancheGo from source, you will also need the following software:

- [Go](https://golang.org/doc/install) version >= 1.19.12
- [Go](https://golang.org/doc/install) version >= 1.20.8
- [gcc](https://gcc.gnu.org/)
- g++

Expand Down
4 changes: 2 additions & 2 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -950,7 +950,7 @@ func getAliases(v *viper.Viper, name string, contentKey string, fileKey string)

aliasMap := make(map[ids.ID][]string)
if err := json.Unmarshal(fileBytes, &aliasMap); err != nil {
return nil, fmt.Errorf("%w on %s: %s", errUnmarshalling, name, err)
return nil, fmt.Errorf("%w on %s: %w", errUnmarshalling, name, err)
}
return aliasMap, nil
}
Expand Down Expand Up @@ -1146,7 +1146,7 @@ func getSubnetConfigsFromDir(v *viper.Viper, subnetIDs []ids.ID) (map[ids.ID]sub

config := getDefaultSubnetConfig(v)
if err := json.Unmarshal(file, &config); err != nil {
return nil, fmt.Errorf("%w: %s", errUnmarshalling, err)
return nil, fmt.Errorf("%w: %w", errUnmarshalling, err)
}

if err := config.Valid(); err != nil {
Expand Down
1 change: 0 additions & 1 deletion config/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,6 @@ func addNodeFlags(fs *pflag.FlagSet) {
fs.Duration(BenchlistMinFailingDurationKey, constants.DefaultBenchlistMinFailingDuration, "Minimum amount of time messages to a peer must be failing before the peer is benched")

// Router
// TODO: Remove this flag in the future
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why's this TODO removed? Do we no longer intend to remove this flag?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The flag was already removed (but the todo wasn't)

fs.Duration(ConsensusAcceptedFrontierGossipFrequencyKey, constants.DefaultAcceptedFrontierGossipFrequency, "Frequency of gossiping accepted frontiers")
fs.Uint(ConsensusAppConcurrencyKey, constants.DefaultConsensusAppConcurrency, "Maximum number of goroutines to use when handling App messages on a chain")
fs.Duration(ConsensusShutdownTimeoutKey, constants.DefaultConsensusShutdownTimeout, "Timeout before killing an unresponsive chain")
Expand Down
4 changes: 2 additions & 2 deletions database/leveldb/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ func New(file string, configBytes []byte, log logging.Logger, namespace string,
}
if len(configBytes) > 0 {
if err := json.Unmarshal(configBytes, &parsedConfig); err != nil {
return nil, fmt.Errorf("%w: %s", ErrInvalidConfig, err)
return nil, fmt.Errorf("%w: %w", ErrInvalidConfig, err)
}
}

Expand Down Expand Up @@ -231,7 +231,7 @@ func New(file string, configBytes []byte, log logging.Logger, namespace string,
db, err = leveldb.RecoverFile(file, nil)
}
if err != nil {
return nil, fmt.Errorf("%w: %s", ErrCouldNotOpen, err)
return nil, fmt.Errorf("%w: %w", ErrCouldNotOpen, err)
}

wrappedDB := &Database{
Expand Down
2 changes: 1 addition & 1 deletion genesis/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ func GetConfigContent(genesisContent string) (*Config, error) {
func parseGenesisJSONBytesToConfig(bytes []byte) (*Config, error) {
var unparsedConfig UnparsedConfig
if err := json.Unmarshal(bytes, &unparsedConfig); err != nil {
return nil, fmt.Errorf("%w: %s", errInvalidGenesisJSON, err)
return nil, fmt.Errorf("%w: %w", errInvalidGenesisJSON, err)
}

config, err := unparsedConfig.Parse()
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module github.com/ava-labs/avalanchego
// Dockerfile
// README.md
// go.mod (here, only major.minor can be specified)
go 1.19
go 1.20

require (
github.com/DataDog/zstd v1.5.2
Expand Down
2 changes: 1 addition & 1 deletion proto/Dockerfile.buf
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ RUN apt-get update && apt -y install bash curl unzip git
WORKDIR /opt

RUN \
curl -L https://golang.org/dl/go1.19.12.linux-amd64.tar.gz > golang.tar.gz && \
curl -L https://golang.org/dl/go1.20.8.linux-amd64.tar.gz > golang.tar.gz && \
mkdir golang && \
tar -zxvf golang.tar.gz -C golang/

Expand Down
2 changes: 1 addition & 1 deletion scripts/build_avalanche.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ done
# Dockerfile
# README.md
# go.mod
go_version_minimum="1.19.12"
go_version_minimum="1.20.8"

go_version() {
go version | sed -nE -e 's/[^0-9.]+([0-9.]+).+/\1/p'
Expand Down
2 changes: 1 addition & 1 deletion snow/engine/snowman/transitive.go
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ func (t *Transitive) HealthCheck(ctx context.Context) (interface{}, error) {
if vmErr == nil {
return intf, consensusErr
}
return intf, fmt.Errorf("vm: %w ; consensus: %v", vmErr, consensusErr)
return intf, fmt.Errorf("vm: %w ; consensus: %w", vmErr, consensusErr)
}

func (t *Transitive) GetVM() common.VM {
Expand Down
3 changes: 1 addition & 2 deletions snow/networking/handler/health.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ func (h *handler) HealthCheck(ctx context.Context) (interface{}, error) {
if networkingErr == nil {
return intf, engineErr
}
// TODO: Update this to return both errors with %w once we upgrade to Go 1.20
return intf, fmt.Errorf("engine: %v; networking: %v", engineErr, networkingErr)
return intf, fmt.Errorf("engine: %w; networking: %w", engineErr, networkingErr)
}

func (h *handler) networkHealthCheck() (interface{}, error) {
Expand Down
28 changes: 3 additions & 25 deletions tests/fixture/testnet/local/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -422,39 +422,17 @@ func (ln *LocalNetwork) GetURIs() []string {
return uris
}

type NodeStopError struct {
NodeID ids.NodeID
StopError error
}

func (e *NodeStopError) Error() string {
return fmt.Sprintf("failed to stop node %s: %v", e.NodeID, e.StopError)
}

type NetworkStopError struct {
Errors []*NodeStopError
}

func (e *NetworkStopError) Error() string {
return fmt.Sprintf("failed to stop network: %v", e.Errors)
}

// Stop all nodes in the network.
func (ln *LocalNetwork) Stop() error {
errs := []*NodeStopError{}
var errs []error
// Assume the nodes are loaded and the pids are current
for _, node := range ln.Nodes {
if err := node.Stop(); err != nil {
errs = append(errs, &NodeStopError{
NodeID: node.NodeID,
StopError: err,
})
errs = append(errs, fmt.Errorf("failed to stop node %s: %w", node.NodeID, err))
}
}
if len(errs) > 0 {
// TODO(marun) When avalanchego updates to go 1.20, update to
// use the new capability to wrap multiple errors.
return &NetworkStopError{Errors: errs}
return fmt.Errorf("failed to stop network:\n%w", errors.Join(errs...))
}
return nil
}
Expand Down
2 changes: 1 addition & 1 deletion utils/cb58/cb58.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func Encode(bytes []byte) (string, error) {
func Decode(str string) ([]byte, error) {
decodedBytes, err := base58.Decode(str)
if err != nil {
return nil, fmt.Errorf("%w: %s", ErrBase58Decoding, err)
return nil, fmt.Errorf("%w: %w", ErrBase58Decoding, err)
}
if len(decodedBytes) < checksumLen {
return nil, ErrMissingChecksum
Expand Down
4 changes: 2 additions & 2 deletions utils/metric/averager.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ func NewAveragerWithErrs(namespace, name, desc string, reg prometheus.Registerer
}

if err := reg.Register(a.count); err != nil {
errs.Add(fmt.Errorf("%w: %s", ErrFailedRegistering, err))
errs.Add(fmt.Errorf("%w: %w", ErrFailedRegistering, err))
}
if err := reg.Register(a.sum); err != nil {
errs.Add(fmt.Errorf("%w: %s", ErrFailedRegistering, err))
errs.Add(fmt.Errorf("%w: %w", ErrFailedRegistering, err))
}
return &a
}
Expand Down
4 changes: 2 additions & 2 deletions vms/components/avax/utxo_id.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,12 @@ func UTXOIDFromString(s string) (*UTXOID, error) {

txID, err := ids.FromString(ss[0])
if err != nil {
return nil, fmt.Errorf("%w: %v", errFailedDecodingUTXOIDTxID, err)
return nil, fmt.Errorf("%w: %w", errFailedDecodingUTXOIDTxID, err)
}

idx, err := strconv.ParseUint(ss[1], 10, 32)
if err != nil {
return nil, fmt.Errorf("%w: %v", errFailedDecodingUTXOIDIndex, err)
return nil, fmt.Errorf("%w: %w", errFailedDecodingUTXOIDIndex, err)
}

return &UTXOID{
Expand Down
Loading