Skip to content

Commit a6fdbad

Browse files
authored
Merge pull request #1116 from onetechnical/onetechnical/beta2.0.14
Algorand Release 2.0.14-beta
2 parents 5df2b13 + 902afe9 commit a6fdbad

File tree

250 files changed

+20357
-2428
lines changed

Some content is hidden

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

250 files changed

+20357
-2428
lines changed

.github/PULL_REQUEST_TEMPLATE.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,8 @@ It is also a good idea to run tests:
1515

1616
## Summary
1717

18-
Explain the goal of this change and what problem it is solving.
18+
Explain the goal of this change and what problem it is solving. Format this cleanly so that it may be used for a commit message, as your changes will be squash-merged.
1919

2020
## Test Plan
2121

2222
How did you test these changes? Please provide the exact scenarios you tested in as much detail as possible including commands, output and rationale.
23-

.travis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ addons:
166166
artifacts:
167167
s3_region: "us-east-1"
168168
paths:
169-
- $(git ls-files -o | grep -v crypto/libsodium-fork | grep -v crypto/lib/ | grep -v ^gen/ | grep -v swagger.json.validated | tr "\n" ":")
169+
- $(git ls-files -o | grep -v crypto/libs | grep -v crypto/copies | grep -v crypto/libsodium-fork | grep -v crypto/lib/ | grep -v ^gen/ | grep -v swagger.json.validated | tr "\n" ":")
170170

171171
notifications:
172172
slack:

CONTRIBUTING.md

+15-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,18 @@
22

33
If you are interested in contributing to the project, we welcome and thank you. We want to make the best decentralized and effective blockchain platform available and we appreciate your willingness to help us.
44

5-
The algorand project is composed of several repositories on GitHub. Specifically we have repositories for the main node software,the JavaScript SDK, the Go SDK, and the Java SDK. Additionally we have repositories for projects we forked like go-codec that make up some of the main dependencies for a node. Each of these will follow similar guidelines on how to contribute. The main difference between these concerns code formatting and deploying changes to production.
5+
The [Algorand GitHub Organization](https://github.com/algorand) has all of our open source projects, and dependencies which we fork and use in those projects. This contribution guide applies to all of these.
6+
7+
Some of our most active projects include:
8+
* [go-algorand](https://github.com/algorand/go-algorand) - Algorand node software (this repository)
9+
* [go-algorand-sdk](https://github.com/algorand/go-algorand-sdk) - Golang SDK
10+
* [java-algorand-sdk](https://github.com/algorand/java-algorand-sdk) - Java SDK
11+
* [js-algorand-sdk](https://github.com/algorand/js-algorand-sdk) - JavaScript SDK
12+
* [indexer](https://github.com/algorand/indexer) - Blockchain analytics database
13+
* [ledger-app-algorand](https://github.com/algorand/ledger-app-algorand) - Ledger hardware wallet application
14+
* [mule](https://github.com/algorand/mule) - Continuous Integration automation tool
15+
* [py-algorand-sdk](https://github.com/algorand/py-algorand-sdk) - Python SDK
16+
* [sandbox](https://github.com/algorand/sandbox) - Algorand node quickstart tool
617

718
# Filing Issues
819

@@ -24,7 +35,9 @@ If you have any questions, don't hesitate to contact us at [email protected]
2435

2536
# Contribution Model
2637

27-
For each of our repositories we use the same model for contributing code. Developers wanting to contribute must create pull requests. This process is described in the GitHub [Creating a pull request from a fork](https://help.github.com/en/articles/creating-a-pull-request-from-a-fork) documentation. Each pull request should be initiated against the master branch in the Algorand repository. After a pull request is submitted the core development team will review the submission and communicate with the developer using the comments sections of the PR. After the submission is reviewed and approved, it will be merged into the master branch of the source. These changes will be merged to our release branch on the next viable release date. For the SDKs, this may be immediate. Changes to the node software may take more time as we must ensure and verify the security, as well as apply protocol upgrades in an orderly way.
38+
For each of our repositories we use the same model for contributing code. Developers wanting to contribute must create pull requests. This process is described in the GitHub [Creating a pull request from a fork](https://help.github.com/en/articles/creating-a-pull-request-from-a-fork) documentation. Each pull request should be initiated against the `master` branch in the Algorand repository. After a pull request is submitted the core development team will review the submission and communicate with the developer using the comments sections of the PR. After the submission is reviewed and approved, it will be merged into the `master` branch of the source. These changes will be merged to our release branch on the next viable release date. For the SDKs, this may be immediate. Changes to the node software may take more time as we must ensure and verify the security, as well as apply protocol upgrades in an orderly way.
39+
40+
Note: some of our projects are using gitflow, for these you will open pull requests against the `develop` branch.
2841

2942
Again, if you have a patch for a critical security vulnerability, please use our [vulnerability disclosure form][vuln_url] instead of creating a PR. We'll follow up with you on distributing the patch before we merge it.
3043

Makefile

+10-18
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
GOPATH := $(shell go env GOPATH)
1+
export GOPATH := $(shell go env GOPATH)
22
GOPATH1 := $(firstword $(subst :, ,$(GOPATH)))
3-
export GOPATH
4-
GO111MODULE := on
5-
export GO111MODULE
3+
export GO111MODULE := on
4+
export GOPROXY := https://gocenter.io
5+
66
UNAME := $(shell uname)
77
SRCPATH := $(shell pwd)
88
ARCH := $(shell ./scripts/archtype.sh)
@@ -52,14 +52,15 @@ GOLDFLAGS := $(GOLDFLAGS_BASE) \
5252
UNIT_TEST_SOURCES := $(sort $(shell GO111MODULE=off go list ./... | grep -v /go-algorand/test/ ))
5353
ALGOD_API_PACKAGES := $(sort $(shell GO111MODULE=off cd daemon/algod/api; go list ./... ))
5454

55-
MSGP_GENERATE := ./protocol ./crypto ./data/basics ./data/transactions ./data/committee ./data/bookkeeping ./data/hashable ./auction ./agreement ./rpcs ./node
55+
MSGP_GENERATE := ./protocol ./crypto ./data/basics ./data/transactions ./data/committee ./data/bookkeeping ./data/hashable ./auction ./agreement ./rpcs ./node ./ledger
5656

5757
default: build
5858

5959
# tools
6060

6161
fmt:
6262
go fmt ./...
63+
./scripts/check_license.sh -i
6364

6465
fix: build
6566
$(GOPATH1)/bin/algofix */
@@ -73,13 +74,10 @@ lint: deps
7374
vet:
7475
go vet ./...
7576

76-
check_license:
77-
./scripts/check_license.sh
78-
7977
check_shell:
8078
find . -type f -name "*.sh" -exec shellcheck {} +
8179

82-
sanity: vet fix lint fmt check_license
80+
sanity: vet fix lint fmt
8381

8482
cover:
8583
go test $(GOTAGS) -coverprofile=cover.out $(UNIT_TEST_SOURCES)
@@ -276,14 +274,8 @@ dump: $(addprefix gen/,$(addsuffix /genesis.dump, $(NETWORKS)))
276274
install: build
277275
scripts/dev_install.sh -p $(GOPATH1)/bin
278276

279-
.PHONY: default fmt vet lint check_license check_shell sanity cover prof deps build test fulltest shorttest clean cleango deploy node_exporter install %gen gen NONGO_BIN
280-
281-
### TARGETS FOR CICD PROCESS
277+
.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
282278

283-
ci-deps:
284-
scripts/configure_dev-deps.sh && \
285-
scripts/check_deps.sh
279+
###### TARGETS FOR CICD PROCESS ######
280+
include ./scripts/release/mule/Makefile.mule
286281

287-
ci-build: buildsrc gen
288-
mkdir -p $(SRCPATH)/tmp/node_pkgs/$(OS_TYPE)/$(ARCH) && \
289-
PKG_ROOT=$(SRCPATH)/tmp/node_pkgs/$(OS_TYPE)/$(ARCH) NO_BUILD=True VARIATIONS=$(OS_TYPE)/$(ARCH) scripts/build_packages.sh $(OS_TYPE)/$(ARCH)

THANKS.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
## Thanks
33

4-
A big thank you to everyone who has contributed to the `go-algorand` codebase.
4+
A big thank you to everyone who has contributed to the `go-algorand` codebase.
55

66
### External Contributors
77
In no particular order:
@@ -11,6 +11,7 @@ In no particular order:
1111
- scnale
1212
- jsign
1313
- RomitKumar
14+
- jeapostrophe
1415

1516
### Bug Reports
1617
- Nanyan

agreement/abstractions.go

+4
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,10 @@ type Network interface {
276276
// Disconnect sends the Network a hint to disconnect to the peer
277277
// associated with the given MessageHandle.
278278
Disconnect(MessageHandle)
279+
280+
// Start notifies the network that the agreement service is ready
281+
// to start receiving messages.
282+
Start()
279283
}
280284

281285
// RandomSource is an abstraction over the random number generator.

agreement/cadaver.go

+11-4
Original file line numberDiff line numberDiff line change
@@ -119,14 +119,21 @@ func (c *cadaver) trySetup() bool {
119119
c.out.Close()
120120
err := os.Rename(c.filename(), c.filename()+".archive")
121121
if err != nil {
122-
logging.Base().Error(err)
123-
c.failed = err
124-
return false
122+
if os.IsNotExist(err) {
123+
// we can't rename the cadaver file since it doesn't exists.
124+
// this typically happens when it being externally deleted, and could happen
125+
// far before we close the handle above.
126+
logging.Base().Info(err)
127+
} else {
128+
logging.Base().Warn(err)
129+
c.failed = err
130+
return false
131+
}
125132
}
126133

127134
err = c.init()
128135
if err != nil {
129-
logging.Base().Error(err)
136+
logging.Base().Warn(err)
130137
c.failed = err
131138
return false
132139
}

agreement/demux.go

+21-10
Original file line numberDiff line numberDiff line change
@@ -66,24 +66,35 @@ type demux struct {
6666
log logging.Logger
6767
}
6868

69+
// demuxParams contains the parameters required to initliaze a new demux object
70+
type demuxParams struct {
71+
net Network
72+
ledger LedgerReader
73+
validator BlockValidator
74+
voteVerifier *AsyncVoteVerifier
75+
processingMonitor EventsProcessingMonitor
76+
log logging.Logger
77+
monitor *coserviceMonitor
78+
}
79+
6980
// makeDemux initializes the goroutines needed to process external events, setting up the appropriate channels.
7081
//
7182
// It must be called before other methods are called.
72-
func makeDemux(net Network, ledger LedgerReader, validator BlockValidator, voteVerifier *AsyncVoteVerifier, processingMonitor EventsProcessingMonitor, log logging.Logger) (d *demux) {
83+
func makeDemux(params demuxParams) (d *demux) {
7384
d = new(demux)
74-
d.crypto = makeCryptoVerifier(ledger, validator, voteVerifier, log)
75-
d.log = log
76-
d.ledger = ledger
85+
d.crypto = makeCryptoVerifier(params.ledger, params.validator, params.voteVerifier, params.log)
86+
d.log = params.log
87+
d.ledger = params.ledger
88+
d.monitor = params.monitor
89+
d.queue = make([]<-chan externalEvent, 0)
90+
d.processingMonitor = params.processingMonitor
7791

7892
tokenizerCtx, cancelTokenizers := context.WithCancel(context.Background())
79-
d.rawVotes = d.tokenizeMessages(tokenizerCtx, net, protocol.AgreementVoteTag, decodeVote)
80-
d.rawProposals = d.tokenizeMessages(tokenizerCtx, net, protocol.ProposalPayloadTag, decodeProposal)
81-
d.rawBundles = d.tokenizeMessages(tokenizerCtx, net, protocol.VoteBundleTag, decodeBundle)
93+
d.rawVotes = d.tokenizeMessages(tokenizerCtx, params.net, protocol.AgreementVoteTag, decodeVote)
94+
d.rawProposals = d.tokenizeMessages(tokenizerCtx, params.net, protocol.ProposalPayloadTag, decodeProposal)
95+
d.rawBundles = d.tokenizeMessages(tokenizerCtx, params.net, protocol.VoteBundleTag, decodeBundle)
8296
d.cancelTokenizers = cancelTokenizers
8397

84-
d.queue = make([]<-chan externalEvent, 0)
85-
d.processingMonitor = processingMonitor
86-
8798
return d
8899
}
89100

agreement/fuzzer/networkFacade_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ func MakeNetworkFacade(fuzzer *Fuzzer, nodeID int) *NetworkFacade {
7777
n := &NetworkFacade{
7878
fuzzer: fuzzer,
7979
nodeID: nodeID,
80-
mux: network.MakeMultiplexer(),
80+
mux: network.MakeMultiplexer(fuzzer.log),
8181
clocks: make(map[int]chan time.Time),
8282
eventsQueues: make(map[string]int),
8383
eventsQueuesCh: make(chan int, 1000),
@@ -258,7 +258,7 @@ func (n *NetworkFacade) RegisterHandlers(dispatch []network.TaggedMessageHandler
258258

259259
// ClearHandlers
260260
func (n *NetworkFacade) ClearHandlers() {
261-
n.mux.ClearHandlers()
261+
n.mux.ClearHandlers([]network.Tag{})
262262
}
263263

264264
// SetDownstreamFilter sets the downstream filter.

agreement/gossip/network.go

+5-2
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,16 @@ func WrapNetwork(net network.GossipNode, log logging.Logger) agreement.Network {
6363
i.net = net
6464
i.log = log
6565

66+
return i
67+
}
68+
69+
func (i *networkImpl) Start() {
6670
handlers := []network.TaggedMessageHandler{
6771
{Tag: protocol.AgreementVoteTag, MessageHandler: network.HandlerFunc(i.processVoteMessage)},
6872
{Tag: protocol.ProposalPayloadTag, MessageHandler: network.HandlerFunc(i.processProposalMessage)},
6973
{Tag: protocol.VoteBundleTag, MessageHandler: network.HandlerFunc(i.processBundleMessage)},
7074
}
71-
net.RegisterHandlers(handlers)
72-
return i
75+
i.net.RegisterHandlers(handlers)
7376
}
7477

7578
func messageMetadataFromHandle(h agreement.MessageHandle) *messageMetadata {

agreement/gossip/networkFull_test.go

+1
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ func spinNetwork(t *testing.T, nodesCount int) ([]*networkImpl, []*messageCounte
8181
for _, gossipNode := range gossipNodes {
8282
networkImpl := WrapNetwork(gossipNode, log).(*networkImpl)
8383
networkImpls = append(networkImpls, networkImpl)
84+
networkImpl.Start()
8485
msgCounter := startMessageCounter(networkImpl)
8586
msgCounters = append(msgCounters, msgCounter)
8687
}

agreement/gossip/network_test.go

+6-2
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ type whiteholeDomain struct {
4545
messagesMu deadlock.Mutex
4646
messagesCond *sync.Cond
4747
peerIdx uint32
48+
log logging.Logger
4849
}
4950

5051
type whiteholeNetwork struct {
@@ -55,6 +56,7 @@ type whiteholeNetwork struct {
5556
quit chan struct{}
5657
domain *whiteholeDomain
5758
disconnected map[uint32]bool
59+
log logging.Logger
5860
}
5961

6062
func (d *whiteholeDomain) syncNetwork(networks ...*whiteholeNetwork) {
@@ -89,7 +91,7 @@ func (w *whiteholeNetwork) RegisterHandlers(dispatch []network.TaggedMessageHand
8991

9092
// ClearHandlers deregisters all the existing message handlers.
9193
func (w *whiteholeNetwork) ClearHandlers() {
92-
w.mux.ClearHandlers()
94+
w.mux.ClearHandlers([]network.Tag{})
9395
}
9496

9597
func (w *whiteholeNetwork) Address() (string, bool) {
@@ -315,7 +317,7 @@ func makewhiteholeNetwork(domain *whiteholeDomain) *whiteholeNetwork {
315317
w := &whiteholeNetwork{
316318
peer: atomic.AddUint32(&domain.peerIdx, 1),
317319
lastMsgRead: uint32(len(domain.messages)),
318-
mux: network.MakeMultiplexer(),
320+
mux: network.MakeMultiplexer(domain.log),
319321
domain: domain,
320322
disconnected: make(map[uint32]bool),
321323
}
@@ -327,6 +329,7 @@ func spinNetworkImpl(domain *whiteholeDomain) (whiteholeNet *whiteholeNetwork, c
327329
netImpl := WrapNetwork(whiteholeNet, logging.Base()).(*networkImpl)
328330
counter = startMessageCounter(netImpl)
329331
whiteholeNet.Start()
332+
netImpl.Start()
330333
return
331334
}
332335

@@ -336,6 +339,7 @@ func TestNetworkImpl(t *testing.T) {
336339
domain := &whiteholeDomain{
337340
messages: make([]sentMessage, 0),
338341
peerIdx: uint32(0),
342+
log: logging.TestingLog(t),
339343
}
340344
domain.messagesCond = sync.NewCond(&domain.messagesMu)
341345

agreement/pseudonode.go

+20-8
Original file line numberDiff line numberDiff line change
@@ -118,19 +118,31 @@ type pseudonodeVerifier struct {
118118
//msgp:ignore verifiedCryptoResults
119119
type verifiedCryptoResults []asyncVerifyVoteResponse
120120

121-
func makePseudonode(factory BlockFactory, validator BlockValidator, keys KeyManager, ledger Ledger, voteVerifier *AsyncVoteVerifier, log serviceLogger) pseudonode {
121+
// pseudonodeParams struct provide the parameters required to create a pseudonode
122+
type pseudonodeParams struct {
123+
factory BlockFactory
124+
validator BlockValidator
125+
keys KeyManager
126+
ledger Ledger
127+
voteVerifier *AsyncVoteVerifier
128+
log serviceLogger
129+
monitor *coserviceMonitor
130+
}
131+
132+
func makePseudonode(params pseudonodeParams) pseudonode {
122133
pn := asyncPseudonode{
123-
factory: factory,
124-
validator: validator,
125-
keys: keys,
126-
ledger: ledger,
127-
log: log,
134+
factory: params.factory,
135+
validator: params.validator,
136+
keys: params.keys,
137+
ledger: params.ledger,
138+
log: params.log,
128139
quit: make(chan struct{}),
129140
closeWg: &sync.WaitGroup{},
141+
monitor: params.monitor,
130142
}
131143

132-
pn.proposalsVerifier = pn.makePseudonodeVerifier(voteVerifier)
133-
pn.votesVerifier = pn.makePseudonodeVerifier(voteVerifier)
144+
pn.proposalsVerifier = pn.makePseudonodeVerifier(params.voteVerifier)
145+
pn.votesVerifier = pn.makePseudonodeVerifier(params.voteVerifier)
134146
return pn
135147
}
136148

agreement/pseudonode_test.go

+9-1
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,15 @@ func TestPseudonode(t *testing.T) {
141141
sLogger := serviceLogger{logging.Base()}
142142

143143
keyManager := simpleKeyManager(accounts)
144-
pb := makePseudonode(testBlockFactory{Owner: 0}, testBlockValidator{}, keyManager, ledger, MakeAsyncVoteVerifier(nil), sLogger)
144+
pb := makePseudonode(pseudonodeParams{
145+
factory: testBlockFactory{Owner: 0},
146+
validator: testBlockValidator{},
147+
keys: keyManager,
148+
ledger: ledger,
149+
voteVerifier: MakeAsyncVoteVerifier(nil),
150+
log: sLogger,
151+
monitor: nil,
152+
})
145153
defer pb.Quit()
146154
spn := makeSerializedPseudonode(testBlockFactory{Owner: 0}, testBlockValidator{}, keyManager, ledger)
147155
defer spn.Quit()

0 commit comments

Comments
 (0)