Skip to content

Commit c048b4a

Browse files
authored
Merge pull request #1681 from onetechnical/onetechnical/relstable2.2.0
Onetechnical/relstable2.2.0
2 parents df65da2 + 566405e commit c048b4a

File tree

325 files changed

+34581
-3470
lines changed

Some content is hidden

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

325 files changed

+34581
-3470
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
name: Algorand Engineering Team Issue Template
3+
about: This is the template that Algorand internal team members use in conjunction
4+
with their task management process. Feel free to use if you're an external contributor.
5+
title: ''
6+
labels: ''
7+
assignees: ''
8+
9+
---
10+
11+
## Summary
12+
*Describe the problem identified or the general goal of this issue*
13+
14+
## Scope/Requirements
15+
*What's involved in this issue? What's required to achieve the goal?*
16+
17+
## Urgency/Relative Priority
18+
*How urgent is this issue? What are the timing considerations to take into account?*

.github/ISSUE_TEMPLATE/bug_report.md

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
---
2-
name: '🐜 Bug report'
3-
about: 'Report a reproducible bug.'
2+
name: "\U0001F41C Bug report"
3+
about: Report a reproducible bug.
44
title: ''
5-
labels: 'new-bug'
5+
labels: new-bug
6+
assignees: ''
7+
68
---
9+
710
<!--
811
NOTE: If this issue relates to security, please use the vulnerability disclosure form here:
912
https://www.algorand.com/resources/blog/security

.github/ISSUE_TEMPLATE/feature_request.md

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
---
2-
name: '🔔 Feature Request'
3-
about: 'Suggestions for how we can improve the algorand platform.'
2+
name: "\U0001F514 Feature Request"
3+
about: Suggestions for how we can improve the algorand platform.
44
title: ''
5-
labels: 'new-feature-request'
5+
labels: new-feature-request
6+
assignees: ''
7+
68
---
9+
710
<!--
811
NOTE: If this issue relates to security, please use the vulnerability disclosure form here:
912
https://www.algorand.com/resources/blog/security

.github/ISSUE_TEMPLATE/question.md

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
---
2-
name: '❓ Question'
3-
about: 'General questions related to the algorand platform.'
2+
name: "❓ Question"
3+
about: General questions related to the algorand platform.
44
title: ''
5-
labels: 'question'
5+
labels: question
6+
assignees: ''
7+
68
---
79

810
🚨 The issue tracker is not for questions. 🚨

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,6 @@ assets
6363

6464
# test binaries
6565
*.test
66+
67+
index.html
68+

.travis.yml

+50-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
os: linux
12
dist: bionic
23
go_import_path: github.com/algorand/go-algorand
34
language: go
@@ -76,6 +77,15 @@ jobs:
7677
name: MacOS AMD64 Integration Test
7778
script:
7879
- ./scripts/travis/integration_test.sh
80+
- # same stage, parallel job
81+
os: windows
82+
name: Windows x64 Build
83+
cache:
84+
directories:
85+
- $HOME/AppData/Local/Temp/chocolatey
86+
- /C/tools/msys64
87+
script:
88+
- $mingw64 scripts/travis/build_test.sh
7989

8090
- stage: build_release
8191
os: linux
@@ -105,6 +115,15 @@ jobs:
105115
- awscli
106116
script:
107117
- scripts/travis/external_build.sh ./scripts/travis/integration_test.sh
118+
- # same stage, parallel job
119+
os: windows
120+
name: Windows x64 Build
121+
cache:
122+
directories:
123+
- $HOME/AppData/Local/Temp/chocolatey
124+
- /C/tools/msys64
125+
script:
126+
- $mingw64 scripts/travis/build_test.sh
108127

109128
- stage: deploy
110129
name: Ubuntu Deploy
@@ -148,8 +167,37 @@ cache:
148167
- crypto/lib
149168

150169
before_install:
151-
# Disable sometimes-broken sources.list in Travis base images
152-
- sudo rm -vf /etc/apt/sources.list.d/*
170+
- |-
171+
case $TRAVIS_OS_NAME in
172+
linux)
173+
# Disable sometimes-broken sources.list in Travis base images
174+
sudo rm -vf /etc/apt/sources.list.d/*
175+
;;
176+
windows)
177+
[[ ! -f C:/tools/msys64/msys2_shell.cmd ]] && rm -rf C:/tools/msys64
178+
choco uninstall -y mingw
179+
choco upgrade --no-progress -y msys2
180+
export msys2='cmd //C RefreshEnv.cmd '
181+
export msys2+='& set MSYS=winsymlinks:nativestrict '
182+
export msys2+='& C:\\tools\\msys64\\msys2_shell.cmd -defterm -no-start'
183+
export mingw64="$msys2 -mingw64 -full-path -here -c "\"\$@"\" --"
184+
export msys2+=" -msys2 -c "\"\$@"\" --"
185+
$msys2 pacman --sync --noconfirm --needed mingw-w64-x86_64-toolchain unzip
186+
## Install more MSYS2 packages from https://packages.msys2.org/base here
187+
taskkill //IM gpg-agent.exe //F # https://travis-ci.community/t/4967
188+
export PATH=/C/tools/msys64/mingw64/bin:$PATH
189+
export MAKE=mingw32-make # so that Autotools can find it
190+
;;
191+
esac
192+
193+
before_cache:
194+
- |-
195+
case $TRAVIS_OS_NAME in
196+
windows)
197+
# https://unix.stackexchange.com/a/137322/107554
198+
$msys2 pacman --sync --clean --noconfirm
199+
;;
200+
esac
153201
154202
addons:
155203
apt:

Makefile

+18-10
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,23 @@
1-
export GOPATH := $(shell go env GOPATH)
2-
GOPATH1 := $(firstword $(subst :, ,$(GOPATH)))
1+
UNAME := $(shell uname)
2+
ifneq (, $(findstring MINGW,$(UNAME)))
3+
#Gopath is not saved across sessions, probably existing Windows env vars, override them
4+
export GOPATH := ${HOME}/go
5+
GOPATH1 := $(GOPATH)
6+
export PATH := $(PATH):$(GOPATH)/bin
7+
else
8+
export GOPATH := $(shell go env GOPATH)
9+
GOPATH1 := $(firstword $(subst :, ,$(GOPATH)))
10+
endif
311
export GO111MODULE := on
412
export GOPROXY := direct
5-
6-
UNAME := $(shell uname)
713
SRCPATH := $(shell pwd)
814
ARCH := $(shell ./scripts/archtype.sh)
915
OS_TYPE := $(shell ./scripts/ostype.sh)
1016
S3_RELEASE_BUCKET = $$S3_RELEASE_BUCKET
1117

1218
# If build number already set, use it - to ensure same build number across multiple platforms being built
1319
BUILDNUMBER ?= $(shell ./scripts/compute_build_number.sh)
20+
FULLBUILDNUMBER ?= $(shell ./scripts/compute_build_number.sh -f)
1421
COMMITHASH := $(shell ./scripts/compute_build_commit.sh)
1522
BUILDBRANCH := $(shell ./scripts/compute_branch.sh)
1623
CHANNEL ?= $(shell ./scripts/compute_branch_channel.sh $(BUILDBRANCH))
@@ -38,6 +45,11 @@ endif
3845
endif
3946
endif
4047

48+
ifneq (, $(findstring MINGW,$(UNAME)))
49+
EXTLDFLAGS := -static-libstdc++ -static-libgcc
50+
export GOBUILDMODE := -buildmode=exe
51+
endif
52+
4153
GOTAGS := --tags "$(GOTAGSLIST)"
4254
GOTRIMPATH := $(shell go help build | grep -q .-trimpath && echo -trimpath)
4355

@@ -53,7 +65,7 @@ GOLDFLAGS := $(GOLDFLAGS_BASE) \
5365
UNIT_TEST_SOURCES := $(sort $(shell GO111MODULE=off go list ./... | grep -v /go-algorand/test/ ))
5466
ALGOD_API_PACKAGES := $(sort $(shell GO111MODULE=off cd daemon/algod/api; go list ./... ))
5567

56-
MSGP_GENERATE := ./protocol ./crypto ./data/basics ./data/transactions ./data/committee ./data/bookkeeping ./data/hashable ./auction ./agreement ./rpcs ./node ./ledger
68+
MSGP_GENERATE := ./protocol ./crypto ./crypto/compactcert ./data/basics ./data/transactions ./data/committee ./data/bookkeeping ./data/hashable ./auction ./agreement ./rpcs ./node ./ledger
5769

5870
default: build
5971

@@ -289,10 +301,6 @@ install: build
289301
###### TARGETS FOR CICD PROCESS ######
290302
include ./scripts/release/mule/Makefile.mule
291303

292-
SUPPORTED_ARCHIVE_OS_ARCH = linux/amd64 linux/arm64 linux/arm darwin/amd64
293-
294304
archive:
295305
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-
306+
aws s3 cp tmp/node_pkgs s3://algorand-internal/channel/${CHANNEL}/$(FULLBUILDNUMBER) --recursive --exclude "*" --include "*${CHANNEL}*$(FULLBUILDNUMBER)*"

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[![Build Status](https://travis-ci.com/algorand/go-algorand.svg?token=25XP72ADqbCQJ3TJVC9S&branch=master)](https://travis-ci.com/algorand/go-algorand)
1+
[![Build Status](https://travis-ci.com/algorand/go-algorand.svg?branch=master)](https://travis-ci.com/algorand/go-algorand)
22

33
go-algorand
44
====================

agreement/abstractions.go

+15
Original file line numberDiff line numberDiff line change
@@ -307,3 +307,18 @@ type Message struct {
307307
type EventsProcessingMonitor interface {
308308
UpdateEventsQueue(queueName string, queueLength int)
309309
}
310+
311+
// LedgerDroppedRoundError is a wrapper error for when the ledger cannot return a Lookup query because
312+
// the entry is old and was dropped from the ledger. The purpose of this wrapper is to help the
313+
// agreement differentiate between a malicious vote and a vote that it cannot verify
314+
type LedgerDroppedRoundError struct {
315+
Err error
316+
}
317+
318+
func (e *LedgerDroppedRoundError) Error() string {
319+
return e.Err.Error()
320+
}
321+
322+
func (e *LedgerDroppedRoundError) Unwrap() error {
323+
return e.Err
324+
}

agreement/agreementtest/simulate.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import (
3131
"github.com/algorand/go-algorand/crypto"
3232
"github.com/algorand/go-algorand/data/basics"
3333
"github.com/algorand/go-algorand/logging"
34+
"github.com/algorand/go-algorand/protocol"
3435
"github.com/algorand/go-algorand/util/db"
3536
"github.com/algorand/go-algorand/util/timers"
3637
)
@@ -68,7 +69,7 @@ func (i *instant) TimeoutAt(d time.Duration) <-chan time.Time {
6869
return ta
6970
}
7071

71-
if d == agreement.FilterTimeout() && !i.HasPending("pseudonode") {
72+
if d == agreement.FilterTimeout(0, protocol.ConsensusCurrentVersion) && !i.HasPending("pseudonode") {
7273
close(ta)
7374
}
7475
return ta

agreement/asyncVoteVerifier.go

+11-2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ package agreement
1818

1919
import (
2020
"context"
21+
"errors"
2122
"sync"
2223

2324
"github.com/algorand/go-algorand/util/execpool"
@@ -104,7 +105,11 @@ func (avv *AsyncVoteVerifier) executeVoteVerification(task interface{}) interfac
104105
// request was not cancelled, so we verify it here and return the result on the channel
105106
v, err := req.uv.verify(req.l)
106107
req.message.Vote = v
107-
return &asyncVerifyVoteResponse{v: v, index: req.index, message: req.message, err: err, req: &req}
108+
109+
var e *LedgerDroppedRoundError
110+
cancelled := errors.As(err, &e)
111+
112+
return &asyncVerifyVoteResponse{v: v, index: req.index, message: req.message, err: err, cancelled: cancelled, req: &req}
108113
}
109114
}
110115

@@ -118,7 +123,11 @@ func (avv *AsyncVoteVerifier) executeEqVoteVerification(task interface{}) interf
118123
default:
119124
// request was not cancelled, so we verify it here and return the result on the channel
120125
ev, err := req.uev.verify(req.l)
121-
return &asyncVerifyVoteResponse{ev: ev, index: req.index, message: req.message, err: err, req: &req}
126+
127+
var e *LedgerDroppedRoundError
128+
cancelled := errors.As(err, &e)
129+
130+
return &asyncVerifyVoteResponse{ev: ev, index: req.index, message: req.message, err: err, cancelled: cancelled, req: &req}
122131
}
123132
}
124133

agreement/common_test.go

+61-3
Original file line numberDiff line numberDiff line change
@@ -192,10 +192,14 @@ type testLedger struct {
192192
certs map[basics.Round]Certificate
193193
nextRound basics.Round
194194

195+
maxNumBlocks uint64
196+
195197
// constant
196198
state map[basics.Address]basics.AccountData
197199

198200
notifications map[basics.Round]signal
201+
202+
consensusVersion func(basics.Round) (protocol.ConsensusVersion, error)
199203
}
200204

201205
func makeTestLedger(state map[basics.Address]basics.AccountData) Ledger {
@@ -204,13 +208,54 @@ func makeTestLedger(state map[basics.Address]basics.AccountData) Ledger {
204208
l.certs = make(map[basics.Round]Certificate)
205209
l.nextRound = 1
206210

207-
// deep copy of state
208211
l.state = make(map[basics.Address]basics.AccountData)
209212
for k, v := range state {
210213
l.state[k] = v
211214
}
212215

213216
l.notifications = make(map[basics.Round]signal)
217+
218+
l.consensusVersion = func(r basics.Round) (protocol.ConsensusVersion, error) {
219+
return protocol.ConsensusCurrentVersion, nil
220+
}
221+
return l
222+
}
223+
224+
func makeTestLedgerWithConsensusVersion(state map[basics.Address]basics.AccountData, consensusVersion func(basics.Round) (protocol.ConsensusVersion, error)) Ledger {
225+
l := new(testLedger)
226+
l.entries = make(map[basics.Round]bookkeeping.Block)
227+
l.certs = make(map[basics.Round]Certificate)
228+
l.nextRound = 1
229+
230+
l.state = make(map[basics.Address]basics.AccountData)
231+
for k, v := range state {
232+
l.state[k] = v
233+
}
234+
235+
l.notifications = make(map[basics.Round]signal)
236+
237+
l.consensusVersion = consensusVersion
238+
return l
239+
}
240+
241+
func makeTestLedgerMaxBlocks(state map[basics.Address]basics.AccountData, maxNumBlocks uint64) Ledger {
242+
l := new(testLedger)
243+
l.entries = make(map[basics.Round]bookkeeping.Block)
244+
l.certs = make(map[basics.Round]Certificate)
245+
l.nextRound = 1
246+
247+
l.maxNumBlocks = maxNumBlocks
248+
249+
l.state = make(map[basics.Address]basics.AccountData)
250+
for k, v := range state {
251+
l.state[k] = v
252+
}
253+
254+
l.notifications = make(map[basics.Round]signal)
255+
256+
l.consensusVersion = func(r basics.Round) (protocol.ConsensusVersion, error) {
257+
return protocol.ConsensusCurrentVersion, nil
258+
}
214259
return l
215260
}
216261

@@ -268,6 +313,10 @@ func (l *testLedger) LookupDigest(r basics.Round) (crypto.Digest, error) {
268313
panic(err)
269314
}
270315

316+
if l.maxNumBlocks != 0 && r+round(l.maxNumBlocks) < l.nextRound {
317+
return crypto.Digest{}, &LedgerDroppedRoundError{}
318+
}
319+
271320
return l.entries[r].Digest(), nil
272321
}
273322

@@ -279,6 +328,11 @@ func (l *testLedger) Lookup(r basics.Round, a basics.Address) (basics.AccountDat
279328
err := fmt.Errorf("Lookup called on future round: %v >= %v! (this is probably a bug)", r, l.nextRound)
280329
panic(err)
281330
}
331+
332+
if l.maxNumBlocks != 0 && r+round(l.maxNumBlocks) < l.nextRound {
333+
return basics.AccountData{}, &LedgerDroppedRoundError{}
334+
}
335+
282336
return l.state[a], nil
283337
}
284338

@@ -348,11 +402,15 @@ func (l *testLedger) EnsureDigest(c Certificate, verifier *AsyncVoteVerifier) {
348402
}
349403

350404
func (l *testLedger) ConsensusParams(r basics.Round) (config.ConsensusParams, error) {
351-
return config.Consensus[protocol.ConsensusCurrentVersion], nil
405+
version, err := l.ConsensusVersion(r)
406+
if err != nil {
407+
return config.ConsensusParams{}, err
408+
}
409+
return config.Consensus[version], nil
352410
}
353411

354412
func (l *testLedger) ConsensusVersion(r basics.Round) (protocol.ConsensusVersion, error) {
355-
return protocol.ConsensusCurrentVersion, nil
413+
return l.consensusVersion(r)
356414
}
357415

358416
// simulation helpers

0 commit comments

Comments
 (0)