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

Uncaught Error: dialed to the wrong peer, Ids do not match #274

Closed
klueq opened this issue Nov 3, 2018 · 16 comments
Closed

Uncaught Error: dialed to the wrong peer, Ids do not match #274

klueq opened this issue Nov 3, 2018 · 16 comments
Labels
exp/expert Having worked on the specific codebase is important help wanted Seeking public contribution on this issue P2 Medium: Good to have, but can wait until someone steps up status/ready Ready to be worked

Comments

@klueq
Copy link

klueq commented Nov 3, 2018

I'm getting the following error when the latest js-libp2p is built with the latest js-ipfs + the DHT PR:

crypto.js:80 Uncaught Error: dialed to the wrong peer, Ids do not match
    at PeerId.createFromPubKey (crypto.js:80)
    at pubKey.hash (index.js:201)
    at Multihashing.Multihashing.digest (index.js:33)
    at index.js:15
    at run (setImmediate.js:40)
    at runIfPresent (setImmediate.js:69)
    at onGlobalMessage (setImmediate.js:109)

This error doesn't seem to break anything.

Repro, just in case: https://klueq.github.io/?https://ipfs.io/ipfs/QmdFgDWRTB4L3Ks87615kSc6yQStXxRTfp1hmYUfDGTeBe/index.js

The console log dump:

index.js:75 [+000.0s] loading the ipfs script
index.js:75 [+000.0s] script: https://ipfs.io/ipfs/QmdFgDWRTB4L3Ks87615kSc6yQStXxRTfp1hmYUfDGTeBe/index.js
favicon.ico:1 GET https://klueq.github.io/favicon.ico 404
index.js:75 [+004.9s] starting ipfs node: {"relay":{"enabled":true,"hop":{"enabled":true}},"Addresses":{"Swarm":["/dns4/ws-star.discovery.libp2p.io/tcp/443/wss/p2p-websocket-star"]}}
libp2p.js:105 Swarm listening on /p2p-circuit/ipfs/QmVEMVdCixKhPeB6NWLq5eUcKbr113VUhKUKrnakWPJz4m
libp2p.js:105 Swarm listening on /p2p-circuit/dns4/ws-star.discovery.libp2p.io/tcp/443/wss/p2p-websocket-star/ipfs/QmVEMVdCixKhPeB6NWLq5eUcKbr113VUhKUKrnakWPJz4m
libp2p.js:105 Swarm listening on /dns4/ws-star.discovery.libp2p.io/tcp/443/wss/p2p-websocket-star/ipfs/QmVEMVdCixKhPeB6NWLq5eUcKbr113VUhKUKrnakWPJz4m
index.js:75 [+006.3s] ipfs.version: 0.33.0
index.js:75 [+006.3s] ipfs.id: QmVEMVdCixKhPeB6NWLq5eUcKbr113VUhKUKrnakWPJz4m
index.js:75 [+006.3s] ipfs.files.get QmQ2r6iMNpky5f1m4cnm3Yqw8VSvjuKpTcK1X7dBR1LkJF
crypto.js:80 Uncaught Error: dialed to the wrong peer, Ids do not match
    at PeerId.createFromPubKey (crypto.js:80)
    at pubKey.hash (index.js:201)
    at Multihashing.Multihashing.digest (index.js:33)
    at index.js:15
    at run (setImmediate.js:40)
    at runIfPresent (setImmediate.js:69)
    at onGlobalMessage (setImmediate.js:109)
PeerId.createFromPubKey @ crypto.js:80
pubKey.hash @ index.js:201
Multihashing.Multihashing.digest @ index.js:33
(anonymous) @ index.js:15
run @ setImmediate.js:40
runIfPresent @ setImmediate.js:69
onGlobalMessage @ setImmediate.js:109
postMessage (async)
registerImmediate @ setImmediate.js:120
setImmediate @ setImmediate.js:27
(anonymous) @ index.js:14
Promise.then (async)
nodeify @ index.js:13
(anonymous) @ crypto-sha1-2-browser.js:37
sha2256 @ crypto-sha1-2-browser.js:49
Ipfs../node_modules/peer-id/node_modules/multihashing-async/src/index.js.Multihashing.digest @ index.js:84
Multihashing @ index.js:28
hash @ rsa-class.js:43
Ipfs../node_modules/peer-id/src/index.js.exports.createFromPubKey @ index.js:196
Ipfs../node_modules/libp2p-secio/src/handshake/crypto.js.exports.identify @ crypto.js:72
waterfall @ propose.js:24
nextTask @ waterfall.js:16
next @ waterfall.js:23
(anonymous) @ onlyOnce.js:12
onComplete @ decode.js:49
reader.read @ decode.js:125
drain @ index.js:39
more @ index.js:55
(anonymous) @ index.js:66
(anonymous) @ index.js:20
(anonymous) @ map.js:19
(anonymous) @ index.js:114
(anonymous) @ index.js:114
(anonymous) @ map.js:19
(anonymous) @ source.js:31
index.js:75 [+025.0s] ipfs.files.get -> [object Object],[object Object]
index.js:75 [+025.0s] ipfs.files.get QmRW3V9znzFW9M5FYbitSEvd5dQrPWGvPvgQD6LM22Tv8D
index.js:75 [+025.9s] ipfs.files.get -> [object Object]
index.js:75 [+025.9s] ipfs.files.get QmXXtHtDwXFbCTzMDjacZxid6CCNY4m5oM6MgBhyPVT3Tr
index.js:75 [+026.7s] ipfs.files.get -> foobar122111

index.js:75 [+026.7s] done
crypto.js:80 Uncaught Error: dialed to the wrong peer, Ids do not match
    at PeerId.createFromPubKey (crypto.js:80)
    at pubKey.hash (index.js:201)
    at Multihashing.Multihashing.digest (index.js:33)
    at index.js:15
    at run (setImmediate.js:40)
    at runIfPresent (setImmediate.js:69)
    at onGlobalMessage (setImmediate.js:109)
PeerId.createFromPubKey @ crypto.js:80
pubKey.hash @ index.js:201
Multihashing.Multihashing.digest @ index.js:33
(anonymous) @ index.js:15
run @ setImmediate.js:40
runIfPresent @ setImmediate.js:69
onGlobalMessage @ setImmediate.js:109
postMessage (async)
registerImmediate @ setImmediate.js:120
setImmediate @ setImmediate.js:27
(anonymous) @ index.js:14
Promise.then (async)
nodeify @ index.js:13
(anonymous) @ crypto-sha1-2-browser.js:37
sha2256 @ crypto-sha1-2-browser.js:49
Ipfs../node_modules/peer-id/node_modules/multihashing-async/src/index.js.Multihashing.digest @ index.js:84
Multihashing @ index.js:28
hash @ rsa-class.js:43
Ipfs../node_modules/peer-id/src/index.js.exports.createFromPubKey @ index.js:196
Ipfs../node_modules/libp2p-secio/src/handshake/crypto.js.exports.identify @ crypto.js:72
waterfall @ propose.js:24
nextTask @ waterfall.js:16
next @ waterfall.js:23
(anonymous) @ onlyOnce.js:12
onComplete @ decode.js:49
reader.read @ decode.js:125
drain @ index.js:39
more @ index.js:55
(anonymous) @ index.js:66
(anonymous) @ index.js:20
(anonymous) @ map.js:19
(anonymous) @ index.js:114
(anonymous) @ index.js:114
(anonymous) @ map.js:19
(anonymous) @ source.js:31
crypto.js:80 Uncaught Error: dialed to the wrong peer, Ids do not match
    at PeerId.createFromPubKey (crypto.js:80)
    at pubKey.hash (index.js:201)
    at Multihashing.Multihashing.digest (index.js:33)
    at index.js:15
    at run (setImmediate.js:40)
    at runIfPresent (setImmediate.js:69)
    at onGlobalMessage (setImmediate.js:109)
PeerId.createFromPubKey @ crypto.js:80
pubKey.hash @ index.js:201
Multihashing.Multihashing.digest @ index.js:33
(anonymous) @ index.js:15
run @ setImmediate.js:40
runIfPresent @ setImmediate.js:69
onGlobalMessage @ setImmediate.js:109
postMessage (async)
registerImmediate @ setImmediate.js:120
setImmediate @ setImmediate.js:27
(anonymous) @ index.js:14
Promise.then (async)
nodeify @ index.js:13
(anonymous) @ crypto-sha1-2-browser.js:37
sha2256 @ crypto-sha1-2-browser.js:49
Ipfs../node_modules/peer-id/node_modules/multihashing-async/src/index.js.Multihashing.digest @ index.js:84
Multihashing @ index.js:28
hash @ rsa-class.js:43
Ipfs../node_modules/peer-id/src/index.js.exports.createFromPubKey @ index.js:196
Ipfs../node_modules/libp2p-secio/src/handshake/crypto.js.exports.identify @ crypto.js:72
waterfall @ propose.js:24
nextTask @ waterfall.js:16
next @ waterfall.js:23
(anonymous) @ onlyOnce.js:12
onComplete @ decode.js:49
reader.read @ decode.js:125
drain @ index.js:39
more @ index.js:55
(anonymous) @ index.js:66
(anonymous) @ index.js:20
(anonymous) @ map.js:19
(anonymous) @ index.js:114
(anonymous) @ index.js:114
(anonymous) @ map.js:19
(anonymous) @ source.js:31
crypto.js:80 Uncaught Error: dialed to the wrong peer, Ids do not match
    at PeerId.createFromPubKey (crypto.js:80)
    at pubKey.hash (index.js:201)
    at Multihashing.Multihashing.digest (index.js:33)
    at index.js:15
    at run (setImmediate.js:40)
    at runIfPresent (setImmediate.js:69)
    at onGlobalMessage (setImmediate.js:109)
PeerId.createFromPubKey @ crypto.js:80
pubKey.hash @ index.js:201
Multihashing.Multihashing.digest @ index.js:33
(anonymous) @ index.js:15
run @ setImmediate.js:40
runIfPresent @ setImmediate.js:69
onGlobalMessage @ setImmediate.js:109
postMessage (async)
registerImmediate @ setImmediate.js:120
setImmediate @ setImmediate.js:27
(anonymous) @ index.js:14
Promise.then (async)
nodeify @ index.js:13
(anonymous) @ crypto-sha1-2-browser.js:37
sha2256 @ crypto-sha1-2-browser.js:49
Ipfs../node_modules/peer-id/node_modules/multihashing-async/src/index.js.Multihashing.digest @ index.js:84
Multihashing @ index.js:28
hash @ rsa-class.js:43
Ipfs../node_modules/peer-id/src/index.js.exports.createFromPubKey @ index.js:196
Ipfs../node_modules/libp2p-secio/src/handshake/crypto.js.exports.identify @ crypto.js:72
waterfall @ propose.js:24
nextTask @ waterfall.js:16
next @ waterfall.js:23
(anonymous) @ onlyOnce.js:12
onComplete @ decode.js:49
reader.read @ decode.js:125
drain @ index.js:39
more @ index.js:55
(anonymous) @ index.js:66
(anonymous) @ index.js:20
(anonymous) @ map.js:19
(anonymous) @ index.js:114
(anonymous) @ index.js:114
(anonymous) @ map.js:19
(anonymous) @ source.js:31
crypto.js:80 Uncaught Error: dialed to the wrong peer, Ids do not match
    at PeerId.createFromPubKey (crypto.js:80)
    at pubKey.hash (index.js:201)
    at Multihashing.Multihashing.digest (index.js:33)
    at index.js:15
    at run (setImmediate.js:40)
    at runIfPresent (setImmediate.js:69)
    at onGlobalMessage (setImmediate.js:109)
PeerId.createFromPubKey @ crypto.js:80
pubKey.hash @ index.js:201
Multihashing.Multihashing.digest @ index.js:33
(anonymous) @ index.js:15
run @ setImmediate.js:40
runIfPresent @ setImmediate.js:69
onGlobalMessage @ setImmediate.js:109
postMessage (async)
registerImmediate @ setImmediate.js:120
setImmediate @ setImmediate.js:27
(anonymous) @ index.js:14
Promise.then (async)
nodeify @ index.js:13
(anonymous) @ crypto-sha1-2-browser.js:37
sha2256 @ crypto-sha1-2-browser.js:49
Ipfs../node_modules/peer-id/node_modules/multihashing-async/src/index.js.Multihashing.digest @ index.js:84
Multihashing @ index.js:28
hash @ rsa-class.js:43
Ipfs../node_modules/peer-id/src/index.js.exports.createFromPubKey @ index.js:196
Ipfs../node_modules/libp2p-secio/src/handshake/crypto.js.exports.identify @ crypto.js:72
waterfall @ propose.js:24
nextTask @ waterfall.js:16
next @ waterfall.js:23
(anonymous) @ onlyOnce.js:12
onComplete @ decode.js:49
reader.read @ decode.js:125
drain @ index.js:39
more @ index.js:55
(anonymous) @ index.js:66
(anonymous) @ index.js:20
(anonymous) @ map.js:19
(anonymous) @ index.js:114
(anonymous) @ index.js:114
(anonymous) @ map.js:19
(anonymous) @ source.js:31
crypto.js:80 Uncaught Error: dialed to the wrong peer, Ids do not match
    at PeerId.createFromPubKey (crypto.js:80)
    at pubKey.hash (index.js:201)
    at Multihashing.Multihashing.digest (index.js:33)
    at index.js:15
    at run (setImmediate.js:40)
    at runIfPresent (setImmediate.js:69)
    at onGlobalMessage (setImmediate.js:109)
PeerId.createFromPubKey @ crypto.js:80
pubKey.hash @ index.js:201
Multihashing.Multihashing.digest @ index.js:33
(anonymous) @ index.js:15
run @ setImmediate.js:40
runIfPresent @ setImmediate.js:69
onGlobalMessage @ setImmediate.js:109
postMessage (async)
registerImmediate @ setImmediate.js:120
setImmediate @ setImmediate.js:27
(anonymous) @ index.js:14
Promise.then (async)
nodeify @ index.js:13
(anonymous) @ crypto-sha1-2-browser.js:37
sha2256 @ crypto-sha1-2-browser.js:49
Ipfs../node_modules/peer-id/node_modules/multihashing-async/src/index.js.Multihashing.digest @ index.js:84
Multihashing @ index.js:28
hash @ rsa-class.js:43
Ipfs../node_modules/peer-id/src/index.js.exports.createFromPubKey @ index.js:196
Ipfs../node_modules/libp2p-secio/src/handshake/crypto.js.exports.identify @ crypto.js:72
waterfall @ propose.js:24
nextTask @ waterfall.js:16
next @ waterfall.js:23
(anonymous) @ onlyOnce.js:12
onComplete @ decode.js:49
reader.read @ decode.js:125
drain @ index.js:39
more @ index.js:55
(anonymous) @ index.js:66
(anonymous) @ index.js:20
(anonymous) @ map.js:19
(anonymous) @ index.js:114
(anonymous) @ index.js:114
(anonymous) @ map.js:19
(anonymous) @ source.js:31
crypto.js:80 Uncaught Error: dialed to the wrong peer, Ids do not match
    at PeerId.createFromPubKey (crypto.js:80)
    at pubKey.hash (index.js:201)
    at Multihashing.Multihashing.digest (index.js:33)
    at index.js:15
    at run (setImmediate.js:40)
    at runIfPresent (setImmediate.js:69)
    at onGlobalMessage (setImmediate.js:109)
PeerId.createFromPubKey @ crypto.js:80
pubKey.hash @ index.js:201
Multihashing.Multihashing.digest @ index.js:33
(anonymous) @ index.js:15
run @ setImmediate.js:40
runIfPresent @ setImmediate.js:69
onGlobalMessage @ setImmediate.js:109
postMessage (async)
registerImmediate @ setImmediate.js:120
setImmediate @ setImmediate.js:27
(anonymous) @ index.js:14
Promise.then (async)
nodeify @ index.js:13
(anonymous) @ crypto-sha1-2-browser.js:37
sha2256 @ crypto-sha1-2-browser.js:49
Ipfs../node_modules/peer-id/node_modules/multihashing-async/src/index.js.Multihashing.digest @ index.js:84
Multihashing @ index.js:28
hash @ rsa-class.js:43
Ipfs../node_modules/peer-id/src/index.js.exports.createFromPubKey @ index.js:196
Ipfs../node_modules/libp2p-secio/src/handshake/crypto.js.exports.identify @ crypto.js:72
waterfall @ propose.js:24
nextTask @ waterfall.js:16
next @ waterfall.js:23
(anonymous) @ onlyOnce.js:12
onComplete @ decode.js:49
reader.read @ decode.js:125
drain @ index.js:39
more @ index.js:55
(anonymous) @ index.js:66
(anonymous) @ index.js:20
(anonymous) @ map.js:19
(anonymous) @ index.js:114
(anonymous) @ index.js:114
(anonymous) @ map.js:19
(anonymous) @ source.js:31
crypto.js:80 Uncaught Error: dialed to the wrong peer, Ids do not match
    at PeerId.createFromPubKey (crypto.js:80)
    at pubKey.hash (index.js:201)
    at Multihashing.Multihashing.digest (index.js:33)
    at index.js:15
    at run (setImmediate.js:40)
    at runIfPresent (setImmediate.js:69)
    at onGlobalMessage (setImmediate.js:109)
PeerId.createFromPubKey @ crypto.js:80
pubKey.hash @ index.js:201
Multihashing.Multihashing.digest @ index.js:33
(anonymous) @ index.js:15
run @ setImmediate.js:40
runIfPresent @ setImmediate.js:69
onGlobalMessage @ setImmediate.js:109
postMessage (async)
registerImmediate @ setImmediate.js:120
setImmediate @ setImmediate.js:27
(anonymous) @ index.js:14
Promise.then (async)
nodeify @ index.js:13
(anonymous) @ crypto-sha1-2-browser.js:37
sha2256 @ crypto-sha1-2-browser.js:49
Ipfs../node_modules/peer-id/node_modules/multihashing-async/src/index.js.Multihashing.digest @ index.js:84
Multihashing @ index.js:28
hash @ rsa-class.js:43
Ipfs../node_modules/peer-id/src/index.js.exports.createFromPubKey @ index.js:196
Ipfs../node_modules/libp2p-secio/src/handshake/crypto.js.exports.identify @ crypto.js:72
waterfall @ propose.js:24
nextTask @ waterfall.js:16
next @ waterfall.js:23
(anonymous) @ onlyOnce.js:12
onComplete @ decode.js:49
reader.read @ decode.js:125
drain @ index.js:39
more @ index.js:55
(anonymous) @ index.js:66
(anonymous) @ index.js:20
(anonymous) @ map.js:19
(anonymous) @ index.js:114
(anonymous) @ index.js:114
(anonymous) @ map.js:19
(anonymous) @ source.js:31
crypto.js:80 Uncaught Error: dialed to the wrong peer, Ids do not match
    at PeerId.createFromPubKey (crypto.js:80)
    at pubKey.hash (index.js:201)
    at Multihashing.Multihashing.digest (index.js:33)
    at index.js:15
    at run (setImmediate.js:40)
    at runIfPresent (setImmediate.js:69)
    at onGlobalMessage (setImmediate.js:109)
PeerId.createFromPubKey @ crypto.js:80
pubKey.hash @ index.js:201
Multihashing.Multihashing.digest @ index.js:33
(anonymous) @ index.js:15
run @ setImmediate.js:40
runIfPresent @ setImmediate.js:69
onGlobalMessage @ setImmediate.js:109
postMessage (async)
registerImmediate @ setImmediate.js:120
setImmediate @ setImmediate.js:27
(anonymous) @ index.js:14
Promise.then (async)
nodeify @ index.js:13
(anonymous) @ crypto-sha1-2-browser.js:37
sha2256 @ crypto-sha1-2-browser.js:49
Ipfs../node_modules/peer-id/node_modules/multihashing-async/src/index.js.Multihashing.digest @ index.js:84
Multihashing @ index.js:28
hash @ rsa-class.js:43
Ipfs../node_modules/peer-id/src/index.js.exports.createFromPubKey @ index.js:196
Ipfs../node_modules/libp2p-secio/src/handshake/crypto.js.exports.identify @ crypto.js:72
waterfall @ propose.js:24
nextTask @ waterfall.js:16
next @ waterfall.js:23
(anonymous) @ onlyOnce.js:12
onComplete @ decode.js:49
reader.read @ decode.js:125
drain @ index.js:39
more @ index.js:55
(anonymous) @ index.js:66
(anonymous) @ index.js:20
(anonymous) @ map.js:19
(anonymous) @ index.js:114
(anonymous) @ index.js:114
(anonymous) @ map.js:19
(anonymous) @ source.js:31
crypto.js:80 Uncaught Error: dialed to the wrong peer, Ids do not match
    at PeerId.createFromPubKey (crypto.js:80)
    at pubKey.hash (index.js:201)
    at Multihashing.Multihashing.digest (index.js:33)
    at index.js:15
    at run (setImmediate.js:40)
    at runIfPresent (setImmediate.js:69)
    at onGlobalMessage (setImmediate.js:109)
PeerId.createFromPubKey @ crypto.js:80
pubKey.hash @ index.js:201
Multihashing.Multihashing.digest @ index.js:33
(anonymous) @ index.js:15
run @ setImmediate.js:40
runIfPresent @ setImmediate.js:69
onGlobalMessage @ setImmediate.js:109
postMessage (async)
registerImmediate @ setImmediate.js:120
setImmediate @ setImmediate.js:27
(anonymous) @ index.js:14
Promise.then (async)
nodeify @ index.js:13
(anonymous) @ crypto-sha1-2-browser.js:37
sha2256 @ crypto-sha1-2-browser.js:49
Ipfs../node_modules/peer-id/node_modules/multihashing-async/src/index.js.Multihashing.digest @ index.js:84
Multihashing @ index.js:28
hash @ rsa-class.js:43
Ipfs../node_modules/peer-id/src/index.js.exports.createFromPubKey @ index.js:196
Ipfs../node_modules/libp2p-secio/src/handshake/crypto.js.exports.identify @ crypto.js:72
waterfall @ propose.js:24
nextTask @ waterfall.js:16
next @ waterfall.js:23
(anonymous) @ onlyOnce.js:12
onComplete @ decode.js:49
reader.read @ decode.js:125
drain @ index.js:39
more @ index.js:55
(anonymous) @ index.js:66
(anonymous) @ index.js:20
(anonymous) @ map.js:19
(anonymous) @ index.js:114
(anonymous) @ index.js:114
(anonymous) @ map.js:19
(anonymous) @ source.js:31
crypto.js:80 Uncaught Error: dialed to the wrong peer, Ids do not match
    at PeerId.createFromPubKey (crypto.js:80)
    at pubKey.hash (index.js:201)
    at Multihashing.Multihashing.digest (index.js:33)
    at index.js:15
    at run (setImmediate.js:40)
    at runIfPresent (setImmediate.js:69)
    at onGlobalMessage (setImmediate.js:109)
PeerId.createFromPubKey @ crypto.js:80
pubKey.hash @ index.js:201
Multihashing.Multihashing.digest @ index.js:33
(anonymous) @ index.js:15
run @ setImmediate.js:40
runIfPresent @ setImmediate.js:69
onGlobalMessage @ setImmediate.js:109
postMessage (async)
registerImmediate @ setImmediate.js:120
setImmediate @ setImmediate.js:27
(anonymous) @ index.js:14
Promise.then (async)
nodeify @ index.js:13
(anonymous) @ crypto-sha1-2-browser.js:37
sha2256 @ crypto-sha1-2-browser.js:49
Ipfs../node_modules/peer-id/node_modules/multihashing-async/src/index.js.Multihashing.digest @ index.js:84
Multihashing @ index.js:28
hash @ rsa-class.js:43
Ipfs../node_modules/peer-id/src/index.js.exports.createFromPubKey @ index.js:196
Ipfs../node_modules/libp2p-secio/src/handshake/crypto.js.exports.identify @ crypto.js:72
waterfall @ propose.js:24
nextTask @ waterfall.js:16
next @ waterfall.js:23
(anonymous) @ onlyOnce.js:12
onComplete @ decode.js:49
reader.read @ decode.js:125
drain @ index.js:39
more @ index.js:55
(anonymous) @ index.js:66
(anonymous) @ index.js:20
(anonymous) @ map.js:19
(anonymous) @ index.js:114
(anonymous) @ index.js:114
(anonymous) @ map.js:19
(anonymous) @ source.js:31
crypto.js:80 Uncaught Error: dialed to the wrong peer, Ids do not match
    at PeerId.createFromPubKey (crypto.js:80)
    at pubKey.hash (index.js:201)
    at Multihashing.Multihashing.digest (index.js:33)
    at index.js:15
    at run (setImmediate.js:40)
    at runIfPresent (setImmediate.js:69)
    at onGlobalMessage (setImmediate.js:109)
PeerId.createFromPubKey @ crypto.js:80
pubKey.hash @ index.js:201
Multihashing.Multihashing.digest @ index.js:33
(anonymous) @ index.js:15
run @ setImmediate.js:40
runIfPresent @ setImmediate.js:69
onGlobalMessage @ setImmediate.js:109
postMessage (async)
registerImmediate @ setImmediate.js:120
setImmediate @ setImmediate.js:27
(anonymous) @ index.js:14
Promise.then (async)
nodeify @ index.js:13
(anonymous) @ crypto-sha1-2-browser.js:37
sha2256 @ crypto-sha1-2-browser.js:49
Ipfs../node_modules/peer-id/node_modules/multihashing-async/src/index.js.Multihashing.digest @ index.js:84
Multihashing @ index.js:28
hash @ rsa-class.js:43
Ipfs../node_modules/peer-id/src/index.js.exports.createFromPubKey @ index.js:196
Ipfs../node_modules/libp2p-secio/src/handshake/crypto.js.exports.identify @ crypto.js:72
waterfall @ propose.js:24
nextTask @ waterfall.js:16
next @ waterfall.js:23
(anonymous) @ onlyOnce.js:12
onComplete @ decode.js:49
reader.read @ decode.js:125
drain @ index.js:39
more @ index.js:55
(anonymous) @ index.js:66
(anonymous) @ index.js:20
(anonymous) @ map.js:19
(anonymous) @ index.js:114
(anonymous) @ index.js:114
(anonymous) @ map.js:19
(anonymous) @ source.js:31
@jacobheun jacobheun added help wanted Seeking public contribution on this issue exp/expert Having worked on the specific codebase is important status/ready Ready to be worked P2 Medium: Good to have, but can wait until someone steps up labels Nov 3, 2018
@jacobheun
Copy link
Contributor

The error indicates there was an issue identifying the peer so the dial will stop. We should catch this error so it's not thrown and ensure there's not an issue in the chain preventing secio from getting the correct peerID to verify against.

@vasco-santos
Copy link
Member

@jacobheun js-ipfs tests are currently breaking if you install the libp2p master branch.

The majority of the failing tests report Uncaught Error: dialed to the wrong peer, Ids do not match. Is there anything that I could help you to solve this?

@jacobheun
Copy link
Contributor

@vasco-santos if we could get a reproducible test of this in libp2p that would be super helpful.

@vasco-santos
Copy link
Member

I will have a look into it!

@vasco-santos
Copy link
Member

@klueq everything seems good in my side now. Tests are ok in the js-ipfs PR with the DHT

Can you double check if this is still an issue for you?

@jacobheun
Copy link
Contributor

@vasco-santos I think I've got the issue sorted out, I just need to write some tests to confirm. I'll submit some PRs tomorrow along with some improvements for catching these uncaught errors before we release with 0.24.

@blakebyrnes
Copy link
Contributor

@jacobheun I’m seeing this when you deploy to multiple servers and register the 0.0.0.0 address with the same port. What I see in the logs is the node trying to dial another peer whose multiaddrs include 127.0.0.1 port 3000 (for example). It then starts a conversation with itself and realizes it sends back a different peer id (it’s own) than the requested node. A solution for this one is tricky. There’s a ticket that talks about being able to configure published addresses vs listen addresses. That could work. Additionally, it might be prudent for the switch to filter out multiaddrs on the same IP and port as the current node’s multiaddrs

@achingbrain
Copy link
Member

It then starts a conversation with itself and realizes it sends back a different peer id (it’s own) than the requested node.

This sounds like similar to the issue I opened here: libp2p/js-libp2p-floodsub#58

I've worked round the problem by getting each node to listen on unique ports but it'd be great to have a proper solution.

@jacobheun
Copy link
Contributor

@blakebyrnes you are right on the money.

I think updating Switch to return a dial self error for internal addresses with the same port is a good quick fix. I am playing around with some of this already, so I will look at getting a PR for this part.

Transports can advertise internal and external addresses, which makes sense when there are multiple nodes on a box. It might be useful to add an option to return only external addresses. For example, libp2p-tcp, when listening on 0.0.0.0 will return all internal and external addresses. If nodes only want to advertise external addresses tcp could additionally filter by ni.internal (https://github.com/libp2p/js-libp2p-tcp/blob/v0.13.0/src/listener.js#L118).

@blakebyrnes
Copy link
Contributor

Cool! This is the ticket with the external vs listen addresses: #202

Personally, I would love to be able to list the addresses I want to publish to the network vs just listen on.

My use cases are:

  • having a static ip on a cloud server (it won't get bound to the box)
  • running a node in a docker

There could be others. But controlling the addresses would be really nice.

I poked around, but couldn't quite figure out where the current node's multiaddrs are shared with other nodes.

@jacobheun
Copy link
Contributor

listener.getAddrs is how the addresses are added to the peer info for the switch. Once listening is done that is called, https://github.com/libp2p/js-libp2p-switch/blob/v0.41.1/src/transport.js#L169.

We could look at passing an option to switch to advertise external only, then modify the getAddrs interface to take an externalOnly flag. Or we could look at doing some post filtering on the addresses before the switch has started listening but before it emits that it has started. I'll have to think about the cleanest way to do that.

@blakebyrnes
Copy link
Contributor

Totally makes sense for the ones that are on the ni. I guess I'm really looking for a solution to a somewhat separate problem. This might not be the right ticket to talk about it.

I have separate addresses that I want to "listen", and that other nodes can reach my node on. The examples above both would have ni addresses to listen on, but in the case of docker, your addresses are the docker ip and localhost. Docker opens a port on the host machine to let traffic through to the docker network. In that case, I need to either merge the docker network with the host network, or I need some ability to "listen" on the docker ips (0.0.0.0 here), while I tell the network to reach me at the host machine ip and port.

Hopefully I'm making sense. The only reason I bring it up here is if other people are having similar issues with binding/publishing, it might be worth having a core fix - which would likely go into a peer-info spec and/or a separate "listen" peer-info and "share with network" peer-info.

@jacobheun
Copy link
Contributor

Yes that makes sense. It sounds like #202 would get you what you need correct? I think we could just do that to help alleviate this particular problem as well, in addition to the switch dial update.

@blakebyrnes
Copy link
Contributor

Yep, #202 is exactly what I want/need. Awesome!! I think 202 will go a long way to helping libp2p be deployable in a cloud setting. Or simply with fixed IPs - ie, creating your own bootstrap nodes.

@jacobheun
Copy link
Contributor

Great, yeah I agree that should help improve cloud usability quite a bit.

I submitted a PR for strict filtering of dialables on switch to help with this issue, libp2p/js-libp2p-switch#284. Once we add listen/announce I think we can improve the logic there.

@jacobheun
Copy link
Contributor

This has been fixed for some time.

@a1300 a1300 mentioned this issue Nov 27, 2020
maschad pushed a commit to maschad/js-libp2p that referenced this issue Jun 21, 2023
…#274)

Bumps [@libp2p/interface-mocks](https://github.com/libp2p/js-libp2p-interfaces) from 11.0.3 to 12.0.1.
- [Release notes](https://github.com/libp2p/js-libp2p-interfaces/releases)
- [Commits](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-mocks-v11.0.3...@libp2p/interface-mocks-v12.0.1)

---
updated-dependencies:
- dependency-name: "@libp2p/interface-mocks"
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
maschad pushed a commit to maschad/js-libp2p that referenced this issue Jun 21, 2023
## [7.0.2](libp2p/js-libp2p-tcp@v7.0.1...v7.0.2) (2023-06-15)

### Trivial Changes

* Update .github/workflows/semantic-pull-request.yml [skip ci] ([6dcfdb3](libp2p/js-libp2p-tcp@6dcfdb3))
* Update .github/workflows/stale.yml [skip ci] ([862af6c](libp2p/js-libp2p-tcp@862af6c))

### Dependencies

* **dev:** bump @libp2p/interface-mocks from 11.0.3 to 12.0.1 ([libp2p#274](libp2p/js-libp2p-tcp#274)) ([147610f](libp2p/js-libp2p-tcp@147610f))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
exp/expert Having worked on the specific codebase is important help wanted Seeking public contribution on this issue P2 Medium: Good to have, but can wait until someone steps up status/ready Ready to be worked
Projects
None yet
Development

No branches or pull requests

5 participants