Skip to content

Commit

Permalink
chore: upgrade to go 1.21
Browse files Browse the repository at this point in the history
  • Loading branch information
dessaya committed Oct 4, 2023
1 parent ee51144 commit 1517ef8
Show file tree
Hide file tree
Showing 37 changed files with 180 additions and 75 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- name: Set up Go 1.x
uses: actions/setup-go@v4
with:
go-version: "1.20"
go-version: "1.21"
id: go

- name: Check out code into the Go module directory
Expand Down Expand Up @@ -44,7 +44,7 @@ jobs:
- name: install golang
uses: actions/setup-go@v4
with:
go-version: "1.20"
go-version: "1.21"

- name: install rust-toolchain
uses: actions-rs/[email protected]
Expand Down Expand Up @@ -88,7 +88,7 @@ jobs:
steps:
- uses: actions/setup-go@v4
with:
go-version: "1.20"
go-version: "1.21"
id: go

- name: Check out code into the Go module directory
Expand All @@ -109,14 +109,14 @@ jobs:
- name: Run global scope golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.53.2
version: v1.54.2
args: --timeout 15m0s
skip-pkg-cache: true

- name: Run golangci-lint on wasp-cli
uses: golangci/golangci-lint-action@v3
with:
working-directory: tools/wasp-cli
version: v1.53.2
version: v1.54.2
args: --timeout 15m0s
skip-pkg-cache: true
2 changes: 1 addition & 1 deletion .github/workflows/go-mod-tidy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- name: Set up Go 1.x
uses: actions/setup-go@v4
with:
go-version: "1.20"
go-version: "1.21"
id: go

- name: Generate token # generate a token to trigger the rest of the CI tasks... https://github.com/tibdex/github-app-token
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/heavy-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,21 @@ jobs:
id: go
uses: actions/setup-go@v4
with:
go-version: "1.20"
go-version: "1.21"

- name: Run global scope golangci-lint
id: global_lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.53.2
version: v1.54.2
args: --timeout 10m0s
skip-pkg-cache: true

- name: Run golangci-lint on wasp-cli
uses: golangci/golangci-lint-action@v3
with:
working-directory: tools/wasp-cli
version: v1.53.2
version: v1.54.2
args: --timeout 10m0s
skip-pkg-cache: true

Expand Down Expand Up @@ -124,7 +124,7 @@ jobs:
id: go
uses: actions/setup-go@v4
with:
go-version: "1.20"
go-version: "1.21"

- name: install tinygo
id: tinygo
Expand Down Expand Up @@ -262,7 +262,7 @@ jobs:
id: go
uses: actions/setup-go@v4
with:
go-version: "1.20"
go-version: "1.21"

- name: Cache Hornet
id: cache_hornet
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
name: Release wasp-cli Binaries
runs-on: ubuntu-latest
container:
image: iotaledger/goreleaser-cgo-cross-compiler:1.20.2
image: iotaledger/goreleaser-cgo-cross-compiler:1.21.0
steps:
- name: Create dist folder
run: mkdir /dist && cd /dist/
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# syntax=docker/dockerfile:1
ARG GOLANG_IMAGE_TAG=1.20-bullseye
ARG GOLANG_IMAGE_TAG=1.21-bullseye

# Build stage
FROM golang:${GOLANG_IMAGE_TAG} AS build
Expand Down
5 changes: 1 addition & 4 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/iotaledger/wasp

go 1.20
go 1.21

replace (
github.com/ethereum/go-ethereum => github.com/iotaledger/go-ethereum v1.12.0-wasp
Expand Down Expand Up @@ -32,7 +32,6 @@ require (
github.com/iotaledger/inx-app v1.0.0-rc.3.0.20230417131029-0bfe891d7c4a
github.com/iotaledger/inx/go v1.0.0-rc.2
github.com/iotaledger/iota.go/v3 v3.0.0-rc.3
github.com/iotaledger/wasp/tools/wasp-cli v0.0.0-20230921125516-90a9fd02b441
github.com/labstack/echo-contrib v0.15.0
github.com/labstack/echo-jwt/v4 v4.2.0
github.com/labstack/echo/v4 v4.11.1
Expand All @@ -45,7 +44,6 @@ require (
github.com/prometheus/client_golang v1.16.0
github.com/samber/lo v1.38.1
github.com/second-state/WasmEdge-go v0.13.4
github.com/spf13/cobra v1.7.0
github.com/spf13/pflag v1.0.5
github.com/stretchr/testify v1.8.4
github.com/wasmerio/wasmer-go v1.0.4
Expand Down Expand Up @@ -112,7 +110,6 @@ require (
github.com/holiman/uint256 v1.2.3 // indirect
github.com/huin/goupnp v1.2.0 // indirect
github.com/iancoleman/orderedmap v0.3.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/iotaledger/grocksdb v1.7.5-0.20230220105546-5162e18885c7 // indirect
github.com/iotaledger/hive.go/stringify v0.0.0-20230629181801-64c530ff9d15 // indirect
github.com/iotaledger/iota.go v1.0.0 // indirect
Expand Down
52 changes: 33 additions & 19 deletions go.sum

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions packages/chain/cons/bp/batch_proposal_set.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@ package bp
import (
"bytes"
"encoding/binary"
"slices"
"sort"
"time"

"golang.org/x/exp/slices"

"github.com/iotaledger/wasp/packages/gpa"
"github.com/iotaledger/wasp/packages/hashing"
"github.com/iotaledger/wasp/packages/isc"
Expand Down
2 changes: 1 addition & 1 deletion packages/chain/mempool/distsync/dist_sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import (
"context"
"fmt"
"math/rand"
"slices"

"github.com/samber/lo"
"golang.org/x/exp/slices"

"github.com/iotaledger/hive.go/ds/shrinkingmap"
"github.com/iotaledger/hive.go/logger"
Expand Down
2 changes: 1 addition & 1 deletion packages/chain/mempool/mempool_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ import (
"context"
"fmt"
"math/rand"
"slices"
"testing"
"time"

"github.com/stretchr/testify/require"
"golang.org/x/exp/slices"

"github.com/iotaledger/hive.go/kvstore/mapdb"
"github.com/iotaledger/hive.go/logger"
Expand Down
3 changes: 1 addition & 2 deletions packages/chain/mempool/time_pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@
package mempool

import (
"slices"
"time"

"golang.org/x/exp/slices"

"github.com/iotaledger/hive.go/ds/shrinkingmap"
"github.com/iotaledger/hive.go/logger"
"github.com/iotaledger/wasp/packages/isc"
Expand Down
3 changes: 1 addition & 2 deletions packages/chain/mempool/typed_pool_by_nonce.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@ package mempool

import (
"fmt"
"slices"
"time"

"golang.org/x/exp/slices"

"github.com/iotaledger/hive.go/ds/shrinkingmap"
"github.com/iotaledger/hive.go/logger"
"github.com/iotaledger/wasp/packages/isc"
Expand Down
3 changes: 1 addition & 2 deletions packages/chain/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,10 @@ package chain
import (
"context"
"fmt"
"slices"
"sync"
"time"

"golang.org/x/exp/slices"

"github.com/iotaledger/hive.go/ds/shrinkingmap"
"github.com/iotaledger/hive.go/logger"
iotago "github.com/iotaledger/iota.go/v3"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ package sm_gpa_utils
import (
"testing"

"golang.org/x/exp/maps"

"github.com/samber/lo"
"github.com/stretchr/testify/require"
"golang.org/x/exp/maps"

"pgregory.net/rapid"

"github.com/iotaledger/wasp/packages/state"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@ import (
"testing"
"time"

"golang.org/x/exp/maps"

"github.com/samber/lo"
"github.com/stretchr/testify/require"
"golang.org/x/exp/maps"

"pgregory.net/rapid"

"github.com/iotaledger/hive.go/logger"
Expand Down
2 changes: 1 addition & 1 deletion packages/evm/jsonrpc/accounts.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ package jsonrpc

import (
"crypto/ecdsa"
"slices"

"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/crypto"
"golang.org/x/exp/slices"
)

type AccountManager struct {
Expand Down
2 changes: 1 addition & 1 deletion packages/users/user_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import (
"encoding/hex"
"errors"
"fmt"
"slices"

"golang.org/x/exp/maps"
"golang.org/x/exp/slices"

"github.com/iotaledger/hive.go/web/basicauth"
"github.com/iotaledger/wasp/packages/onchangemap"
Expand Down
7 changes: 0 additions & 7 deletions packages/util/misc.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,6 @@ func IsZeroBigInt(bi *big.Int) bool {
return len(bi.Bits()) == 0
}

func MinUint64(a, b uint64) uint64 {
if a < b {
return a
}
return b
}

func GetHashValue(obj interface{ Bytes() []byte }) hashing.HashValue {
return hashing.HashData(obj.Bytes())
}
2 changes: 1 addition & 1 deletion packages/util/same.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

package util

import "golang.org/x/exp/slices"
import "slices"

type Equated[V any] interface {
Equals(other V) bool
Expand Down
2 changes: 1 addition & 1 deletion packages/vm/core/evm/emulator/emulator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"encoding/hex"
"errors"
"fmt"
"maps"
"math"
"math/big"
"strings"
Expand All @@ -23,7 +24,6 @@ import (
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/params"
"github.com/stretchr/testify/require"
"golang.org/x/exp/maps"

"github.com/iotaledger/wasp/packages/evm/evmtest"
"github.com/iotaledger/wasp/packages/hashing"
Expand Down
2 changes: 1 addition & 1 deletion packages/vm/core/evm/emulator/statedb.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ package emulator
import (
"fmt"
"math/big"
"slices"

"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/core/vm"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/params"
"golang.org/x/exp/slices"

"github.com/iotaledger/wasp/packages/kv"
"github.com/iotaledger/wasp/packages/kv/codec"
Expand Down
2 changes: 1 addition & 1 deletion packages/vm/core/testcore/accounts_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ import (
"fmt"
"math"
"math/big"
"slices"
"strconv"
"testing"

"github.com/ethereum/go-ethereum/accounts/abi"
"github.com/samber/lo"
"github.com/stretchr/testify/require"
"golang.org/x/exp/slices"

iotago "github.com/iotaledger/iota.go/v3"
"github.com/iotaledger/iota.go/v3/tpkg"
Expand Down
2 changes: 1 addition & 1 deletion packages/vm/gas/feepolicy.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func (p *FeePolicy) FeeFromGasBurned(gasUnits, availableTokens uint64) (sendToOw

// round up
fee = p.FeeFromGas(gasUnits)
fee = util.MinUint64(fee, availableTokens)
fee = min(fee, availableTokens)

validatorPercentage := p.ValidatorFeeShare
if validatorPercentage > 100 {
Expand Down
4 changes: 2 additions & 2 deletions packages/vm/vmimpl/runreq.go
Original file line number Diff line number Diff line change
Expand Up @@ -339,9 +339,9 @@ func (reqctx *requestContext) calculateAffordableGasBudget() (budget, maxTokensT
// calculate affordableGas gas budget
affordableGas := reqctx.vm.chainInfo.GasFeePolicy.GasBudgetFromTokens(guaranteedFeeTokens)
// adjust gas budget to what is affordable
affordableGas = util.MinUint64(gasBudget, affordableGas)
affordableGas = min(gasBudget, affordableGas)
// cap gas to the maximum allowed per tx
return util.MinUint64(affordableGas, reqctx.vm.chainInfo.GasLimits.MaxGasPerRequest), maxTokensToSpendForGasFee
return min(affordableGas, reqctx.vm.chainInfo.GasLimits.MaxGasPerRequest), maxTokensToSpendForGasFee
}

// calcGuaranteedFeeTokens return the maximum tokens (base tokens or native) can be guaranteed for the fee,
Expand Down
3 changes: 1 addition & 2 deletions packages/vm/vmtxbuilder/nfts.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ package vmtxbuilder

import (
"bytes"

"golang.org/x/exp/slices"
"slices"

iotago "github.com/iotaledger/iota.go/v3"
"github.com/iotaledger/wasp/packages/parameters"
Expand Down
2 changes: 1 addition & 1 deletion scripts/build_goreleaser_snapshot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# make script executable independent of path
WASP_ROOT_DIR="$( cd -- "$(dirname "$0")/.." >/dev/null 2>&1 ; pwd -P )"

GORELEASER_IMAGE=iotaledger/goreleaser-cgo-cross-compiler:1.20.2
GORELEASER_IMAGE=iotaledger/goreleaser-cgo-cross-compiler:1.21.0
REPO_PATH="/build"

docker pull "${GORELEASER_IMAGE}"
Expand Down
2 changes: 1 addition & 1 deletion tools/cluster/tests/wasp-cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ import (
"os/exec"
"path"
"regexp"
"slices"
"strings"
"testing"
"time"

"github.com/stretchr/testify/require"
"golang.org/x/exp/slices"

iotago "github.com/iotaledger/iota.go/v3"
"github.com/iotaledger/wasp/clients/apiclient"
Expand Down
2 changes: 1 addition & 1 deletion tools/evm/evmemulator/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/iotaledger/wasp/tools/evm/evmemulator

go 1.20
go 1.21

replace (
github.com/ethereum/go-ethereum => github.com/iotaledger/go-ethereum v1.12.0-wasp
Expand Down
Loading

0 comments on commit 1517ef8

Please sign in to comment.