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

Peer authentication sender factory #4414

Merged
merged 8 commits into from Sep 1, 2022

Conversation

sstanculeanu
Copy link
Contributor

Description of the reasoning behind the pull request (what feature was missing / how the problem was manifesting itself / what was the motive behind the refactoring)

  • 2 types of peer authentication available, one for multikey and the old one

Proposed Changes

  • add a factory which automatically creates the proper peer authentication based on the configuration

Testing procedure

  • system test

@sstanculeanu sstanculeanu self-assigned this Aug 30, 2022
@iulianpascalau iulianpascalau self-requested a review August 31, 2022 06:24
Base automatically changed from integrate_peerauthentication_sender to feat/multisigner August 31, 2022 13:58
@sstanculeanu sstanculeanu marked this pull request as ready for review August 31, 2022 13:59

func (pasf *peerAuthenticationSenderFactory) createMultikeyPeerAuthenticationSender() (*multikeyPeerAuthenticationSender, error) {
args := argMultikeyPeerAuthenticationSender{
argBaseSender: argBaseSender{
Copy link
Contributor

Choose a reason for hiding this comment

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

could have extracted a function createBaseSenderArgs and use it in the both functions

Copy link
Contributor Author

Choose a reason for hiding this comment

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

not needed anymore with latest push

return nil, fmt.Errorf("%w for peerAuthenticationSenderFactory, could not determine node's type", heartbeat.ErrInvalidConfiguration)
_, _, err = args.nodesCoordinator.GetValidatorWithPublicKey(pkBytes)
if err == nil {
return createRegularSender(args)
Copy link
Contributor

Choose a reason for hiding this comment

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

please add a check here for len(keysMap) and allow to create the regular peer only if that len is 0. Otherwise we should output error

…ests, partially integrated the sender parameters into heartbeat v2 components
@@ -142,6 +143,9 @@ func (hcf *heartbeatV2ComponentsFactory) Create() (*heartbeatV2Components, error
HardforkTrigger: hcf.processComponents.HardforkTrigger(),
HardforkTimeBetweenSends: time.Second * time.Duration(cfg.HardforkTimeBetweenSendsInSec),
HardforkTriggerPubKey: hcf.coreComponents.HardforkTriggerPubKey(),
KeysHolder: &testscommon.KeysHolderStub{}, // TODO: use the real component once it is completely integrated
Copy link
Contributor

Choose a reason for hiding this comment

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

don't use mock / test packages in production code. Please create a disabled package somewhere, alongside with a disabledKeysHolder and use this instead.

Copy link
Contributor

Choose a reason for hiding this comment

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

Agree, let's pass the real component here. Should be created & stored in crypto components

Copy link
Contributor Author

Choose a reason for hiding this comment

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

pushed the integration into crypto components

@@ -486,6 +486,10 @@
MaxRoundsToKeepUnprocessedMiniBlocks = 300 # max number of rounds unprocessed miniblocks are kept in pool
MaxRoundsToKeepUnprocessedTransactions = 300 # max number of rounds unprocessed transactions are kept in pool

[KeysHolderConfig]
IsMainMachine = false
Copy link
Contributor

Choose a reason for hiding this comment

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

why do we have a separate configuration? Couldn't this be determined based on the redundancy level?

Copy link
Contributor

Choose a reason for hiding this comment

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

we have this in prefs.toml file

Copy link
Contributor

Choose a reason for hiding this comment

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

and the MaxRoundsWithoutReceivedMessages is actually the RedundancyLevel value

Copy link
Contributor Author

Choose a reason for hiding this comment

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

pushed

@@ -167,6 +174,19 @@ func (ccf *cryptoComponentsFactory) Create() (*cryptoComponents, error) {
return nil, err
}

blsKeyGenerator := signing.NewKeyGenerator(mcl.NewSuiteBLS12())
Copy link
Contributor

Choose a reason for hiding this comment

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

shouldn't it be created based on a config? similar to factory/cryptoComponents.getSuite()

@@ -486,6 +486,10 @@
MaxRoundsToKeepUnprocessedMiniBlocks = 300 # max number of rounds unprocessed miniblocks are kept in pool
MaxRoundsToKeepUnprocessedTransactions = 300 # max number of rounds unprocessed transactions are kept in pool

[KeysHolderConfig]
IsMainMachine = false
Copy link
Contributor

Choose a reason for hiding this comment

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

we have this in prefs.toml file

@@ -486,6 +486,10 @@
MaxRoundsToKeepUnprocessedMiniBlocks = 300 # max number of rounds unprocessed miniblocks are kept in pool
MaxRoundsToKeepUnprocessedTransactions = 300 # max number of rounds unprocessed transactions are kept in pool

[KeysHolderConfig]
IsMainMachine = false
Copy link
Contributor

Choose a reason for hiding this comment

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

and the MaxRoundsWithoutReceivedMessages is actually the RedundancyLevel value

@@ -167,6 +174,19 @@ func (ccf *cryptoComponentsFactory) Create() (*cryptoComponents, error) {
return nil, err
}

blsKeyGenerator := signing.NewKeyGenerator(mcl.NewSuiteBLS12())
Copy link
Contributor

Choose a reason for hiding this comment

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

instead of this, we should use the blockSignKeyGen

@@ -15,7 +15,7 @@ import (
"github.com/ElrondNetwork/elrond-go/config"
)

const minRoundsWithoutReceivedMessages = 1
const minRoundsWithoutReceivedMessages = -1
Copy link
Contributor

Choose a reason for hiding this comment

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

we might refactor this in a future PR and re-check the logic.

@sstanculeanu sstanculeanu merged commit 82885f5 into feat/multisigner Sep 1, 2022
@sstanculeanu sstanculeanu deleted the peer_auth_sender_factory branch September 1, 2022 19:07
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.

None yet

3 participants