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

Integrate State Proof keys #2990

Merged
merged 345 commits into from
Feb 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
345 commits
Select commit Hold shift + click to select a range
c9c3d03
WIP: adding round commitment to the merklekeystore keys
algonathan Jul 21, 2021
4805692
added const to EphemeralPublicKey ToBeHashed
algonathan Jul 21, 2021
8de8ebd
extended unit tests
algonathan Jul 21, 2021
b0d8e51
fix: 'make sanity'
algonathan Jul 21, 2021
8e75eaf
api change
algonathan Jul 21, 2021
994d938
fix: lexicographic order
algonathan Jul 21, 2021
0f741fa
fix: import style convention
algonathan Jul 21, 2021
6020752
removed unused variable
algonathan Jul 21, 2021
0625577
changed name of ephemralpk
algonathan Jul 22, 2021
238f10c
fix: msgpack for merklekeystore.Verifier
algonathan Jul 22, 2021
2b5f0b1
changed signature test in merklekeystore
algonathan Jul 22, 2021
b5cb25e
fix: comment for EphemralKeys in merklekeystore
algonathan Jul 22, 2021
27bc1bd
fix: bug in unit test
algonathan Jul 22, 2021
15b74a8
fix: comment for EphemralKeys in merklekeystore
algonathan Jul 22, 2021
ecf4d60
removed some spaces
algonathan Jul 22, 2021
d546e32
removed unneeded firstRound param from signer
algonathan Jul 25, 2021
03918f9
added a trimming function to the merklekeystore.
algonathan Jul 25, 2021
1eeba1a
added comments in merkle key store to fields in EphemeralKeys,Signer
algonathan Jul 25, 2021
9a85e36
removed test for valid blockproofPK - no such check for new type of key
algonathan Jul 25, 2021
c6dc936
fix: comparision of merklekeystore.Signer inside tests
algonathan Jul 25, 2021
fe868c4
fix: bad comment over Trim function
algonathan Jul 25, 2021
df16663
fix: using error.new instead of fmt.Errorf when possible
algonathan Jul 28, 2021
80ff497
fix: import conventions
algonathan Jul 28, 2021
b727b7e
fix: comment in participation struct
algonathan Jul 28, 2021
36d935b
fix: removed errors from Trim
algonathan Jul 28, 2021
a3105eb
fix: removed bad comments
algonathan Jul 28, 2021
d260bbd
WIP: dividing key rounds in merklekeystore
algonathan Jul 28, 2021
31dfdd3
fix: sanity checks
algonathan Jul 28, 2021
cc8f2fe
decided not to support zero key, because it doesn't make sense
algonathan Jul 28, 2021
0f201ae
fix: merklekeystore signer will not return invalid verifier
algonathan Jul 28, 2021
d1f0101
fix: bug in libgoal/participation - did not check errors
algonathan Jul 28, 2021
f8e8256
fix: signature and verification align with key spaces
algonathan Jul 28, 2021
5d753c0
fix code panic on 0 divisor
algonathan Jul 28, 2021
d1d91a4
fix: forgot to copy merklekeystore.signer originRound
algonathan Jul 28, 2021
a6e0495
ensuring no verification for round zero
algonathan Jul 28, 2021
fed6f50
added test for divisor >1 in deletion tests
algonathan Jul 28, 2021
a2dc8c2
WIP: fixing trim
algonathan Jul 29, 2021
781724f
renamed divisor into interval
algonathan Jul 29, 2021
e33b60f
renaming merklekeystore bases
algonathan Jul 29, 2021
a4be043
trim is set to work with specific keys only
algonathan Jul 29, 2021
75f64ec
changed codec name, and removed unused field from verifier
algonathan Aug 1, 2021
5a2a2a7
removed commented out code
algonathan Aug 1, 2021
c14d35a
fix: removed unused function numkeys, changed names of params
algonathan Aug 1, 2021
64eb11c
renamed field divisor to interval in merklekeystore.New function
algonathan Aug 1, 2021
b482cfc
removed unused code
algonathan Aug 1, 2021
ed490c2
explicit init for ArrayBase
algonathan Aug 1, 2021
e0f864c
fix: using round instead of indexToRound in verify func
algonathan Aug 1, 2021
858e275
fix: added Status to verifier
algonathan Aug 1, 2021
4ef8990
reverted one commit back
algonathan Aug 1, 2021
5254c1e
renamed firstValid
algonathan Aug 1, 2021
a0376c3
removed unneeded structure (EphemeralKeys) and merged into signer
algonathan Aug 1, 2021
b62872d
fix: changed receiver name to match signer first initial
algonathan Aug 1, 2021
8fe1fd0
fix: renamed functionality to get indices and rounds
algonathan Aug 1, 2021
ac77b57
fix: bug in new signer - overflow in roundToIndex, fixed by explicit …
algonathan Aug 1, 2021
f3190a7
added unit tests
algonathan Aug 1, 2021
3bcb5f9
added a way to dicern empty verifier from verifier that is tied to a …
algonathan Aug 1, 2021
4cf11f6
fix: fmt
algonathan Aug 1, 2021
7cdf8ad
Squashed Review commits, all messages are present below:
algonathan Aug 1, 2021
3bbf7b1
concluded TODO in participation/account is not needed anymore
algonathan Aug 1, 2021
80e8450
removing valid testing for signatureAlgos
algonathan Aug 2, 2021
e87acad
fix:msggen
algonathan Aug 2, 2021
3fb37e9
dillithiumkey basic integration:
algonathan Aug 2, 2021
25bbf53
squashed changes from master
algonathan Aug 4, 2021
811d5a9
placeholder key turned into dilithium key
algonathan Aug 4, 2021
954050c
participation key creation will use concensus params to determine the…
algonathan Aug 4, 2021
04bea3f
WIP: dilithium cgo, -o3 flag. still needs some configurations
algonathan Aug 4, 2021
d58958d
fix: go fmt
algonathan Aug 4, 2021
e943929
new participation key will use keydilution as compactcertround parame…
algonathan Aug 5, 2021
199c846
renamed dilithium library
algonathan Aug 5, 2021
4c6d3b8
fix lint checks
algonathan Aug 5, 2021
f2003eb
check for arm64 integration tests
algonathan Aug 5, 2021
d03a327
merged from main branch
algonathan Aug 5, 2021
609c6c6
added unit test to crypto/dilithium
algonathan Aug 9, 2021
2933533
fix: typos in dilithium.go comments
algonathan Aug 9, 2021
0326a01
rearanging cdilithium directories, cdillithium to use dil3, and rando…
algonathan Aug 9, 2021
398a9b7
changed functions used from api.h
algonathan Aug 9, 2021
419ef35
added constant values
algonathan Aug 9, 2021
63227b5
changing the codec name of dilithium public key
algonathan Aug 11, 2021
5ccfb53
cannot have empty signature
algonathan Aug 11, 2021
2492570
compiling withoung rnadomised sig flag
algonathan Aug 11, 2021
a36c0d8
moved cdilithium wrapper to a different fork
algonathan Aug 11, 2021
1be5466
increased interval
algonathan Aug 11, 2021
ab7e54d
upgraded go-mod version of the algorand/dilithium fork
algonathan Aug 11, 2021
98da7af
added test for dilithium hashable
algonathan Aug 11, 2021
d1e68e1
fixing partitiontest in msgpack tests
Aug 19, 2021
b170684
Subsetsum (#2786)
algonathan Aug 25, 2021
2b53ef0
Compcert sumhash integration (#2816)
algonathan Sep 5, 2021
baf32d2
fix: codegen_verification
algonathan Sep 5, 2021
33b68f4
the compact certificate code now uses the state proof.
Sep 6, 2021
611330f
CR fix
Sep 9, 2021
352bda9
fix layer bug.
Sep 10, 2021
24caaf6
using copy instead of append
Sep 10, 2021
c6e7418
reduce the default number of rounds
Sep 12, 2021
6afa138
added benchmark to participation. refactored fillDB benchmark too.
algonathan Sep 14, 2021
c40c149
fix for review
algonathan Sep 29, 2021
0d2d977
concensus can keep on sending money after reaching version future fro…
algonathan Sep 23, 2021
3c83615
refactored the way testing for upgrade and sending txns work
algonathan Sep 23, 2021
244ce11
added a test that inspects old keys can be made up to the version upg…
algonathan Sep 23, 2021
7c8e55b
refactored func signature to not pass fields of Fixture object
algonathan Sep 24, 2021
d0c415b
added test for participating after concensus upgrade
algonathan Sep 24, 2021
92e92a6
changed comments
algonathan Sep 24, 2021
d88665b
added large participation key registration
algonathan Sep 25, 2021
d0e868e
added a scenario that makes certain compact cert are being made after…
algonathan Sep 25, 2021
ff1bced
added partitionTest to each test
algonathan Sep 29, 2021
8bdd470
changed todo
algonathan Sep 29, 2021
7f51668
removed test
algonathan Sep 29, 2021
7cdd4ff
remove the long test.
Sep 29, 2021
4847851
fixing comments and add PartitionTest
Oct 4, 2021
cb5ad44
adding sync tests
Oct 4, 2021
13c807e
fix fmt problems.
Oct 4, 2021
fca0eb9
rebase corrections
algonautshant Oct 13, 2021
5afa037
msgp regenerated
algonautshant Oct 13, 2021
7e05919
fix integration error
algonautshant Oct 14, 2021
cddceb2
Fix for TestAccountStorageWithBlockProofID broken after ledger refact…
algonautshant Oct 14, 2021
116dc52
fix gofmt (test still failng)
algonautshant Oct 15, 2021
e028ee0
Persistent keystore (#3073)
Aharonee Oct 15, 2021
40ef097
Fix for TestKeysWithoutStateProofKeyCannotRegister and TestAccountSto…
algonautshant Oct 15, 2021
4421cf3
certs now uses sumhash to build merkle tree
Oct 18, 2021
d6e32ba
Merge remote-tracking branch 'upstream/master' into feature/dilithium…
algonautshant Oct 19, 2021
98e8104
regenerated msgp
algonautshant Oct 19, 2021
f50fd16
fix TestTxnGroupEncodingReflection (#3115)
algonautshant Oct 21, 2021
9927833
Change default genesis partkey round validity to 3,000,000 and add a …
Aharonee Oct 21, 2021
12d5214
crypto interfaces api fix (#3097)
algonathan Oct 22, 2021
da63e1a
add test verbositiy to validate participation period
Oct 22, 2021
48a8255
rename blockproof->stateproof (#3133)
id-ms Oct 24, 2021
e06c7b7
fix CC test bug
Oct 24, 2021
b8eee52
Added HashType to ProofResponse REST endpoint (#3104)
Aharonee Oct 25, 2021
6498416
Revised roundToIndex and indexToRound functions and tests (#3081)
algonautshant Oct 26, 2021
a79c255
Algokey print for participation keys (#3140)
algonathan Oct 26, 2021
10ba9bf
Fix encode bug+reduce type sized (#3136)
id-ms Oct 26, 2021
4659d1d
Refactoring and minor fixes (#3150)
Aharonee Oct 28, 2021
f3e7d2e
added benchmarks for sumhash in the merklearray (#3144)
algonathan Oct 28, 2021
5d5f289
Remove containskeys field from verifier (#3146)
id-ms Oct 28, 2021
5788c52
Add some cleanup if writing keys to DB fails
Aharonee Oct 28, 2021
32597c7
Merge branch 'master' into feature/dilithium-scheme-integration
Aharonee Oct 28, 2021
96e55f0
refactor for angry linter
Aharonee Oct 28, 2021
39f4034
z -> h -> z -> h -> ...
Aharonee Oct 28, 2021
2fa0a09
fix msgpack error
Oct 28, 2021
1388110
Expose `StateProofPK` in TEAL (#3114)
jasonpaulos Oct 30, 2021
d6a7181
Refactoring and small fixes
Aharonee Oct 31, 2021
fca5470
Accounts endpoint update (#3141)
algonathan Oct 31, 2021
c3c2ff7
fix broken API
Oct 31, 2021
d6bfce3
merge with master
algonautshant Nov 1, 2021
e8fcc1e
fix merge issue
algonautshant Nov 1, 2021
57b17d9
fix flaky test (#3170)
id-ms Nov 2, 2021
6b3b389
fix copy by value issue
Nov 2, 2021
ad2853a
Merge remote-tracking branch 'upstream/master' into feature/dilithium…
algonautshant Nov 3, 2021
cb4c3ef
use updated version of sumhashfunction (#3180)
id-ms Nov 3, 2021
1066186
generate routs:
algonautshant Nov 3, 2021
c01591d
Merge branch 'master' into feature/dilithium-scheme-integration
Nov 4, 2021
76f9648
FillDBWithParticipationKeys return object on error (#3184)
algonautshant Nov 9, 2021
91a0958
turn up no_output_default from 30m to 60m for dilithium branch
cce Nov 9, 2021
3c45629
change gotestsum format from testname to standard-verbose
cce Nov 9, 2021
c9f71ef
Merge pull request #3199 from cce/dilithium-longer-timeout
cce Nov 10, 2021
d9b945a
Add MT missing bounds (#3171)
algonautshant Nov 12, 2021
8987db4
Merge remote-tracking branch 'upstream/master' into feature/dilithium…
algonautshant Nov 12, 2021
674dba8
Integrate falcon scheme (#3179)
id-ms Nov 16, 2021
744399f
Merge remote-tracking branch 'upstream/master' into feature/dilithium…
algonautshant Nov 17, 2021
aa047b6
msgp and routs
algonautshant Nov 17, 2021
ca7ddf8
fix merge issues.
algonautshant Nov 17, 2021
25171bb
Disabling 3m round checks since not so many will be generated with fa…
algonautshant Nov 18, 2021
d879b7b
partial fix for rest-participation-key.sh
algonautshant Nov 20, 2021
ea61ca0
Adding missing msgp bounds (#3196)
algonautshant Nov 22, 2021
5a71da5
Limit the longest validity period allowed for key registration to pre…
Aharonee Nov 30, 2021
3f996ff
use sha512_256 instead of sumhash to speed up merkle tests
Dec 1, 2021
c94180e
Merge remote-tracking branch 'upstream/master' into feature/dilithium…
algonautshant Dec 1, 2021
cb8715b
Merge remote-tracking branch 'upstream/master' into feature/dilithium…
algonautshant Dec 6, 2021
c01a9e2
routs
algonautshant Dec 6, 2021
6aabe46
Merge remote-tracking branch 'upstream/master' into feature/dilithium…
algonautshant Dec 8, 2021
9b54a6e
msgp regenerated
algonautshant Dec 8, 2021
0219e92
update the test baseline
algonautshant Dec 8, 2021
f8173ff
Merge branch 'master' into feature/dilithium-scheme-integration
Dec 14, 2021
0631b3e
verbose test output to detect which test in not finishing in time
algonautshant Dec 15, 2021
77258d3
Merge remote-tracking branch 'upstream/master' into feature/dilithium…
algonautshant Dec 17, 2021
6d01f6b
fix merge conflict
algonautshant Dec 17, 2021
cd4a466
regenerate paths
algonautshant Dec 17, 2021
ca652fe
msgp regenerated
algonautshant Dec 17, 2021
309c751
run only TestArchivalFromNonArchival for testing
algonautshant Dec 20, 2021
efac333
Reducing the number of blocks to 1000.
algonautshant Dec 20, 2021
965cf04
use 1500 blocks
algonautshant Dec 20, 2021
efe6c77
Merge branch 'master' into feature/dilithium-scheme-integration
Jan 2, 2022
ca330c6
license update for feature branch
Jan 2, 2022
ea5485d
Falcon key gen time: set LastPartKeyRound 3K (#3280)
algonautshant Jan 4, 2022
244b5f2
Use gc to avoid trashing. (#3363)
algonautshant Jan 6, 2022
b93f0e5
Make merkle signer SNARK friendly (#3263)
id-ms Jan 11, 2022
2f2dd3d
Integrate stateproof with the updated account manager (#3350)
Aharonee Jan 13, 2022
d786394
Fix stateproof in goal (#3425)
id-ms Jan 17, 2022
6f12712
Merge branch 'master' into feature/dilithium-scheme-integration
Jan 17, 2022
6d44afc
Add vector commitment (#3370)
id-ms Jan 26, 2022
92d9b68
Merge branch 'master' into feature/dilithium-scheme-integration
Jan 27, 2022
b501f4a
regenerate routes + resotre circleCI config
Jan 27, 2022
3750eb7
Integrate mss and vc (#3512)
id-ms Jan 27, 2022
a4d2ed5
Rename + change compact cert rounds (#3517)
id-ms Jan 27, 2022
3a00dae
fix install bug (#3535)
id-ms Jan 30, 2022
32ac35d
update falcon lib + speed-up participation test
Jan 30, 2022
564fc05
Remove sig abstraction (#3541)
id-ms Feb 1, 2022
0711e2a
Merge branch 'master' into feature/dilithium-scheme-integration
Feb 1, 2022
b8f2ee2
fix memory consumption problem in testing (#3548)
id-ms Feb 2, 2022
cedc835
cr fix
Feb 2, 2022
cd1c60c
nits and CR fixes
Feb 3, 2022
c9adc44
update state proof branch for go 1.13 style errors
cce Feb 7, 2022
9507aca
Refactoring and CR fixes
Aharonee Feb 7, 2022
572ef06
Merge branch 'feature/dilithium-scheme-integration' into stateproofs-…
Aharonee Feb 8, 2022
af0c721
Merge pull request #3585 from cce/stateproofs-go1.13
Aharonee Feb 8, 2022
91e612b
Update error check in unit test
Aharonee Feb 8, 2022
1431b04
changes in keyBuilder
tsachiherman Feb 8, 2022
7bbf683
Merge pull request #3593 from tsachiherman/tsachi/dilithium-keys-builder
Aharonee Feb 8, 2022
de20e30
refactoring and fixes
Aharonee Feb 8, 2022
45f0097
Merge branch 'master' into feature/dilithium-scheme-integration
jannotti Feb 8, 2022
7436433
generated results
jannotti Feb 8, 2022
7ab2c45
Use context instead of an atomic var.
tsachiherman Feb 8, 2022
b01a301
few minor updates.
tsachiherman Feb 9, 2022
35a9c83
Use ErrorIs
jannotti Feb 9, 2022
368a93f
Merge pull request #3597 from algorand/c2c-merge
Aharonee Feb 9, 2022
ab6571f
Merge branch 'feature/dilithium-scheme-integration' into tsachi/keybu…
Aharonee Feb 9, 2022
8c625b7
Merge pull request #3599 from tsachiherman/tsachi/keybuilder2
Aharonee Feb 9, 2022
94f34ab
fix indentation
Aharonee Feb 9, 2022
46eb2b8
Merge pull request #3601 from tsachiherman/tsachi/updateimports
Aharonee Feb 9, 2022
8c37d5e
Iterate over participation data from the registry instead of the old …
Aharonee Feb 9, 2022
fd65cba
fix reviewdog
tsachiherman Feb 9, 2022
c96d6cd
prepare statement stateproofkeys insert
Aharonee Feb 9, 2022
977c517
Merge pull request #3602 from tsachiherman/tsachi/fixrd
Aharonee Feb 9, 2022
dd98456
few db persistence CR
tsachiherman Feb 9, 2022
70abe5b
Merge branch 'feature/dilithium-scheme-integration' into tsachi/fixpmss
tsachiherman Feb 9, 2022
a242d16
update
tsachiherman Feb 9, 2022
bef7804
small change.
tsachiherman Feb 9, 2022
b139765
Merge pull request #3603 from tsachiherman/tsachi/fixpmss
Aharonee Feb 9, 2022
075dfb1
faster implementation.
tsachiherman Feb 9, 2022
0862843
Merge pull request #3604 from tsachiherman/tsachi/faster_txnMerkleToRaw
Aharonee Feb 9, 2022
83f9a05
database schema testing.
tsachiherman Feb 9, 2022
83c8510
Merge pull request #3606 from tsachiherman/tsachi/dilithium_database_…
Aharonee Feb 9, 2022
bd7fcc8
pass flag instead of ConsensusParams to function
Aharonee Feb 9, 2022
90c3248
fix performance regression.
tsachiherman Feb 9, 2022
0d35440
Merge branch 'feature/dilithium-scheme-integration' of github.com:alg…
tsachiherman Feb 9, 2022
aea9374
fix broken test
tsachiherman Feb 9, 2022
7db102d
make test consts non exported
Aharonee Feb 9, 2022
ed6efa5
update e2e_subs test
Aharonee Feb 9, 2022
674688d
changes
tsachiherman Feb 9, 2022
8c2b31a
Merge pull request #3608 from tsachiherman/tsachi/fixtxnMerkleToRawre…
tsachiherman Feb 9, 2022
005e3f1
Merge branch 'feature/dilithium-scheme-integration' into tsachi/sigle…
tsachiherman Feb 9, 2022
01fdce0
replace error strings with error type
Aharonee Feb 10, 2022
617f69f
Update crypto/merklearray/merkle.go
Aharonee Feb 10, 2022
74d31b9
update per peer review
tsachiherman Feb 10, 2022
8d10050
Merge pull request #3609 from tsachiherman/tsachi/siglentest
tsachiherman Feb 10, 2022
268ee6d
reuse code in GetStateProofForRound
Aharonee Feb 10, 2022
e4302da
docstring
Aharonee Feb 10, 2022
1dc185c
rename
Aharonee Feb 10, 2022
3fa00c3
replace error strings with type
Aharonee Feb 10, 2022
9cc0800
newline for goal output
Aharonee Feb 10, 2022
83f96ab
newline for goal output
Aharonee Feb 10, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ EXTLDFLAGS := -static -static-libstdc++ -static-libgcc
export GOBUILDMODE := -buildmode=exe
endif

ifeq ($(SHORT_PART_PERIOD), 1)
export SHORT_PART_PERIOD_FLAG := -s
endif

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

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

MSGP_GENERATE := ./protocol ./protocol/test ./crypto ./crypto/compactcert ./data/basics ./data/transactions ./data/committee ./data/bookkeeping ./data/hashable ./agreement ./rpcs ./node ./ledger ./ledger/ledgercore ./compactcert ./data/account
MSGP_GENERATE := ./protocol ./protocol/test ./crypto ./crypto/merklearray ./crypto/merklesignature ./crypto/compactcert ./data/basics ./data/transactions ./data/committee ./data/bookkeeping ./data/hashable ./agreement ./rpcs ./node ./ledger ./ledger/ledgercore ./compactcert ./data/account

default: build

Expand Down Expand Up @@ -290,7 +294,7 @@ gen/%/genesis.dump: gen/%/genesis.json
./scripts/dump_genesis.sh $< > $@

gen/%/genesis.json: gen/%.json gen/generate.go buildsrc
$(GOPATH1)/bin/genesis -q -n $(shell basename $(shell dirname $@)) -c $< -d $(subst .json,,$<)
$(GOPATH1)/bin/genesis -q $(SHORT_PART_PERIOD_FLAG) -n $(shell basename $(shell dirname $@)) -c $< -d $(subst .json,,$<)

gen: $(addsuffix gen, $(NETWORKS)) mainnetgen

Expand Down
2 changes: 1 addition & 1 deletion agreement/abstractions.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ type KeyManager interface {
// VotingKeys returns an immutable array of voting keys that are
// valid for the provided votingRound, and were available at
// keysRound.
VotingKeys(votingRound, keysRound basics.Round) []account.Participation
VotingKeys(votingRound, keysRound basics.Round) []account.ParticipationRecordForRound

// Record indicates that the given participation action has been taken.
// The operation needs to be asynchronous to avoid impacting agreement.
Expand Down
20 changes: 17 additions & 3 deletions agreement/agreementtest/keyManager.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,25 @@ import (
type SimpleKeyManager []account.Participation

// VotingKeys implements KeyManager.VotingKeys.
func (m SimpleKeyManager) VotingKeys(votingRound, _ basics.Round) []account.Participation {
var km []account.Participation
func (m SimpleKeyManager) VotingKeys(votingRound, _ basics.Round) []account.ParticipationRecordForRound {
var km []account.ParticipationRecordForRound
for _, acc := range m {
if acc.OverlapsInterval(votingRound, votingRound) {
km = append(km, acc)
record := account.ParticipationRecord{
ParticipationID: acc.ID(),
Account: acc.Parent,
FirstValid: acc.FirstValid,
LastValid: acc.LastValid,
KeyDilution: acc.KeyDilution,
LastVote: 0,
LastBlockProposal: 0,
LastStateProof: 0,
EffectiveFirst: acc.FirstValid,
EffectiveLast: acc.LastValid,
VRF: acc.VRF,
Voting: acc.Voting,
}
km = append(km, account.ParticipationRecordForRound{ParticipationRecord: record})
}
}
return km
Expand Down
25 changes: 21 additions & 4 deletions agreement/keyManager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@ package agreement
import (
"testing"

"github.com/algorand/go-deadlock"
"github.com/stretchr/testify/require"

"github.com/algorand/go-deadlock"

"github.com/algorand/go-algorand/data/account"
"github.com/algorand/go-algorand/data/basics"
)
Expand All @@ -41,11 +42,27 @@ type recordingKeyManager struct {
}

// VotingKeys implements KeyManager.VotingKeys.
func (m *recordingKeyManager) VotingKeys(votingRound, _ basics.Round) []account.Participation {
var km []account.Participation
func (m *recordingKeyManager) VotingKeys(votingRound, _ basics.Round) []account.ParticipationRecordForRound {
var km []account.ParticipationRecordForRound
for _, acc := range m.keys {
if acc.OverlapsInterval(votingRound, votingRound) {
km = append(km, acc)
partRecordForRound := account.ParticipationRecordForRound{
ParticipationRecord: account.ParticipationRecord{
ParticipationID: acc.ID(),
Account: acc.Parent,
FirstValid: acc.FirstValid,
LastValid: acc.LastValid,
KeyDilution: acc.KeyDilution,
LastVote: 0,
LastBlockProposal: 0,
LastStateProof: 0,
EffectiveFirst: 0,
EffectiveLast: acc.LastValid,
VRF: acc.VRF,
Voting: acc.Voting,
},
}
km = append(km, partRecordForRound)
}
}
return km
Expand Down
28 changes: 14 additions & 14 deletions agreement/pseudonode.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ type asyncPseudonode struct {
quit chan struct{} // a quit signal for the verifier goroutines
closeWg *sync.WaitGroup // frontend waitgroup to get notified when all the verifier goroutines are done.
monitor *coserviceMonitor
participationKeysRound basics.Round // the round to which the participationKeys matches
participationKeys []account.Participation // the list of the participation keys for round participationKeysRound
participationKeysRound basics.Round // the round to which the participationKeys matches
participationKeys []account.ParticipationRecordForRound // the list of the participation keys for round participationKeysRound

proposalsVerifier *pseudonodeVerifier // dynamically generated verifier goroutine that manages incoming proposals making request.
votesVerifier *pseudonodeVerifier // dynamically generated verifier goroutine that manages incoming votes making request.
Expand All @@ -94,7 +94,7 @@ type pseudonodeBaseTask struct {
node *asyncPseudonode
context context.Context // the context associated with that task; context might expire for a single task but remain valid for others.
out chan externalEvent
participation []account.Participation
participation []account.ParticipationRecordForRound
}

type pseudonodeVotesTask struct {
Expand Down Expand Up @@ -199,7 +199,7 @@ func (n asyncPseudonode) MakeVotes(ctx context.Context, r round, p period, s ste

// load the participation keys from the account manager ( as needed ) for the
// current round.
func (n *asyncPseudonode) loadRoundParticipationKeys(voteRound basics.Round) []account.Participation {
func (n *asyncPseudonode) loadRoundParticipationKeys(voteRound basics.Round) []account.ParticipationRecordForRound {
// if we've already loaded up the keys, then just skip loading them.
if n.participationKeysRound == voteRound {
return n.participationKeys
Expand Down Expand Up @@ -277,7 +277,7 @@ func (n asyncPseudonode) makePseudonodeVerifier(voteVerifier *AsyncVoteVerifier)
}

// makeProposals creates a slice of block proposals for the given round and period.
func (n asyncPseudonode) makeProposals(round basics.Round, period period, accounts []account.Participation) ([]proposal, []unauthenticatedVote) {
func (n asyncPseudonode) makeProposals(round basics.Round, period period, accounts []account.ParticipationRecordForRound) ([]proposal, []unauthenticatedVote) {
ve, err := n.factory.AssembleBlock(round)
if err != nil {
if err != ErrAssembleBlockRoundStale {
Expand All @@ -288,16 +288,16 @@ func (n asyncPseudonode) makeProposals(round basics.Round, period period, accoun

votes := make([]unauthenticatedVote, 0, len(accounts))
proposals := make([]proposal, 0, len(accounts))
for _, account := range accounts {
payload, proposal, err := proposalForBlock(account.Address(), account.VRFSecrets(), ve, period, n.ledger)
for _, acc := range accounts {
payload, proposal, err := proposalForBlock(acc.Account, acc.VRF, ve, period, n.ledger)
if err != nil {
n.log.Errorf("pseudonode.makeProposals: could not create proposal for block (address %v): %v", account.Address(), err)
n.log.Errorf("pseudonode.makeProposals: could not create proposal for block (address %v): %v", acc.Account, err)
continue
}

// attempt to make the vote
rv := rawVote{Sender: account.Address(), Round: round, Period: period, Step: propose, Proposal: proposal}
uv, err := makeVote(rv, account.VotingSigner(), account.VRFSecrets(), n.ledger)
rv := rawVote{Sender: acc.Account, Round: round, Period: period, Step: propose, Proposal: proposal}
uv, err := makeVote(rv, acc.VotingSigner(), acc.VRF, n.ledger)
if err != nil {
n.log.Warnf("pseudonode.makeProposals: could not create vote: %v", err)
continue
Expand All @@ -313,11 +313,11 @@ func (n asyncPseudonode) makeProposals(round basics.Round, period period, accoun

// makeVotes creates a slice of votes for a given proposal value in a given
// round, period, and step.
func (n asyncPseudonode) makeVotes(round basics.Round, period period, step step, proposal proposalValue, participation []account.Participation) []unauthenticatedVote {
func (n asyncPseudonode) makeVotes(round basics.Round, period period, step step, proposal proposalValue, participation []account.ParticipationRecordForRound) []unauthenticatedVote {
votes := make([]unauthenticatedVote, 0)
for _, account := range participation {
rv := rawVote{Sender: account.Address(), Round: round, Period: period, Step: step, Proposal: proposal}
uv, err := makeVote(rv, account.VotingSigner(), account.VRFSecrets(), n.ledger)
for _, part := range participation {
rv := rawVote{Sender: part.Account, Round: round, Period: period, Step: step, Proposal: proposal}
uv, err := makeVote(rv, part.VotingSigner(), part.VRF, n.ledger)
if err != nil {
n.log.Warnf("pseudonode.makeVotes: could not create vote: %v", err)
continue
Expand Down
6 changes: 3 additions & 3 deletions agreement/pseudonode_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -388,10 +388,10 @@ func (n serializedPseudonode) Quit() {
}

type KeyManagerProxy struct {
target func(basics.Round, basics.Round) []account.Participation
target func(basics.Round, basics.Round) []account.ParticipationRecordForRound
}

func (k *KeyManagerProxy) VotingKeys(votingRound, balanceRound basics.Round) []account.Participation {
func (k *KeyManagerProxy) VotingKeys(votingRound, balanceRound basics.Round) []account.ParticipationRecordForRound {
return k.target(votingRound, balanceRound)
}

Expand Down Expand Up @@ -447,7 +447,7 @@ func TestPseudonodeLoadingOfParticipationKeys(t *testing.T) {
pb.keys = keyManagerProxy
cparams, _ := ledger.ConsensusParams(0)
for rnd := basics.Round(3); rnd < 1000; rnd += 43 {
keyManagerProxy.target = func(votingRound, balanceRnd basics.Round) []account.Participation {
keyManagerProxy.target = func(votingRound, balanceRnd basics.Round) []account.ParticipationRecordForRound {
require.Equal(t, rnd, votingRound)
require.Equal(t, balanceRound(rnd, cparams), balanceRnd)
return keyManager.VotingKeys(votingRound, balanceRnd)
Expand Down
20 changes: 19 additions & 1 deletion cmd/algokey/part.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (

"github.com/algorand/go-algorand/data/account"
"github.com/algorand/go-algorand/data/basics"
"github.com/algorand/go-algorand/util"
"github.com/algorand/go-algorand/util/db"
)

Expand Down Expand Up @@ -75,12 +76,26 @@ var partGenerateCmd = &cobra.Command{
os.Exit(1)
}

partkey, err := account.FillDBWithParticipationKeys(partdb, parent, basics.Round(partFirstRound), basics.Round(partLastRound), partKeyDilution)
fmt.Println("Please stand by while generating keys. This might take a few minutes...")

var partkey account.PersistedParticipation
participationGen := func() {
partkey, err = account.FillDBWithParticipationKeys(partdb, parent, basics.Round(partFirstRound), basics.Round(partLastRound), partKeyDilution)
}

util.RunFuncWithSpinningCursor(participationGen)

if err != nil {
fmt.Fprintf(os.Stderr, "Cannot generate partkey database %s: %v\n", partKeyfile, err)
err = os.Remove(partKeyfile)
if err != nil {
fmt.Fprintf(os.Stderr, "Failed to cleanup the database file %s: %v\n", partKeyfile, err)
}
os.Exit(1)
}

fmt.Println("Participation key generation successful")

printPartkey(partkey.Participation)
},
}
Expand Down Expand Up @@ -146,6 +161,9 @@ func printPartkey(partkey account.Participation) {
fmt.Printf("Parent address: %s\n", partkey.Parent.String())
fmt.Printf("VRF public key: %s\n", base64.StdEncoding.EncodeToString(partkey.VRF.PK[:]))
fmt.Printf("Voting public key: %s\n", base64.StdEncoding.EncodeToString(partkey.Voting.OneTimeSignatureVerifier[:]))
if partkey.StateProofSecrets != nil && !partkey.StateProofSecrets.GetVerifier().IsEmpty() {
fmt.Printf("State proof key: %s\n", base64.StdEncoding.EncodeToString(partkey.StateProofSecrets.GetVerifier()[:]))
}
fmt.Printf("First round: %d\n", partkey.FirstValid)
fmt.Printf("Last round: %d\n", partkey.LastValid)
fmt.Printf("Key dilution: %d\n", partkey.KeyDilution)
Expand Down
8 changes: 8 additions & 0 deletions cmd/genesis/newgenesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ var outDir = flag.String("d", "", "The directory containing the generated ledger
var netName = flag.String("n", "", "The name of the network for this ledger (will override config file).")
var configFile = flag.String("c", "", "The config file containing the genesis ledger and wallets")
var quiet = flag.Bool("q", false, "Skip verbose informational messages")
var short = flag.Bool("s", false, "Cap the last participation key round to 1500")

func init() {
flag.Parse()
Expand Down Expand Up @@ -60,6 +61,13 @@ func main() {
if !*quiet {
verboseOut = os.Stdout
}

if *short {
if genesisData.LastPartKeyRound > 1500 {
genesisData.LastPartKeyRound = 1500
}
}

err = gen.GenerateGenesisFiles(genesisData, config.Consensus, *outDir, verboseOut)
if err != nil {
reportErrorf("Cannot write genesis files: %s", err)
Expand Down
33 changes: 26 additions & 7 deletions cmd/goal/account.go
Original file line number Diff line number Diff line change
Expand Up @@ -877,11 +877,19 @@ var addParticipationKeyCmd = &cobra.Command{
// Generate a participation keys database and install it
client := ensureFullClient(dataDir)

_, _, err := client.GenParticipationKeysTo(accountAddress, roundFirstValid, roundLastValid, keyDilution, partKeyOutDir)
reportInfof("Please stand by while generating keys. This might take a few minutes...")

var err error
participationGen := func() {
_, _, err = client.GenParticipationKeysTo(accountAddress, roundFirstValid, roundLastValid, keyDilution, partKeyOutDir)
}

util.RunFuncWithSpinningCursor(participationGen)
if err != nil {
reportErrorf(errorRequestFail, err)
}
fmt.Println("Participation key generation successful")

reportInfof("Participation key generation successful")
},
}

Expand Down Expand Up @@ -964,11 +972,21 @@ var renewParticipationKeyCmd = &cobra.Command{

func generateAndRegisterPartKey(address string, currentRound, keyLastValidRound, txLastValidRound uint64, fee uint64, leaseBytes [32]byte, dilution uint64, wallet string, dataDir string, client libgoal.Client) error {
// Generate a participation keys database and install it
part, keyPath, err := client.GenParticipationKeysTo(address, currentRound, keyLastValidRound, dilution, "")
var part algodAcct.Participation
var keyPath string
var err error
genFunc := func() {
part, keyPath, err = client.GenParticipationKeysTo(address, currentRound, keyLastValidRound, dilution, "")
if err != nil {
err = fmt.Errorf(errorRequestFail, err)
}
fmt.Println("Participation key generation successful")
}
fmt.Println("Please stand by while generating keys. This might take a few minutes...")
util.RunFuncWithSpinningCursor(genFunc)
if err != nil {
return fmt.Errorf(errorRequestFail, err)
return err
}
fmt.Printf(" Generated participation key for %s (Valid %d - %d)\n", address, currentRound, keyLastValidRound)

// Now register it as our new online participation key
goOnline := true
Expand Down Expand Up @@ -1449,8 +1467,9 @@ var partkeyInfoCmd = &cobra.Command{
fmt.Printf("Key dilution: %d\n", part.Key.VoteKeyDilution)
fmt.Printf("Selection key: %s\n", base64.StdEncoding.EncodeToString(part.Key.SelectionParticipationKey))
fmt.Printf("Voting key: %s\n", base64.StdEncoding.EncodeToString(part.Key.VoteParticipationKey))
// PKI TODO: enable with state proof support.
//fmt.Printf("State proof key: %s\n", base64.StdEncoding.EncodeToString(part.StateProofKey))
if part.Key.StateProofKey != nil {
fmt.Printf("State proof key: %s\n", base64.StdEncoding.EncodeToString(*part.Key.StateProofKey))
}
}
})
},
Expand Down
2 changes: 1 addition & 1 deletion compactcert/abstractions.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,5 @@ type Network interface {
// Accounts captures the aspects of the AccountManager that are used by
// this package.
type Accounts interface {
Keys(basics.Round) []account.Participation
StateProofKeys(basics.Round) []account.StateProofRecordForRound
}
4 changes: 2 additions & 2 deletions compactcert/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"database/sql"
"fmt"

"github.com/algorand/go-algorand/crypto"
"github.com/algorand/go-algorand/crypto/merklesignature"
"github.com/algorand/go-algorand/data/basics"
"github.com/algorand/go-algorand/protocol"
)
Expand All @@ -47,7 +47,7 @@ var schema = []string{

type pendingSig struct {
signer basics.Address
sig crypto.OneTimeSignature
sig merklesignature.Signature
fromThisNode bool
}

Expand Down
Loading