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

Go 1.22 #126

Merged
merged 4 commits into from
Aug 22, 2024
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/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
6 changes: 3 additions & 3 deletions dbft_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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++ {
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/nspcc-dev/dbft

go 1.21
go 1.22

require (
github.com/stretchr/testify v1.9.0
Expand Down
2 changes: 1 addition & 1 deletion internal/consensus/amev_block.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
// 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 {

Check warning on line 33 in internal/consensus/amev_block.go

View check run for this annotation

Codecov / codecov/patch

internal/consensus/amev_block.go#L33

Added line #L33 was not covered by tests
sum += binary.BigEndian.Uint32(cnData[i])
}
tx := Tx64(math.MaxInt64 - int64(sum))
Expand Down
2 changes: 1 addition & 1 deletion internal/merkle/merkle_tree.go
Original file line number Diff line number Diff line change
Expand Up @@ -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]

Expand Down
2 changes: 1 addition & 1 deletion internal/merkle/merkle_tree_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)})
}

Expand Down
2 changes: 1 addition & 1 deletion internal/simulation/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@
}

func (n *simNode) addTx(count int) {
for i := 0; i < count; i++ {
for i := range count {

Check warning on line 202 in internal/simulation/main.go

View check run for this annotation

Codecov / codecov/patch

internal/simulation/main.go#L202

Added line #L202 was not covered by tests
tx := consensus.Tx64(uint64(i))
n.pool.Add(&tx)
}
Expand Down
Loading