Skip to content

Commit e77a367

Browse files
authored
Merge pull request #6208 from Algo-devops-service/relbeta4.0.0
2 parents d1fbc97 + 89109d8 commit e77a367

File tree

212 files changed

+13948
-1701
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

212 files changed

+13948
-1701
lines changed

.github/workflows/reviewdog.yml

+12-10
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
name: "ReviewDog workflow"
2+
env:
3+
GOLANGCI_LINT_VERSION: "v1.62.0"
24
on:
35
push:
46
branches:
@@ -17,15 +19,15 @@ jobs:
1719
- name: Make libsodium.a
1820
run: sudo mv /usr/bin/go /usr/bin/go.bak && make crypto/libs/linux/amd64/lib/libsodium.a && sudo mv /usr/bin/go.bak /usr/bin/go
1921
- name: reviewdog-golangci-lint
20-
uses: reviewdog/action-golangci-lint@v2.6.2
22+
uses: reviewdog/action-golangci-lint@v2.7.0
2123
with:
2224
go_version_file: go.mod
23-
golangci_lint_version: "v1.62.0"
25+
golangci_lint_version: ${{ env.GOLANGCI_LINT_VERSION }}
2426
golangci_lint_flags: "-c .golangci.yml --allow-parallel-runners"
2527
reporter: "github-pr-check"
2628
tool_name: "Lint Errors"
2729
level: "error"
28-
fail_on_error: true
30+
fail_level: any
2931
filter_mode: "nofilter"
3032
# Non-Blocking Warnings Section
3133
reviewdog-warnings:
@@ -56,20 +58,20 @@ jobs:
5658
uses: actions/[email protected]
5759
with:
5860
path: cicdtmp/golangci-lint/golangci-lint-cgo
59-
key: cicd-golangci-lint-cgo-v0.0.2-${{ env.GO_VERSION }}
61+
key: cicd-golangci-lint-cgo-v0.0.3-${{ env.GO_VERSION }}-${{ env.GOLANGCI_LINT_VERSION }}
6062

6163
- name: Build custom golangci-lint with CGO_ENABLED
6264
if: steps.cache-golangci-lint.outputs.cache-hit != 'true'
6365
run: |
6466
cd cicdtmp/golangci-lint
6567
git clone https://github.com/golangci/golangci-lint.git .
66-
git checkout tags/v1.62.0
68+
git checkout tags/${GOLANGCI_LINT_VERSION}
6769
CGO_ENABLED=true go build -trimpath -o golangci-lint-cgo ./cmd/golangci-lint
6870
./golangci-lint-cgo --version
6971
cd ../../
7072
- name: Install reviewdog
7173
run: |
72-
curl -sfL https://raw.githubusercontent.com/reviewdog/reviewdog/v0.20.2/install.sh | sh -s -- v0.20.2
74+
curl -sfL https://raw.githubusercontent.com/reviewdog/reviewdog/v0.20.3/install.sh | sh -s -- v0.20.3
7375
reviewdog --version
7476
- name: Build custom linters
7577
run: |
@@ -92,9 +94,9 @@ jobs:
9294
cat temp_golangci-lint-cgo.txt | reviewdog \
9395
-f=golangci-lint \
9496
-name="Lint Warnings" \
95-
-reporter=github-check \
97+
-reporter=github-pr-check \
9698
-filter-mode=added \
97-
-fail-on-error=true \
99+
-fail-level=any \
98100
-level=warning
99101
- name: Slack Notification
100102
env:
@@ -107,11 +109,11 @@ jobs:
107109
steps:
108110
- uses: actions/checkout@v4
109111
- name: shellcheck
110-
uses: reviewdog/action-shellcheck@v1
112+
uses: reviewdog/action-shellcheck@v1.28.0
111113
with:
112114
github_token: ${{ secrets.GITHUB_TOKEN }}
113115
reporter: "github-pr-check"
114116
shellcheck_flags: "-e SC2034,SC2046,SC2053,SC2207,SC2145 -S warning"
115-
fail_on_error: true
117+
fail_level: any
116118
path: |
117119
test/scripts/e2e_subs

.golangci-warnings.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ linters:
99
- partitiontest
1010

1111
linters-settings:
12-
gosec: # we are mostly only interested in G601
13-
excludes: [G101, G103, G104, G107, G202, G301, G302, G303, G304, G306, G307, G404]
12+
gosec: # Go 1.22 makes G601 irrelevant
13+
excludes: [G101, G103, G104, G107, G115, G202, G301, G302, G303, G304, G306, G307, G404, G601]
1414
custom:
1515
partitiontest:
1616
path: cmd/partitiontest_linter/plugin.so

Makefile

+3
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,9 @@ $(GOPATH1)/bin/%:
293293
test: build
294294
$(GOTESTCOMMAND) $(GOTAGS) -race $(UNIT_TEST_SOURCES) -timeout 1h -coverprofile=coverage.txt -covermode=atomic
295295

296+
testc:
297+
echo $(UNIT_TEST_SOURCES) | xargs -P8 -n1 go test -c
298+
296299
benchcheck: build
297300
$(GOTESTCOMMAND) $(GOTAGS) -race $(UNIT_TEST_SOURCES) -run ^NOTHING -bench Benchmark -benchtime 1x -timeout 1h
298301

agreement/agreementtest/simulate_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ package agreementtest
1919
import (
2020
"context"
2121
"fmt"
22+
"maps"
2223
"math/rand"
2324
"os"
2425
"strconv"
@@ -27,7 +28,6 @@ import (
2728

2829
"github.com/algorand/go-deadlock"
2930
"github.com/stretchr/testify/require"
30-
"golang.org/x/exp/maps"
3131

3232
"github.com/algorand/go-algorand/agreement"
3333
"github.com/algorand/go-algorand/config"

agreement/autopsy.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ import (
2020
"fmt"
2121
"io"
2222
"os"
23+
"slices"
2324

2425
"github.com/algorand/go-algorand/data/basics"
2526
"github.com/algorand/go-algorand/logging"
2627
"github.com/algorand/go-algorand/protocol"
27-
"golang.org/x/exp/slices"
2828
)
2929

3030
// An Autopsy is a trace of the ordered input events and output

agreement/common_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ package agreement
1919
import (
2020
"context"
2121
"fmt"
22+
"maps"
2223
"math/rand"
2324
"testing"
2425

2526
"github.com/algorand/go-deadlock"
2627
"github.com/stretchr/testify/require"
27-
"golang.org/x/exp/maps"
2828

2929
"github.com/algorand/go-algorand/config"
3030
"github.com/algorand/go-algorand/crypto"

agreement/gossip/networkFull_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ func spinNetwork(t *testing.T, nodesCount int, cfg config.Local) ([]*networkImpl
103103
break
104104
}
105105
}
106-
log.Infof("network established, %d nodes connected in %s", nodesCount, time.Now().Sub(start).String())
106+
log.Infof("network established, %d nodes connected in %s", nodesCount, time.Since(start).String())
107107
return networkImpls, msgCounters
108108
}
109109

agreement/selector.go

+7-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,13 @@ func (sel selector) CommitteeSize(proto config.ConsensusParams) uint64 {
5151
// looking at online stake (and status and key material). It is exported so that
5252
// AVM can provide opcodes that return the same data.
5353
func BalanceRound(r basics.Round, cparams config.ConsensusParams) basics.Round {
54-
return r.SubSaturate(basics.Round(2 * cparams.SeedRefreshInterval * cparams.SeedLookback))
54+
return r.SubSaturate(BalanceLookback(cparams))
55+
}
56+
57+
// BalanceLookback is how far back agreement looks when considering balances for
58+
// voting stake.
59+
func BalanceLookback(cparams config.ConsensusParams) basics.Round {
60+
return basics.Round(2 * cparams.SeedRefreshInterval * cparams.SeedLookback)
5561
}
5662

5763
func seedRound(r basics.Round, cparams config.ConsensusParams) basics.Round {

catchup/catchpointService_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,8 @@ func (m *catchpointCatchupAccessorMock) Ledger() (l ledger.CatchupAccessorClient
8181
}
8282

8383
// GetVerifyData returns the balances hash, spver hash and totals used by VerifyCatchpoint
84-
func (m *catchpointCatchupAccessorMock) GetVerifyData(ctx context.Context) (balancesHash crypto.Digest, spverHash crypto.Digest, totals ledgercore.AccountTotals, err error) {
85-
return crypto.Digest{}, crypto.Digest{}, ledgercore.AccountTotals{}, nil
84+
func (m *catchpointCatchupAccessorMock) GetVerifyData(ctx context.Context) (balancesHash, spverHash, onlineAccountsHash, onlineRoundParamsHash crypto.Digest, totals ledgercore.AccountTotals, err error) {
85+
return crypto.Digest{}, crypto.Digest{}, crypto.Digest{}, crypto.Digest{}, ledgercore.AccountTotals{}, nil
8686
}
8787

8888
// TestCatchpointServicePeerRank ensures CatchpointService does not crash when a block fetched

catchup/universalFetcher.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ func (uf *universalBlockFetcher) fetchBlock(ctx context.Context, round basics.Ro
8888
} else {
8989
return nil, nil, time.Duration(0), fmt.Errorf("fetchBlock: UniversalFetcher only supports HTTPPeer and UnicastPeer")
9090
}
91-
downloadDuration = time.Now().Sub(blockDownloadStartTime)
91+
downloadDuration = time.Since(blockDownloadStartTime)
9292
block, cert, err := processBlockBytes(fetchedBuf, round, address)
9393
if err != nil {
9494
return nil, nil, time.Duration(0), err

cmd/algokey/keyreg.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,12 @@ import (
2020
"encoding/base64"
2121
"errors"
2222
"fmt"
23+
"maps"
2324
"os"
25+
"slices"
2426
"strings"
2527

2628
"github.com/spf13/cobra"
27-
"golang.org/x/exp/maps"
2829

2930
"github.com/algorand/go-algorand/crypto"
3031
"github.com/algorand/go-algorand/data/account"
@@ -95,7 +96,7 @@ func init() {
9596
"betanet": mustConvertB64ToDigest("mFgazF+2uRS1tMiL9dsj01hJGySEmPN28B/TjjvpVW0="),
9697
"devnet": mustConvertB64ToDigest("sC3P7e2SdbqKJK0tbiCdK9tdSpbe6XeCGKdoNzmlj0E="),
9798
}
98-
validNetworkList = maps.Keys(validNetworks)
99+
validNetworkList = slices.Collect(maps.Keys(validNetworks))
99100
}
100101

101102
func mustConvertB64ToDigest(b64 string) (digest crypto.Digest) {

cmd/catchpointdump/file.go

+4-3
Original file line numberDiff line numberDiff line change
@@ -214,12 +214,13 @@ func loadCatchpointIntoDatabase(ctx context.Context, catchupAccessor ledger.Catc
214214
if err != nil {
215215
return fileHeader, err
216216
}
217-
var balanceHash, spverHash crypto.Digest
218-
balanceHash, spverHash, _, err = catchupAccessor.GetVerifyData(ctx)
217+
var balanceHash, spverHash, onlineAccountsHash, onlineRoundParamsHash crypto.Digest
218+
balanceHash, spverHash, onlineAccountsHash, onlineRoundParamsHash, _, err = catchupAccessor.GetVerifyData(ctx)
219219
if err != nil {
220220
return fileHeader, err
221221
}
222-
fmt.Printf("accounts digest=%s, spver digest=%s\n\n", balanceHash, spverHash)
222+
fmt.Printf("accounts digest=%s, spver digest=%s, onlineaccounts digest=%s onlineroundparams digest=%s\n\n",
223+
balanceHash, spverHash, onlineAccountsHash, onlineRoundParamsHash)
223224
}
224225
return fileHeader, nil
225226
}

cmd/goal/account.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@ import (
2424
"net/http"
2525
"os"
2626
"path/filepath"
27+
"slices"
2728
"sort"
2829
"strings"
2930
"time"
3031

3132
"github.com/spf13/cobra"
32-
"golang.org/x/exp/slices"
3333

3434
"github.com/algorand/go-algorand/cmd/util/datadir"
3535
"github.com/algorand/go-algorand/config"

cmd/goal/clerk.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -221,8 +221,7 @@ func waitForCommit(client libgoal.Client, txid string, transactionLastValidRound
221221
}
222222

223223
reportInfof(infoTxPending, txid, stat.LastRound)
224-
// WaitForRound waits until round "stat.LastRound+1" is committed
225-
stat, err = client.WaitForRound(stat.LastRound)
224+
stat, err = client.WaitForRound(stat.LastRound + 1)
226225
if err != nil {
227226
return model.PendingTransactionResponse{}, fmt.Errorf(errorRequestFail, err)
228227
}

cmd/loadgenerator/main.go

+6-5
Original file line numberDiff line numberDiff line change
@@ -200,22 +200,23 @@ func waitForRound(restClient client.RestClient, cfg config, spendingRound bool)
200200
time.Sleep(1 * time.Second)
201201
continue
202202
}
203-
if isSpendRound(cfg, nodeStatus.LastRound) == spendingRound {
203+
lastRound := nodeStatus.LastRound
204+
if isSpendRound(cfg, lastRound) == spendingRound {
204205
// time to send transactions.
205206
return
206207
}
207208
if spendingRound {
208-
fmt.Printf("Last round %d, waiting for spending round %d\n", nodeStatus.LastRound, nextSpendRound(cfg, nodeStatus.LastRound))
209+
fmt.Printf("Last round %d, waiting for spending round %d\n", lastRound, nextSpendRound(cfg, nodeStatus.LastRound))
209210
}
210211
for {
211212
// wait for the next round.
212-
nodeStatus, err = restClient.WaitForBlock(basics.Round(nodeStatus.LastRound))
213+
err = restClient.WaitForRoundWithTimeout(lastRound + 1)
213214
if err != nil {
214215
fmt.Fprintf(os.Stderr, "unable to wait for next round node status : %v", err)
215-
time.Sleep(1 * time.Second)
216216
break
217217
}
218-
if isSpendRound(cfg, nodeStatus.LastRound) == spendingRound {
218+
lastRound++
219+
if isSpendRound(cfg, lastRound) == spendingRound {
219220
// time to send transactions.
220221
return
221222
}

cmd/opdoc/opdoc.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,7 @@ func create(file string) *os.File {
443443
}
444444

445445
func main() {
446-
const docVersion = uint64(10)
446+
const docVersion = uint64(11)
447447

448448
opGroups := make(map[string][]string, len(logic.OpSpecs))
449449
for grp, names := range logic.OpGroups {

cmd/tealdbg/local.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import (
2020
"fmt"
2121
"io"
2222
"log"
23+
"slices"
2324
"time"
2425

2526
"github.com/algorand/go-algorand/config"
@@ -28,7 +29,6 @@ import (
2829
"github.com/algorand/go-algorand/data/transactions/logic"
2930
"github.com/algorand/go-algorand/ledger/apply"
3031
"github.com/algorand/go-algorand/protocol"
31-
"golang.org/x/exp/slices"
3232
)
3333

3434
func protoFromString(protoString string) (name string, proto config.ConsensusParams, err error) {

cmd/tealdbg/localLedger.go

+4
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,10 @@ func (l *localLedger) LookupAgreement(rnd basics.Round, addr basics.Address) (ba
359359
}, nil
360360
}
361361

362+
func (l *localLedger) GetKnockOfflineCandidates(basics.Round, config.ConsensusParams) (map[basics.Address]basics.OnlineAccountData, error) {
363+
return nil, nil
364+
}
365+
362366
func (l *localLedger) OnlineCirculation(rnd basics.Round, voteRound basics.Round) (basics.MicroAlgos, error) {
363367
// A constant is fine for tealdbg
364368
return basics.Algos(1_000_000_000), nil // 1B

components/mocks/mockCatchpointCatchupAccessor.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ func (m *MockCatchpointCatchupAccessor) GetCatchupBlockRound(ctx context.Context
7171
}
7272

7373
// GetVerifyData returns the balances hash, spver hash and totals used by VerifyCatchpoint
74-
func (m *MockCatchpointCatchupAccessor) GetVerifyData(ctx context.Context) (balancesHash crypto.Digest, spverHash crypto.Digest, totals ledgercore.AccountTotals, err error) {
75-
return crypto.Digest{}, crypto.Digest{}, ledgercore.AccountTotals{}, nil
74+
func (m *MockCatchpointCatchupAccessor) GetVerifyData(ctx context.Context) (balancesHash, spverHash, onlineAccountsHash, onlineRoundParams crypto.Digest, totals ledgercore.AccountTotals, err error) {
75+
return crypto.Digest{}, crypto.Digest{}, crypto.Digest{}, crypto.Digest{}, ledgercore.AccountTotals{}, nil
7676
}
7777

7878
// VerifyCatchpoint verifies that the catchpoint is valid by reconstructing the label.

0 commit comments

Comments
 (0)