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

WIP Update Libp2p to v0.27.6 #11

Merged
merged 32 commits into from
Aug 1, 2020

Conversation

prateekreddy
Copy link
Collaborator

No description provided.

@shresthagrawal shresthagrawal added the enhancement New feature or request label Apr 23, 2020
@prateekreddy prateekreddy changed the title WIP Update Libp2p to v0.27.4 WIP Update Libp2p to v0.27.6 Apr 26, 2020
@prateekreddy
Copy link
Collaborator Author

prateekreddy commented Apr 26, 2020

All chapters refactored to libp2p v0.27.6

Copy link
Owner

@shresthagrawal shresthagrawal left a comment

Choose a reason for hiding this comment

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

@prateekreddy awesome work!
I ran the bootstrap code 2.2-finished-code.js and then ran the code 2.3-finished-code.js which just dials to the bootstrap. It throws this error:

(node:67986) UnhandledPromiseRejectionWarning: AggregateError:
    Error: protocol selection failed
        at module.exports (/Users/shresthagrawal/Desktop/study/libp2p/jslibp2p-chat-tutorial/assets/node_modules/multistream-select/src/select.js:50:17)
        at async Upgrader._encryptOutbound (/Users/shresthagrawal/Desktop/study/libp2p/jslibp2p-chat-tutorial/assets/node_modules/libp2p/src/upgrader.js:361:36)
        at async Upgrader.upgradeOutbound (/Users/shresthagrawal/Desktop/study/libp2p/jslibp2p-chat-tutorial/assets/node_modules/libp2p/src/upgrader.js:168:11)
        at async ClassIsWrapper.dial (/Users/shresthagrawal/Desktop/study/libp2p/jslibp2p-chat-tutorial/assets/node_modules/libp2p-tcp/src/index.js:42:18)
        at async TransportManager.dial (/Users/shresthagrawal/Desktop/study/libp2p/jslibp2p-chat-tutorial/assets/node_modules/libp2p/src/transport-manager.js:87:14)
        at async /Users/shresthagrawal/Desktop/study/libp2p/jslibp2p-chat-tutorial/assets/node_modules/libp2p/src/dialer/dial-request.js:58:18
        at async /Users/shresthagrawal/Desktop/study/libp2p/jslibp2p-chat-tutorial/assets/node_modules/p-some/index.js:53:19
    at maybeSettle (/Users/shresthagrawal/Desktop/study/libp2p/jslibp2p-chat-tutorial/assets/node_modules/p-some/index.js:31:11)
    at /Users/shresthagrawal/Desktop/study/libp2p/jslibp2p-chat-tutorial/assets/node_modules/p-some/index.js:69:23
(node:67986) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:67986) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

The error seems to disappear once we add secio in the next chapter. Is the support for plaintext removed in the latest version?
can you check it out why?

@prateekreddy
Copy link
Collaborator Author

@prateekreddy awesome work!
I ran the bootstrap code 2.2-finished-code.js and then ran the code 2.3-finished-code.js which just dials to the bootstrap. It throws this error:

(node:67986) UnhandledPromiseRejectionWarning: AggregateError:
    Error: protocol selection failed
        at module.exports (/Users/shresthagrawal/Desktop/study/libp2p/jslibp2p-chat-tutorial/assets/node_modules/multistream-select/src/select.js:50:17)
        at async Upgrader._encryptOutbound (/Users/shresthagrawal/Desktop/study/libp2p/jslibp2p-chat-tutorial/assets/node_modules/libp2p/src/upgrader.js:361:36)
        at async Upgrader.upgradeOutbound (/Users/shresthagrawal/Desktop/study/libp2p/jslibp2p-chat-tutorial/assets/node_modules/libp2p/src/upgrader.js:168:11)
        at async ClassIsWrapper.dial (/Users/shresthagrawal/Desktop/study/libp2p/jslibp2p-chat-tutorial/assets/node_modules/libp2p-tcp/src/index.js:42:18)
        at async TransportManager.dial (/Users/shresthagrawal/Desktop/study/libp2p/jslibp2p-chat-tutorial/assets/node_modules/libp2p/src/transport-manager.js:87:14)
        at async /Users/shresthagrawal/Desktop/study/libp2p/jslibp2p-chat-tutorial/assets/node_modules/libp2p/src/dialer/dial-request.js:58:18
        at async /Users/shresthagrawal/Desktop/study/libp2p/jslibp2p-chat-tutorial/assets/node_modules/p-some/index.js:53:19
    at maybeSettle (/Users/shresthagrawal/Desktop/study/libp2p/jslibp2p-chat-tutorial/assets/node_modules/p-some/index.js:31:11)
    at /Users/shresthagrawal/Desktop/study/libp2p/jslibp2p-chat-tutorial/assets/node_modules/p-some/index.js:69:23
(node:67986) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:67986) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

The error seems to disappear once we add secio in the next chapter. Is the support for plaintext removed in the latest version?
can you check it out why?

Yes looks like encryption is mandatory now.

assets/package.json Outdated Show resolved Hide resolved
@acolytec3
Copy link
Collaborator

Other than the package version issue noted in my above comment, this looks great!

Comment on lines +15 to +27
"it-pipe": "^1.1.0",
"libp2p": "^0.27.6",
"libp2p-bootstrap": "^0.10.4",
"libp2p-gossipsub": "^0.3.0",
"libp2p-kad-dht": "^0.18.6",
"libp2p-mdns": "^0.13.3",
"libp2p-mplex": "^0.9.5",
"libp2p-secio": "^0.12.4",
"libp2p-tcp": "^0.14.4",
"libp2p-webrtc-star": "^0.17.9",
"libp2p-websockets": "^0.13.6",
"multiaddr": "^7.4.3",
"peer-info": "^0.17.5",
Copy link
Owner

Choose a reason for hiding this comment

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

pull-mplex is missing?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Shouldn't need it since it's been replaced by it-pipe right? I thought pull-mplex was part of the set of dependencies if you're working with pull-streams.

Copy link
Owner

@shresthagrawal shresthagrawal left a comment

Choose a reason for hiding this comment

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

Nice work, can you check out why does the code 6.2-finished-code.js doesn't work? the code until chapter 5 works perfectly

@acolytec3
Copy link
Collaborator

@prateekreddy awesome work!
I ran the bootstrap code 2.2-finished-code.js and then ran the code 2.3-finished-code.js which just dials to the bootstrap. It throws this error:

(node:67986) UnhandledPromiseRejectionWarning: AggregateError:
    Error: protocol selection failed
        at module.exports (/Users/shresthagrawal/Desktop/study/libp2p/jslibp2p-chat-tutorial/assets/node_modules/multistream-select/src/select.js:50:17)
        at async Upgrader._encryptOutbound (/Users/shresthagrawal/Desktop/study/libp2p/jslibp2p-chat-tutorial/assets/node_modules/libp2p/src/upgrader.js:361:36)
        at async Upgrader.upgradeOutbound (/Users/shresthagrawal/Desktop/study/libp2p/jslibp2p-chat-tutorial/assets/node_modules/libp2p/src/upgrader.js:168:11)
        at async ClassIsWrapper.dial (/Users/shresthagrawal/Desktop/study/libp2p/jslibp2p-chat-tutorial/assets/node_modules/libp2p-tcp/src/index.js:42:18)
        at async TransportManager.dial (/Users/shresthagrawal/Desktop/study/libp2p/jslibp2p-chat-tutorial/assets/node_modules/libp2p/src/transport-manager.js:87:14)
        at async /Users/shresthagrawal/Desktop/study/libp2p/jslibp2p-chat-tutorial/assets/node_modules/libp2p/src/dialer/dial-request.js:58:18
        at async /Users/shresthagrawal/Desktop/study/libp2p/jslibp2p-chat-tutorial/assets/node_modules/p-some/index.js:53:19
    at maybeSettle (/Users/shresthagrawal/Desktop/study/libp2p/jslibp2p-chat-tutorial/assets/node_modules/p-some/index.js:31:11)
    at /Users/shresthagrawal/Desktop/study/libp2p/jslibp2p-chat-tutorial/assets/node_modules/p-some/index.js:69:23
(node:67986) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:67986) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

The error seems to disappear once we add secio in the next chapter. Is the support for plaintext removed in the latest version?
can you check it out why?

Per here, this can be fixed but you have to specify Plaintext as the connEncryption module in the options object for the node. I did this locally 2.2 and 2.3 completed code sections and it works fine.

const Plaintext = require('libp2p/src/insecure/plaintext')
...
let options = {
    modules: {
        transport: [ TCP, WS, WStar ],
        connEncryption: [Plaintext]
    },...

assets/2/2.2-finished-code.js Show resolved Hide resolved
assets/2/2.2-finished-code.js Show resolved Hide resolved
@prateekreddy
Copy link
Collaborator Author

Nice work, can you check out why does the code 6.2-finished-code.js doesn't work? the code until chapter 5 works perfectly

Oops looks like I missed chapter 6 completely. Let me update the code in the chapter as well.

Copy link
Collaborator

@acolytec3 acolytec3 left a comment

Choose a reason for hiding this comment

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

Add connEncryption: [Plaintext]

This will resolve the protocol selection failed error that @shresthagrawal mentioned.

@acolytec3
Copy link
Collaborator

Fired up 2 nodes using the 6.2 finished code and it works great. Thanks for this!

@acolytec3
Copy link
Collaborator

@shresthagrawal @jjperezaguinaga Hey guys, any chance one of you can give this a final look so we can get it merged? I'd love to have it merged this weekend if possible so we can start merging the content updates in the other PRs.

@shresthagrawal shresthagrawal merged commit 36cfda2 into shresthagrawal:master Aug 1, 2020
@prateekreddy prateekreddy deleted the js-libp2p-v0.27.4 branch August 2, 2020 03:39
@prateekreddy prateekreddy linked an issue Aug 15, 2020 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Refactor all the code to latest version of js-libp2p
3 participants