Skip to content

Remove check for impossible condition in x/sync #1348

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

Merged
merged 4 commits into from
Apr 21, 2023

Conversation

danlaine
Copy link

Why this should be merged

The node ID should never be empty

How this works

Self explanatory

How this was tested

Existing UT

@danlaine danlaine requested a review from darioush as a code owner April 14, 2023 14:47
@danlaine danlaine self-assigned this Apr 14, 2023
@@ -186,11 +186,6 @@ func (c *networkClient) RequestAny(
// If the limit on active requests is reached, this function blocks until
// a slot becomes available.
func (c *networkClient) Request(ctx context.Context, nodeID ids.NodeID, request []byte) ([]byte, error) {
// TODO danlaine: is it possible for this condition to occur?
if nodeID == ids.EmptyNodeID {
return nil, fmt.Errorf("cannot send request to empty nodeID, nodeID=%s, requestLen=%d", nodeID, len(request))
Copy link
Contributor

Choose a reason for hiding this comment

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

This seems like a useful check to leave on the exported method, I think.
Even if all current uses are correct it might catch errors in future development.

Not very strongly opinionated, happy to defer to @dboehm-avalabs

@danlaine danlaine merged commit 319f38b into dev Apr 21, 2023
@danlaine danlaine deleted the sync-remove-check-for-impossible-condition branch April 21, 2023 19:55
@patrick-ogrady patrick-ogrady added this to the v1.10.1 milestone Apr 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants