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
[Observer] Add bootstrap command to generate observer networking key #2087
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2087 +/- ##
==========================================
- Coverage 57.63% 57.29% -0.34%
==========================================
Files 631 635 +4
Lines 36233 36578 +345
==========================================
+ Hits 20884 20959 +75
- Misses 12732 12984 +252
- Partials 2617 2635 +18
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
2170a69
to
dcfdc60
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall good, a few small comments
Co-authored-by: Simon Zhu <simon.zsiyan@gmail.com>
96f75d4
to
35fdc9d
Compare
log.Info().Msg("generated network key") | ||
|
||
// hex encode and write to file | ||
output := make([]byte, hex.EncodedLen(networkKey.Size())) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is .Size()
returning encoded length?
I'm not sure if we need really to do this pre-allocation, can't we just encode whatever we get?
This might lead to some subtle bugs in the future
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fair enough. I updated to use the actual slice len. the preallocation is needed. that's actually what the hex library does for EncodeToString
except without the cast
} | ||
|
||
// generate unstaked networking private key | ||
networkKey, err := utils.GenerateUnstakedNetworkingKey(flagNetworkSeed) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What are "observers" exactly? are these a sub-type of unstaked access nodes?
I'm asking to make sure GenerateUnstakedNetworkingKey
is what we need and not GenerateNetworkingKey
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Observer is the new name for unstaked access node.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah okay 😅 It makes sense to use that function then.
bors merge |
Closes: #2087
This adds a new command to generate the networking key used by observers on the public libp2p network.
Note: this key uses a different format from the normal staked networking key.