-
Notifications
You must be signed in to change notification settings - Fork 205
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
Conversation
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.
GJ for the necessary cleanup! 👍
dataRetriever/factory/resolverscontainer/baseResolversContainerFactory.go
Show resolved
Hide resolved
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.
👍
} | ||
|
||
sort.Slice(validatorsPKs, func(i, j int) bool { | ||
return bytes.Compare(validatorsPKs[i], validatorsPKs[j]) < 0 |
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.
👍 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 { |
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.
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 { |
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.
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.
dataRetriever/errors.go
Outdated
// ErrNotFound signals that a data is missing | ||
var ErrNotFound = errors.New("data not found") |
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.
// 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 |
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.
// 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) { |
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.
func Test_peerAuthenticationResolver_ProcessReceivedMessage(t *testing.T) { | |
func TestPeerAuthenticationResolver_ProcessReceivedMessage(t *testing.T) { |
}) | ||
} | ||
|
||
func Test_peerAuthenticationResolver_RequestShouldError(t *testing.T) { |
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.
func Test_peerAuthenticationResolver_RequestShouldError(t *testing.T) { | |
func TestPeerAuthenticationResolver_RequestShouldError(t *testing.T) { |
|
||
} | ||
|
||
func Test_peerAuthenticationResolver_RequestShouldWork(t *testing.T) { |
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.
func Test_peerAuthenticationResolver_RequestShouldWork(t *testing.T) { | |
func TestPeerAuthenticationResolver_RequestShouldWork(t *testing.T) { |
No description provided.