Skip to content

Commit c1d2eb7

Browse files
authored
Merge pull request #2813 from Algo-devops-service/relstable2.10.1
go-algorand 2.10.1-stable
2 parents 7b53f6f + d1aca92 commit c1d2eb7

File tree

314 files changed

+8769
-1546
lines changed

Some content is hidden

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

314 files changed

+8769
-1546
lines changed

.circleci/config.yml

Lines changed: 702 additions & 3 deletions
Large diffs are not rendered by default.

.github/ISSUE_TEMPLATE/algorand-engineering-team-issue-template.md

Lines changed: 0 additions & 21 deletions
This file was deleted.

.github/ISSUE_TEMPLATE/feature_request.md

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,20 @@ about: Suggestions for how we can improve the algorand platform.
44
title: ''
55
labels: new-feature-request
66
assignees: ''
7-
87
---
98

10-
## Is your feature request related to a problem? Please describe.
9+
## Problem
10+
11+
<!-- What is the problem that we’re trying to solve? -->
12+
13+
## Solution
1114

12-
<!-- A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] -->
15+
<!-- Do you have a potential/suggested solution? Document more than one if possible. -->
1316

14-
## Describe the solution you'd like.
17+
## Dependencies
1518

16-
<!-- A clear and concise description of what you want to happen. -->
19+
<!-- Does the solution have any team or design dependencies? -->
1720

18-
## Additional context.
21+
## Urgency
1922

20-
<!-- Add any other context or screenshots about the feature request here. -->
23+
<!-- What is the urgency here and why? -->

.github/workflows/reviewdog.yml

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
name: "ReviewDog workflow"
2+
on:
3+
pull_request:
4+
jobs:
5+
# Blocking Errors Section
6+
reviewdog-errors:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- name: Check out code into the Go module directory
10+
uses: actions/checkout@v2
11+
with:
12+
fetch-depth: 0 # required for new-from-rev option in .golangci.yml
13+
- name: Install libraries
14+
run: sudo apt-get -y -q install libboost-math-dev
15+
# move go out of the way temporarily to avoid "go list ./..." from installing modules
16+
- name: Make libsodium.a
17+
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
18+
- name: reviewdog-golangci-lint
19+
uses: reviewdog/action-golangci-lint@v2
20+
with:
21+
golangci_lint_version: "v1.41.1"
22+
golangci_lint_flags: "-c .golangci.yml --allow-parallel-runners"
23+
reporter: "github-pr-review"
24+
tool_name: "Lint Errors"
25+
level: "error"
26+
fail_on_error: true
27+
# Non-Blocking Warnings Section
28+
reviewdog-warnings:
29+
runs-on: ubuntu-latest
30+
steps:
31+
- name: Check out code into the Go module directory
32+
uses: actions/checkout@v2
33+
with:
34+
fetch-depth: 0 # required for new-from-rev option in .golangci.yml
35+
- name: Install libraries
36+
run: sudo apt-get -y -q install libboost-math-dev
37+
# move go out of the way temporarily to avoid "go list ./..." from installing modules
38+
- name: Make libsodium.a
39+
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
40+
- name: Add bin to PATH
41+
run: |
42+
echo "$GITHUB_WORKSPACE/bin" >> $GITHUB_PATH
43+
echo "$RUNNER_WORKSPACE/$(basename $GITHUB_REPOSITORY)/bin" >> $GITHUB_PATH
44+
- name: Install specific golang
45+
uses: actions/setup-go@v2
46+
with:
47+
go-version: '1.16.6'
48+
- name: Create folders for golangci-lint
49+
run: mkdir -p cicdtmp/golangci-lint
50+
- name: Check if custom golangci-lint is already built
51+
id: cache-golangci-lint
52+
uses: actions/cache@v2
53+
with:
54+
path: cicdtmp/golangci-lint/golangci-lint-cgo
55+
key: cicd-golangci-lint-cgo-v0.0.1
56+
57+
- name: Build custom golangci-lint with CGO_ENABLED
58+
if: steps.cache-golangci-lint.outputs.cache-hit != 'true'
59+
run: |
60+
cd cicdtmp/golangci-lint
61+
git clone https://github.com/golangci/golangci-lint.git .
62+
git checkout tags/v1.41.1
63+
CGO_ENABLED=true go build -trimpath -o golangci-lint-cgo ./cmd/golangci-lint
64+
./golangci-lint-cgo --version
65+
cd ../../
66+
- name: Install reviewdog
67+
run: |
68+
curl -sfL https://raw.githubusercontent.com/reviewdog/reviewdog/v0.13.0/install.sh | sh -s
69+
reviewdog --version
70+
- name: Build custom linters
71+
run: |
72+
cd cmd/partitiontest_linter/
73+
CGO_ENABLED=true go build -buildmode=plugin -trimpath plugin/plugin.go
74+
cd ../../
75+
ls -la cmd/partitiontest_linter/
76+
- name: Run golangci-lint with reviewdog
77+
env:
78+
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
79+
run: >
80+
./cicdtmp/golangci-lint/golangci-lint-cgo run
81+
--out-format line-number
82+
-c .golangci-warnings.yml
83+
--allow-parallel-runners
84+
| reviewdog
85+
-f=golangci-lint
86+
-name="Lint Warnings"
87+
-reporter=github-check
88+
-filter-mode=added
89+
-fail-on-error=false
90+
-level=warning

.golangci-warnings.yml

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
run:
2+
timeout: 5m
3+
tests: true
4+
5+
linters:
6+
disable-all: true
7+
enable:
8+
- staticcheck
9+
- structcheck
10+
- typecheck
11+
- varcheck
12+
- deadcode
13+
- gosimple
14+
- unused
15+
- partitiontest
16+
17+
18+
linters-settings:
19+
custom:
20+
partitiontest:
21+
path: cmd/partitiontest_linter/plugin.so
22+
description: This custom linter checks files that end in '_test.go', specifically functions that start with 'Test' and have testing argument, for a line 'partitiontest.ParitionTest(<testing arg>)'
23+
original-url: github.com/algorand/go-algorand/cmd/partitiontest_linter
24+
25+
severity:
26+
default-severity: warning
27+
28+
issues:
29+
# use these new lint checks on code since #2574
30+
new-from-rev: eb019291beed556ec6ac1ceb4a15114ce4df0c57
31+
32+
# Disable default exclude rules listed in `golangci-lint run --help` (selectively re-enable some below)
33+
exclude-use-default: false
34+
35+
# Maximum issues count per one linter. Set to 0 to disable. Default is 50.
36+
max-issues-per-linter: 0
37+
38+
# Maximum count of issues with the same text. Set to 0 to disable. Default is 3.
39+
max-same-issues: 0
40+
41+
exclude:
42+
# ignore govet false positive fixed in https://github.com/golang/go/issues/45043
43+
- "sigchanyzer: misuse of unbuffered os.Signal channel as argument to signal.Notify"
44+
# ignore golint false positive fixed in https://github.com/golang/lint/pull/487
45+
- "exported method (.*).Unwrap` should have comment or be unexported"
46+
# ignore issues about the way we use _struct fields to define encoding settings
47+
- "`_struct` is unused"
48+
49+
# Enable some golangci-lint default exception rules:
50+
# "EXC0001 errcheck: Almost all programs ignore errors on these functions and in most cases it's ok"
51+
- Error return value of .((os\.)?std(out|err)\..*|.*Close|.*Flush|os\.Remove(All)?|.*print(f|ln)?|os\.(Un)?Setenv). is not checked
52+
# "EXC0005 staticcheck: Developers tend to write in C-style with an explicit 'break' in a 'switch', so it's ok to ignore"
53+
- ineffective break statement. Did you mean to break out of the outer loop
54+
55+
exclude-rules:
56+
# be more lenient with test code
57+
- path: _test\.go
58+
linters:
59+
- staticcheck
60+
- structcheck
61+
- typecheck
62+
- varcheck
63+
- deadcode
64+
- gosimple
65+
- unused
66+
# Add all linters here -- Comment this block out for testing linters
67+
- path: test/linttest/lintissues\.go
68+
linters:
69+
- staticcheck
70+
- structcheck
71+
- typecheck
72+
- varcheck
73+
- deadcode
74+
- gosimple
75+
- unused
76+
- partitiontest

.golangci.yml

Lines changed: 38 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,35 +3,52 @@ run:
33
tests: false
44

55
linters:
6+
disable-all: true
67
enable:
8+
- errcheck
9+
- gofmt
710
- golint
8-
- misspell
911
- govet
10-
11-
disable:
12-
- deadcode
13-
- errcheck
14-
- gosimple
1512
- ineffassign
16-
- staticcheck
17-
- structcheck
18-
- unused
19-
- varcheck
20-
21-
linters-settings:
22-
# govet:
23-
# check-shadowing: true
13+
- misspell
14+
15+
severity:
16+
default-severity: error
2417

2518
issues:
26-
# don't use default exclude rules listed in `golangci-lint run --help`
19+
# use these new lint checks on code since #2574
20+
new-from-rev: eb019291beed556ec6ac1ceb4a15114ce4df0c57
21+
22+
# Disable default exclude rules listed in `golangci-lint run --help` (selectively re-enable some below)
2723
exclude-use-default: false
2824

29-
exclude-rules:
25+
# Maximum issues count per one linter. Set to 0 to disable. Default is 50.
26+
max-issues-per-linter: 0
27+
28+
# Maximum count of issues with the same text. Set to 0 to disable. Default is 3.
29+
max-same-issues: 0
30+
31+
exclude:
3032
# ignore govet false positive fixed in https://github.com/golang/go/issues/45043
31-
- linters:
32-
- govet
33-
text: "sigchanyzer: misuse of unbuffered os.Signal channel as argument to signal.Notify"
33+
- "sigchanyzer: misuse of unbuffered os.Signal channel as argument to signal.Notify"
3434
# ignore golint false positive fixed in https://github.com/golang/lint/pull/487
35-
- linters:
35+
- "exported method (.*).Unwrap` should have comment or be unexported"
36+
# ignore issues about the way we use _struct fields to define encoding settings
37+
- "`_struct` is unused"
38+
39+
# Enable some golangci-lint default exception rules:
40+
# "EXC0001 errcheck: Almost all programs ignore errors on these functions and in most cases it's ok"
41+
- Error return value of .((os\.)?std(out|err)\..*|.*Close|.*Flush|os\.Remove(All)?|.*print(f|ln)?|os\.(Un)?Setenv). is not checked
42+
# "EXC0005 staticcheck: Developers tend to write in C-style with an explicit 'break' in a 'switch', so it's ok to ignore"
43+
- ineffective break statement. Did you mean to break out of the outer loop
44+
45+
exclude-rules:
46+
# Add all linters here -- Comment this block out for testing linters
47+
- path: test/linttest/lintissues\.go
48+
linters:
49+
- errcheck
50+
- gofmt
3651
- golint
37-
text: "exported method (.*).Unwrap` should have comment or be unexported"
52+
- govet
53+
- ineffassign
54+
- misspell

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,8 +217,8 @@ before_cache:
217217
esac
218218
docker save -o $HOME/docker_cache/images.tar $(docker images -a -q)
219219
220-
after_success:
221-
- scripts/travis/upload_coverage.sh || true
220+
#after_success:
221+
# - scripts/travis/upload_coverage.sh || true
222222

223223
addons:
224224
apt:

Makefile

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ BUILDBRANCH := $(shell ./scripts/compute_branch.sh)
2323
CHANNEL ?= $(shell ./scripts/compute_branch_channel.sh $(BUILDBRANCH))
2424
DEFAULTNETWORK ?= $(shell ./scripts/compute_branch_network.sh $(BUILDBRANCH))
2525
DEFAULT_DEADLOCK ?= $(shell ./scripts/compute_branch_deadlock_default.sh $(BUILDBRANCH))
26+
export GOCACHE=$(SRCPATH)/tmp/go-cache
2627

2728
GOTAGSLIST := sqlite_unlock_notify sqlite_omit_load_extension
2829

@@ -75,7 +76,7 @@ GOLDFLAGS := $(GOLDFLAGS_BASE) \
7576
UNIT_TEST_SOURCES := $(sort $(shell GOPATH=$(GOPATH) && GO111MODULE=off && go list ./... | grep -v /go-algorand/test/ ))
7677
ALGOD_API_PACKAGES := $(sort $(shell GOPATH=$(GOPATH) && GO111MODULE=off && cd daemon/algod/api; go list ./... ))
7778

78-
MSGP_GENERATE := ./protocol ./crypto ./crypto/compactcert ./data/basics ./data/transactions ./data/committee ./data/bookkeeping ./data/hashable ./agreement ./rpcs ./node ./ledger ./ledger/ledgercore ./compactcert
79+
MSGP_GENERATE := ./protocol ./protocol/test ./crypto ./crypto/compactcert ./data/basics ./data/transactions ./data/committee ./data/bookkeeping ./data/hashable ./agreement ./rpcs ./node ./ledger ./ledger/ledgercore ./compactcert
7980

8081
default: build
8182

@@ -203,9 +204,9 @@ build: buildsrc
203204
# to cache binaries from time to time on empty NFS
204205
# dirs
205206
buildsrc: check-go-version crypto/libs/$(OS_TYPE)/$(ARCH)/lib/libsodium.a node_exporter NONGO_BIN
206-
mkdir -p tmp/go-cache && \
207-
touch tmp/go-cache/file.txt && \
208-
GOCACHE=$(SRCPATH)/tmp/go-cache go install $(GOTRIMPATH) $(GOTAGS) $(GOBUILDMODE) -ldflags="$(GOLDFLAGS)" ./...
207+
mkdir -p "${GOCACHE}" && \
208+
touch "${GOCACHE}"/file.txt && \
209+
go install $(GOTRIMPATH) $(GOTAGS) $(GOBUILDMODE) -ldflags="$(GOLDFLAGS)" ./...
209210

210211
check-go-version:
211212
./scripts/check_golang_version.sh build
@@ -321,3 +322,7 @@ include ./scripts/release/mule/Makefile.mule
321322

322323
archive:
323324
aws s3 cp tmp/node_pkgs s3://algorand-internal/channel/$(CHANNEL)/$(FULLBUILDNUMBER) --recursive --exclude "*" --include "*$(FULLBUILDNUMBER)*"
325+
326+
build_custom_linters:
327+
cd $(SRCPATH)/cmd/partitiontest_linter/ && go build -buildmode=plugin -trimpath plugin/plugin.go && ls plugin.so
328+
cd $(SRCPATH)

agreement/bundle_test.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,13 @@ import (
2929
"github.com/algorand/go-algorand/data/committee"
3030
"github.com/algorand/go-algorand/logging"
3131
"github.com/algorand/go-algorand/protocol"
32+
"github.com/algorand/go-algorand/test/partitiontest"
3233
)
3334

3435
// Test Bundle Creation
3536
func TestBundleCreation(t *testing.T) {
37+
partitiontest.PartitionTest(t)
38+
3639
ledger, addresses, vrfSecrets, otSecrets := readOnlyFixture100()
3740
round := ledger.NextRound()
3841
period := period(0)
@@ -68,6 +71,8 @@ func TestBundleCreation(t *testing.T) {
6871

6972
// Test Bundle validation with Zero Votes
7073
func TestBundleCreationWithZeroVotes(t *testing.T) {
74+
partitiontest.PartitionTest(t)
75+
7176
//ledger, addresses, vrfSecrets, otSecrets := readOnlyFixture100()
7277
ledger, _, _, _ := readOnlyFixture100()
7378

@@ -105,6 +110,8 @@ func makeBundlePanicWrapper(t *testing.T, message string, proposal proposalValue
105110

106111
//Test Bundle Creation with Validation for duplicate votes from same sender
107112
func TestBundleCreationWithVotesFromSameAddress(t *testing.T) {
113+
partitiontest.PartitionTest(t)
114+
108115
ledger, addresses, vrfSecrets, otSecrets := readOnlyFixture10()
109116
round := ledger.NextRound()
110117
period := period(0)
@@ -168,6 +175,8 @@ func TestBundleCreationWithVotesFromSameAddress(t *testing.T) {
168175

169176
//Test Bundle Creation with Validation
170177
func TestBundleCreationWithEquivocationVotes(t *testing.T) {
178+
partitiontest.PartitionTest(t)
179+
171180
ledger, addresses, vrfSecrets, otSecrets := readOnlyFixture10()
172181
round := ledger.NextRound()
173182
period := period(0)
@@ -276,6 +285,8 @@ func TestBundleCreationWithEquivocationVotes(t *testing.T) {
276285

277286
//Test Bundle Creation with Validation
278287
func TestBundleCertificationWithEquivocationVotes(t *testing.T) {
288+
partitiontest.PartitionTest(t)
289+
279290
ledger, addresses, vrfSecrets, otSecrets := readOnlyFixture10()
280291
round := ledger.NextRound()
281292
period := period(0)
@@ -349,6 +360,8 @@ func certificatePanicWrapper(t *testing.T, message string, ub unauthenticatedBun
349360

350361
// Test Bundle Creation with Equivocation Votes under Quorum
351362
func TestBundleCreationWithEquivocationVotesUnderQuorum(t *testing.T) {
363+
partitiontest.PartitionTest(t)
364+
352365
ledger, addresses, vrfSecrets, otSecrets := readOnlyFixture100()
353366
round := ledger.NextRound()
354367
period := period(0)

0 commit comments

Comments
 (0)