diff --git a/.github/ISSUE_TEMPLATE/BUG-REPORT.md b/.github/ISSUE_TEMPLATE/BUG-REPORT.md index 3aca60cdbb7..3f2fe8452b5 100644 --- a/.github/ISSUE_TEMPLATE/BUG-REPORT.md +++ b/.github/ISSUE_TEMPLATE/BUG-REPORT.md @@ -13,7 +13,7 @@ Describe your issue in as much detail as possible here ### Your environment -* Go version (example: go1.23.4) +* Go version (example: go1.23.6) * OS and CPU architecture (example: linux/amd64) * Gno commit hash causing the issue (example: f24690e7ebf325bffcfaf9e328c3df8e6b21e50c) @@ -37,4 +37,4 @@ Please paste any logs here that demonstrate the issue, if they exist ### Proposed solution -If you have an idea of how to fix this issue, please write it down here, so we can begin discussing it \ No newline at end of file +If you have an idea of how to fix this issue, please write it down here, so we can begin discussing it diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml index 09c0ee0bbd9..ee18c864236 100644 --- a/.github/workflows/examples.yml +++ b/.github/workflows/examples.yml @@ -89,7 +89,7 @@ jobs: strategy: fail-fast: false matrix: - go-version: [ "1.23.x" ] + go-version: ["1.23.x"] # unittests: TODO: matrix with contracts runs-on: ubuntu-latest timeout-minutes: 10 diff --git a/.github/workflows/gnofmt_template.yml b/.github/workflows/gnofmt_template.yml index c47ef35efd7..edf9311f480 100644 --- a/.github/workflows/gnofmt_template.yml +++ b/.github/workflows/gnofmt_template.yml @@ -30,4 +30,4 @@ jobs: - name: Check for unformatted code run: | - git diff --exit-code || (echo "Some gno files are not formatted, please run 'make fmt'." && exit 1) \ No newline at end of file + git diff --exit-code || (echo "Some gno files are not formatted, please run 'make fmt'." && exit 1) diff --git a/.github/workflows/main_template.yml b/.github/workflows/main_template.yml index 260c983e871..6b62a176cae 100644 --- a/.github/workflows/main_template.yml +++ b/.github/workflows/main_template.yml @@ -39,4 +39,3 @@ jobs: tests-extra-args: ${{ inputs.tests-extra-args }} secrets: codecov-token: ${{ secrets.codecov-token }} - diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 9562a531227..2e0e989ccac 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -56,7 +56,7 @@ The gno repository is primarily based on Go (Golang) and Gno. The primary tech stack for working on the repository: -- Go (version 1.22+) +- Go (version 1.23+) - make (for using Makefile configurations) It is recommended to work on a Unix environment, as most of the tooling is built around ready-made tools in Unix (WSL2 @@ -514,4 +514,3 @@ automatic label management. | info needed | Issue is lacking information needed for resolving | | investigating | Issue is still being investigated by the team | | question | Issue starts a discussion or raises a question | - diff --git a/Dockerfile b/Dockerfile index effc30ca32f..057d4388415 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ # build gno -FROM golang:1.22-alpine AS build-gno +FROM golang:1.23-alpine AS build-gno RUN go env -w GOMODCACHE=/root/.cache/go-build WORKDIR /gnoroot ENV GNOROOT="/gnoroot" @@ -11,7 +11,7 @@ RUN --mount=type=cache,target=/root/.cache/go-build go build -o ./ RUN --mount=type=cache,target=/root/.cache/go-build go build -o ./build/gno ./gnovm/cmd/gno # build misc binaries -FROM golang:1.22-alpine AS build-misc +FROM golang:1.23-alpine AS build-misc RUN go env -w GOMODCACHE=/root/.cache/go-build WORKDIR /gnoroot ENV GNOROOT="/gnoroot" diff --git a/contribs/github-bot/go.mod b/contribs/github-bot/go.mod index f8914819d54..e3072115c95 100644 --- a/contribs/github-bot/go.mod +++ b/contribs/github-bot/go.mod @@ -1,8 +1,6 @@ module github.com/gnolang/gno/contribs/github-bot -go 1.22.0 - -toolchain go1.23.2 +go 1.23.6 replace github.com/gnolang/gno => ../.. diff --git a/contribs/gnodev/go.mod b/contribs/gnodev/go.mod index 9aea08c4a30..f520e2fbb79 100644 --- a/contribs/gnodev/go.mod +++ b/contribs/gnodev/go.mod @@ -1,8 +1,6 @@ module github.com/gnolang/gno/contribs/gnodev -go 1.22.0 - -toolchain go1.22.10 +go 1.23.6 replace github.com/gnolang/gno => ../.. diff --git a/contribs/gnofaucet/go.mod b/contribs/gnofaucet/go.mod index 88c05e0d778..0a862162331 100644 --- a/contribs/gnofaucet/go.mod +++ b/contribs/gnofaucet/go.mod @@ -1,8 +1,6 @@ module github.com/gnolang/gno/contribs/gnofaucet -go 1.22.0 - -toolchain go1.22.10 +go 1.23.6 require ( github.com/gnolang/faucet v0.3.2 diff --git a/contribs/gnogenesis/go.mod b/contribs/gnogenesis/go.mod index 8af370f8169..e03ad1dde42 100644 --- a/contribs/gnogenesis/go.mod +++ b/contribs/gnogenesis/go.mod @@ -1,8 +1,6 @@ module github.com/gnolang/contribs/gnogenesis -go 1.22.0 - -toolchain go1.22.10 +go 1.23.6 require ( github.com/gnolang/gno v0.0.0-00010101000000-000000000000 diff --git a/contribs/gnohealth/go.mod b/contribs/gnohealth/go.mod index 76d7cd9c437..81c0ae7325b 100644 --- a/contribs/gnohealth/go.mod +++ b/contribs/gnohealth/go.mod @@ -1,6 +1,6 @@ module github.com/gnolang/gno/contribs/gnohealth -go 1.22.4 +go 1.23.6 replace github.com/gnolang/gno => ../.. diff --git a/contribs/gnokeykc/go.mod b/contribs/gnokeykc/go.mod index 3abcf3d834f..0ecc7b34cf3 100644 --- a/contribs/gnokeykc/go.mod +++ b/contribs/gnokeykc/go.mod @@ -1,8 +1,6 @@ module github.com/gnolang/gno/contribs/gnokeykc -go 1.22.0 - -toolchain go1.22.10 +go 1.23.6 replace github.com/gnolang/gno => ../.. diff --git a/contribs/gnomigrate/go.mod b/contribs/gnomigrate/go.mod index 96f6dc9bdc6..0381c6acd01 100644 --- a/contribs/gnomigrate/go.mod +++ b/contribs/gnomigrate/go.mod @@ -1,8 +1,6 @@ module github.com/gnolang/gnomigrate -go 1.22.0 - -toolchain go1.22.10 +go 1.23.6 require ( github.com/gnolang/gno v0.0.0-00010101000000-000000000000 diff --git a/docs/getting-started/local-setup/installation.md b/docs/getting-started/local-setup/installation.md index e05c2f9b205..2d091d6bf44 100644 --- a/docs/getting-started/local-setup/installation.md +++ b/docs/getting-started/local-setup/installation.md @@ -13,7 +13,7 @@ to run on your machine. ## Prerequisites - **Git** - **`make` (for running Makefiles)** -- **Go 1.22+** +- **Go 1.23+** - **Go Environment Setup**: - Make sure `$GOPATH` is well-defined, and `$GOPATH/bin` is added to your `$PATH` variable. - To do this, you can add the following line to your `.bashrc`, `.zshrc` or other config file: diff --git a/docs/gno-infrastructure/validators/connect-to-existing-chain.md b/docs/gno-infrastructure/validators/connect-to-existing-chain.md index f15f6bb59e2..82adeb557c4 100644 --- a/docs/gno-infrastructure/validators/connect-to-existing-chain.md +++ b/docs/gno-infrastructure/validators/connect-to-existing-chain.md @@ -12,7 +12,7 @@ In this tutorial, you will learn how to start a local Gno node and connect to an - **Git** - **`make` (for running Makefiles)** -- **Go 1.22+** +- **Go 1.23+** - **Go Environment Setup**: Ensure you have Go set up as outlined in the [Go official installation documentation](https://go.dev/doc/install) for your environment diff --git a/docs/gno-infrastructure/validators/setting-up-a-new-chain.md b/docs/gno-infrastructure/validators/setting-up-a-new-chain.md index 5db8a7f1a59..58ae7e011b8 100644 --- a/docs/gno-infrastructure/validators/setting-up-a-new-chain.md +++ b/docs/gno-infrastructure/validators/setting-up-a-new-chain.md @@ -13,7 +13,7 @@ Additionally, you will see the different options you can use to make your Gno in - **Git** - **`make` (for running Makefiles)** -- **Go 1.22+** +- **Go 1.23+** - **Go Environment Setup**: Ensure you have Go set up as outlined in the [Go official installation documentation](https://go.dev/doc/install) for your environment diff --git a/gnovm/cmd/gno/bug.go b/gnovm/cmd/gno/bug.go index 6f4f78410d6..fd5f907bc40 100644 --- a/gnovm/cmd/gno/bug.go +++ b/gnovm/cmd/gno/bug.go @@ -69,7 +69,7 @@ func newBugCmd(io commands.IO) *commands.Command { The new issue body is prefilled for you with the following information: - Gno version (the output of "gno version") -- Go version (example: go1.22.4) +- Go version (example: go1.23.4) - OS and CPU architecture (example: linux/amd64) - Gno commit hash causing the issue (example: f24690e7ebf325bffcfaf9e328c3df8e6b21e50c) diff --git a/gnovm/pkg/gnolang/internal/txlog/txlog.go b/gnovm/pkg/gnolang/internal/txlog/txlog.go index cda11083672..0c5e8640bf7 100644 --- a/gnovm/pkg/gnolang/internal/txlog/txlog.go +++ b/gnovm/pkg/gnolang/internal/txlog/txlog.go @@ -7,12 +7,14 @@ // when calling [MapCommitter.Commit]. package txlog +import "iter" + // Map is a generic interface to a key/value map, like Go's builtin map. type Map[K comparable, V any] interface { Get(K) (V, bool) Set(K, V) Delete(K) - Iterate() func(yield func(K, V) bool) + Iterate() iter.Seq2[K, V] } // MapCommitter is a Map which also implements a Commit() method, which writes @@ -47,7 +49,7 @@ func (m GoMap[K, V]) Delete(k K) { } // Iterate implements [Map]. -func (m GoMap[K, V]) Iterate() func(yield func(K, V) bool) { +func (m GoMap[K, V]) Iterate() iter.Seq2[K, V] { return func(yield func(K, V) bool) { for k, v := range m { if !yield(k, v) { @@ -103,21 +105,26 @@ func (b txLog[K, V]) Delete(k K) { b.dirty[k] = deletable[V]{deleted: true} } -func (b txLog[K, V]) Iterate() func(yield func(K, V) bool) { +func (b txLog[K, V]) Iterate() iter.Seq2[K, V] { return func(yield func(K, V) bool) { // go through b.source; skip deleted values, and use updated values // for those which exist in b.dirty. - b.source.Iterate()(func(k K, v V) bool { + for k, v := range b.source.Iterate() { if dirty, ok := b.dirty[k]; ok { if dirty.deleted { - return true + continue + } + if !yield(k, dirty.v) { + return } - return yield(k, dirty.v) + continue } // not in dirty - return yield(k, v) - }) + if !yield(k, v) { + return + } + } // iterate over all "new" values (ie. exist in b.dirty but not b.source). for k, v := range b.dirty { @@ -129,7 +136,7 @@ func (b txLog[K, V]) Iterate() func(yield func(K, V) bool) { continue } if !yield(k, v.v) { - break + return } } } diff --git a/gnovm/pkg/gnolang/internal/txlog/txlog_test.go b/gnovm/pkg/gnolang/internal/txlog/txlog_test.go index b0780fc8380..fd2a2597194 100644 --- a/gnovm/pkg/gnolang/internal/txlog/txlog_test.go +++ b/gnovm/pkg/gnolang/internal/txlog/txlog_test.go @@ -51,17 +51,17 @@ func ExampleWrap() { func Test_txLog(t *testing.T) { t.Parallel() - type Value = struct{} + type Value = struct{ b byte } // Full "integration test" of the txLog + mapwrapper. source := GoMap[int, *Value](map[int]*Value{}) // create 4 empty values (we'll just use the pointers) vs := [...]*Value{ - {}, - {}, - {}, - {}, + {0}, + {1}, + {2}, + {3}, } source.Set(0, vs[0]) source.Set(1, vs[1]) @@ -121,8 +121,8 @@ func Test_txLog(t *testing.T) { assert.Equal(t, saved, txm.source) // double-check on the iterators. - verifyHashMapValues(t, source, map[int]*Value{1: vs[1], 2: vs[0]}) - verifyHashMapValues(t, txm, map[int]*Value{2: vs[2], 3: vs[3]}) + verifyHashMapValues(t, source, map[int]*Value{1: vs[1], 2: vs[2]}) + verifyHashMapValues(t, txm, map[int]*Value{2: vs[0], 3: vs[3]}) } { @@ -146,17 +146,16 @@ func Test_txLog(t *testing.T) { } } -func verifyHashMapValues(t *testing.T, m Map[int, *struct{}], expectedReadonly map[int]*struct{}) { +func verifyHashMapValues(t *testing.T, m Map[int, *struct{ b byte }], expectedReadonly map[int]*struct{ b byte }) { t.Helper() expected := maps.Clone(expectedReadonly) - m.Iterate()(func(k int, v *struct{}) bool { + for k, v := range m.Iterate() { ev, eok := expected[k] _ = assert.True(t, eok, "mapping %d:%v should exist in expected map", k, v) && assert.Equal(t, ev, v, "values should match") delete(expected, k) - return true - }) + } assert.Empty(t, expected, "(some) expected values not found in the Map") } diff --git a/gnovm/pkg/gnolang/store.go b/gnovm/pkg/gnolang/store.go index 84625bd92c1..1ddc97ed0d0 100644 --- a/gnovm/pkg/gnolang/store.go +++ b/gnovm/pkg/gnolang/store.go @@ -246,14 +246,12 @@ func CopyFromCachedStore(destStore, cachedStore Store, cachedBase, cachedIavl st ds.iavlStore.Set(iter.Key(), iter.Value()) } - ss.cacheTypes.Iterate()(func(k TypeID, v Type) bool { + for k, v := range ss.cacheTypes.Iterate() { ds.cacheTypes.Set(k, v) - return true - }) - ss.cacheNodes.Iterate()(func(k Location, v BlockNode) bool { + } + for k, v := range ss.cacheNodes.Iterate() { ds.cacheNodes.Set(k, v) - return true - }) + } } func (ds *defaultStore) GetAllocator() *Allocator { diff --git a/go.mod b/go.mod index 027ba6359bc..026351cec77 100644 --- a/go.mod +++ b/go.mod @@ -1,8 +1,8 @@ module github.com/gnolang/gno -go 1.22.0 +go 1.23 -toolchain go1.22.10 +toolchain go1.23.6 require ( dario.cat/mergo v1.0.1 diff --git a/misc/autocounterd/go.mod b/misc/autocounterd/go.mod index 972975d4fb0..7d9def2b3cc 100644 --- a/misc/autocounterd/go.mod +++ b/misc/autocounterd/go.mod @@ -1,8 +1,6 @@ module autocounterd -go 1.22.0 - -toolchain go1.22.10 +go 1.23.6 require github.com/gnolang/gno v0.0.0-00010101000000-000000000000 diff --git a/misc/docs-linter/go.mod b/misc/docs-linter/go.mod index 2951bcbef54..a98f8115b1c 100644 --- a/misc/docs-linter/go.mod +++ b/misc/docs-linter/go.mod @@ -1,8 +1,6 @@ module linter -go 1.22.0 - -toolchain go1.23.2 +go 1.23.6 require ( github.com/gnolang/gno v0.0.0-00010101000000-000000000000 diff --git a/misc/loop/go.mod b/misc/loop/go.mod index 4c5a3f41839..7d0252da82c 100644 --- a/misc/loop/go.mod +++ b/misc/loop/go.mod @@ -1,8 +1,6 @@ module loop -go 1.22.0 - -toolchain go1.22.10 +go 1.23.6 require ( github.com/docker/docker v25.0.6+incompatible diff --git a/misc/stdlib_diff/go.mod b/misc/stdlib_diff/go.mod index f2ddffba2b2..7ec537a127e 100644 --- a/misc/stdlib_diff/go.mod +++ b/misc/stdlib_diff/go.mod @@ -1,7 +1,5 @@ module github.com/gnolang/gno/misc/stdlib_diff -go 1.22.0 - -toolchain go1.22.10 +go 1.23.6 require github.com/hexops/gotextdiff v1.0.3