Skip to content

Commit c845f99

Browse files
authored
Merge pull request #1347 from onetechnical/onetechnical/relbeta2.1.0
Onetechnical/relbeta2.1.0
2 parents ea9f684 + 3b6c243 commit c845f99

File tree

446 files changed

+58042
-8566
lines changed

Some content is hidden

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

446 files changed

+58042
-8566
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -61,3 +61,5 @@ data/transactions/logic/*.md
6161
# Folder for collecting release assets
6262
assets
6363

64+
# test binaries
65+
*.test

.travis.yml

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ go:
33
- "1.12"
44
go_import_path: github.com/algorand/go-algorand
55
language: go
6-
sudo: required
76

87
# Don't build tags
98
if: tag IS blank

Makefile

+25-8
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
11
export GOPATH := $(shell go env GOPATH)
22
GOPATH1 := $(firstword $(subst :, ,$(GOPATH)))
33
export GO111MODULE := on
4-
export GOPROXY := https://gocenter.io
4+
export GOPROXY := direct
55

66
UNAME := $(shell uname)
77
SRCPATH := $(shell pwd)
88
ARCH := $(shell ./scripts/archtype.sh)
99
OS_TYPE := $(shell ./scripts/ostype.sh)
10+
S3_RELEASE_BUCKET = $$S3_RELEASE_BUCKET
1011

1112
# If build number already set, use it - to ensure same build number across multiple platforms being built
1213
BUILDNUMBER ?= $(shell ./scripts/compute_build_number.sh)
1314
COMMITHASH := $(shell ./scripts/compute_build_commit.sh)
14-
BUILDBRANCH ?= $(shell ./scripts/compute_branch.sh)
15-
BUILDCHANNEL ?= $(shell ./scripts/compute_branch_channel.sh $(BUILDBRANCH))
15+
BUILDBRANCH := $(shell ./scripts/compute_branch.sh)
16+
CHANNEL ?= $(shell ./scripts/compute_branch_channel.sh $(BUILDBRANCH))
1617
DEFAULTNETWORK ?= $(shell ./scripts/compute_branch_network.sh $(BUILDBRANCH))
1718
DEFAULT_DEADLOCK ?= $(shell ./scripts/compute_branch_deadlock_default.sh $(BUILDBRANCH))
1819

@@ -47,7 +48,7 @@ GOLDFLAGS_BASE := -X github.com/algorand/go-algorand/config.BuildNumber=$(BUILD
4748
-extldflags \"$(EXTLDFLAGS)\"
4849

4950
GOLDFLAGS := $(GOLDFLAGS_BASE) \
50-
-X github.com/algorand/go-algorand/config.Channel=$(BUILDCHANNEL)
51+
-X github.com/algorand/go-algorand/config.Channel=$(CHANNEL)
5152

5253
UNIT_TEST_SOURCES := $(sort $(shell GO111MODULE=off go list ./... | grep -v /go-algorand/test/ ))
5354
ALGOD_API_PACKAGES := $(sort $(shell GO111MODULE=off cd daemon/algod/api; go list ./... ))
@@ -155,8 +156,14 @@ $(KMD_API_SWAGGER_INJECT): $(KMD_API_SWAGGER_SPEC) $(KMD_API_SWAGGER_SPEC).valid
155156

156157
build: buildsrc gen
157158

159+
# We're making an empty file in the go-cache dir to
160+
# get around a bug in go build where it will fail
161+
# to cache binaries from time to time on empty NFS
162+
# dirs
158163
buildsrc: crypto/libs/$(OS_TYPE)/$(ARCH)/lib/libsodium.a node_exporter NONGO_BIN deps $(ALGOD_API_SWAGGER_INJECT) $(KMD_API_SWAGGER_INJECT)
159-
go install $(GOTRIMPATH) $(GOTAGS) $(GOBUILDMODE) -ldflags="$(GOLDFLAGS)" ./...
164+
mkdir -p tmp/go-cache && \
165+
touch tmp/go-cache/file.txt && \
166+
GOCACHE=$(SRCPATH)/tmp/go-cache go install $(GOTRIMPATH) $(GOTAGS) $(GOBUILDMODE) -ldflags="$(GOLDFLAGS)" ./...
160167

161168
SOURCES_RACE := github.com/algorand/go-algorand/cmd/kmd
162169

@@ -190,13 +197,13 @@ test: build
190197

191198
fulltest: build-race
192199
for PACKAGE_DIRECTORY in $(UNIT_TEST_SOURCES) ; do \
193-
go test $(GOTAGS) -timeout 2000s -race $$PACKAGE_DIRECTORY; \
200+
go test $(GOTAGS) -timeout 2500s -race $$PACKAGE_DIRECTORY; \
194201
done
195202

196203
shorttest: build-race $(addprefix short_test_target_, $(UNIT_TEST_SOURCES))
197204

198205
$(addprefix short_test_target_, $(UNIT_TEST_SOURCES)): build
199-
@go test $(GOTAGS) -short -timeout 2000s -race $(subst short_test_target_,,$@)
206+
@go test $(GOTAGS) -short -timeout 2500s -race $(subst short_test_target_,,$@)
200207

201208
integration: build-race
202209
./test/scripts/run_integration_tests.sh
@@ -233,7 +240,10 @@ node_exporter: $(GOPATH1)/bin/node_exporter
233240
# The file is was taken from the S3 cloud and it traditionally stored at
234241
# /travis-build-artifacts-us-ea-1.algorand.network/algorand/node_exporter/latest/node_exporter-stable-linux-x86_64.tar.gz
235242
$(GOPATH1)/bin/node_exporter:
236-
tar -xzvf installer/external/node_exporter-stable-$(shell ./scripts/ostype.sh)-$(shell uname -m | tr '[:upper:]' '[:lower:]').tar.gz -C $(GOPATH1)/bin
243+
mkdir -p $(GOPATH1)/bin && \
244+
cd $(GOPATH1)/bin && \
245+
tar -xzvf $(SRCPATH)/installer/external/node_exporter-stable-$(shell ./scripts/ostype.sh)-$(shell uname -m | tr '[:upper:]' '[:lower:]').tar.gz && \
246+
cd -
237247

238248
# deploy
239249

@@ -279,3 +289,10 @@ install: build
279289
###### TARGETS FOR CICD PROCESS ######
280290
include ./scripts/release/mule/Makefile.mule
281291

292+
SUPPORTED_ARCHIVE_OS_ARCH = linux/amd64 linux/arm64 linux/arm darwin/amd64
293+
294+
archive:
295+
CHANNEL=$(CHANNEL) \
296+
PATH=$(SRCPATH)/tmp/node_pkgs/$(OS_TYPE)/$(ARCH)/bin:$${PATH} \
297+
scripts/upload_version.sh $(CHANNEL) $(SRCPATH)/tmp/node_pkgs $(S3_RELEASE_BUCKET)
298+

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ about using and installing the algorand platform.
1414

1515
## Building from source ##
1616

17-
Development is done using the [Go Programming Language](https://golang.org/)
18-
version 1.12.x, and this document assumes that you have a functioning
17+
Development is done using the [Go Programming Language](https://golang.org/).
18+
The version of go is specified in the project's [go.mod](go.mod) file. This document assumes that you have a functioning
1919
environment setup. If you need assistance setting up an environment please visit
2020
the [official Go documentation website](https://golang.org/doc/).
2121

agreement/msgp_gen.go

+162
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

agreement/msgp_gen_test.go

+2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

agreement/persistence.go

+4-5
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
package agreement
1818

19-
//go:generate dbgen -i agree.sql -p agreement -n agree -o agreeInstall.go
2019
import (
2120
"context"
2221
"database/sql"
@@ -74,7 +73,7 @@ func persist(log serviceLogger, crash db.Accessor, Round basics.Round, Period pe
7473
log.with(logEvent).Info("persisted state to the database")
7574
}()
7675

77-
err = crash.Atomic(func(tx *sql.Tx) error {
76+
err = crash.Atomic(func(ctx context.Context, tx *sql.Tx) error {
7877
_, err := tx.Exec("insert or replace into Service (rowid, data) values (1, ?)", raw)
7978
return err
8079
})
@@ -92,7 +91,7 @@ func persist(log serviceLogger, crash db.Accessor, Round basics.Round, Period pe
9291
func reset(log logging.Logger, crash db.Accessor) (err error) {
9392
logging.Base().Infof("reset (agreement): resetting crash state")
9493

95-
err = crash.Atomic(func(tx *sql.Tx) (res error) {
94+
err = crash.Atomic(func(ctx context.Context, tx *sql.Tx) (res error) {
9695
// we could not retrieve our state, so wipe it
9796
_, err := tx.Exec("delete from Service")
9897
if err != nil {
@@ -115,11 +114,11 @@ func restore(log logging.Logger, crash db.Accessor) (raw []byte, err error) {
115114
}
116115
}()
117116

118-
crash.Atomic(func(tx *sql.Tx) error {
117+
crash.Atomic(func(ctx context.Context, tx *sql.Tx) error {
119118
return agreeInstallDatabase(tx)
120119
}) // ignore error
121120

122-
err = crash.Atomic(func(tx *sql.Tx) (res error) {
121+
err = crash.Atomic(func(ctx context.Context, tx *sql.Tx) (res error) {
123122
var reset bool
124123
defer func() {
125124
if !reset {

agreement/persistence_test.go

+4-3
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
package agreement
1818

1919
import (
20+
"context"
2021
"database/sql"
2122
"testing"
2223
"time"
@@ -85,7 +86,7 @@ func TestAgreementPersistence(t *testing.T) {
8586
require.NoError(t, err)
8687
defer accessor.Close()
8788

88-
accessor.Atomic(func(tx *sql.Tx) error {
89+
accessor.Atomic(func(ctx context.Context, tx *sql.Tx) error {
8990
return agreeInstallDatabase(tx)
9091
}) // ignore error
9192

@@ -112,7 +113,7 @@ func BenchmarkAgreementPersistence(b *testing.B) {
112113
accessor, _ := db.MakeAccessor(b.Name()+"_crash.db", false, true)
113114
defer accessor.Close()
114115

115-
accessor.Atomic(func(tx *sql.Tx) error {
116+
accessor.Atomic(func(ctx context.Context, tx *sql.Tx) error {
116117
return agreeInstallDatabase(tx)
117118
}) // ignore error
118119

@@ -138,7 +139,7 @@ func BenchmarkAgreementPersistenceRecovery(b *testing.B) {
138139
accessor, _ := db.MakeAccessor(b.Name()+"_crash.db", false, true)
139140
defer accessor.Close()
140141

141-
accessor.Atomic(func(tx *sql.Tx) error {
142+
accessor.Atomic(func(ctx context.Context, tx *sql.Tx) error {
142143
return agreeInstallDatabase(tx)
143144
}) // ignore error
144145

agreement/player_test.go

+1-12
Original file line numberDiff line numberDiff line change
@@ -24,20 +24,10 @@ import (
2424

2525
"github.com/algorand/go-algorand/config"
2626
"github.com/algorand/go-algorand/crypto"
27-
"github.com/algorand/go-algorand/data/committee" //TODO(upgrade) remove this line
2827
"github.com/algorand/go-algorand/logging"
2928
"github.com/algorand/go-algorand/protocol"
3029
)
3130

32-
// TODO(upgrade) remove the entire lessMaybeBuggy function once the upgrade goes through
33-
func lessMaybeBuggy(cred, other committee.Credential) bool {
34-
// this function calls either Less or LessBuggy depending on ConsensusCurrentVersion, which is what the agreement tests use
35-
if config.Consensus[protocol.ConsensusCurrentVersion].UseBuggyProposalLowestOutput {
36-
return cred.LessBuggy(other)
37-
}
38-
return cred.Less(other)
39-
}
40-
4131
var playerTracer tracer
4232

4333
func init() {
@@ -69,8 +59,7 @@ func generateProposalEvents(t *testing.T, player player, accs testAccountData, f
6959
lowestCredential := votes[0].Cred
7060
lowestProposal = votes[0].R.Proposal
7161
for _, vote := range votes {
72-
// if vote.Cred.Less(lowestCredential) { //TODO(upgrade) uncomment this line
73-
if lessMaybeBuggy(vote.Cred, lowestCredential) { // TODO(upgrade) remove this line
62+
if vote.Cred.Less(lowestCredential) {
7463
lowestCredential = vote.Cred
7564
lowestProposal = vote.R.Proposal
7665
}

0 commit comments

Comments
 (0)