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

PeerAuthenticationResolver #3749

Merged
merged 7 commits into from
Feb 8, 2022
Merged

PeerAuthenticationResolver #3749

merged 7 commits into from
Feb 8, 2022

Conversation

sstanculeanu
Copy link
Collaborator

No description provided.

@iulianpascalau iulianpascalau self-requested a review February 4, 2022 08:15
Copy link
Contributor

@iulianpascalau iulianpascalau left a comment

Choose a reason for hiding this comment

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

GJ for the necessary cleanup! 👍

@sstanculeanu sstanculeanu changed the title Resolvers PeerAuthenticationResolver Feb 4, 2022
@sstanculeanu sstanculeanu marked this pull request as ready for review February 4, 2022 17:30
Copy link
Contributor

@iulianpascalau iulianpascalau left a comment

Choose a reason for hiding this comment

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

👍

}

sort.Slice(validatorsPKs, func(i, j int) bool {
return bytes.Compare(validatorsPKs[i], validatorsPKs[j]) < 0
Copy link
Contributor

Choose a reason for hiding this comment

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

👍 this sort by the bls pks should make the distribution among shards quite even

dataSlice := make([][]byte, 0, res.maxNumOfPeerAuthenticationInResponse)
for _, pk := range pksChunk {
peerAuth, tmpErr := res.fetchPeerAuthenticationAsByteSlice(pk)
if tmpErr != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

I do not think we should add the errors here. It will just clutter the node in normal circumstances when some peer authentication messages are missing. Instead, I would return an error if the data slice is empty, outside this for loop

sort.Slice(keys, func(i, j int) bool {
return bytes.Compare(keys[i], keys[j]) < 0
})

for _, key := range keys {
Copy link
Contributor

Choose a reason for hiding this comment

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

didn't realized how this would have actually end up implemented.
This is way too sub-optimal to be left as it is.
We should use a get operation here and send the full public key in the request until we figure out how to optimally resolve this.

iulianpascalau
iulianpascalau previously approved these changes Feb 7, 2022
Comment on lines 230 to 231
// ErrNotFound signals that a data is missing
var ErrNotFound = errors.New("data not found")
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// ErrNotFound signals that a data is missing
var ErrNotFound = errors.New("data not found")
// ErrPeerAuthsNotFound signals that no Peer Authentications has been provided
var ErrPeerAuthsNotFound = errors.New("no peer authentications")

)
}

// ProcessReceivedMessage will be the callback func from the p2p.Messenger and will be called each time a new message was received
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// ProcessReceivedMessage will be the callback func from the p2p.Messenger and will be called each time a new message was received
// ProcessReceivedMessage represents the callback func from the p2p.Messenger that is called each time a new message is received

})
}

func Test_peerAuthenticationResolver_ProcessReceivedMessage(t *testing.T) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
func Test_peerAuthenticationResolver_ProcessReceivedMessage(t *testing.T) {
func TestPeerAuthenticationResolver_ProcessReceivedMessage(t *testing.T) {

})
}

func Test_peerAuthenticationResolver_RequestShouldError(t *testing.T) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
func Test_peerAuthenticationResolver_RequestShouldError(t *testing.T) {
func TestPeerAuthenticationResolver_RequestShouldError(t *testing.T) {


}

func Test_peerAuthenticationResolver_RequestShouldWork(t *testing.T) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
func Test_peerAuthenticationResolver_RequestShouldWork(t *testing.T) {
func TestPeerAuthenticationResolver_RequestShouldWork(t *testing.T) {

@iulianpascalau iulianpascalau merged commit caaf55d into feat/heartbeat-v2 Feb 8, 2022
@iulianpascalau iulianpascalau deleted the resolvers branch February 8, 2022 07:11
@sstanculeanu sstanculeanu self-assigned this Aug 4, 2022
@sstanculeanu sstanculeanu added the ignore-for-release-notes Do not include item in release notes label Aug 4, 2022
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.

3 participants