Skip to content

Commit bdf68f3

Browse files
jannottiAlgo-devops-servicejasonpaulosccealgonautshant
authored
Feature/contract to contract (#3285)
* Update the Version, BuildNumber, genesistimestamp.data * Three new globals for to help contract-to-contract usability * detritis * Check error * doc comments * Support transaction arguments for `goal app method` (#3233) * Implement transactions as arguments * Fix indexing and dryrun issue * Add docstring * Satisfy review dog * Fix pointer issue * Fix group command * Rename e2e test * Fix filename variable * Add e2e test * Use tab * CI: use libboost-math-dev instead of libboost-all-dev (#3223) ## Summary Small change: libboost-math-dev requires just 4 packages to install, while libboost-all-dev requires > 100. Only Debian/Ubuntu distributions provide fine-grained boost packages like this, but should shave a little time off the CI builds. (Our only boost include is boost/math/distributions/binomial.hpp.) ## Test Plan Builds should pass as before. Now that we are no longer using Travis for Linux builds, the side effect of libboost-all-dev installing make and other missing build tools on Travis encountered in #2717 is no longer a concern. * testing: fixes to rest-participation-key e2e test (#3238) ## Summary - Test to make sure RES has the right input before counting line numbers for result size. - Rest RES to empty so that the same output is not recycled in case of an error. - exit 1 in case of an error - Reduce LAST_ROUND from 1200000 to 120 - "Get List of Keys" before getting NUM_IDS_3 otherwise it will recycle old RES value. * testing: interactive mode for e2e testing (#3227) ## Summary Some e2e tests require a python environment for testing. Unfortunately, setting up that environment adequately similar to the testing environment may not be trivial. This change introduces an interactive mode to the e2e.sh script which stops at the point of running the tests, and allows the user to run the tests from the same testing environment. ## Test Plan No tests needed. Tested the script locally. * Make dev-mode tests less flaky. (#3252) ## Summary Fix a couple flaws in the new go-e2e tests built ontop of DevMode: * Shutdown the fixture when finished. * Don't run in parallel. * Longer delays / better algorithms to wait for data flushing to complete. * Check for "out of order" keys. ## Test Plan N/A, this is a test. * adding libtool to ubuntu deps (#3251) ## Summary The sandbox is not building with dev config using master branch algorand/sandbox#85, complains about libtool not being installed Guessing from this change #3223 Adding libtool to UBUNTU_DEPS in install scripts ## Test Plan Set config in sandbox to my branch `sandbox up dev` It built * Fix error shadowing in Eval (#3258) ## Summary Error from account preloading was shadowed by returning a wrong err variable. This caused subsequent problems in account updates and masked the original failure. ## Test Plan Use existing tests * Disable flaky test. (#3256) ## Summary This test doesn't work properly, disable it until #3255 addresses any underlying problems. * Update the Version, BuildNumber, genesistimestamp.data * Fix a data race in app tests (#3269) ## Summary A test helper function `commitRound` accessed `l.trackers.lastFlushTime` without taking a lock. Fixed. ## Test Plan ``` go test ./ledger -run TestAppEmpty -race -count=50 ok github.com/algorand/go-algorand/ledger 4.078s ``` * Fix e2e.sh mixed indent characters. (#3266) ## Summary Fix e2e.sh mixed indent characters. * Fix ParticipationKeyResponse type. (#3264) ## Summary Fix a small type discrepancy in the OpenAPI spec ahead of some other work that's about to happen. * disable parallelism for e2e-go tests (#3242) ## Summary This sets `-p 1` for the e2e-go tests, intended to make them more deterministic when running on a VM with relatively constrained resources. Since each e2e-go test might spin up a few nodes, it seems like it would help to avoid resource contention. ## Test Plan Tests should run as before. Desired effect can be verified by looking at the test output where the value of PARALLEL_FLAG is printed out before tests are run. * Updating Readme.md with circleci status badges (#3245) * Fix formatting for CircleCI badges (#3272) * Add Custom Scenario for Performance Testing (#3278) Add Custom Scenario for Performance Testing. Add README on how to run custom scenario and modify create_and_deploy_recipe.sh to accept a network template that will generate a new recipe. * Impose limits on the entire "tree" of inner calls. This also increases the realism of testing of multiple app calls in a group by creating the EvalParams with the real constructor, thus getting the pooling stuff tested here without playing games manipulating the ep after construction. * ParticipationRegistry - StateProof loading methods (#3261) ## Summary Add ParticipationRegistry methods for setting and retrieving state proof keys. Since they aren't in master yet there is a `type StateProofKey []byte` stub which will need to be updated later. ## Test Plan New unit tests. * Op base64 decode (#3220) b64 opcode, tests, and specs * Bump Version, Remove buildnumber.dat and genesistimestamp.dat files. * Change golang version to 1.16.11 in go-algorand (#2825) Upgrading to 1.16 to help alleviate issues with working on different go versions, and update to a supported, more secure version. Release notes for Go 1.15 and 1.16: https://tip.golang.org/doc/go1.16 https://tip.golang.org/doc/go1.15 * Compatibility mode for partkeyinfo. (#3291) ## Summary Compatibility for `partkeyinfo` was also needed by some users. In addition to the different format, the old command also allows printing key information when the node is not running Workarounds: 1) use an older `goal` binary. 2) use `algokey part info --keyfile <file>` ## Test Plan Tested manually: ``` ~$ goal account partkeyinfo -d /tmp/private_network/Node/ Dumping participation key info from /tmp/private_network/Node/... Participation ID: CPLHRU3WEY3PE7XTPPSIE7BGJYWAIFPS7DL3HZNC4OKQRQ5YAYUA Parent address: DGS6VNX2BRMKGKVAS2LTREMYG33TOCYPFLPCQ3DUTJULQU6P6S7KJCDNTU Last vote round: 1 Last block proposal round: 2 Effective first round: 1 Effective last round: 3000000 First round: 0 Last round: 3000000 Key dilution: 10000 Selection key: 5QRrTgzSUTqqym43QVsBus1/AOwGR5zE+I7FGwA14vQ= Voting key: PK0NMyZ4BKSjPQ9JuT7dQBLdTpjLQv2txuDYDKhkuqs= ~$ goal account partkeyinfo -d /tmp/private_network/Node/ -c Dumping participation key info from /tmp/private_network/Node/... ------------------------------------------------------------------ File: Wallet2.0.3000000.partkey { "acct": "DGS6VNX2BRMKGKVAS2LTREMYG33TOCYPFLPCQ3DUTJULQU6P6S7KJCDNTU", "last": 3000000, "sel": "5QRrTgzSUTqqym43QVsBus1/AOwGR5zE+I7FGwA14vQ=", "vote": "PK0NMyZ4BKSjPQ9JuT7dQBLdTpjLQv2txuDYDKhkuqs=", "voteKD": 10000 } ``` * TestEcdsa: fix flaky "tampering" of public key (#3282) ## Summary This test (TestEcdsa) tests the ecdsa_pk_decompress opcode and intentionally "tampers" with the public key by setting the first byte to zero. Occasionally this test is failing, likely because the first byte was already zero. (The test failures are for the cases where failure is expected, `pass=false`) ## Test Plan Existing test should pass, occasional flakiness should go away. * Move appID tracking into EvalContext, out of LedgerForLogic This change increases the seperation between AVM execution and the ledger being used to lookup resources. Previously, the ledger kept track of the appID being executed, to offer a narrower interface to those resources. But now, with app-to-app calls, the appID being executed must change, and the AVM needs to maintain the current appID. * Stupid linter * Support reference types in `goal app method` (#3275) * Fix method signature parse bug * Support reference types * Review dog fixes * Fix comments * Add a hash prefix for ARCs-related hashes (#3298) ## Summary This is to allow ARCs (github.com/algorandfoundation/ARCs) to have their own hash prefix without risk of collision. ## Test Plan It is purely informational. There is no real code change. * catchup: suspend the catchup session once the agreement service kicks in (#3299) The catchup service stops when it is complete, i.e. it has reached up to the round which is being agreed on. The catchup service knows it is complete and should stop, when it finds that a block is in the ledger before it adds it. In other words, apart from the catchup, only the agreement adds blocks to the ledger. And when the agreement adds a block to the ledger before the catchup, it means the agreement is ahead, and the catchup is complete. When `fetchAndWrite` detects the block is already in the ledger, it returns. The return value of `false` stops the catchup syncing. In previous releases, `fetchAndWrite` was only checking if the block is already in the ledger after attempting to fetch it. Since it fails to fetch a block not yet agreed on, the fetch fails after multiple attempts, and `fetchAndWrite` returns `false` ending the catchup. A recent change made this process more efficient by first checking if the block is in the ledger before/during the fetch. However, once the block was found in the ledger, `fetchAndWrite` returned true instead of false (consistent with already existing logic since forever, which was also wrong). This caused the catchup to continue syncing after catchup was complete. This change fixes the return value from true to false. * Compatibility mode for partkeyinfo. (#3291) ## Summary Compatibility for `partkeyinfo` was also needed by some users. In addition to the different format, the old command also allows printing key information when the node is not running Workarounds: 1) use an older `goal` binary. 2) use `algokey part info --keyfile <file>` ## Test Plan Tested manually: ``` ~$ goal account partkeyinfo -d /tmp/private_network/Node/ Dumping participation key info from /tmp/private_network/Node/... Participation ID: CPLHRU3WEY3PE7XTPPSIE7BGJYWAIFPS7DL3HZNC4OKQRQ5YAYUA Parent address: DGS6VNX2BRMKGKVAS2LTREMYG33TOCYPFLPCQ3DUTJULQU6P6S7KJCDNTU Last vote round: 1 Last block proposal round: 2 Effective first round: 1 Effective last round: 3000000 First round: 0 Last round: 3000000 Key dilution: 10000 Selection key: 5QRrTgzSUTqqym43QVsBus1/AOwGR5zE+I7FGwA14vQ= Voting key: PK0NMyZ4BKSjPQ9JuT7dQBLdTpjLQv2txuDYDKhkuqs= ~$ goal account partkeyinfo -d /tmp/private_network/Node/ -c Dumping participation key info from /tmp/private_network/Node/... ------------------------------------------------------------------ File: Wallet2.0.3000000.partkey { "acct": "DGS6VNX2BRMKGKVAS2LTREMYG33TOCYPFLPCQ3DUTJULQU6P6S7KJCDNTU", "last": 3000000, "sel": "5QRrTgzSUTqqym43QVsBus1/AOwGR5zE+I7FGwA14vQ=", "vote": "PK0NMyZ4BKSjPQ9JuT7dQBLdTpjLQv2txuDYDKhkuqs=", "voteKD": 10000 } ``` * catchup: suspend the catchup session once the agreement service kicks in (#3299) The catchup service stops when it is complete, i.e. it has reached up to the round which is being agreed on. The catchup service knows it is complete and should stop, when it finds that a block is in the ledger before it adds it. In other words, apart from the catchup, only the agreement adds blocks to the ledger. And when the agreement adds a block to the ledger before the catchup, it means the agreement is ahead, and the catchup is complete. When `fetchAndWrite` detects the block is already in the ledger, it returns. The return value of `false` stops the catchup syncing. In previous releases, `fetchAndWrite` was only checking if the block is already in the ledger after attempting to fetch it. Since it fails to fetch a block not yet agreed on, the fetch fails after multiple attempts, and `fetchAndWrite` returns `false` ending the catchup. A recent change made this process more efficient by first checking if the block is in the ledger before/during the fetch. However, once the block was found in the ledger, `fetchAndWrite` returned true instead of false (consistent with already existing logic since forever, which was also wrong). This caused the catchup to continue syncing after catchup was complete. This change fixes the return value from true to false. * Bump buildnumber.dat * testing: disable flaky test (#3268) Disable a flaky test, to be re-enabled later with #3267. * enumerate conditions that might cause this fetchAndWrite to return false (#3301) ## Summary The fetchAndWrite function contains some complex logic to ultimately determine if we should continue trying to catch up. The conditions that might cause it to return false should be more explicitly enumerated. ## Test Plan Just comments * Fix unit tests error messages * make sure the block service is not attempting to access the ledger after being stopped. (#3303) ## Summary The block service was attempting to serve block via the http handler even after it has been stopped. This lead to undesired downstream failures in the ledger, which was shutdown as well. ## Test Plan unit test added. * Avoid creating algod process for the sole purpose of retrieving the genesis-id. (#3308) ## Summary Avoid creating algod process for the sole purpose of retrieving the genesis-id. Existing code was calling `algod -G -d <data dir>` in order to obtain the genesis version string. The genesis version string can be easily retrieved by loading the genesis file. ## Test Plan Use existing e2e tests. * documentation: fix algorand specs link (#3309) ## Summary This PR fixes a link in a README. ## Testing I clicked on the new link. * testing: reword partitiontest lint message. (#3297) ## Summary The wording on this was tripping me, maybe I was having an off day. I think it would be slightly easier if the message were to tell exactly what you need to do (and not use the angle brackets). * testing: fix random data race in TestAppAccountDataStorage (#3315) fix random data race in unit test * Allow access to resources created in the same transaction group The method will be reworked, but the tests are correct and want to get them visible to team. Co-authored-by: DevOps Service <[email protected]> Co-authored-by: Jason Paulos <[email protected]> Co-authored-by: chris erway <[email protected]> Co-authored-by: Shant Karakashian <[email protected]> Co-authored-by: John Lee <[email protected]> Co-authored-by: Will Winder <[email protected]> Co-authored-by: Ben Guidarelli <[email protected]> Co-authored-by: Pavel Zbitskiy <[email protected]> Co-authored-by: Jack <[email protected]> Co-authored-by: John Lee <[email protected]> Co-authored-by: algobarb <[email protected]> Co-authored-by: Zeph Grunschlag <[email protected]> Co-authored-by: Fabrice Benhamouda <[email protected]> Co-authored-by: Tsachi Herman <[email protected]> Co-authored-by: Tolik Zinovyev <[email protected]> Co-authored-by: egieseke <[email protected]>
1 parent d28eca1 commit bdf68f3

File tree

90 files changed

+3272
-1569
lines changed

Some content is hidden

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

90 files changed

+3272
-1569
lines changed

.circleci/config.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ commands:
197197
shell: bash.exe
198198
command: |
199199
choco install -y msys2 pacman make wget --force
200-
choco install -y golang --version=1.14.7 --force
200+
choco install -y golang --version=1.16.11 --force
201201
choco install -y python3 --version=3.7.3 --force
202202
export msys2='cmd //C RefreshEnv.cmd '
203203
export msys2+='& set MSYS=winsymlinks:nativestrict '
@@ -322,7 +322,6 @@ commands:
322322
export PACKAGE_NAMES=$(echo $PACKAGES | tr -d '\n')
323323
export PARTITION_TOTAL=${CIRCLE_NODE_TOTAL}
324324
export PARTITION_ID=${CIRCLE_NODE_INDEX}
325-
export PARALLEL_FLAG="-p 1"
326325
gotestsum --format testname --junitfile << parameters.result_path >>/<< parameters.result_subdir >>/${CIRCLE_NODE_INDEX}/results.xml --jsonfile << parameters.result_path >>/<< parameters.result_subdir >>/${CIRCLE_NODE_INDEX}/testresults.json -- --tags "sqlite_unlock_notify sqlite_omit_load_extension" << parameters.short_test_flag >> -race -timeout 1h -coverprofile=coverage.txt -covermode=atomic -p 1 $PACKAGE_NAMES
327326
- store_artifacts:
328327
path: << parameters.result_path >>
@@ -432,6 +431,7 @@ commands:
432431
export TEST_RESULTS=<< parameters.result_path >>/<< parameters.result_subdir >>/${CIRCLE_NODE_INDEX}
433432
export PARTITION_TOTAL=${CIRCLE_NODE_TOTAL}
434433
export PARTITION_ID=${CIRCLE_NODE_INDEX}
434+
export PARALLEL_FLAG="-p 1"
435435
test/scripts/run_integration_tests.sh
436436
- store_artifacts:
437437
path: << parameters.result_path >>

.github/workflows/reviewdog.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ jobs:
4444
- name: Install specific golang
4545
uses: actions/setup-go@v2
4646
with:
47-
go-version: '1.16.6'
47+
go-version: '1.16.11'
4848
- name: Create folders for golangci-lint
4949
run: mkdir -p cicdtmp/golangci-lint
5050
- name: Check if custom golangci-lint is already built

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -65,3 +65,5 @@ assets
6565

6666
index.html
6767

68+
# test summary
69+
testresults.json

Makefile

-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ else
88
export GOPATH := $(shell go env GOPATH)
99
GOPATH1 := $(firstword $(subst :, ,$(GOPATH)))
1010
endif
11-
export GO111MODULE := on
1211
export GOPROXY := direct
1312
SRCPATH := $(shell pwd)
1413
ARCH := $(shell ./scripts/archtype.sh)

README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
[![Build Status](https://travis-ci.com/algorand/go-algorand.svg?branch=master)](https://travis-ci.com/algorand/go-algorand)
1+
| rel/stable <br> [![CircleCI](https://circleci.com/gh/algorand/go-algorand/tree/rel%2Fstable.svg?style=svg)](https://circleci.com/gh/algorand/go-algorand/tree/rel%2Fstable) | rel/beta <br> [![CircleCI](https://circleci.com/gh/algorand/go-algorand/tree/rel%2Fbeta.svg?style=svg)](https://circleci.com/gh/algorand/go-algorand/tree/rel%2Fbeta) | rel/nightly <br> [![CircleCI](https://circleci.com/gh/algorand/go-algorand/tree/rel%2Fnightly.svg?style=svg)](https://circleci.com/gh/algorand/go-algorand/tree/rel%2Fnightly) |
2+
| --- | --- | --- |
23

34
go-algorand
45
====================

agreement/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ will also recover safely after crashes.
4343
# Specification
4444

4545
The specification for the protocol implemented by this package is
46-
located [here](https://github.com/algorand/spec).
46+
located [here](https://github.com/algorandfoundation/specs).
4747

4848
Optimizations from and other deviations from the spec will be noted
4949
throughout this file.

catchup/service.go

+14-6
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,11 @@ func (s *Service) innerFetch(r basics.Round, peer network.Peer) (blk *bookkeepin
195195
}
196196

197197
// fetchAndWrite fetches a block, checks the cert, and writes it to the ledger. Cert checking and ledger writing both wait for the ledger to advance if necessary.
198-
// Returns false if we couldn't fetch or write (i.e., if we failed even after a given number of retries or if we were told to abort.)
198+
// Returns false if we should stop trying to catch up. This may occur for several reasons:
199+
// - If the context is canceled (e.g. if the node is shutting down)
200+
// - If we couldn't fetch the block (e.g. if there are no peers available or we've reached the catchupRetryLimit)
201+
// - If the block is already in the ledger (e.g. if agreement service has already written it)
202+
// - If the retrieval of the previous block was unsuccessful
199203
func (s *Service) fetchAndWrite(r basics.Round, prevFetchCompleteChan chan bool, lookbackComplete chan bool, peerSelector *peerSelector) bool {
200204
i := 0
201205
hasLookback := false
@@ -241,8 +245,10 @@ func (s *Service) fetchAndWrite(r basics.Round, prevFetchCompleteChan chan bool,
241245

242246
if err != nil {
243247
if err == errLedgerAlreadyHasBlock {
244-
// ledger already has the block, no need to request this block from anyone.
245-
return true
248+
// ledger already has the block, no need to request this block.
249+
// only the agreement could have added this block into the ledger, catchup is complete
250+
s.log.Infof("fetchAndWrite(%d): the block is already in the ledger. The catchup is complete", r)
251+
return false
246252
}
247253
s.log.Debugf("fetchAndWrite(%v): Could not fetch: %v (attempt %d)", r, err, i)
248254
peerSelector.rankPeer(psp, peerRankDownloadFailed)
@@ -353,8 +359,10 @@ func (s *Service) fetchAndWrite(r basics.Round, prevFetchCompleteChan chan bool,
353359
s.log.Infof("fetchAndWrite(%d): no need to re-evaluate historical block", r)
354360
return true
355361
case ledgercore.BlockInLedgerError:
356-
s.log.Infof("fetchAndWrite(%d): block already in ledger", r)
357-
return true
362+
// the block was added to the ledger from elsewhere after fetching it here
363+
// only the agreement could have added this block into the ledger, catchup is complete
364+
s.log.Infof("fetchAndWrite(%d): after fetching the block, it is already in the ledger. The catchup is complete", r)
365+
return false
358366
case protocol.Error:
359367
if !s.protocolErrorLogged {
360368
logging.Base().Errorf("fetchAndWrite(%v): unrecoverable protocol error detected: %v", r, err)
@@ -387,7 +395,7 @@ func (s *Service) pipelineCallback(r basics.Round, thisFetchComplete chan bool,
387395
thisFetchComplete <- fetchResult
388396

389397
if !fetchResult {
390-
s.log.Infof("failed to fetch block %v", r)
398+
s.log.Infof("pipelineCallback(%d): did not fetch or write the block", r)
391399
return 0
392400
}
393401
return r

cmd/goal/account.go

+52-3
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ var (
5959
partKeyOutDir string
6060
partKeyFile string
6161
partKeyDeleteInput bool
62-
listpartkeyCompat bool
62+
partkeyCompat bool
6363
importDefault bool
6464
mnemonic string
6565
dumpOutFile string
@@ -167,7 +167,10 @@ func init() {
167167
installParticipationKeyCmd.Flags().BoolVar(&partKeyDeleteInput, "delete-input", false, "Acknowledge that installpartkey will delete the input key file")
168168

169169
// listpartkey flags
170-
listParticipationKeysCmd.Flags().BoolVarP(&listpartkeyCompat, "compatibility", "c", false, "Print output in compatibility mode. This option will be removed in a future release, please use REST API for tooling.")
170+
listParticipationKeysCmd.Flags().BoolVarP(&partkeyCompat, "compatibility", "c", false, "Print output in compatibility mode. This option will be removed in a future release, please use REST API for tooling.")
171+
172+
// partkeyinfo flags
173+
partkeyInfoCmd.Flags().BoolVarP(&partkeyCompat, "compatibility", "c", false, "Print output in compatibility mode. This option will be removed in a future release, please use REST API for tooling.")
171174

172175
// import flags
173176
importCmd.Flags().BoolVarP(&importDefault, "default", "f", false, "Set this account as the default one")
@@ -1069,6 +1072,7 @@ func uintToStr(number uint64) string {
10691072
// legacyListParticipationKeysCommand prints key information in the same
10701073
// format as earlier versions of goal. Some users are using this information
10711074
// in scripts and need some extra time to migrate to the REST API.
1075+
// DEPRECATED
10721076
func legacyListParticipationKeysCommand() {
10731077
dataDir := ensureSingleDataDir()
10741078

@@ -1118,7 +1122,7 @@ var listParticipationKeysCmd = &cobra.Command{
11181122
Long: `List all participation keys tracked by algod along with summary of additional information. For detailed key information use 'partkeyinfo'.`,
11191123
Args: validateNoPosArgsFn,
11201124
Run: func(cmd *cobra.Command, args []string) {
1121-
if listpartkeyCompat {
1125+
if partkeyCompat {
11221126
legacyListParticipationKeysCommand()
11231127
return
11241128
}
@@ -1364,12 +1368,57 @@ func strOrNA(value *uint64) string {
13641368
return uintToStr(*value)
13651369
}
13661370

1371+
// legacyPartkeyInfoCommand prints key information in the same
1372+
// format as earlier versions of goal. Some users are using this information
1373+
// in scripts and need some extra time to migrate to alternatives.
1374+
// DEPRECATED
1375+
func legacyPartkeyInfoCommand() {
1376+
type partkeyInfo struct {
1377+
_struct struct{} `codec:",omitempty,omitemptyarray"`
1378+
Address string `codec:"acct"`
1379+
FirstValid basics.Round `codec:"first"`
1380+
LastValid basics.Round `codec:"last"`
1381+
VoteID crypto.OneTimeSignatureVerifier `codec:"vote"`
1382+
SelectionID crypto.VRFVerifier `codec:"sel"`
1383+
VoteKeyDilution uint64 `codec:"voteKD"`
1384+
}
1385+
1386+
onDataDirs(func(dataDir string) {
1387+
fmt.Printf("Dumping participation key info from %s...\n", dataDir)
1388+
client := ensureGoalClient(dataDir, libgoal.DynamicClient)
1389+
1390+
// Make sure we don't already have a partkey valid for (or after) specified roundLastValid
1391+
parts, err := client.ListParticipationKeyFiles()
1392+
if err != nil {
1393+
reportErrorf(errorRequestFail, err)
1394+
}
1395+
1396+
for filename, part := range parts {
1397+
fmt.Println("------------------------------------------------------------------")
1398+
info := partkeyInfo{
1399+
Address: part.Address().String(),
1400+
FirstValid: part.FirstValid,
1401+
LastValid: part.LastValid,
1402+
VoteID: part.VotingSecrets().OneTimeSignatureVerifier,
1403+
SelectionID: part.VRFSecrets().PK,
1404+
VoteKeyDilution: part.KeyDilution,
1405+
}
1406+
infoString := protocol.EncodeJSON(&info)
1407+
fmt.Printf("File: %s\n%s\n", filename, string(infoString))
1408+
}
1409+
})
1410+
}
1411+
13671412
var partkeyInfoCmd = &cobra.Command{
13681413
Use: "partkeyinfo",
13691414
Short: "Output details about all available part keys",
13701415
Long: `Output details about all available part keys in the specified data directory(ies), such as key validity period.`,
13711416
Args: validateNoPosArgsFn,
13721417
Run: func(cmd *cobra.Command, args []string) {
1418+
if partkeyCompat {
1419+
legacyPartkeyInfoCommand()
1420+
return
1421+
}
13731422

13741423
onDataDirs(func(dataDir string) {
13751424
fmt.Printf("Dumping participation key info from %s...\n", dataDir)

0 commit comments

Comments
 (0)