diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1d187dfd..6369cfa0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -26,7 +26,7 @@ on: jobs: run: name: Run simulation - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v4 with: @@ -35,7 +35,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v5 with: - go-version: '1.22' + go-version: '1.23' cache: true - name: Run simulation diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 2dfdcb4a..91fafcc1 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -30,17 +30,17 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - go: [ '1.21', '1.22'] + go: [ '1.22', '1.23'] os: [ubuntu-latest, windows-2022, macos-14] exclude: # Only latest Go version for Windows and MacOS. - os: windows-2022 - go: '1.21' + go: '1.22' - os: macos-14 - go: '1.21' + go: '1.22' # Exclude latest Go version for Ubuntu as Coverage uses it. - os: ubuntu-latest - go: '1.22' + go: '1.23' steps: - name: Setup go @@ -62,7 +62,7 @@ jobs: - name: Setup Go uses: actions/setup-go@v5 with: - go-version: 1.22 + go-version: 1.23 - name: Check out uses: actions/checkout@v4 diff --git a/CHANGELOG.md b/CHANGELOG.md index 5cdd2cea..bc1bf067 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,7 +9,7 @@ New features: Behaviour changes: Improvements: - * minimum required Go version is 1.21 (#122) + * minimum required Go version is 1.22 (#122, #126) Bugs fixed: diff --git a/README.md b/README.md index 5b97a410..f694ae93 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ +[![Go Reference](https://pkg.go.dev/badge/github.com/nspcc-dev/dbft.svg)](https://pkg.go.dev/github.com/nspcc-dev/dbft/) ![Codecov](https://img.shields.io/codecov/c/github/nspcc-dev/dbft.svg) [![Report](https://goreportcard.com/badge/github.com/nspcc-dev/dbft)](https://goreportcard.com/report/github.com/nspcc-dev/dbft) +![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/nspcc-dev/dbft?sort=semver) ![License](https://img.shields.io/github/license/nspcc-dev/dbft.svg?style=popout) # DBFT diff --git a/dbft_test.go b/dbft_test.go index f6ef2b75..75f003ea 100644 --- a/dbft_test.go +++ b/dbft_test.go @@ -409,8 +409,8 @@ func TestDBFT_OnReceiveRecoveryRequestResponds(t *testing.T) { var params []recoveryset for _, nodes := range []int{4, 5, 7, 10} { // 5 is a bad BFT number, but we want to test the logic anyway. - for sender := 0; sender < nodes; sender++ { - for recv := 0; recv < nodes; recv++ { + for sender := range nodes { + for recv := range nodes { params = append(params, recoveryset{nodes, sender, recv, false}) for i := 1; i <= ((nodes-1)/3)+1; i++ { @@ -1221,7 +1221,7 @@ func newConsensusPayload(c *dbft.Context[crypto.Uint256], t dbft.MessageType, ms } func getTestValidators(n int) (privs []dbft.PrivateKey, pubs []dbft.PublicKey) { - for i := 0; i < n; i++ { + for range n { priv, pub := crypto.Generate(rand.Reader) privs = append(privs, priv) pubs = append(pubs, pub) diff --git a/go.mod b/go.mod index 6c8e4bdd..f062eec5 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/nspcc-dev/dbft -go 1.21 +go 1.22 require ( github.com/stretchr/testify v1.9.0 diff --git a/internal/consensus/amev_block.go b/internal/consensus/amev_block.go index 8e51c5b6..4df63057 100644 --- a/internal/consensus/amev_block.go +++ b/internal/consensus/amev_block.go @@ -30,7 +30,7 @@ func NewAMEVBlock(pre dbft.PreBlock[crypto.Uint256], cnData [][]byte, m int) dbf // Some artificial rules of new tx creation are invented here, but in Neo X there will // be well-defined custom rules for Envelope transactions. var sum uint32 - for i := 0; i < m; i++ { + for i := range m { sum += binary.BigEndian.Uint32(cnData[i]) } tx := Tx64(math.MaxInt64 - int64(sum)) diff --git a/internal/merkle/merkle_tree.go b/internal/merkle/merkle_tree.go index 5d6bb31e..1585006a 100644 --- a/internal/merkle/merkle_tree.go +++ b/internal/merkle/merkle_tree.go @@ -54,7 +54,7 @@ func buildTree(leaves ...TreeNode) *TreeNode { } parents := make([]TreeNode, (l+1)/2) - for i := 0; i < len(parents); i++ { + for i := range parents { parents[i].Left = &leaves[i*2] leaves[i*2].Parent = &parents[i] diff --git a/internal/merkle/merkle_tree_test.go b/internal/merkle/merkle_tree_test.go index 99706b16..5e769e03 100644 --- a/internal/merkle/merkle_tree_test.go +++ b/internal/merkle/merkle_tree_test.go @@ -25,7 +25,7 @@ func TestNewMerkleTree(t *testing.T) { t.Run("predefined tree on 4 leaves", func(t *testing.T) { hashes := make([]crypto.Uint256, 5) - for i := 0; i < 5; i++ { + for i := range hashes { hashes[i] = sha256.Sum256([]byte{byte(i)}) } diff --git a/internal/simulation/main.go b/internal/simulation/main.go index d47ba6a1..0a2973ec 100644 --- a/internal/simulation/main.go +++ b/internal/simulation/main.go @@ -199,7 +199,7 @@ func (n *simNode) VerifyPayload(p dbft.ConsensusPayload[crypto.Uint256]) error { } func (n *simNode) addTx(count int) { - for i := 0; i < count; i++ { + for i := range count { tx := consensus.Tx64(uint64(i)) n.pool.Add(&tx) }