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

goal: Add export and import options for genesis files during network creation #5672

Merged
merged 16 commits into from
Sep 1, 2023

Conversation

algochoi
Copy link
Contributor

@algochoi algochoi commented Aug 16, 2023

Summary

Generating part keys (particularly falcon keys) is on the critical path when creating new private networks. This PR provides an option to export and import files like genesis.json, root and participation keys to speed that up.

Adds a new command to goal to export genesis files:

  • goal network pregen [-p] [-t]: Generates genesis.json, root and part keys based on the template file [-t]. [-p] is where the genesis files are saved (since this is an inherited required flag), and it must be empty or command will error.

Adds a new flag to import genesis files:

  • goal network create [-r] [-t] [-p]: Imports files from pregendir to networkDir. Importing keys was already possible, but this explicitly copies over the keys from another directory, because network directories are wiped if there is an error during creation.

Some small benchmarks experiment to estimate start-up time savings: https://gist.github.com/algochoi/53af36bc5d0356124098ffe2c0967b3e

#4826

Test Plan

Manually tested that importing large number of rounds saves time, checked partkeys using: goal account partkeyinfo -d ${NETROOTPATH}/{WALLET}

Added a e2e test.

@algochoi algochoi changed the title Add export and import options for genesis files during network creation goal: Add export and import options for genesis files during network creation Aug 16, 2023
@codecov
Copy link

codecov bot commented Aug 16, 2023

Codecov Report

Merging #5672 (a45062f) into master (b0cf5c8) will increase coverage by 1.17%.
The diff coverage is 24.19%.

@@            Coverage Diff             @@
##           master    #5672      +/-   ##
==========================================
+ Coverage   54.31%   55.48%   +1.17%     
==========================================
  Files         474      474              
  Lines       66416    66471      +55     
==========================================
+ Hits        36075    36884     +809     
+ Misses      27839    27077     -762     
- Partials     2502     2510       +8     
Files Changed Coverage Δ
netdeploy/network.go 9.29% <0.00%> (ø)
cmd/goal/network.go 15.95% <21.05%> (+1.13%) ⬆️
netdeploy/networkTemplate.go 40.58% <100.00%> (ø)

... and 80 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@algochoi algochoi requested review from a team, winder, tzaffi, Eric-Warehime and shiqizng and removed request for a team August 21, 2023 13:39
Copy link
Contributor

@tzaffi tzaffi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change is great and it will have a great impact for projects that use private networks.

I left one nit regarding the usage of -r in the context of goal network genesis which seems a bit confusing to me. Maybe this was motivated by -r being required for goal network. Some options (other than keeping things as is) are to not mark it as required, but then add checks to all the other goal network commands enforcing its presence, or to carve out a new goal genesis command.

test/scripts/test_private_network.sh Outdated Show resolved Hide resolved
tzaffi
tzaffi previously approved these changes Aug 21, 2023
Copy link
Contributor

@tzaffi tzaffi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@algochoi algochoi marked this pull request as ready for review August 23, 2023 17:21
cmd/goal/network.go Outdated Show resolved Hide resolved
cmd/goal/network.go Outdated Show resolved Hide resolved
test/scripts/test_private_network.sh Outdated Show resolved Hide resolved
test/scripts/test_private_network.sh Show resolved Hide resolved
cmd/goal/network.go Outdated Show resolved Hide resolved
cmd/goal/network.go Outdated Show resolved Hide resolved
@algochoi algochoi requested review from winder, shiqizng and tzaffi August 31, 2023 18:08
Copy link
Contributor

@algorandskiy algorandskiy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested, updated the PR description to match cli switches

@algorandskiy algorandskiy merged commit c4dfc1b into algorand:master Sep 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants