Skip to content

Commit

Permalink
Merge pull request #4618 from Algo-devops-service/relstable3.10.0
Browse files Browse the repository at this point in the history
go-algorand 3.10.0-stable Release PR
  • Loading branch information
algojohnlee authored Oct 4, 2022
2 parents 921e8f6 + 2145c29 commit 9869cd9
Show file tree
Hide file tree
Showing 281 changed files with 23,504 additions and 7,381 deletions.
619 changes: 311 additions & 308 deletions .circleci/config.yml

Large diffs are not rendered by default.

21 changes: 15 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
name: "Build workflow"
name: "Build Windows"
on:
push:
branches:
- master
pull_request:
jobs:
build-test-windows:
build-windows:
runs-on: windows-2022
defaults:
run:
Expand All @@ -14,14 +17,20 @@ jobs:
update: true
path-type: inherit
- name: Check out code
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install golang
uses: actions/setup-go@v2
uses: actions/setup-go@v3
with:
go-version: '1.17.9'
- name: Build Test
go-version: "1.17.13"
- name: Restore libsodium from cache
id: cache-libsodium
uses: actions/cache@v3
with:
path: crypto/libs
key: libsodium-fork-v2-${{ runner.os }}-${{ hashFiles('crypto/libsodium-fork/**') }}
- name: Build
run: |
export ALGORAND_DEADLOCK=enable
export SKIP_GO_INSTALLATION=True
Expand Down
22 changes: 22 additions & 0 deletions .github/workflows/codegen_verification.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: "codegen verification"
on:
push:
branches:
- master
pull_request:
jobs:
codegen_verification:
runs-on: ubuntu-20.04
steps:
- name: Check out code
uses: actions/checkout@v3
with:
fetch-depth: 0
path: go-algorand
- name: Uninstall existing go installation
run: sudo apt-get -y -q purge golang-go
- name: Run codegen_verification.sh
run: |
export GOPATH="${GITHUB_WORKSPACE}/go"
cd go-algorand
scripts/travis/codegen_verification.sh
12 changes: 8 additions & 4 deletions .github/workflows/reviewdog.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
name: "ReviewDog workflow"
on:
push:
branches:
- master
pull_request:
jobs:
# Blocking Errors Section
Expand All @@ -18,12 +21,13 @@ jobs:
- name: reviewdog-golangci-lint
uses: reviewdog/action-golangci-lint@v2
with:
golangci_lint_version: "v1.41.1"
golangci_lint_version: "v1.47.3"
golangci_lint_flags: "-c .golangci.yml --allow-parallel-runners"
reporter: "github-pr-review"
reporter: "github-pr-check"
tool_name: "Lint Errors"
level: "error"
fail_on_error: true
filter_mode: "nofilter"
# Non-Blocking Warnings Section
reviewdog-warnings:
runs-on: ubuntu-latest
Expand All @@ -44,7 +48,7 @@ jobs:
- name: Install specific golang
uses: actions/setup-go@v2
with:
go-version: '1.17.9'
go-version: '1.17.13'
- name: Create folders for golangci-lint
run: mkdir -p cicdtmp/golangci-lint
- name: Check if custom golangci-lint is already built
Expand All @@ -59,7 +63,7 @@ jobs:
run: |
cd cicdtmp/golangci-lint
git clone https://github.com/golangci/golangci-lint.git .
git checkout tags/v1.41.1
git checkout tags/v1.47.3
CGO_ENABLED=true go build -trimpath -o golangci-lint-cgo ./cmd/golangci-lint
./golangci-lint-cgo --version
cd ../../
Expand Down
8 changes: 2 additions & 6 deletions .golangci-warnings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,12 @@ run:
linters:
disable-all: true
enable:
- staticcheck
- deadcode
- partitiontest
- structcheck
- typecheck
- varcheck
- deadcode
- gosimple
- unused
- partitiontest


linters-settings:
Expand Down Expand Up @@ -41,8 +39,6 @@ issues:
exclude:
# ignore govet false positive fixed in https://github.com/golang/go/issues/45043
- "sigchanyzer: misuse of unbuffered os.Signal channel as argument to signal.Notify"
# ignore golint false positive fixed in https://github.com/golang/lint/pull/487
- "exported method (.*).Unwrap` should have comment or be unexported"
# ignore issues about the way we use _struct fields to define encoding settings
- "`_struct` is unused"

Expand Down
45 changes: 40 additions & 5 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,44 @@
run:
timeout: 5m
tests: false
tests: true

linters:
# default: deadcode, errcheck, gosimple, govet, ineffassign, staticcheck, typecheck, unused, varcheck
disable-all: true
enable:
- errcheck
- gofmt
- golint
- gosimple
- govet
- ineffassign
- misspell
- nolintlint
- revive
- staticcheck
- typecheck

severity:
default-severity: error

linters-settings:
nolintlint:
# require naming a specific linter X using //nolint:X
require-specific: true
# require comments like "//nolint:errcheck // Explanation of why we are ignoring linter here..."
require-explanation: true
errcheck:
exclude-functions:
# data/transactions/logic/assembler.go uses ops.error, warn, to append log messages: OK to ignore for this case
- (*github.com/algorand/go-algorand/data/transactions/logic.OpStream).errorf
- (*github.com/algorand/go-algorand/data/transactions/logic.OpStream).error
- (*github.com/algorand/go-algorand/data/transactions/logic.OpStream).warnf
- (*github.com/algorand/go-algorand/data/transactions/logic.OpStream).warn

issues:
# use these new lint checks on code since #2574
new-from-rev: eb019291beed556ec6ac1ceb4a15114ce4df0c57
# Work our way back over time to be clean against all these
# checkers. If you'd like to contribute, raise the number after ~,
# run the linter and dig in.
new-from-rev: eb019291beed556ec6ac1ceb4a15114ce4df0c57~25

# Disable default exclude rules listed in `golangci-lint run --help` (selectively re-enable some below)
exclude-use-default: false
Expand All @@ -41,14 +62,28 @@ issues:
- Error return value of .((os\.)?std(out|err)\..*|.*Close|.*Flush|os\.Remove(All)?|.*print(f|ln)?|os\.(Un)?Setenv). is not checked
# "EXC0005 staticcheck: Developers tend to write in C-style with an explicit 'break' in a 'switch', so it's ok to ignore"
- ineffective break statement. Did you mean to break out of the outer loop
# revive: irrelevant error about naming
- "var-naming: don't use leading k in Go names"

exclude-rules:
- path: _test\.go
linters:
- errcheck
- gofmt
- gosimple
- govet
- ineffassign
- misspell
- nolintlint
# - revive
- staticcheck
- typecheck
# Add all linters here -- Comment this block out for testing linters
- path: test/linttest/lintissues\.go
linters:
- errcheck
- gofmt
- golint
- revive
- govet
- ineffassign
- misspell
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Again, if you have a patch for a critical security vulnerability, please use our

For Go code we use the [Golang guidelines defined here](https://golang.org/doc/effective_go.html).
* Code must adhere to the official Go formatting guidelines (i.e. uses gofmt).
* We use **gofmt** and **golint**. Also make sure to run `make sanity` and `make generate` before opening a pull request.
* We use **gofmt** and **golangci-lint**. Also make sure to run `make sanity` and `make generate` before opening a pull request.
* Code must be documented adhering to the official Go commentary guidelines.

For JavaScript code we use the [MDN formatting rules](https://developer.mozilla.org/en-US/docs/MDN/Contribute/Guidelines/Code_guidelines/JavaScript).
Expand Down
10 changes: 3 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ else
export GOPATH := $(shell go env GOPATH)
GOPATH1 := $(firstword $(subst :, ,$(GOPATH)))
endif
export GOPROXY := direct
SRCPATH := $(shell pwd)
ARCH := $(shell ./scripts/archtype.sh)
OS_TYPE := $(shell ./scripts/ostype.sh)
Expand Down Expand Up @@ -100,15 +99,12 @@ fix: build
$(GOPATH1)/bin/algofix */

lint: deps
$(GOPATH1)/bin/golint ./...

vet:
go vet ./...
$(GOPATH1)/bin/golangci-lint run -c .golangci.yml

check_shell:
find . -type f -name "*.sh" -exec shellcheck {} +

sanity: vet fix lint fmt
sanity: fix lint fmt

cover:
go test $(GOTAGS) -coverprofile=cover.out $(UNIT_TEST_SOURCES)
Expand Down Expand Up @@ -331,7 +327,7 @@ dump: $(addprefix gen/,$(addsuffix /genesis.dump, $(NETWORKS)))
install: build
scripts/dev_install.sh -p $(GOPATH1)/bin

.PHONY: default fmt vet lint check_shell sanity cover prof deps build test fulltest shorttest clean cleango deploy node_exporter install %gen gen NONGO_BIN check-go-version rebuild_swagger
.PHONY: default fmt lint check_shell sanity cover prof deps build test fulltest shorttest clean cleango deploy node_exporter install %gen gen NONGO_BIN check-go-version rebuild_swagger

###### TARGETS FOR CICD PROCESS ######
include ./scripts/release/mule/Makefile.mule
Expand Down
2 changes: 2 additions & 0 deletions agreement/actions.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ func (a ensureAction) do(ctx context.Context, s *Service) {
Hash: a.Certificate.Proposal.BlockDigest.String(),
Round: uint64(a.Certificate.Round),
ValidatedAt: a.Payload.validatedAt,
ReceivedAt: a.Payload.receivedAt,
PreValidated: true,
PropBufLen: uint64(len(s.demux.rawProposals)),
VoteBufLen: uint64(len(s.demux.rawVotes)),
Expand All @@ -250,6 +251,7 @@ func (a ensureAction) do(ctx context.Context, s *Service) {
Hash: a.Certificate.Proposal.BlockDigest.String(),
Round: uint64(a.Certificate.Round),
ValidatedAt: a.Payload.validatedAt,
ReceivedAt: a.Payload.receivedAt,
PreValidated: false,
PropBufLen: uint64(len(s.demux.rawProposals)),
VoteBufLen: uint64(len(s.demux.rawVotes)),
Expand Down
5 changes: 4 additions & 1 deletion agreement/demux.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,11 @@ func (d *demux) next(s *Service, deadline time.Duration, fastDeadline time.Durat
proto, err := d.ledger.ConsensusVersion(ParamsRound(e.ConsensusRound()))
e = e.AttachConsensusVersion(ConsensusVersionView{Err: makeSerErr(err), Version: proto})

if e.t() == payloadVerified {
switch e.t() {
case payloadVerified:
e = e.(messageEvent).AttachValidatedAt(s.Clock.Since())
case payloadPresent:
e = e.(messageEvent).AttachReceivedAt(s.Clock.Since())
}
}()

Expand Down
5 changes: 5 additions & 0 deletions agreement/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -938,3 +938,8 @@ func (e messageEvent) AttachValidatedAt(d time.Duration) messageEvent {
e.Input.Proposal.validatedAt = d
return e
}

func (e messageEvent) AttachReceivedAt(d time.Duration) messageEvent {
e.Input.Proposal.receivedAt = d
return e
}
3 changes: 1 addition & 2 deletions agreement/fuzzer/tests_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import (
"encoding/json"
"flag"
"fmt"
"io/ioutil"
"log"
"math"
"math/rand"
Expand Down Expand Up @@ -440,7 +439,7 @@ func TestFuzzer(t *testing.T) {
t.Run(testName, func(t *testing.T) {
partitiontest.PartitionTest(t) // Check if this expect test should by run, may SKIP
jsonFilename := jsonFiles[testName]
jsonBytes, err := ioutil.ReadFile(jsonFilename)
jsonBytes, err := os.ReadFile(jsonFilename)
require.NoError(t, err)
var fuzzerTest FuzzerTestFile
err = json.Unmarshal(jsonBytes, &fuzzerTest)
Expand Down
Loading

0 comments on commit 9869cd9

Please sign in to comment.