Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Onetechnical/relstable2.2.0 #1681

Merged
merged 149 commits into from
Nov 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
149 commits
Select commit Hold shift + click to select a range
f92fafc
Add versions endpoint to spec, fix versions model objects.
winder Sep 2, 2020
108c474
Auth Middleware Tests (#1438)
winder Sep 2, 2020
ffb4e69
Add genesis.json endpoint.
winder Sep 2, 2020
4c1cd34
Update spec with genesis.json endpoint.
winder Sep 2, 2020
febe0b6
Add e2e test.
winder Sep 2, 2020
6c707c0
Fixes for make fmt && make lint
winder Sep 2, 2020
23382ba
Minor code simplification.
winder Sep 2, 2020
107e9c0
Recipe for network testing (#1322)
egieseke Sep 3, 2020
7ab606e
Improve versions description.
winder Sep 3, 2020
0b6774f
Update algod.oas2.json
winder Sep 3, 2020
ff5d1f1
Allow max and assetIndex to be optional. Closes #1445
winder Sep 3, 2020
29ef275
Remove .json from the new /genesis.json endpoint.
winder Sep 3, 2020
a6c8275
No need to return an error when requesting the same catchpoint multip…
winder Sep 4, 2020
4e8530d
Fix genesis endpoint operation ID.
winder Sep 4, 2020
5d6bdad
Merge branch 'master' into will/add-versions-to-v2-openapi-doc
winder Sep 4, 2020
09253dd
finish merge...
winder Sep 4, 2020
d82fcf4
Merge branch 'master' into will/genesis-endpoint
winder Sep 4, 2020
bcc0350
Minor catchpoint error handling code cleanup (#1484)
winder Sep 4, 2020
423e959
Simplify dryrunning and debugging group txn (#1405)
algorandskiy Sep 4, 2020
0f6f191
Add unit tests to logic debugger (#1466)
algonautshant Sep 4, 2020
da3c456
Add support for algorelay deleting unused SRV and DNS entries
tsachiherman Sep 4, 2020
8fd86a2
Add a benchmark to test restoring from catchpoint performance. (#1485)
tsachiherman Sep 4, 2020
edb4fc6
Merge pull request #1482 from winder/will/v1-assets-fix
algorotem Sep 7, 2020
17bfc38
-- -- typo
algorotem Sep 7, 2020
b648e0d
Merge pull request #1468 from winder/will/genesis-endpoint
algorotem Sep 7, 2020
8041c81
Merge branch 'master' into will/add-versions-to-v2-openapi-doc
winder Sep 8, 2020
7f01897
Optimize Merkle trie memory consumption (#1481)
tsachiherman Sep 8, 2020
399078c
Add unit tests for equal functions in teal.go (#1486)
algorandskiy Sep 8, 2020
6bc1c01
core crypto primitives for compact certificates (#1359)
zeldovich Sep 9, 2020
4849f51
implement tracking of top-N online accounts in the ledger (#1361)
zeldovich Sep 9, 2020
b741465
Add a benchmark for writeCatchpointStagingBalances (#1491)
tsachiherman Sep 9, 2020
b45ec88
Merge pull request #1467 from winder/will/add-versions-to-v2-openapi-doc
algorotem Sep 9, 2020
c58f4e9
Fix e2e test : removing close from eof pattern match (#1493)
algonautshant Sep 9, 2020
bdc298c
Improve BenchmarkWriteCatchpointStagingBalances benchmark - compared …
tsachiherman Sep 9, 2020
b238b96
Adding ledger tests (#1495)
algonautshant Sep 10, 2020
5c6b67d
Add txn.Accounts and txn.ApplicationArgs support to tealdbg (#1497)
algorandskiy Sep 10, 2020
b1a884c
Improve RestoringFromCatchpointFile benchmark precision (#1499)
tsachiherman Sep 10, 2020
23b740c
Fix asset flags.
winder Sep 11, 2020
4afd8de
e2e test updates.
winder Sep 11, 2020
cd76f72
commit to Merkle tree of online participants in block header (#1447)
zeldovich Sep 14, 2020
ba31225
fixup docs (#1498)
ryanRfox Sep 14, 2020
09e0ff8
REST docs update: /v1/account/{addr}/transactions (#1503)
winder Sep 14, 2020
c2fada3
Change database synchronous mode during fast catchup (#1501)
tsachiherman Sep 15, 2020
9c41ddf
Don't change parameter name.
winder Sep 15, 2020
c9417ba
calculate normalized balance using genesis proto (#1509)
tsachiherman Sep 15, 2020
fbf88ed
Exit with a non-zero in case of an error (#1511)
tsachiherman Sep 16, 2020
18cdaed
Test for process return in expect tests (#1502)
algonautshant Sep 16, 2020
c1b79d8
Create new `algorand-devtools` package (#1492)
Sep 16, 2020
f5b760a
Return 404 if v1/transaction/{txid} doesn't find the txn. (#1504)
winder Sep 16, 2020
d8d60e9
Remove commas from mule yaml files (#1469)
Sep 16, 2020
967240a
Remove devtools binaries from algorand package (rpm) (#1515)
Sep 16, 2020
34904e2
No hardcoded dependency package names (#1516)
Sep 17, 2020
de964b3
Updates to support testing TEAL application size (#1506)
egieseke Sep 17, 2020
58d398b
Revert "Don't change parameter name."
winder Sep 17, 2020
85eb20e
Add 'asset' back in and mark it deprecated.
winder Sep 17, 2020
60d4ec6
Fix pathing issue to installer directory (#1517)
Sep 17, 2020
0a35947
Remove the Lookup from the ledgerForEvaluator interface (#1521)
tsachiherman Sep 18, 2020
3573f43
Bug fix - revert change to grep recommended by shellcheck (#1523)
onetechnical Sep 18, 2020
f2c1347
Add metrics for the various ledger components (#1510)
brianolson Sep 18, 2020
52b6898
Vote validation error refactor (#1508)
Sep 19, 2020
76c1fc3
Switch unit to unitname
winder Sep 21, 2020
79e639d
Add a transaction type to store compact certificates (#1391)
zeldovich Sep 22, 2020
ecd0e2b
Filter Timeout Change Refactor (#1520)
Sep 22, 2020
fe4c834
Merge pull request #1500 from winder/will/goal-cleanup
algorotem Sep 22, 2020
c815ba4
Cache the most recent Seed/Circulation calls to reduce pressure on le…
tsachiherman Sep 22, 2020
98d6238
Deprecate algolambdamsec environment variable (#1536)
Sep 22, 2020
e14f3d5
Fix heuristicFormatStr logic (#1528)
tsachiherman Sep 22, 2020
deb7504
Correctly account for bloom filter binary marshaling size. (#1539)
tsachiherman Sep 22, 2020
0ced664
Bug fix - use DEFAULT_RELEASE_NETWORK genesis file in debian package …
onetechnical Sep 23, 2020
80d5fbb
Test reading from database while writing (#1532)
tsachiherman Sep 23, 2020
648552a
Add detailed error logging in case of failed blocks download (#1542)
tsachiherman Sep 23, 2020
a4528a3
Improve goal node start error reporting in case of algod errored (#1513)
tsachiherman Sep 23, 2020
953318a
remove expected ReadError events (#1549)
tsachiherman Sep 24, 2020
ea2af12
Hot fix for fixing bad genesis file on 2.1.5 install (#1553)
Sep 24, 2020
dd8ae07
add more inputs into hashCoin() for better hygiene (#1541)
zeldovich Sep 24, 2020
7ee6fa3
Extend expect timeout when checking account balance (#1546)
egieseke Sep 25, 2020
21d7b6d
Add a unit test to confirm BinaryMarshalLength correctness. (#1556)
tsachiherman Sep 25, 2020
9d86768
Fix typos in ledger package (#1564)
algonautshant Sep 29, 2020
28b7ee1
bugfix: limit txpool size by transaction count rather then transactio…
tsachiherman Sep 29, 2020
0bb4cf3
Windows version (#1540)
mxmauro Sep 29, 2020
36c16ad
Fix random failure in goalNodeTest.exp (#1574)
tsachiherman Sep 30, 2020
4b43e73
Remove Travis token, which is not needed for open source repos (#1567)
onetechnical Sep 30, 2020
cb17a70
Fix bug in expect test (#1579)
tsachiherman Oct 1, 2020
302a3e6
Update mule rpm packaging to support more scenarios (#1476)
Oct 2, 2020
f5a0ebd
Update deploy scripts to reflect current deploy strategy (#1477)
Oct 2, 2020
c99d721
Add unit tests for IsWritingCatchpointFile and GetCatchpointStream (#…
algonautshant Oct 3, 2020
31ebf7a
bugfix: correct accounting of transactions in checkPendingQueueSize (…
tsachiherman Oct 3, 2020
f28458e
Improve network template validation (#1512)
tsachiherman Oct 5, 2020
726a95e
Decouple database round and acctupdate round (#1527)
tsachiherman Oct 6, 2020
fc537bc
Added more deb and rpm package tests (#1580)
Oct 6, 2020
965ece0
avoid printing control characters from goal (#1585)
tsachiherman Oct 6, 2020
953277b
Optimize listCreatables per reviewer request. (#1599)
tsachiherman Oct 6, 2020
9678691
cleanup buggy test code (#1602)
brianolson Oct 7, 2020
52dd302
make sanity (#1603)
brianolson Oct 7, 2020
3df0d06
Simplify mule signing task (#1604)
Oct 7, 2020
eeb195c
Add support for Windows compilation on travis (#1608)
tsachiherman Oct 9, 2020
8619d73
Remove unused dockerfiles (#1610)
Oct 12, 2020
95e4404
Refactor AssembleBlock error (#1611)
Oct 12, 2020
284f69a
Correct Telemetry uploading message reported in node.log (#1605)
algonautshant Oct 12, 2020
93a9909
Repack merkle trie pages before flush (#1612)
tsachiherman Oct 13, 2020
667949f
Change telemetryConfig from global variable to a member of the logger…
algonautshant Oct 14, 2020
47c1ca2
add ascii filtering for remote requests logged data (#1595)
tsachiherman Oct 14, 2020
fbe0bfe
Update mule docs for new pipeline (#1606)
Oct 14, 2020
e81b91b
Added `package-upload` mule task (#1617)
Oct 14, 2020
a156ba9
Fix unreliable unit test. (#1622)
tsachiherman Oct 14, 2020
ebc90af
Add syncMu to AlgorandFullNode OnNewBlock (#1623)
Oct 14, 2020
3fa7a92
Implement e2e test for tealdbg (#1609)
algorandskiy Oct 15, 2020
0f9f8c9
Fix datarace in TestPing unit test (#1624)
tsachiherman Oct 15, 2020
69514e3
Set content type header for health endpoint (#1621)
jasonpaulos Oct 15, 2020
e2865f4
extend account lookup to include validity range (#1626)
tsachiherman Oct 16, 2020
74a9339
tealdbg unit tests (#1613)
algorandskiy Oct 20, 2020
0c77053
Brice/perf10x (#1625)
bricerisingalgorand Oct 20, 2020
1df4439
Add goal account info command (#1583)
jasonpaulos Oct 20, 2020
ffb3b20
Output error when 'goal node stop' is run on invalid directory (#1627)
Oct 21, 2020
915c005
Netgoal general templates (#1639)
brianolson Oct 22, 2020
e54bc28
tealdbg: listen for upcoming spinoff connections (#1634)
algorandskiy Oct 22, 2020
0ca696d
Update issue templates (#1643)
ian-algorand Oct 22, 2020
f48e1e3
Tweak the mainnet-model recipe (#1642)
tsachiherman Oct 23, 2020
bb0896f
Revert "Revert "Filter timeout to 2s for period 0, 4s for period > 0 …
onetechnical Oct 23, 2020
82a7819
Merge branch 'rel/beta-proposed' into master-proposed
onetechnical Oct 23, 2020
7eaa42f
Merge branch 'rel/stable' into master-proposed
onetechnical Oct 23, 2020
715dd25
Remove buildnumber.dat and genesistimestamp.dat
onetechnical Oct 23, 2020
3c6c54b
Merge pull request #1650 from onetechnical/onetechnical/branch-remerge
algojohnlee Oct 23, 2020
06c5a89
Update build to version 2.2.0
onetechnical Oct 26, 2020
92308ff
Update buildnumber.dat to 0.
onetechnical Oct 26, 2020
397583f
Implement mule packaging pipeline (#1629)
bricerisingalgorand Oct 26, 2020
f44f85c
Merge branch 'master' into onetechnical/relbeta2.2.0
onetechnical Oct 26, 2020
085e60f
Ensure syncStartNS is managed correctly across catchpoint file writin…
tsachiherman Oct 27, 2020
69f210f
Refactor parseIntcblock (#1644)
Oct 27, 2020
8dabd4a
Added S3_SOURCE env var to specify source of packages for signing (#1…
Oct 27, 2020
e4937cf
Merge branch 'master' into onetechnical/relbeta2.2.0
onetechnical Oct 27, 2020
f780004
Merge pull request #1651 from onetechnical/onetechnical/relbeta2.2.0
algojohnlee Oct 27, 2020
4ccded4
Set TRAVIS_BRANCH env var in jenkins mule agents (#1656)
bricerisingalgorand Oct 27, 2020
e8a890f
Fix the way environments were being set in mule
bricerisingalgorand Oct 27, 2020
f81b5ad
Ensure script picks up TRAVIS_BRANCH env var, if set (#1661)
Oct 28, 2020
7b80473
Default to branch name when branch parent fails (#1662)
bricerisingalgorand Oct 28, 2020
cdacf08
Check for null when setting BRANCHPARENT in compute branch network (#…
bricerisingalgorand Oct 28, 2020
1aab31b
Fix double quote parameters passing in docker env (#1664)
bricerisingalgorand Oct 28, 2020
7aef02c
Fix computed network for packaging (#1665)
onetechnical Oct 29, 2020
f9ce051
Fix path of build_status files in deb packaging (#1668)
bricerisingalgorand Oct 29, 2020
d2e9b9b
Harden mule signing task (#1667)
Oct 29, 2020
450fd8c
Change rpm package file to match rename (#1666)
Oct 29, 2020
3ae2f78
Created mule tasks for aptly, releases page and docker hub images (#1…
Oct 29, 2020
08171f6
Fix RPM errors introduced in new pipeline (#1673)
bricerisingalgorand Oct 30, 2020
f8bdceb
Revert "Change rpm package file to match rename (#1666)" (#1675)
onetechnical Oct 30, 2020
4de3deb
Support multiple OS and ARCH for signing (#1674)
Oct 30, 2020
fcd3fd9
Add ARCH_TYPE to build status file (#1676)
Oct 30, 2020
cccd1bf
Bug Fix - RPM missing genesisfiles and Debian package misnamed (#1677)
bricerisingalgorand Oct 30, 2020
566405e
Fix bugs in mule test stage (#1679)
Oct 30, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
18 changes: 18 additions & 0 deletions .github/ISSUE_TEMPLATE/algorand-engineering-team-issue-template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
name: Algorand Engineering Team Issue Template
about: This is the template that Algorand internal team members use in conjunction
with their task management process. Feel free to use if you're an external contributor.
title: ''
labels: ''
assignees: ''

---

## Summary
*Describe the problem identified or the general goal of this issue*

## Scope/Requirements
*What's involved in this issue? What's required to achieve the goal?*

## Urgency/Relative Priority
*How urgent is this issue? What are the timing considerations to take into account?*
9 changes: 6 additions & 3 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
---
name: '🐜 Bug report'
about: 'Report a reproducible bug.'
name: "\U0001F41C Bug report"
about: Report a reproducible bug.
title: ''
labels: 'new-bug'
labels: new-bug
assignees: ''

---

<!--
NOTE: If this issue relates to security, please use the vulnerability disclosure form here:
https://www.algorand.com/resources/blog/security
Expand Down
9 changes: 6 additions & 3 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
---
name: '🔔 Feature Request'
about: 'Suggestions for how we can improve the algorand platform.'
name: "\U0001F514 Feature Request"
about: Suggestions for how we can improve the algorand platform.
title: ''
labels: 'new-feature-request'
labels: new-feature-request
assignees: ''

---

<!--
NOTE: If this issue relates to security, please use the vulnerability disclosure form here:
https://www.algorand.com/resources/blog/security
Expand Down
8 changes: 5 additions & 3 deletions .github/ISSUE_TEMPLATE/question.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
---
name: '❓ Question'
about: 'General questions related to the algorand platform.'
name: "❓ Question"
about: General questions related to the algorand platform.
title: ''
labels: 'question'
labels: question
assignees: ''

---

🚨 The issue tracker is not for questions. 🚨
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,6 @@ assets

# test binaries
*.test

index.html

52 changes: 50 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
os: linux
dist: bionic
go_import_path: github.com/algorand/go-algorand
language: go
Expand Down Expand Up @@ -76,6 +77,15 @@ jobs:
name: MacOS AMD64 Integration Test
script:
- ./scripts/travis/integration_test.sh
- # same stage, parallel job
os: windows
name: Windows x64 Build
cache:
directories:
- $HOME/AppData/Local/Temp/chocolatey
- /C/tools/msys64
script:
- $mingw64 scripts/travis/build_test.sh

- stage: build_release
os: linux
Expand Down Expand Up @@ -105,6 +115,15 @@ jobs:
- awscli
script:
- scripts/travis/external_build.sh ./scripts/travis/integration_test.sh
- # same stage, parallel job
os: windows
name: Windows x64 Build
cache:
directories:
- $HOME/AppData/Local/Temp/chocolatey
- /C/tools/msys64
script:
- $mingw64 scripts/travis/build_test.sh

- stage: deploy
name: Ubuntu Deploy
Expand Down Expand Up @@ -148,8 +167,37 @@ cache:
- crypto/lib

before_install:
# Disable sometimes-broken sources.list in Travis base images
- sudo rm -vf /etc/apt/sources.list.d/*
- |-
case $TRAVIS_OS_NAME in
linux)
# Disable sometimes-broken sources.list in Travis base images
sudo rm -vf /etc/apt/sources.list.d/*
;;
windows)
[[ ! -f C:/tools/msys64/msys2_shell.cmd ]] && rm -rf C:/tools/msys64
choco uninstall -y mingw
choco upgrade --no-progress -y msys2
export msys2='cmd //C RefreshEnv.cmd '
export msys2+='& set MSYS=winsymlinks:nativestrict '
export msys2+='& C:\\tools\\msys64\\msys2_shell.cmd -defterm -no-start'
export mingw64="$msys2 -mingw64 -full-path -here -c "\"\$@"\" --"
export msys2+=" -msys2 -c "\"\$@"\" --"
$msys2 pacman --sync --noconfirm --needed mingw-w64-x86_64-toolchain unzip
## Install more MSYS2 packages from https://packages.msys2.org/base here
taskkill //IM gpg-agent.exe //F # https://travis-ci.community/t/4967
export PATH=/C/tools/msys64/mingw64/bin:$PATH
export MAKE=mingw32-make # so that Autotools can find it
;;
esac

before_cache:
- |-
case $TRAVIS_OS_NAME in
windows)
# https://unix.stackexchange.com/a/137322/107554
$msys2 pacman --sync --clean --noconfirm
;;
esac

addons:
apt:
Expand Down
28 changes: 18 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,16 +1,23 @@
export GOPATH := $(shell go env GOPATH)
GOPATH1 := $(firstword $(subst :, ,$(GOPATH)))
UNAME := $(shell uname)
ifneq (, $(findstring MINGW,$(UNAME)))
#Gopath is not saved across sessions, probably existing Windows env vars, override them
export GOPATH := ${HOME}/go
GOPATH1 := $(GOPATH)
export PATH := $(PATH):$(GOPATH)/bin
else
export GOPATH := $(shell go env GOPATH)
GOPATH1 := $(firstword $(subst :, ,$(GOPATH)))
endif
export GO111MODULE := on
export GOPROXY := direct

UNAME := $(shell uname)
SRCPATH := $(shell pwd)
ARCH := $(shell ./scripts/archtype.sh)
OS_TYPE := $(shell ./scripts/ostype.sh)
S3_RELEASE_BUCKET = $$S3_RELEASE_BUCKET

# If build number already set, use it - to ensure same build number across multiple platforms being built
BUILDNUMBER ?= $(shell ./scripts/compute_build_number.sh)
FULLBUILDNUMBER ?= $(shell ./scripts/compute_build_number.sh -f)
COMMITHASH := $(shell ./scripts/compute_build_commit.sh)
BUILDBRANCH := $(shell ./scripts/compute_branch.sh)
CHANNEL ?= $(shell ./scripts/compute_branch_channel.sh $(BUILDBRANCH))
Expand Down Expand Up @@ -38,6 +45,11 @@ endif
endif
endif

ifneq (, $(findstring MINGW,$(UNAME)))
EXTLDFLAGS := -static-libstdc++ -static-libgcc
export GOBUILDMODE := -buildmode=exe
endif

GOTAGS := --tags "$(GOTAGSLIST)"
GOTRIMPATH := $(shell go help build | grep -q .-trimpath && echo -trimpath)

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

MSGP_GENERATE := ./protocol ./crypto ./data/basics ./data/transactions ./data/committee ./data/bookkeeping ./data/hashable ./auction ./agreement ./rpcs ./node ./ledger
MSGP_GENERATE := ./protocol ./crypto ./crypto/compactcert ./data/basics ./data/transactions ./data/committee ./data/bookkeeping ./data/hashable ./auction ./agreement ./rpcs ./node ./ledger

default: build

Expand Down Expand Up @@ -289,10 +301,6 @@ install: build
###### TARGETS FOR CICD PROCESS ######
include ./scripts/release/mule/Makefile.mule

SUPPORTED_ARCHIVE_OS_ARCH = linux/amd64 linux/arm64 linux/arm darwin/amd64

archive:
CHANNEL=$(CHANNEL) \
PATH=$(SRCPATH)/tmp/node_pkgs/$(OS_TYPE)/$(ARCH)/bin:$${PATH} \
scripts/upload_version.sh $(CHANNEL) $(SRCPATH)/tmp/node_pkgs $(S3_RELEASE_BUCKET)

aws s3 cp tmp/node_pkgs s3://algorand-internal/channel/${CHANNEL}/$(FULLBUILDNUMBER) --recursive --exclude "*" --include "*${CHANNEL}*$(FULLBUILDNUMBER)*"
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![Build Status](https://travis-ci.com/algorand/go-algorand.svg?token=25XP72ADqbCQJ3TJVC9S&branch=master)](https://travis-ci.com/algorand/go-algorand)
[![Build Status](https://travis-ci.com/algorand/go-algorand.svg?branch=master)](https://travis-ci.com/algorand/go-algorand)

go-algorand
====================
Expand Down
15 changes: 15 additions & 0 deletions agreement/abstractions.go
Original file line number Diff line number Diff line change
Expand Up @@ -307,3 +307,18 @@ type Message struct {
type EventsProcessingMonitor interface {
UpdateEventsQueue(queueName string, queueLength int)
}

// LedgerDroppedRoundError is a wrapper error for when the ledger cannot return a Lookup query because
// the entry is old and was dropped from the ledger. The purpose of this wrapper is to help the
// agreement differentiate between a malicious vote and a vote that it cannot verify
type LedgerDroppedRoundError struct {
Err error
}

func (e *LedgerDroppedRoundError) Error() string {
return e.Err.Error()
}

func (e *LedgerDroppedRoundError) Unwrap() error {
return e.Err
}
3 changes: 2 additions & 1 deletion agreement/agreementtest/simulate.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import (
"github.com/algorand/go-algorand/crypto"
"github.com/algorand/go-algorand/data/basics"
"github.com/algorand/go-algorand/logging"
"github.com/algorand/go-algorand/protocol"
"github.com/algorand/go-algorand/util/db"
"github.com/algorand/go-algorand/util/timers"
)
Expand Down Expand Up @@ -68,7 +69,7 @@ func (i *instant) TimeoutAt(d time.Duration) <-chan time.Time {
return ta
}

if d == agreement.FilterTimeout() && !i.HasPending("pseudonode") {
if d == agreement.FilterTimeout(0, protocol.ConsensusCurrentVersion) && !i.HasPending("pseudonode") {
close(ta)
}
return ta
Expand Down
13 changes: 11 additions & 2 deletions agreement/asyncVoteVerifier.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package agreement

import (
"context"
"errors"
"sync"

"github.com/algorand/go-algorand/util/execpool"
Expand Down Expand Up @@ -104,7 +105,11 @@ func (avv *AsyncVoteVerifier) executeVoteVerification(task interface{}) interfac
// request was not cancelled, so we verify it here and return the result on the channel
v, err := req.uv.verify(req.l)
req.message.Vote = v
return &asyncVerifyVoteResponse{v: v, index: req.index, message: req.message, err: err, req: &req}

var e *LedgerDroppedRoundError
cancelled := errors.As(err, &e)

return &asyncVerifyVoteResponse{v: v, index: req.index, message: req.message, err: err, cancelled: cancelled, req: &req}
}
}

Expand All @@ -118,7 +123,11 @@ func (avv *AsyncVoteVerifier) executeEqVoteVerification(task interface{}) interf
default:
// request was not cancelled, so we verify it here and return the result on the channel
ev, err := req.uev.verify(req.l)
return &asyncVerifyVoteResponse{ev: ev, index: req.index, message: req.message, err: err, req: &req}

var e *LedgerDroppedRoundError
cancelled := errors.As(err, &e)

return &asyncVerifyVoteResponse{ev: ev, index: req.index, message: req.message, err: err, cancelled: cancelled, req: &req}
}
}

Expand Down
64 changes: 61 additions & 3 deletions agreement/common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,10 +192,14 @@ type testLedger struct {
certs map[basics.Round]Certificate
nextRound basics.Round

maxNumBlocks uint64

// constant
state map[basics.Address]basics.AccountData

notifications map[basics.Round]signal

consensusVersion func(basics.Round) (protocol.ConsensusVersion, error)
}

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

// deep copy of state
l.state = make(map[basics.Address]basics.AccountData)
for k, v := range state {
l.state[k] = v
}

l.notifications = make(map[basics.Round]signal)

l.consensusVersion = func(r basics.Round) (protocol.ConsensusVersion, error) {
return protocol.ConsensusCurrentVersion, nil
}
return l
}

func makeTestLedgerWithConsensusVersion(state map[basics.Address]basics.AccountData, consensusVersion func(basics.Round) (protocol.ConsensusVersion, error)) Ledger {
l := new(testLedger)
l.entries = make(map[basics.Round]bookkeeping.Block)
l.certs = make(map[basics.Round]Certificate)
l.nextRound = 1

l.state = make(map[basics.Address]basics.AccountData)
for k, v := range state {
l.state[k] = v
}

l.notifications = make(map[basics.Round]signal)

l.consensusVersion = consensusVersion
return l
}

func makeTestLedgerMaxBlocks(state map[basics.Address]basics.AccountData, maxNumBlocks uint64) Ledger {
l := new(testLedger)
l.entries = make(map[basics.Round]bookkeeping.Block)
l.certs = make(map[basics.Round]Certificate)
l.nextRound = 1

l.maxNumBlocks = maxNumBlocks

l.state = make(map[basics.Address]basics.AccountData)
for k, v := range state {
l.state[k] = v
}

l.notifications = make(map[basics.Round]signal)

l.consensusVersion = func(r basics.Round) (protocol.ConsensusVersion, error) {
return protocol.ConsensusCurrentVersion, nil
}
return l
}

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

if l.maxNumBlocks != 0 && r+round(l.maxNumBlocks) < l.nextRound {
return crypto.Digest{}, &LedgerDroppedRoundError{}
}

return l.entries[r].Digest(), nil
}

Expand All @@ -279,6 +328,11 @@ func (l *testLedger) Lookup(r basics.Round, a basics.Address) (basics.AccountDat
err := fmt.Errorf("Lookup called on future round: %v >= %v! (this is probably a bug)", r, l.nextRound)
panic(err)
}

if l.maxNumBlocks != 0 && r+round(l.maxNumBlocks) < l.nextRound {
return basics.AccountData{}, &LedgerDroppedRoundError{}
}

return l.state[a], nil
}

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

func (l *testLedger) ConsensusParams(r basics.Round) (config.ConsensusParams, error) {
return config.Consensus[protocol.ConsensusCurrentVersion], nil
version, err := l.ConsensusVersion(r)
if err != nil {
return config.ConsensusParams{}, err
}
return config.Consensus[version], nil
}

func (l *testLedger) ConsensusVersion(r basics.Round) (protocol.ConsensusVersion, error) {
return protocol.ConsensusCurrentVersion, nil
return l.consensusVersion(r)
}

// simulation helpers
Expand Down
Loading