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

cmd: Add goal node subcommand to generate peer private key #6078

Merged
merged 6 commits into from
Aug 1, 2024

Conversation

algorandskiy
Copy link
Contributor

@algorandskiy algorandskiy commented Jul 23, 2024

Summary

As part of upcoming p2p deployment we need to register p2p bootstrap nodes in DNS TXT.
This tool allows to generate a new peer private key and print out peer ID (or print it from existing key file with default name).

Test Plan

Tested manually

goal node -d . -d test generate-p2pid
[Data Directory: /Users/algorandskiy/go-algorand]
PeerID: 12D3KooWSPTKMhFqaWMsjNtBG1vWgRd8GXUbUtQt3iX2GQp9bgC5
Private key saved to /Users/algorandskiy/go-algorand/peerIDPrivKey.pem
[Data Directory: test]
PeerID: 12D3KooWJzt2v6g2BtaD5pTLLa2JkA4bnKCAW6b2AmRbqLDPccBg
Private key saved to test/peerIDPrivKey.pem

goal node -d . -d test generate-p2pid
[Data Directory: /Users/algorandskiy/go-algorand]
PeerID: 12D3KooWSPTKMhFqaWMsjNtBG1vWgRd8GXUbUtQt3iX2GQp9bgC5
Used existing key /Users/algorandskiy/go-algorand/peerIDPrivKey.pem
[Data Directory: test]
PeerID: 12D3KooWJzt2v6g2BtaD5pTLLa2JkA4bnKCAW6b2AmRbqLDPccBg
Used existing key test/peerIDPrivKey.pem

@algorandskiy algorandskiy added Enhancement p2p Work related to the p2p project labels Jul 23, 2024
@algorandskiy algorandskiy self-assigned this Jul 23, 2024
@algorandskiy algorandskiy force-pushed the pavel/p2p-peerkey-gen branch from f8c6534 to 9b23a43 Compare July 23, 2024 19:02
Copy link

codecov bot commented Jul 23, 2024

Codecov Report

Attention: Patch coverage is 4.00000% with 24 lines in your changes missing coverage. Please review.

Project coverage is 56.26%. Comparing base (edda2ee) to head (375efad).
Report is 3 commits behind head on master.

Files Patch % Lines
cmd/goal/p2pid.go 0.00% 24 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6078      +/-   ##
==========================================
+ Coverage   55.95%   56.26%   +0.30%     
==========================================
  Files         488      489       +1     
  Lines       69602    69627      +25     
==========================================
+ Hits        38945    39173     +228     
+ Misses      27967    27802     -165     
+ Partials     2690     2652      -38     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@jasonpaulos jasonpaulos left a comment

Choose a reason for hiding this comment

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

Makes sense, just one comment

cmd/p2pid/main.go Outdated Show resolved Hide resolved
@algorandskiy algorandskiy requested a review from jasonpaulos July 24, 2024 14:56
jasonpaulos
jasonpaulos previously approved these changes Jul 24, 2024
cce
cce previously approved these changes Jul 26, 2024
Copy link
Contributor

@cce cce left a comment

Choose a reason for hiding this comment

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

LGTM, though it may make sense to move this to be a goal subcommand later, for node operators who want to generate persistent p2p IDs.

@algorandskiy
Copy link
Contributor Author

Like goal node -d /a/b/c generatep2pkey ?

@algorandskiy algorandskiy dismissed stale reviews from cce and jasonpaulos via dc8b3e0 July 29, 2024 17:41
@algorandskiy algorandskiy requested review from cce and jasonpaulos July 29, 2024 17:42
@algorandskiy
Copy link
Contributor Author

Implemented as goal node generate-p2pid subcommand.

@algorandskiy algorandskiy changed the title cmd: Add a simple cli util to generate peer private key cmd: Add goal node subcommand to generate peer private key Aug 1, 2024
@algorandskiy algorandskiy merged commit d2c4ca7 into algorand:master Aug 1, 2024
19 checks passed
@algorandskiy algorandskiy deleted the pavel/p2p-peerkey-gen branch August 1, 2024 17:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement p2p Work related to the p2p project
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants