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

Relay node keeps giving me CodeError: Tried to dial self repetitively #1872

Closed
noahfigueras opened this issue Jul 8, 2023 · 3 comments
Closed
Labels
kind/stale need/author-input Needs input from the original author

Comments

@noahfigueras
Copy link

Severity:

Low

Description:

I have a relay node setup and everything works as expected, however when I check the debugging logs I keep getting the following error:

libp2p:connection-manager dial QmRLoXS3E73psYaUsma1VSbboTa2J8Z9kso1tpiGLk9WQ4 +1ms
  libp2p:connection-manager:dial-queue:error error during dial of /ip4/10.29.111.57/tcp/37465/ws/p2p/QmRLoXS3E73psYaUsma1VSbboTa2J8Z9kso1tpiGLk9WQ4/p2p-circuit/p2p/12D3KooWEJwR9sLYvvEmuncxm6cBvbEYLLinS71accCznBeAaUY2 CodeError: Tried to dial self
    at DialQueue.calculateMultiaddrs (file:///home/nf/Blockchain/smoothly_protocol/relay/node_modules/libp2p/dist/src/connection-manager/dial-queue.js:202:23)
    at DialQueue.dial (file:///home/nf/Blockchain/smoothly_protocol/relay/node_modules/libp2p/dist/src/connection-manager/dial-queue.js:126:38)
    at DefaultConnectionManager.openConnection (file:///home/nf/Blockchain/smoothly_protocol/relay/node_modules/libp2p/dist/src/connection-manager/index.js:310:49)
    at CircuitRelayTransport.dial (file:///home/nf/Blockchain/smoothly_protocol/relay/node_modules/libp2p/dist/src/circuit-relay/transport/index.js:127:60)
    at async DefaultTransportManager.dial (file:///home/nf/Blockchain/smoothly_protocol/relay/node_modules/libp2p/dist/src/transport-manager.js:82:20)
    at async queue.add (file:///home/nf/Blockchain/smoothly_protocol/relay/node_modules/libp2p/dist/src/connection-manager/dial-queue.js:333:42)
    at async file:///home/nf/Blockchain/smoothly_protocol/relay/node_modules/p-queue/dist/index.js:118:36 {
  code: 'ERR_DIALED_SELF',
  props: {}

relay node id: QmRLoXS3E73psYaUsma1VSbboTa2J8Z9kso1tpiGLk9WQ4

I assume that this is because all dials go through the relay node, but is this an expected behavior?

Steps to reproduce the error:

This is the relay node config:

import { createLibp2p } from 'libp2p'
import { tcp } from '@libp2p/tcp'
import { webSockets } from '@libp2p/websockets'
import { noise } from '@chainsafe/libp2p-noise'
import { mplex } from '@libp2p/mplex'
import { yamux } from '@chainsafe/libp2p-yamux'
import { circuitRelayServer, circuitRelayTransport } from 'libp2p/circuit-relay'
import { identifyService } from 'libp2p/identify'
import { gossipsub } from '@chainsafe/libp2p-gossipsub'
import { floodsub } from '@libp2p/floodsub'
import { pubsubPeerDiscovery } from '@libp2p/pubsub-peer-discovery'
import { bootstrap } from '@libp2p/bootstrap'
import { createFromJSON } from '@libp2p/peer-id-factory'
import { rid } from './rid.js';
import { homedir } from 'os';
import { LevelDatastore } from 'datastore-level';

async function main () {
  const id = await createFromJSON(rid);
	const node = await createLibp2p({
		peerId: id,
		addresses: {
      listen: ['/ip4/0.0.0.0/tcp/37465/ws'],
      //announce: ['/dns4/127.0.0.1/tcp/443/wss/']
		},
		transports: [
			webSockets(),
			circuitRelayTransport()
		],
		connectionEncryption: [
			noise()
		],
		streamMuxers: [
			yamux()
		],
		services: {
			identify: identifyService(),
			relay: circuitRelayServer(),
			pubsub: floodsub() 
		},
		peerDiscovery: [
			pubsubPeerDiscovery({
				interval: 1000
			})	
		],
		datastore: new LevelDatastore(`${homedir}/.smoothly/libp2p`),
		peerStore: {
			persistence: true,
			threshold: 5
		}
	})

	node.services.pubsub.subscribe('checkpoint');
	console.log(`Node started with id ${node.peerId.toString()}`)
	console.log('Listening on:')
	node.getMultiaddrs().forEach((ma) => console.log(ma.toString()))

	// Subscribe to personal channels
	node.addEventListener('peer:discovery', async (evt) => {
		const { id } = evt.detail;
		console.log(id);
		node.services.pubsub.subscribe(`${id.toString()}`);
	})

}

main()
@noahfigueras noahfigueras added the need/triage Needs initial labeling and prioritization label Jul 8, 2023
@maschad
Copy link
Member

maschad commented Jul 17, 2023

This would happen if all dials go through the relay node, if the intention is strictly to have this node act as a relay, then you don't need to have the circuitRelayTransport transport but rather just as a relay server where other nodes would dial this to make and accept relayed connections.

maschad added a commit to maschad/js-libp2p that referenced this issue Jul 29, 2023
@maschad maschad added need/author-input Needs input from the original author and removed need/triage Needs initial labeling and prioritization labels Aug 29, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Sep 5, 2023

Oops, seems like we needed more information for this issue, please comment with more details or this issue will be closed in 7 days.

@github-actions
Copy link
Contributor

This issue was closed because it is missing author input.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/stale need/author-input Needs input from the original author
Projects
None yet
Development

No branches or pull requests

2 participants