Skip to content

fix: parameter to _onPeerDisconnected #58

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 3 commits into from
Jan 22, 2020
Merged

fix: parameter to _onPeerDisconnected #58

merged 3 commits into from
Jan 22, 2020

Conversation

alanshaw
Copy link

_onPeerDisconnected is expecting a PeerInfo but it was being passed a pubsub Peer.

I'm not sure if this is the correct fix but it resolves this error for me:

(node:77189) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'toB58String' of undefined
    at GossipSub._onPeerDisconnected (/Users/alan/Code/pl/ipfs/js-ipfs/node_modules/libp2p-pubsub/src/index.js:190:34)
    at GossipSub._processMessages (/Users/alan/Code/pl/ipfs/js-ipfs/node_modules/libp2p-gossipsub/src/pubsub.js:120:12)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:94:5)

`_onPeerDisconnected` is expecting a `PeerInfo` but it was being passed a pubsub `Peer`.

I'm not sure if this is the correct fix but it resolves this error for me:

```
(node:77189) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'toB58String' of undefined
    at GossipSub._onPeerDisconnected (/Users/alan/Code/pl/ipfs/js-ipfs/node_modules/libp2p-pubsub/src/index.js:190:34)
    at GossipSub._processMessages (/Users/alan/Code/pl/ipfs/js-ipfs/node_modules/libp2p-gossipsub/src/pubsub.js:120:12)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:94:5)
```
@alanshaw alanshaw requested review from wemeetagain and vasco-santos and removed request for wemeetagain January 16, 2020 12:26
@claassistantio
Copy link

claassistantio commented Jan 16, 2020

CLA assistant check
All committers have signed the CLA.

@alanshaw alanshaw requested a review from wemeetagain January 16, 2020 12:28
@codecov-io
Copy link

codecov-io commented Jan 16, 2020

Codecov Report

Merging #58 into master will increase coverage by 0.2%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master      #58     +/-   ##
=========================================
+ Coverage    83.6%   83.81%   +0.2%     
=========================================
  Files           8        8             
  Lines         482      482             
=========================================
+ Hits          403      404      +1     
+ Misses         79       78      -1
Impacted Files Coverage Δ
src/pubsub.js 88.74% <100%> (+0.66%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8cc71a2...2754dcf. Read the comment docs.

alanshaw pushed a commit to libp2p/js-libp2p-floodsub that referenced this pull request Jan 16, 2020
Copy link
Collaborator

@vasco-santos vasco-santos left a comment

Choose a reason for hiding this comment

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

Looks good, can you just add a test where the process message throws?

Copy link
Collaborator

@jacobheun jacobheun left a comment

Choose a reason for hiding this comment

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

This LGTM! I went ahead and created a PR at libp2p-pubsub to correct the jsdocs there for _processMessage, libp2p/js-libp2p-pubsub#35.

@alanshaw
Copy link
Author

@wemeetagain can this fix be merged and released? 🙏

Copy link
Member

@wemeetagain wemeetagain left a comment

Choose a reason for hiding this comment

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

LGTM

Thanks for the ping

@wemeetagain wemeetagain dismissed vasco-santos’s stale review January 22, 2020 16:25

test has been added as requested

@wemeetagain wemeetagain merged commit 71cb905 into ChainSafe:master Jan 22, 2020
@alanshaw alanshaw deleted the patch-1 branch January 23, 2020 12:22
@alanshaw
Copy link
Author

@wemeetagain any chance this can get released under the "beta" tag?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants