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-algorand 4.0.0-beta Release PR #6208

Merged
merged 18 commits into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
0bc3d7e
CI: update reviewdog warning linter job (#6175)
cce Nov 21, 2024
f54f099
Merge pull request #6178 from Algo-devops-service/relstable3.27.0
algojohnlee Nov 25, 2024
92e0e00
refactor: replace experimental `maps` and `slices` with stdlib (#6179)
Juneezee Nov 25, 2024
a8cb2c2
Merge remote-tracking branch 'origin/rel/stable' into relstable3.27.0…
Algo-devops-service Nov 26, 2024
0a13501
Bump Version, Remove buildnumber.dat and genesistimestamp.dat files.
Algo-devops-service Nov 26, 2024
7e562c3
Merge pull request #6181 from Algo-devops-service/relstable3.27.0-rem…
algojohnlee Nov 26, 2024
b7b3e5e
chore: fix some problematic function names (#6184)
hishope Dec 3, 2024
b0f1396
chore: fix some function name in comment (#6192)
needsure Dec 10, 2024
f87ae8a
ledger: add callback to clear state between commitRound retries (#6190)
cce Dec 10, 2024
548e3f6
AVM: new teal opcodes for the MiMC hash function to support Zero Know…
giuliop Dec 16, 2024
a625d03
CI: update reviewdog config for deprecated fail_on_error (#6196)
cce Dec 19, 2024
fcad0bb
Eval: Feature/heartbeats (#6189)
jannotti Dec 19, 2024
a896dfd
Doc: voter balance version fix (#6205)
jannotti Dec 19, 2024
38ce41c
build(deps): bump golang.org/x/crypto from 0.29.0 to 0.31.0 (#6203)
dependabot[bot] Dec 19, 2024
2e043df
Specs: Commits spec changes made in specs repo (#6206)
jannotti Dec 20, 2024
a10b6b3
catchpoints: Add onlineaccounts and onlineroundparamstail tables to s…
cce Dec 20, 2024
a1137a2
Consensus: Consensus version v40, set major release to 4 and reset mi…
gmalouf Dec 20, 2024
89109d8
Update the Version, BuildNumber, genesistimestamp.data
Algo-devops-service Dec 20, 2024
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
22 changes: 12 additions & 10 deletions .github/workflows/reviewdog.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
name: "ReviewDog workflow"
env:
GOLANGCI_LINT_VERSION: "v1.62.0"
on:
push:
branches:
Expand All @@ -17,15 +19,15 @@ jobs:
- name: Make libsodium.a
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
- name: reviewdog-golangci-lint
uses: reviewdog/action-golangci-lint@v2.6.2
uses: reviewdog/action-golangci-lint@v2.7.0
with:
go_version_file: go.mod
golangci_lint_version: "v1.62.0"
golangci_lint_version: ${{ env.GOLANGCI_LINT_VERSION }}
golangci_lint_flags: "-c .golangci.yml --allow-parallel-runners"
reporter: "github-pr-check"
tool_name: "Lint Errors"
level: "error"
fail_on_error: true
fail_level: any
filter_mode: "nofilter"
# Non-Blocking Warnings Section
reviewdog-warnings:
Expand Down Expand Up @@ -56,20 +58,20 @@ jobs:
uses: actions/[email protected]
with:
path: cicdtmp/golangci-lint/golangci-lint-cgo
key: cicd-golangci-lint-cgo-v0.0.2-${{ env.GO_VERSION }}
key: cicd-golangci-lint-cgo-v0.0.3-${{ env.GO_VERSION }}-${{ env.GOLANGCI_LINT_VERSION }}

- name: Build custom golangci-lint with CGO_ENABLED
if: steps.cache-golangci-lint.outputs.cache-hit != 'true'
run: |
cd cicdtmp/golangci-lint
git clone https://github.com/golangci/golangci-lint.git .
git checkout tags/v1.62.0
git checkout tags/${GOLANGCI_LINT_VERSION}
CGO_ENABLED=true go build -trimpath -o golangci-lint-cgo ./cmd/golangci-lint
./golangci-lint-cgo --version
cd ../../
- name: Install reviewdog
run: |
curl -sfL https://raw.githubusercontent.com/reviewdog/reviewdog/v0.20.2/install.sh | sh -s -- v0.20.2
curl -sfL https://raw.githubusercontent.com/reviewdog/reviewdog/v0.20.3/install.sh | sh -s -- v0.20.3
reviewdog --version
- name: Build custom linters
run: |
Expand All @@ -92,9 +94,9 @@ jobs:
cat temp_golangci-lint-cgo.txt | reviewdog \
-f=golangci-lint \
-name="Lint Warnings" \
-reporter=github-check \
-reporter=github-pr-check \
-filter-mode=added \
-fail-on-error=true \
-fail-level=any \
-level=warning
- name: Slack Notification
env:
Expand All @@ -107,11 +109,11 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: shellcheck
uses: reviewdog/action-shellcheck@v1
uses: reviewdog/action-shellcheck@v1.28.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
reporter: "github-pr-check"
shellcheck_flags: "-e SC2034,SC2046,SC2053,SC2207,SC2145 -S warning"
fail_on_error: true
fail_level: any
path: |
test/scripts/e2e_subs
4 changes: 2 additions & 2 deletions .golangci-warnings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ linters:
- partitiontest

linters-settings:
gosec: # we are mostly only interested in G601
excludes: [G101, G103, G104, G107, G202, G301, G302, G303, G304, G306, G307, G404]
gosec: # Go 1.22 makes G601 irrelevant
excludes: [G101, G103, G104, G107, G115, G202, G301, G302, G303, G304, G306, G307, G404, G601]
custom:
partitiontest:
path: cmd/partitiontest_linter/plugin.so
Expand Down
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,9 @@ $(GOPATH1)/bin/%:
test: build
$(GOTESTCOMMAND) $(GOTAGS) -race $(UNIT_TEST_SOURCES) -timeout 1h -coverprofile=coverage.txt -covermode=atomic

testc:
echo $(UNIT_TEST_SOURCES) | xargs -P8 -n1 go test -c

benchcheck: build
$(GOTESTCOMMAND) $(GOTAGS) -race $(UNIT_TEST_SOURCES) -run ^NOTHING -bench Benchmark -benchtime 1x -timeout 1h

Expand Down
2 changes: 1 addition & 1 deletion agreement/agreementtest/simulate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package agreementtest
import (
"context"
"fmt"
"maps"
"math/rand"
"os"
"strconv"
Expand All @@ -27,7 +28,6 @@ import (

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

"github.com/algorand/go-algorand/agreement"
"github.com/algorand/go-algorand/config"
Expand Down
2 changes: 1 addition & 1 deletion agreement/autopsy.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ import (
"fmt"
"io"
"os"
"slices"

"github.com/algorand/go-algorand/data/basics"
"github.com/algorand/go-algorand/logging"
"github.com/algorand/go-algorand/protocol"
"golang.org/x/exp/slices"
)

// An Autopsy is a trace of the ordered input events and output
Expand Down
2 changes: 1 addition & 1 deletion agreement/common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ package agreement
import (
"context"
"fmt"
"maps"
"math/rand"
"testing"

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

"github.com/algorand/go-algorand/config"
"github.com/algorand/go-algorand/crypto"
Expand Down
2 changes: 1 addition & 1 deletion agreement/gossip/networkFull_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ func spinNetwork(t *testing.T, nodesCount int, cfg config.Local) ([]*networkImpl
break
}
}
log.Infof("network established, %d nodes connected in %s", nodesCount, time.Now().Sub(start).String())
log.Infof("network established, %d nodes connected in %s", nodesCount, time.Since(start).String())
return networkImpls, msgCounters
}

Expand Down
8 changes: 7 additions & 1 deletion agreement/selector.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,13 @@ func (sel selector) CommitteeSize(proto config.ConsensusParams) uint64 {
// looking at online stake (and status and key material). It is exported so that
// AVM can provide opcodes that return the same data.
func BalanceRound(r basics.Round, cparams config.ConsensusParams) basics.Round {
return r.SubSaturate(basics.Round(2 * cparams.SeedRefreshInterval * cparams.SeedLookback))
return r.SubSaturate(BalanceLookback(cparams))
}

// BalanceLookback is how far back agreement looks when considering balances for
// voting stake.
func BalanceLookback(cparams config.ConsensusParams) basics.Round {
return basics.Round(2 * cparams.SeedRefreshInterval * cparams.SeedLookback)
}

func seedRound(r basics.Round, cparams config.ConsensusParams) basics.Round {
Expand Down
4 changes: 2 additions & 2 deletions catchup/catchpointService_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ func (m *catchpointCatchupAccessorMock) Ledger() (l ledger.CatchupAccessorClient
}

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

// TestCatchpointServicePeerRank ensures CatchpointService does not crash when a block fetched
Expand Down
2 changes: 1 addition & 1 deletion catchup/universalFetcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ func (uf *universalBlockFetcher) fetchBlock(ctx context.Context, round basics.Ro
} else {
return nil, nil, time.Duration(0), fmt.Errorf("fetchBlock: UniversalFetcher only supports HTTPPeer and UnicastPeer")
}
downloadDuration = time.Now().Sub(blockDownloadStartTime)
downloadDuration = time.Since(blockDownloadStartTime)
block, cert, err := processBlockBytes(fetchedBuf, round, address)
if err != nil {
return nil, nil, time.Duration(0), err
Expand Down
5 changes: 3 additions & 2 deletions cmd/algokey/keyreg.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@
"encoding/base64"
"errors"
"fmt"
"maps"
"os"
"slices"
"strings"

"github.com/spf13/cobra"
"golang.org/x/exp/maps"

"github.com/algorand/go-algorand/crypto"
"github.com/algorand/go-algorand/data/account"
Expand Down Expand Up @@ -95,7 +96,7 @@
"betanet": mustConvertB64ToDigest("mFgazF+2uRS1tMiL9dsj01hJGySEmPN28B/TjjvpVW0="),
"devnet": mustConvertB64ToDigest("sC3P7e2SdbqKJK0tbiCdK9tdSpbe6XeCGKdoNzmlj0E="),
}
validNetworkList = maps.Keys(validNetworks)
validNetworkList = slices.Collect(maps.Keys(validNetworks))

Check warning on line 99 in cmd/algokey/keyreg.go

View check run for this annotation

Codecov / codecov/patch

cmd/algokey/keyreg.go#L99

Added line #L99 was not covered by tests
}

func mustConvertB64ToDigest(b64 string) (digest crypto.Digest) {
Expand Down
7 changes: 4 additions & 3 deletions cmd/catchpointdump/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,13 +214,14 @@
if err != nil {
return fileHeader, err
}
var balanceHash, spverHash crypto.Digest
balanceHash, spverHash, _, err = catchupAccessor.GetVerifyData(ctx)
var balanceHash, spverHash, onlineAccountsHash, onlineRoundParamsHash crypto.Digest
balanceHash, spverHash, onlineAccountsHash, onlineRoundParamsHash, _, err = catchupAccessor.GetVerifyData(ctx)

Check warning on line 218 in cmd/catchpointdump/file.go

View check run for this annotation

Codecov / codecov/patch

cmd/catchpointdump/file.go#L217-L218

Added lines #L217 - L218 were not covered by tests
if err != nil {
return fileHeader, err
}
fmt.Printf("accounts digest=%s, spver digest=%s\n\n", balanceHash, spverHash)
fmt.Printf("accounts digest=%s, spver digest=%s, onlineaccounts digest=%s onlineroundparams digest=%s\n\n",
balanceHash, spverHash, onlineAccountsHash, onlineRoundParamsHash)
}

Check warning on line 224 in cmd/catchpointdump/file.go

View check run for this annotation

Codecov / codecov/patch

cmd/catchpointdump/file.go#L222-L224

Added lines #L222 - L224 were not covered by tests
return fileHeader, nil
}
return fileHeader, err
Expand Down
2 changes: 1 addition & 1 deletion cmd/goal/account.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ import (
"net/http"
"os"
"path/filepath"
"slices"
"sort"
"strings"
"time"

"github.com/spf13/cobra"
"golang.org/x/exp/slices"

"github.com/algorand/go-algorand/cmd/util/datadir"
"github.com/algorand/go-algorand/config"
Expand Down
3 changes: 1 addition & 2 deletions cmd/goal/clerk.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,7 @@ func waitForCommit(client libgoal.Client, txid string, transactionLastValidRound
}

reportInfof(infoTxPending, txid, stat.LastRound)
// WaitForRound waits until round "stat.LastRound+1" is committed
stat, err = client.WaitForRound(stat.LastRound)
stat, err = client.WaitForRound(stat.LastRound + 1)
if err != nil {
return model.PendingTransactionResponse{}, fmt.Errorf(errorRequestFail, err)
}
Expand Down
11 changes: 6 additions & 5 deletions cmd/loadgenerator/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,22 +200,23 @@
time.Sleep(1 * time.Second)
continue
}
if isSpendRound(cfg, nodeStatus.LastRound) == spendingRound {
lastRound := nodeStatus.LastRound
if isSpendRound(cfg, lastRound) == spendingRound {

Check warning on line 204 in cmd/loadgenerator/main.go

View check run for this annotation

Codecov / codecov/patch

cmd/loadgenerator/main.go#L203-L204

Added lines #L203 - L204 were not covered by tests
// time to send transactions.
return
}
if spendingRound {
fmt.Printf("Last round %d, waiting for spending round %d\n", nodeStatus.LastRound, nextSpendRound(cfg, nodeStatus.LastRound))
fmt.Printf("Last round %d, waiting for spending round %d\n", lastRound, nextSpendRound(cfg, nodeStatus.LastRound))

Check warning on line 209 in cmd/loadgenerator/main.go

View check run for this annotation

Codecov / codecov/patch

cmd/loadgenerator/main.go#L209

Added line #L209 was not covered by tests
}
for {
// wait for the next round.
nodeStatus, err = restClient.WaitForBlock(basics.Round(nodeStatus.LastRound))
err = restClient.WaitForRoundWithTimeout(lastRound + 1)

Check warning on line 213 in cmd/loadgenerator/main.go

View check run for this annotation

Codecov / codecov/patch

cmd/loadgenerator/main.go#L213

Added line #L213 was not covered by tests
if err != nil {
fmt.Fprintf(os.Stderr, "unable to wait for next round node status : %v", err)
time.Sleep(1 * time.Second)
break
}
if isSpendRound(cfg, nodeStatus.LastRound) == spendingRound {
lastRound++
if isSpendRound(cfg, lastRound) == spendingRound {

Check warning on line 219 in cmd/loadgenerator/main.go

View check run for this annotation

Codecov / codecov/patch

cmd/loadgenerator/main.go#L218-L219

Added lines #L218 - L219 were not covered by tests
// time to send transactions.
return
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/opdoc/opdoc.go
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@
}

func main() {
const docVersion = uint64(10)
const docVersion = uint64(11)

Check warning on line 446 in cmd/opdoc/opdoc.go

View check run for this annotation

Codecov / codecov/patch

cmd/opdoc/opdoc.go#L446

Added line #L446 was not covered by tests

opGroups := make(map[string][]string, len(logic.OpSpecs))
for grp, names := range logic.OpGroups {
Expand Down
2 changes: 1 addition & 1 deletion cmd/tealdbg/local.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"fmt"
"io"
"log"
"slices"
"time"

"github.com/algorand/go-algorand/config"
Expand All @@ -28,7 +29,6 @@ import (
"github.com/algorand/go-algorand/data/transactions/logic"
"github.com/algorand/go-algorand/ledger/apply"
"github.com/algorand/go-algorand/protocol"
"golang.org/x/exp/slices"
)

func protoFromString(protoString string) (name string, proto config.ConsensusParams, err error) {
Expand Down
4 changes: 4 additions & 0 deletions cmd/tealdbg/localLedger.go
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,10 @@
}, nil
}

func (l *localLedger) GetKnockOfflineCandidates(basics.Round, config.ConsensusParams) (map[basics.Address]basics.OnlineAccountData, error) {
return nil, nil

Check warning on line 363 in cmd/tealdbg/localLedger.go

View check run for this annotation

Codecov / codecov/patch

cmd/tealdbg/localLedger.go#L362-L363

Added lines #L362 - L363 were not covered by tests
}

func (l *localLedger) OnlineCirculation(rnd basics.Round, voteRound basics.Round) (basics.MicroAlgos, error) {
// A constant is fine for tealdbg
return basics.Algos(1_000_000_000), nil // 1B
Expand Down
4 changes: 2 additions & 2 deletions components/mocks/mockCatchpointCatchupAccessor.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@
}

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

Check warning on line 75 in components/mocks/mockCatchpointCatchupAccessor.go

View check run for this annotation

Codecov / codecov/patch

components/mocks/mockCatchpointCatchupAccessor.go#L74-L75

Added lines #L74 - L75 were not covered by tests
}

// VerifyCatchpoint verifies that the catchpoint is valid by reconstructing the label.
Expand Down
Loading
Loading