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

added p2p private key in crypto components #4674

Merged
merged 16 commits into from
Dec 9, 2022

Conversation

ssd04
Copy link
Contributor

@ssd04 ssd04 commented Nov 7, 2022

Reasoning behind the pull request

  • Refactor p2p keys creation and management in order to have all crypto related components in one single place

Proposed changes

  • create p2p crypto components in crypto components factory, based on the newly added crypto suite (secp256k1 curve, ecdsa signing)
  • adapt seednode to use the new setup
  • refactor keygenerator to use the same generate key pattern

Testing procedure

  • Standard system test
  • Make sure the seeder and keygenerator works as before

Pre-requisites

Based on the Contributing Guidelines the PR author and the reviewers must check the following requirements are met:

  • was the PR targeted to the correct branch?
  • if this is a larger feature that probably needs more than one PR, is there a feat branch created?
  • if this is a feat branch merging, do all satellite projects have a proper tag inside go.mod?

@ssd04 ssd04 self-assigned this Nov 7, 2022
@codecov-commenter
Copy link

Codecov Report

Base: 70.77% // Head: 70.71% // Decreases project coverage by -0.05% ⚠️

Coverage data is based on head (5c069a7) compared to base (2da454c).
Patch coverage: 0.00% of modified lines in pull request are covered.

Additional details and impacted files
@@              Coverage Diff              @@
##           rc/v1.4.0    #4674      +/-   ##
=============================================
- Coverage      70.77%   70.71%   -0.06%     
=============================================
  Files            640      640              
  Lines          84329    84390      +61     
=============================================
  Hits           59680    59680              
- Misses         20176    20237      +61     
  Partials        4473     4473              
Impacted Files Coverage Δ
factory/crypto/cryptoComponents.go 0.00% <0.00%> (ø)
factory/crypto/cryptoComponentsHandler.go 0.00% <0.00%> (ø)
factory/network/networkComponents.go 0.00% <0.00%> (ø)
node/nodeRunner.go 0.00% <0.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@@ -105,6 +119,7 @@ func NewCryptoComponentsFactory(args CryptoComponentsFactoryArgs) (*cryptoCompon
importModeNoSigCheck: args.ImportModeNoSigCheck,
enableEpochs: args.EnableEpochs,
noKeyProvided: args.NoKeyProvided,
p2pKeyPemFileName: args.P2pKeyPemFileName,
Copy link
Collaborator

Choose a reason for hiding this comment

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

perhaps add a check for len(args.P2pKeyPemFileName) == 0

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the check was not added intentionally, so that if there is no file provided, a new key will be generated

Copy link
Collaborator

Choose a reason for hiding this comment

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

oh, right

@@ -82,15 +82,24 @@ func (mcc *managedCryptoComponents) CheckSubcomponents() error {
if check.IfNil(mcc.cryptoComponents.publicKey) {
return errors.ErrNilPublicKey
}
if check.IfNil(mcc.cryptoComponents.p2pPublicKey) {
return errors.ErrNilPublicKey
Copy link
Collaborator

Choose a reason for hiding this comment

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

should use different errors for p2pPublicKey and p2pPrivateKey

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done, added

go.mod Outdated
@@ -5,9 +5,9 @@ go 1.15
require (
github.com/ElrondNetwork/elastic-indexer-go v1.3.0
github.com/ElrondNetwork/elrond-go-core v1.1.24
github.com/ElrondNetwork/elrond-go-crypto v1.2.1
github.com/ElrondNetwork/elrond-go-crypto v1.2.2-0.20221110121517-4e85e482f854
Copy link
Collaborator

Choose a reason for hiding this comment

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

don't forget proper releases

Copy link
Contributor

Choose a reason for hiding this comment

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

yup, proper release :D

@iulianpascalau iulianpascalau self-requested a review November 15, 2022 15:11
sstanculeanu
sstanculeanu previously approved these changes Nov 15, 2022
cmd/keygenerator/main.go Show resolved Hide resolved
common/configParser.go Outdated Show resolved Hide resolved
go.mod Outdated
@@ -5,9 +5,9 @@ go 1.15
require (
github.com/ElrondNetwork/elastic-indexer-go v1.3.0
github.com/ElrondNetwork/elrond-go-core v1.1.24
github.com/ElrondNetwork/elrond-go-crypto v1.2.1
github.com/ElrondNetwork/elrond-go-crypto v1.2.2-0.20221110121517-4e85e482f854
Copy link
Contributor

Choose a reason for hiding this comment

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

yup, proper release :D

go.mod Outdated
github.com/ElrondNetwork/wasm-vm-v1_4 v1.4.63
github.com/ElrondNetwork/elastic-indexer-go v1.3.3
github.com/ElrondNetwork/elrond-go-core v1.1.26
github.com/ElrondNetwork/elrond-go-crypto v1.2.3-0.20221207130836-796c2dff9ad7
Copy link
Contributor

Choose a reason for hiding this comment

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

do not forget about proper release here and on L10

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍

Copy link
Contributor Author

@ssd04 ssd04 Dec 9, 2022

Choose a reason for hiding this comment

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

added proper release tags

gabi-vuls
gabi-vuls previously approved these changes Dec 9, 2022
@ssd04 ssd04 merged commit 9e63bd1 into rc/v1.4.0 Dec 9, 2022
@ssd04 ssd04 deleted the refactor-p2p-create-private-key branch December 9, 2022 16:04
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