Skip to content

Commit 8fe22d4

Browse files
authored
Merge pull request #2179 from Algo-devops-service/relstable2.6.0
go-algorand 2.6.0-stable
2 parents 219b78d + 34f7106 commit 8fe22d4

File tree

307 files changed

+20227
-4590
lines changed

Some content is hidden

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

307 files changed

+20227
-4590
lines changed

.travis.yml

+3
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ jobs:
165165
cache:
166166
directories:
167167
- crypto/lib
168+
- $HOME/docker_cache
168169

169170
before_install:
170171
- |-
@@ -189,6 +190,7 @@ before_install:
189190
export MAKE=mingw32-make # so that Autotools can find it
190191
;;
191192
esac
193+
docker load -i $HOME/docker_cache/images.tar || true
192194
193195
before_cache:
194196
- |-
@@ -198,6 +200,7 @@ before_cache:
198200
$msys2 pacman --sync --clean --noconfirm
199201
;;
200202
esac
203+
docker save -o $HOME/docker_cache/images.tar $(docker images -a -q)
201204
202205
addons:
203206
apt:

Makefile

+15-4
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,18 @@ generate: deps
107107
msgp: $(patsubst %,%/msgp_gen.go,$(MSGP_GENERATE))
108108

109109
%/msgp_gen.go: deps ALWAYS
110-
$(GOPATH1)/bin/msgp -file ./$(@D) -o $@ -warnmask github.com/algorand/go-algorand
110+
@set +e; \
111+
printf "msgp: $(@D)..."; \
112+
$(GOPATH1)/bin/msgp -file ./$(@D) -o $@ -warnmask github.com/algorand/go-algorand > ./$@.out 2>&1; \
113+
if [ "$$?" != "0" ]; then \
114+
printf "failed:\n$(GOPATH1)/bin/msgp -file ./$(@D) -o $@ -warnmask github.com/algorand/go-algorand\n"; \
115+
cat ./$@.out; \
116+
rm ./$@.out; \
117+
exit 1; \
118+
else \
119+
echo " done."; \
120+
fi; \
121+
rm -f ./$@.out
111122
ALWAYS:
112123

113124
# build our fork of libsodium, placing artifacts into crypto/lib/ and crypto/include/
@@ -210,17 +221,17 @@ $(GOPATH1)/bin/%:
210221
cp -f $< $@
211222

212223
test: build
213-
go test $(GOTAGS) -race $(UNIT_TEST_SOURCES) -timeout 3600s
224+
go test $(GOTAGS) -race $(UNIT_TEST_SOURCES) -timeout 3600s | logfilter
214225

215226
fulltest: build-race
216227
for PACKAGE_DIRECTORY in $(UNIT_TEST_SOURCES) ; do \
217-
go test $(GOTAGS) -timeout 2500s -race $$PACKAGE_DIRECTORY; \
228+
go test $(GOTAGS) -timeout 2500s -race $$PACKAGE_DIRECTORY | logfilter; \
218229
done
219230

220231
shorttest: build-race $(addprefix short_test_target_, $(UNIT_TEST_SOURCES))
221232

222233
$(addprefix short_test_target_, $(UNIT_TEST_SOURCES)): build
223-
@go test $(GOTAGS) -short -timeout 2500s -race $(subst short_test_target_,,$@)
234+
@go test $(GOTAGS) -short -timeout 2500s -race $(subst short_test_target_,,$@) | logfilter
224235

225236
integration: build-race
226237
./test/scripts/run_integration_tests.sh

README.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,10 @@ the [official Go documentation website](https://golang.org/doc/).
2222
### Linux / OSX ###
2323

2424
We currently strive to support Debian based distributions with Ubuntu 18.04
25-
being our official release target. Our core engineering team uses Linux and OSX,
26-
so both environments are well supported for development.
25+
being our official release target.
26+
Building on Arch Linux works as well.
27+
Our core engineering team uses Linux and OSX, so both environments are well
28+
supported for development.
2729

2830
OSX only: [Homebrew (brew)](https://brew.sh) must be installed before
2931
continuing. [Here](https://docs.brew.sh/Installation) are the installation

agreement/abstractions.go

+4-7
Original file line numberDiff line numberDiff line change
@@ -225,13 +225,10 @@ type LedgerWriter interface {
225225

226226
// A KeyManager stores and deletes participation keys.
227227
type KeyManager interface {
228-
// Keys returns an immutable array of participation intervals to
229-
// participating accounts.
230-
Keys() []account.Participation
231-
232-
// HasLiveKeys returns true if we have any Participation
233-
// keys valid for the specified round range (inclusive)
234-
HasLiveKeys(from, to basics.Round) bool
228+
// VotingKeys returns an immutable array of voting keys that are
229+
// valid for the provided votingRound, and were available at
230+
// keysRound.
231+
VotingKeys(votingRound, keysRound basics.Round) []account.Participation
235232
}
236233

237234
// MessageHandle is an ID referring to a specific message.

agreement/agreementtest/keyManager.go

+5-14
Original file line numberDiff line numberDiff line change
@@ -24,24 +24,15 @@ import (
2424
// SimpleKeyManager provides a simple implementation of a KeyManager.
2525
type SimpleKeyManager []account.Participation
2626

27-
// Keys implements KeyManager.Keys.
28-
func (m SimpleKeyManager) Keys() []account.Participation {
27+
// VotingKeys implements KeyManager.VotingKeys.
28+
func (m SimpleKeyManager) VotingKeys(votingRound, _ basics.Round) []account.Participation {
2929
var km []account.Participation
3030
for _, acc := range m {
31-
km = append(km, acc)
32-
}
33-
return km
34-
}
35-
36-
// HasLiveKeys returns true if we have any Participation
37-
// keys valid for the specified round range (inclusive)
38-
func (m SimpleKeyManager) HasLiveKeys(from, to basics.Round) bool {
39-
for _, acc := range m {
40-
if acc.OverlapsInterval(from, to) {
41-
return true
31+
if acc.OverlapsInterval(votingRound, votingRound) {
32+
km = append(km, acc)
4233
}
4334
}
44-
return false
35+
return km
4536
}
4637

4738
// DeleteOldKeys implements KeyManager.DeleteOldKeys.

agreement/agreementtest/simulate_test.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,8 @@ func generateNAccounts(t *testing.T, N int, firstRound, lastRound basics.Round,
356356
if err != nil {
357357
panic(err)
358358
}
359-
accounts = append(accounts, part)
359+
accounts = append(accounts, part.Participation)
360+
part.Close()
360361
}
361362
return
362363
}

agreement/cryptoVerifier_test.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,8 @@ func BenchmarkCryptoVerifierProposalVertification(b *testing.B) {
317317
}
318318

319319
Period := period(0)
320-
participation := pn.getParticipations("BenchmarkCryptoVerifierProposalVertification", ledger.NextRound())
320+
pn.loadRoundParticipationKeys(ledger.NextRound())
321+
participation := pn.participationKeys
321322

322323
proposals, _ := pn.makeProposals(ledger.NextRound(), Period, participation)
323324

agreement/demux.go

+12-5
Original file line numberDiff line numberDiff line change
@@ -238,12 +238,19 @@ func (d *demux) next(s *Service, deadline time.Duration, fastDeadline time.Durat
238238
deadlineCh := s.Clock.TimeoutAt(deadline)
239239
var fastDeadlineCh <-chan time.Time
240240

241-
proto, err := d.ledger.ConsensusVersion(ParamsRound(currentRound))
242-
if err == nil && config.Consensus[proto].FastPartitionRecovery {
243-
fastDeadlineCh = s.Clock.TimeoutAt(fastDeadline)
241+
fastPartitionRecoveryEnabled := false
242+
if proto, err := d.ledger.ConsensusVersion(ParamsRound(currentRound)); err != nil {
243+
logging.Base().Warnf("demux: could not get consensus parameters for round %d: %v", ParamsRound(currentRound), err)
244+
// this might happen during catchup, since the Ledger.Wait fires as soon as a new block is received by the ledger, which could be
245+
// far before it's being committed. In these cases, it should be safe to default to the current consensus version. On subsequent
246+
// iterations, it will get "corrected" since the ledger would finish flushing the blocks to disk.
247+
fastPartitionRecoveryEnabled = config.Consensus[protocol.ConsensusCurrentVersion].FastPartitionRecovery
248+
} else {
249+
fastPartitionRecoveryEnabled = config.Consensus[proto].FastPartitionRecovery
244250
}
245-
if err != nil {
246-
logging.Base().Errorf("could not get consensus parameters for round %d: %v", ParamsRound(currentRound), err)
251+
252+
if fastPartitionRecoveryEnabled {
253+
fastDeadlineCh = s.Clock.TimeoutAt(fastDeadline)
247254
}
248255

249256
d.UpdateEventsQueue(eventQueueDemux, 0)

agreement/fuzzer/fuzzer_test.go

+2-17
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ func MakeFuzzer(config FuzzerConfig) *Fuzzer {
8484
crashAccessors: make([]db.Accessor, config.NodesCount),
8585
accounts: make([]account.Participation, config.NodesCount),
8686
balances: make(map[basics.Address]basics.AccountData),
87-
accountAccessors: make([]db.Accessor, config.NodesCount*2),
87+
accountAccessors: make([]db.Accessor, config.NodesCount),
8888
ledgers: make([]*testLedger, config.NodesCount),
8989
agreementParams: make([]agreement.Parameters, config.NodesCount),
9090
tickGranularity: time.Millisecond * 300,
@@ -196,7 +196,7 @@ func (n *Fuzzer) initAccountsAndBalances(rootSeed []byte, onlineNodes []bool) er
196196
if err != nil {
197197
return err
198198
}
199-
n.accountAccessors[i*2+0] = rootAccess
199+
n.accountAccessors[i] = rootAccess
200200

201201
seed = sha256.Sum256(seed[:])
202202
root, err := account.ImportRoot(rootAccess, seed)
@@ -205,27 +205,12 @@ func (n *Fuzzer) initAccountsAndBalances(rootSeed []byte, onlineNodes []bool) er
205205
}
206206
rootAddress := root.Address()
207207

208-
partAccess, err := db.MakeAccessor(n.networkName+"part"+strconv.Itoa(i+off), false, true)
209-
210-
if err != nil {
211-
return err
212-
}
213-
214-
n.accountAccessors[i*2+1] = partAccess
215-
216208
n.accounts[i] = account.Participation{
217209
Parent: rootAddress,
218210
VRF: generatePseudoRandomVRF(i),
219211
Voting: readOnlyParticipationVotes[i],
220212
FirstValid: firstValid,
221213
LastValid: lastValid,
222-
Store: partAccess,
223-
}
224-
225-
err = n.accounts[i].Persist()
226-
227-
if err != nil {
228-
panic(err)
229214
}
230215

231216
acctData := basics.AccountData{

agreement/fuzzer/keyManager_test.go

+5-8
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,12 @@ import (
2323

2424
type simpleKeyManager []account.Participation
2525

26-
func (m simpleKeyManager) Keys() []account.Participation {
27-
return m
28-
}
29-
30-
func (m simpleKeyManager) HasLiveKeys(from, to basics.Round) bool {
26+
func (m simpleKeyManager) VotingKeys(votingRound, _ basics.Round) []account.Participation {
27+
var km []account.Participation
3128
for _, acc := range m {
32-
if acc.OverlapsInterval(from, to) {
33-
return true
29+
if acc.OverlapsInterval(votingRound, votingRound) {
30+
km = append(km, acc)
3431
}
3532
}
36-
return false
33+
return km
3734
}

agreement/gossip/networkFull_test.go

+13-13
Original file line numberDiff line numberDiff line change
@@ -202,12 +202,12 @@ func testNetworkImplMixed(t *testing.T, nodesCount int) {
202202
nets, counters := spinNetwork(t, nodesCount)
203203
defer shutdownNetwork(nets, counters)
204204

205-
nets[0].broadcastTimeout(protocol.AgreementVoteTag, []byte{1}, testNetTimeout)
206-
nets[0].broadcastTimeout(protocol.ProposalPayloadTag, []byte{1}, testNetTimeout)
207-
nets[0].broadcastTimeout(protocol.ProposalPayloadTag, []byte{1}, testNetTimeout)
208-
nets[0].broadcastTimeout(protocol.VoteBundleTag, []byte{1}, testNetTimeout)
209-
nets[0].broadcastTimeout(protocol.VoteBundleTag, []byte{1}, testNetTimeout)
210-
nets[0].broadcastTimeout(protocol.VoteBundleTag, []byte{1}, testNetTimeout)
205+
nets[0].Broadcast(protocol.AgreementVoteTag, []byte{1})
206+
nets[0].Broadcast(protocol.ProposalPayloadTag, []byte{1})
207+
nets[0].Broadcast(protocol.ProposalPayloadTag, []byte{1})
208+
nets[0].Broadcast(protocol.VoteBundleTag, []byte{1})
209+
nets[0].Broadcast(protocol.VoteBundleTag, []byte{1})
210+
nets[0].Broadcast(protocol.VoteBundleTag, []byte{1})
211211
for i, counter := range counters {
212212
if i != 0 {
213213
if !counter.verify(t, 1, 2, 3) {
@@ -228,14 +228,14 @@ func testNetworkImplMixed2(t *testing.T, nodesCount int) {
228228

229229
const loadSize = 12
230230
for i := byte(0); i < loadSize; i++ {
231-
ok := nets[0].broadcastTimeout(protocol.AgreementVoteTag, []byte{i}, testNetTimeout)
231+
ok := nets[0].Broadcast(protocol.AgreementVoteTag, []byte{i})
232232
assert.NoError(t, ok)
233233
if i%2 == 0 {
234-
ok = nets[0].broadcastTimeout(protocol.ProposalPayloadTag, []byte{i}, testNetTimeout)
234+
ok = nets[0].Broadcast(protocol.ProposalPayloadTag, []byte{i})
235235
assert.NoError(t, ok)
236236
}
237237
if i%4 == 0 {
238-
ok = nets[0].broadcastTimeout(protocol.VoteBundleTag, []byte{i}, testNetTimeout)
238+
ok = nets[0].Broadcast(protocol.VoteBundleTag, []byte{i})
239239
assert.NoError(t, ok)
240240
}
241241
}
@@ -266,14 +266,14 @@ func testNetworkImplReordered(t *testing.T, nodesCount int) {
266266
wg.Add(loadSize)
267267
for i := byte(0); i < loadSize; i++ {
268268
go func(i byte) {
269-
ok := nets[0].broadcastTimeout(protocol.AgreementVoteTag, []byte{i}, testNetTimeout)
269+
ok := nets[0].Broadcast(protocol.AgreementVoteTag, []byte{i})
270270
assert.NoError(t, ok)
271271
if i%2 == 0 {
272-
ok = nets[0].broadcastTimeout(protocol.ProposalPayloadTag, []byte{i}, testNetTimeout)
272+
ok = nets[0].Broadcast(protocol.ProposalPayloadTag, []byte{i})
273273
assert.NoError(t, ok)
274274
}
275275
if i%4 == 0 {
276-
ok = nets[0].broadcastTimeout(protocol.VoteBundleTag, []byte{i}, testNetTimeout)
276+
ok = nets[0].Broadcast(protocol.VoteBundleTag, []byte{i})
277277
assert.NoError(t, ok)
278278
}
279279
wg.Done()
@@ -323,7 +323,7 @@ func testNetworkImplRebroadcast(t *testing.T, nodesCount int) {
323323
rebroadcastNodes = 3
324324
}
325325
for i := byte(0); i < byte(rebroadcastNodes); i++ {
326-
ok := nets[i].broadcastTimeout(protocol.AgreementVoteTag, []byte{i, i + 1}, testNetTimeout)
326+
ok := nets[i].Broadcast(protocol.AgreementVoteTag, []byte{i, i + 1})
327327
assert.NoError(t, ok)
328328
}
329329

0 commit comments

Comments
 (0)