Log pseudonyms with peer id (#334)

* Log pseudonyms with peer id

* Upgrade package version
This commit is contained in:
Nabarun Gogoi 2023-03-06 16:26:38 +05:30 committed by GitHub
parent c46d5c3f33
commit 1ba731915d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
23 changed files with 92 additions and 87 deletions

View File

@ -2,7 +2,7 @@
"packages": [ "packages": [
"packages/*" "packages/*"
], ],
"version": "0.2.29", "version": "0.2.30",
"npmClient": "yarn", "npmClient": "yarn",
"useWorkspaces": true, "useWorkspaces": true,
"command": { "command": {

View File

@ -1,6 +1,6 @@
{ {
"name": "@cerc-io/address-watcher", "name": "@cerc-io/address-watcher",
"version": "0.2.29", "version": "0.2.30",
"description": "Address Watcher", "description": "Address Watcher",
"private": true, "private": true,
"scripts": { "scripts": {
@ -26,11 +26,11 @@
"homepage": "https://github.com/cerc-io/watcher-ts#readme", "homepage": "https://github.com/cerc-io/watcher-ts#readme",
"dependencies": { "dependencies": {
"@apollo/client": "^3.3.19", "@apollo/client": "^3.3.19",
"@cerc-io/cache": "^0.2.29", "@cerc-io/cache": "^0.2.30",
"@cerc-io/ipld-eth-client": "^0.2.29", "@cerc-io/ipld-eth-client": "^0.2.30",
"@cerc-io/solidity-mapper": "^0.2.29", "@cerc-io/solidity-mapper": "^0.2.30",
"@cerc-io/tracing-client": "^0.2.29", "@cerc-io/tracing-client": "^0.2.30",
"@cerc-io/util": "^0.2.29", "@cerc-io/util": "^0.2.30",
"@types/lodash": "^4.14.168", "@types/lodash": "^4.14.168",
"debug": "^4.3.1", "debug": "^4.3.1",
"ethers": "^5.4.4", "ethers": "^5.4.4",

View File

@ -1,6 +1,6 @@
{ {
"name": "@cerc-io/cache", "name": "@cerc-io/cache",
"version": "0.2.29", "version": "0.2.30",
"description": "Generic object cache", "description": "Generic object cache",
"main": "dist/index.js", "main": "dist/index.js",
"scripts": { "scripts": {

View File

@ -1,6 +1,6 @@
{ {
"name": "@cerc-io/cli", "name": "@cerc-io/cli",
"version": "0.2.29", "version": "0.2.30",
"main": "dist/index.js", "main": "dist/index.js",
"license": "AGPL-3.0", "license": "AGPL-3.0",
"scripts": { "scripts": {
@ -11,8 +11,8 @@
"chat": "DEBUG='vulcanize:*, laconic:*' node dist/chat.js" "chat": "DEBUG='vulcanize:*, laconic:*' node dist/chat.js"
}, },
"dependencies": { "dependencies": {
"@cerc-io/peer": "^0.2.29", "@cerc-io/peer": "^0.2.30",
"@cerc-io/util": "^0.2.29", "@cerc-io/util": "^0.2.30",
"@ethersproject/providers": "^5.4.4", "@ethersproject/providers": "^5.4.4",
"@graphql-tools/utils": "^9.1.1", "@graphql-tools/utils": "^9.1.1",
"@ipld/dag-cbor": "^8.0.0", "@ipld/dag-cbor": "^8.0.0",

View File

@ -1,6 +1,6 @@
{ {
"name": "@cerc-io/codegen", "name": "@cerc-io/codegen",
"version": "0.2.29", "version": "0.2.30",
"description": "Code generator", "description": "Code generator",
"private": true, "private": true,
"main": "index.js", "main": "index.js",
@ -20,7 +20,7 @@
}, },
"homepage": "https://github.com/cerc-io/watcher-ts#readme", "homepage": "https://github.com/cerc-io/watcher-ts#readme",
"dependencies": { "dependencies": {
"@cerc-io/util": "^0.2.29", "@cerc-io/util": "^0.2.30",
"@graphql-tools/load-files": "^6.5.2", "@graphql-tools/load-files": "^6.5.2",
"@poanet/solidity-flattener": "https://github.com/vulcanize/solidity-flattener.git", "@poanet/solidity-flattener": "https://github.com/vulcanize/solidity-flattener.git",
"@solidity-parser/parser": "^0.13.2", "@solidity-parser/parser": "^0.13.2",

View File

@ -41,12 +41,12 @@
"dependencies": { "dependencies": {
"@apollo/client": "^3.3.19", "@apollo/client": "^3.3.19",
"@ethersproject/providers": "^5.4.4", "@ethersproject/providers": "^5.4.4",
"@cerc-io/cli": "^0.2.29", "@cerc-io/cli": "^0.2.30",
"@cerc-io/ipld-eth-client": "^0.2.29", "@cerc-io/ipld-eth-client": "^0.2.30",
"@cerc-io/solidity-mapper": "^0.2.29", "@cerc-io/solidity-mapper": "^0.2.30",
"@cerc-io/util": "^0.2.29", "@cerc-io/util": "^0.2.30",
{{#if (subgraphPath)}} {{#if (subgraphPath)}}
"@cerc-io/graph-node": "^0.2.29", "@cerc-io/graph-node": "^0.2.30",
{{/if}} {{/if}}
"apollo-type-bigint": "^0.1.3", "apollo-type-bigint": "^0.1.3",
"debug": "^4.3.1", "debug": "^4.3.1",

View File

@ -1,6 +1,6 @@
{ {
"name": "@cerc-io/eden-watcher", "name": "@cerc-io/eden-watcher",
"version": "0.2.29", "version": "0.2.30",
"description": "eden-watcher", "description": "eden-watcher",
"private": true, "private": true,
"main": "dist/index.js", "main": "dist/index.js",
@ -38,11 +38,11 @@
"homepage": "https://github.com/cerc-io/watcher-ts#readme", "homepage": "https://github.com/cerc-io/watcher-ts#readme",
"dependencies": { "dependencies": {
"@apollo/client": "^3.3.19", "@apollo/client": "^3.3.19",
"@cerc-io/cli": "^0.2.29", "@cerc-io/cli": "^0.2.30",
"@cerc-io/graph-node": "^0.2.29", "@cerc-io/graph-node": "^0.2.30",
"@cerc-io/ipld-eth-client": "^0.2.29", "@cerc-io/ipld-eth-client": "^0.2.30",
"@cerc-io/solidity-mapper": "^0.2.29", "@cerc-io/solidity-mapper": "^0.2.30",
"@cerc-io/util": "^0.2.29", "@cerc-io/util": "^0.2.30",
"@ethersproject/providers": "^5.4.4", "@ethersproject/providers": "^5.4.4",
"apollo-type-bigint": "^0.1.3", "apollo-type-bigint": "^0.1.3",
"debug": "^4.3.1", "debug": "^4.3.1",

View File

@ -1,6 +1,6 @@
{ {
"name": "@cerc-io/erc20-watcher", "name": "@cerc-io/erc20-watcher",
"version": "0.2.29", "version": "0.2.30",
"description": "ERC20 Watcher", "description": "ERC20 Watcher",
"private": true, "private": true,
"main": "dist/index.js", "main": "dist/index.js",
@ -42,10 +42,10 @@
"homepage": "https://github.com/cerc-io/watcher-ts#readme", "homepage": "https://github.com/cerc-io/watcher-ts#readme",
"dependencies": { "dependencies": {
"@apollo/client": "^3.3.19", "@apollo/client": "^3.3.19",
"@cerc-io/cli": "^0.2.29", "@cerc-io/cli": "^0.2.30",
"@cerc-io/ipld-eth-client": "^0.2.29", "@cerc-io/ipld-eth-client": "^0.2.30",
"@cerc-io/solidity-mapper": "^0.2.29", "@cerc-io/solidity-mapper": "^0.2.30",
"@cerc-io/util": "^0.2.29", "@cerc-io/util": "^0.2.30",
"@ethersproject/providers": "^5.4.4", "@ethersproject/providers": "^5.4.4",
"apollo-type-bigint": "^0.1.3", "apollo-type-bigint": "^0.1.3",
"debug": "^4.3.1", "debug": "^4.3.1",

View File

@ -1,6 +1,6 @@
{ {
"name": "@cerc-io/erc721-watcher", "name": "@cerc-io/erc721-watcher",
"version": "0.2.29", "version": "0.2.30",
"description": "erc721-watcher", "description": "erc721-watcher",
"private": true, "private": true,
"main": "dist/index.js", "main": "dist/index.js",
@ -47,10 +47,10 @@
"homepage": "https://github.com/cerc-io/watcher-ts#readme", "homepage": "https://github.com/cerc-io/watcher-ts#readme",
"dependencies": { "dependencies": {
"@apollo/client": "^3.3.19", "@apollo/client": "^3.3.19",
"@cerc-io/cli": "^0.2.29", "@cerc-io/cli": "^0.2.30",
"@cerc-io/ipld-eth-client": "^0.2.29", "@cerc-io/ipld-eth-client": "^0.2.30",
"@cerc-io/solidity-mapper": "^0.2.29", "@cerc-io/solidity-mapper": "^0.2.30",
"@cerc-io/util": "^0.2.29", "@cerc-io/util": "^0.2.30",
"@ethersproject/providers": "^5.4.4", "@ethersproject/providers": "^5.4.4",
"apollo-type-bigint": "^0.1.3", "apollo-type-bigint": "^0.1.3",
"debug": "^4.3.1", "debug": "^4.3.1",

View File

@ -1,10 +1,10 @@
{ {
"name": "@cerc-io/graph-node", "name": "@cerc-io/graph-node",
"version": "0.2.29", "version": "0.2.30",
"main": "dist/index.js", "main": "dist/index.js",
"license": "AGPL-3.0", "license": "AGPL-3.0",
"devDependencies": { "devDependencies": {
"@cerc-io/solidity-mapper": "^0.2.29", "@cerc-io/solidity-mapper": "^0.2.30",
"@ethersproject/providers": "^5.4.4", "@ethersproject/providers": "^5.4.4",
"@graphprotocol/graph-ts": "^0.22.0", "@graphprotocol/graph-ts": "^0.22.0",
"@nomiclabs/hardhat-ethers": "^2.0.2", "@nomiclabs/hardhat-ethers": "^2.0.2",
@ -50,9 +50,9 @@
"dependencies": { "dependencies": {
"@apollo/client": "^3.3.19", "@apollo/client": "^3.3.19",
"@cerc-io/assemblyscript": "0.19.10-watcher-ts-0.1.2", "@cerc-io/assemblyscript": "0.19.10-watcher-ts-0.1.2",
"@cerc-io/cache": "^0.2.29", "@cerc-io/cache": "^0.2.30",
"@cerc-io/ipld-eth-client": "^0.2.29", "@cerc-io/ipld-eth-client": "^0.2.30",
"@cerc-io/util": "^0.2.29", "@cerc-io/util": "^0.2.30",
"@types/json-diff": "^0.5.2", "@types/json-diff": "^0.5.2",
"bn.js": "^4.11.9", "bn.js": "^4.11.9",
"debug": "^4.3.1", "debug": "^4.3.1",

View File

@ -1,6 +1,6 @@
{ {
"name": "@cerc-io/graph-test-watcher", "name": "@cerc-io/graph-test-watcher",
"version": "0.2.29", "version": "0.2.30",
"description": "graph-test-watcher", "description": "graph-test-watcher",
"private": true, "private": true,
"main": "dist/index.js", "main": "dist/index.js",
@ -38,11 +38,11 @@
"homepage": "https://github.com/cerc-io/watcher-ts#readme", "homepage": "https://github.com/cerc-io/watcher-ts#readme",
"dependencies": { "dependencies": {
"@apollo/client": "^3.3.19", "@apollo/client": "^3.3.19",
"@cerc-io/cli": "^0.2.29", "@cerc-io/cli": "^0.2.30",
"@cerc-io/graph-node": "^0.2.29", "@cerc-io/graph-node": "^0.2.30",
"@cerc-io/ipld-eth-client": "^0.2.29", "@cerc-io/ipld-eth-client": "^0.2.30",
"@cerc-io/solidity-mapper": "^0.2.29", "@cerc-io/solidity-mapper": "^0.2.30",
"@cerc-io/util": "^0.2.29", "@cerc-io/util": "^0.2.30",
"@ethersproject/providers": "^5.4.4", "@ethersproject/providers": "^5.4.4",
"apollo-type-bigint": "^0.1.3", "apollo-type-bigint": "^0.1.3",
"debug": "^4.3.1", "debug": "^4.3.1",

View File

@ -1,6 +1,6 @@
{ {
"name": "@cerc-io/ipld-eth-client", "name": "@cerc-io/ipld-eth-client",
"version": "0.2.29", "version": "0.2.30",
"description": "IPLD ETH Client", "description": "IPLD ETH Client",
"main": "dist/index.js", "main": "dist/index.js",
"scripts": { "scripts": {
@ -20,7 +20,7 @@
"homepage": "https://github.com/cerc-io/watcher-ts#readme", "homepage": "https://github.com/cerc-io/watcher-ts#readme",
"dependencies": { "dependencies": {
"@apollo/client": "^3.7.1", "@apollo/client": "^3.7.1",
"@cerc-io/cache": "^0.2.29", "@cerc-io/cache": "^0.2.30",
"cross-fetch": "^3.1.4", "cross-fetch": "^3.1.4",
"debug": "^4.3.1", "debug": "^4.3.1",
"ethers": "^5.4.4", "ethers": "^5.4.4",

View File

@ -1,6 +1,6 @@
{ {
"name": "@cerc-io/mobymask-v2-watcher", "name": "@cerc-io/mobymask-v2-watcher",
"version": "0.2.29", "version": "0.2.30",
"description": "mobymask-v2-watcher", "description": "mobymask-v2-watcher",
"private": true, "private": true,
"main": "dist/index.js", "main": "dist/index.js",
@ -38,10 +38,10 @@
"homepage": "https://github.com/cerc-io/watcher-ts#readme", "homepage": "https://github.com/cerc-io/watcher-ts#readme",
"dependencies": { "dependencies": {
"@apollo/client": "^3.3.19", "@apollo/client": "^3.3.19",
"@cerc-io/cli": "^0.2.29", "@cerc-io/cli": "^0.2.30",
"@cerc-io/ipld-eth-client": "^0.2.29", "@cerc-io/ipld-eth-client": "^0.2.30",
"@cerc-io/solidity-mapper": "^0.2.29", "@cerc-io/solidity-mapper": "^0.2.30",
"@cerc-io/util": "^0.2.29", "@cerc-io/util": "^0.2.30",
"@ethersproject/providers": "^5.4.4", "@ethersproject/providers": "^5.4.4",
"apollo-type-bigint": "^0.1.3", "apollo-type-bigint": "^0.1.3",
"debug": "^4.3.1", "debug": "^4.3.1",

View File

@ -1,6 +1,6 @@
{ {
"name": "@cerc-io/mobymask-watcher", "name": "@cerc-io/mobymask-watcher",
"version": "0.2.29", "version": "0.2.30",
"description": "mobymask-watcher", "description": "mobymask-watcher",
"private": true, "private": true,
"main": "dist/index.js", "main": "dist/index.js",
@ -37,10 +37,10 @@
"homepage": "https://github.com/cerc-io/watcher-ts#readme", "homepage": "https://github.com/cerc-io/watcher-ts#readme",
"dependencies": { "dependencies": {
"@apollo/client": "^3.3.19", "@apollo/client": "^3.3.19",
"@cerc-io/cli": "^0.2.29", "@cerc-io/cli": "^0.2.30",
"@cerc-io/ipld-eth-client": "^0.2.29", "@cerc-io/ipld-eth-client": "^0.2.30",
"@cerc-io/solidity-mapper": "^0.2.29", "@cerc-io/solidity-mapper": "^0.2.30",
"@cerc-io/util": "^0.2.29", "@cerc-io/util": "^0.2.30",
"@ethersproject/providers": "^5.4.4", "@ethersproject/providers": "^5.4.4",
"apollo-type-bigint": "^0.1.3", "apollo-type-bigint": "^0.1.3",
"debug": "^4.3.1", "debug": "^4.3.1",

View File

@ -1,6 +1,6 @@
{ {
"name": "@cerc-io/peer", "name": "@cerc-io/peer",
"version": "0.2.29", "version": "0.2.30",
"description": "libp2p module", "description": "libp2p module",
"main": "dist/index.js", "main": "dist/index.js",
"exports": "./dist/index.js", "exports": "./dist/index.js",

View File

@ -7,6 +7,7 @@ import type { PeerId } from '@libp2p/interface-peer-id';
import debug from 'debug'; import debug from 'debug';
import { DEFAULT_PING_INTERVAL, DEFAULT_PING_TIMEOUT } from './constants.js'; import { DEFAULT_PING_INTERVAL, DEFAULT_PING_TIMEOUT } from './constants.js';
import { getPseudonymForPeerId } from './utils/index.js';
const log = debug('laconic:peer-heartbeat-checker'); const log = debug('laconic:peer-heartbeat-checker');
@ -149,7 +150,7 @@ export class PeerHearbeatChecker {
return; return;
} }
console.log(`Not connected to peer ${peerId.toString()}`); log(`Not connected to peer ${peerId.toString()} (${getPseudonymForPeerId(peerId.toString())})`);
await handleDisconnect(); await handleDisconnect();
} }
} }

View File

@ -44,7 +44,7 @@ import {
DEBUG_INFO_TOPIC DEBUG_INFO_TOPIC
} from './constants.js'; } from './constants.js';
import { PeerHearbeatChecker } from './peer-heartbeat-checker.js'; import { PeerHearbeatChecker } from './peer-heartbeat-checker.js';
import { debugInfoRequestHandler, dialWithRetry, getConnectionsInfo, getSelfInfo } from './utils/index.js'; import { debugInfoRequestHandler, dialWithRetry, getConnectionsInfo, getPseudonymForPeerId, getSelfInfo } from './utils/index.js';
import { ConnectionType, DebugPeerInfo, DebugRequest, PeerConnectionInfo, PeerSelfInfo } from './types/debug-info.js'; import { ConnectionType, DebugPeerInfo, DebugRequest, PeerConnectionInfo, PeerSelfInfo } from './types/debug-info.js';
const ERR_PEER_ALREADY_TAGGED = 'Peer already tagged'; const ERR_PEER_ALREADY_TAGGED = 'Peer already tagged';
@ -91,7 +91,7 @@ _peerStreamMap: Map<string, Pushable<any>> = new Map()
const relayPeerId = this._relayNodeMultiaddr.getPeerId(); const relayPeerId = this._relayNodeMultiaddr.getPeerId();
assert(relayPeerId); assert(relayPeerId);
console.log(`Using peer ${relayPeerId.toString()} as the primary relay node`); console.log(`Using peer ${relayPeerId.toString()} (${getPseudonymForPeerId(relayPeerId.toString())}) as the primary relay node`);
const initOptions: WebRTCDirectInit = { const initOptions: WebRTCDirectInit = {
wrtc: nodejs ? wrtc : undefined, // Instantiation in nodejs wrtc: nodejs ? wrtc : undefined, // Instantiation in nodejs
@ -472,7 +472,7 @@ _peerStreamMap: Map<string, Pushable<any>> = new Map()
return; return;
} }
console.log(`Discovered peer ${peer.id.toString()} with multiaddrs`, peer.multiaddrs.map(addr => addr.toString())); console.log(`Discovered peer ${peer.id.toString()} (${getPseudonymForPeerId(peer.id.toString())}) with multiaddrs`, peer.multiaddrs.map(addr => addr.toString()));
this._connectPeer(peer); this._connectPeer(peer);
} }
@ -483,7 +483,7 @@ _peerStreamMap: Map<string, Pushable<any>> = new Map()
const remoteAddrString = connection.remoteAddr.toString(); const remoteAddrString = connection.remoteAddr.toString();
// Log connected peer // Log connected peer
console.log(`Connected to ${remotePeerIdString} using multiaddr ${remoteAddrString}`); console.log(`Connected to ${remotePeerIdString} (${getPseudonymForPeerId(remotePeerIdString)}) using multiaddr ${remoteAddrString}`);
const isRemoteARelayPeer = this.isRelayPeerMultiaddr(remoteAddrString); const isRemoteARelayPeer = this.isRelayPeerMultiaddr(remoteAddrString);
@ -492,7 +492,7 @@ _peerStreamMap: Map<string, Pushable<any>> = new Map()
// Check if relay connections limit has already been reached // Check if relay connections limit has already been reached
if (this._numRelayConnections > maxRelayConnections && !this.isPrimaryRelay(remoteAddrString)) { if (this._numRelayConnections > maxRelayConnections && !this.isPrimaryRelay(remoteAddrString)) {
console.log(`Closing connection to relay ${remotePeerIdString} as max relay connections limit reached`); console.log(`Closing connection to relay ${remotePeerIdString} (${getPseudonymForPeerId(remotePeerIdString)}) as max relay connections limit reached`);
await connection.close(); await connection.close();
return; return;
} }
@ -507,14 +507,14 @@ _peerStreamMap: Map<string, Pushable<any>> = new Map()
if (remoteConnections.length > 1) { if (remoteConnections.length > 1) {
// Close new connection if using relayed multiaddr // Close new connection if using relayed multiaddr
if (connection.remoteAddr.protoNames().includes(P2P_CIRCUIT_ID)) { if (connection.remoteAddr.protoNames().includes(P2P_CIRCUIT_ID)) {
console.log(`Closing new relayed connection with ${remotePeerIdString} in favor of existing connection`); console.log(`Closing new relayed connection with ${remotePeerIdString} (${getPseudonymForPeerId(remotePeerIdString)}) in favor of existing connection`);
await connection.close(); await connection.close();
console.log('Closed'); console.log('Closed');
return; return;
} }
console.log(`Closing exisiting connections with ${remotePeerIdString} in favor of new webrtc connection`); console.log(`Closing exisiting connections with ${remotePeerIdString} (${getPseudonymForPeerId(remotePeerIdString)}) in favor of new webrtc connection`);
// Close existing connections if new connection is not using relayed multiaddr (so it is a webrtc connection) // Close existing connections if new connection is not using relayed multiaddr (so it is a webrtc connection)
const closeConnectionPromises = remoteConnections.filter(remoteConnection => remoteConnection.id !== connection.id) const closeConnectionPromises = remoteConnections.filter(remoteConnection => remoteConnection.id !== connection.id)
.map(remoteConnection => remoteConnection.close()); .map(remoteConnection => remoteConnection.close());
@ -549,13 +549,13 @@ _peerStreamMap: Map<string, Pushable<any>> = new Map()
const stream = await connection.newStream([protocol]); const stream = await connection.newStream([protocol]);
this._handleStream(remotePeerId, stream); this._handleStream(remotePeerId, stream);
} catch (err: any) { } catch (err: any) {
console.log(`Could not create a new ${protocol} stream with ${remotePeerId.toString()}`, err); console.log(`Could not create a new ${protocol} stream with ${remotePeerId.toString()} (${getPseudonymForPeerId(remotePeerId.toString())})`, err);
} }
} }
async _handleDeadConnections (remotePeerId: PeerId) { async _handleDeadConnections (remotePeerId: PeerId) {
// Close existing connections of remote peer // Close existing connections of remote peer
console.log(`Closing connections for ${remotePeerId}`); console.log(`Closing connections for ${remotePeerId} (${getPseudonymForPeerId(remotePeerId.toString())})`);
await this._node?.hangUp(remotePeerId); await this._node?.hangUp(remotePeerId);
console.log('Closed'); console.log('Closed');
} }
@ -566,7 +566,7 @@ _peerStreamMap: Map<string, Pushable<any>> = new Map()
const remoteAddrString = connection.remoteAddr.toString(); const remoteAddrString = connection.remoteAddr.toString();
// Log disconnected peer // Log disconnected peer
console.log(`Disconnected from ${disconnectedPeerId.toString()} using multiaddr ${remoteAddrString}`); console.log(`Disconnected from ${disconnectedPeerId.toString()} (${getPseudonymForPeerId(disconnectedPeerId.toString())}) using multiaddr ${remoteAddrString}`);
console.log(`Current number of peers connected: ${this._node?.getPeers().length}`); console.log(`Current number of peers connected: ${this._node?.getPeers().length}`);
if (this.isRelayPeerMultiaddr(remoteAddrString)) { if (this.isRelayPeerMultiaddr(remoteAddrString)) {
@ -589,11 +589,11 @@ _peerStreamMap: Map<string, Pushable<any>> = new Map()
const peerIdString = peer.id.toString(); const peerIdString = peer.id.toString();
try { try {
console.log(`Dialling peer ${peerIdString}`); console.log(`Dialling peer ${peerIdString} (${getPseudonymForPeerId(peerIdString)})`);
// When dialling with peer id, all multiaddr(s) (direct/relayed) of the discovered peer are dialled in parallel // When dialling with peer id, all multiaddr(s) (direct/relayed) of the discovered peer are dialled in parallel
await this._node.dial(peer.id); await this._node.dial(peer.id);
} catch (err: any) { } catch (err: any) {
console.log(`Could not dial ${peerIdString}`, err); console.log(`Could not dial ${peerIdString} (${getPseudonymForPeerId(peerIdString)})`, err);
} }
} }

View File

@ -30,7 +30,7 @@ import {
DEBUG_INFO_TOPIC DEBUG_INFO_TOPIC
} from './constants.js'; } from './constants.js';
import { PeerHearbeatChecker } from './peer-heartbeat-checker.js'; import { PeerHearbeatChecker } from './peer-heartbeat-checker.js';
import { debugInfoRequestHandler, dialWithRetry, getConnectionsInfo, getSelfInfo } from './utils/index.js'; import { debugInfoRequestHandler, dialWithRetry, getConnectionsInfo, getPseudonymForPeerId, getSelfInfo } from './utils/index.js';
import { PeerIdObj } from './peer.js'; import { PeerIdObj } from './peer.js';
import { SelfInfo, ConnectionInfo } from './types/debug-info.js'; import { SelfInfo, ConnectionInfo } from './types/debug-info.js';
@ -119,7 +119,7 @@ export async function createRelayNode (init: RelayNodeInitConfig): Promise<Libp2
} }
); );
log(`Relay node started with id ${node.peerId.toString()}`); log(`Relay node started with id ${node.peerId.toString()} (${getPseudonymForPeerId(node.peerId.toString())})`);
log('Listening on:'); log('Listening on:');
node.getMultiaddrs().forEach((ma) => log(ma.toString())); node.getMultiaddrs().forEach((ma) => log(ma.toString()));
@ -128,7 +128,7 @@ export async function createRelayNode (init: RelayNodeInitConfig): Promise<Libp2
// log('event peer:connect', evt); // log('event peer:connect', evt);
// Log connected peer // Log connected peer
const connection: Connection = evt.detail; const connection: Connection = evt.detail;
log(`Connected to ${connection.remotePeer.toString()} using multiaddr ${connection.remoteAddr.toString()}`); log(`Connected to ${connection.remotePeer.toString()} (${getPseudonymForPeerId(connection.remotePeer.toString())}) using multiaddr ${connection.remoteAddr.toString()}`);
// Start heartbeat check for peer // Start heartbeat check for peer
await peerHeartbeatChecker.start( await peerHeartbeatChecker.start(
@ -146,7 +146,7 @@ export async function createRelayNode (init: RelayNodeInitConfig): Promise<Libp2
// Log disconnected peer // Log disconnected peer
const connection: Connection = evt.detail; const connection: Connection = evt.detail;
const remoteAddr = connection.remoteAddr; const remoteAddr = connection.remoteAddr;
log(`Disconnected from ${connection.remotePeer.toString()} using multiaddr ${remoteAddr.toString()}`); log(`Disconnected from ${connection.remotePeer.toString()} (${getPseudonymForPeerId(connection.remotePeer.toString())}) using multiaddr ${remoteAddr.toString()}`);
// Stop connection check for disconnected peer // Stop connection check for disconnected peer
peerHeartbeatChecker.stop(connection.remotePeer); peerHeartbeatChecker.stop(connection.remotePeer);
@ -193,7 +193,7 @@ async function _dialRelayPeers (node: Libp2p, relayPeersList: string[], maxDialR
async function _handleDeadConnections (node: Libp2p, remotePeerId: PeerId): Promise<void> { async function _handleDeadConnections (node: Libp2p, remotePeerId: PeerId): Promise<void> {
// Close existing connections of remote peer // Close existing connections of remote peer
log(`Closing connections for ${remotePeerId}`); log(`Closing connections for ${remotePeerId} (${getPseudonymForPeerId(remotePeerId.toString())})`);
await node.hangUp(remotePeerId); await node.hangUp(remotePeerId);
log('Closed'); log('Closed');
} }

View File

@ -5,6 +5,7 @@
import { uniqueNamesGenerator, adjectives, colors, names } from 'unique-names-generator'; import { uniqueNamesGenerator, adjectives, colors, names } from 'unique-names-generator';
import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string'; import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string';
import debug from 'debug'; import debug from 'debug';
import assert from 'assert';
import { Libp2p } from '@cerc-io/libp2p'; import { Libp2p } from '@cerc-io/libp2p';
import { Multiaddr } from '@multiformats/multiaddr'; import { Multiaddr } from '@multiformats/multiaddr';
@ -41,13 +42,16 @@ export const dialWithRetry = async (node: Libp2p, multiaddr: Multiaddr, options:
// Keep dialling node until it connects // Keep dialling node until it connects
for (let i = 0; i < maxRetry; i++) { for (let i = 0; i < maxRetry; i++) {
const peerId = multiaddr.getPeerId();
assert(peerId);
try { try {
console.log(`Dialling node ${multiaddr.getPeerId()} using multiaddr ${multiaddr.toString()}`); console.log(`Dialling node ${peerId} (${getPseudonymForPeerId(peerId.toString())}) using multiaddr ${multiaddr.toString()}`);
const connection = await node.dial(multiaddr); const connection = await node.dial(multiaddr);
return connection; return connection;
} catch (err) { } catch (err) {
console.log(`Could not dial node ${multiaddr.toString()}`, err); console.log(`Could not dial node ${multiaddr.toString()} (${getPseudonymForPeerId(peerId.toString())})`, err);
console.log(`Retrying after ${redialInterval}ms`); console.log(`Retrying after ${redialInterval}ms`);
// TODO: Use wait method from util package. // TODO: Use wait method from util package.
@ -91,7 +95,7 @@ export const debugInfoRequestHandler = async (
const msgType = debugMsg.type; const msgType = debugMsg.type;
if (msgType === 'Request') { if (msgType === 'Request') {
log('got a debug info request from', peerId.toString()); log('got a debug info request from', peerId.toString(), `(${getPseudonymForPeerId(peerId.toString())})`);
const peerInfo: DebugPeerInfo = await getPeerInfo(); const peerInfo: DebugPeerInfo = await getPeerInfo();
const response: DebugResponse = { const response: DebugResponse = {
type: 'Response', type: 'Response',

View File

@ -1,10 +1,10 @@
{ {
"name": "@cerc-io/solidity-mapper", "name": "@cerc-io/solidity-mapper",
"version": "0.2.29", "version": "0.2.30",
"main": "dist/index.js", "main": "dist/index.js",
"license": "AGPL-3.0", "license": "AGPL-3.0",
"devDependencies": { "devDependencies": {
"@cerc-io/ipld-eth-client": "^0.2.29", "@cerc-io/ipld-eth-client": "^0.2.30",
"@ethersproject/abi": "^5.3.0", "@ethersproject/abi": "^5.3.0",
"@nomiclabs/hardhat-ethers": "^2.0.2", "@nomiclabs/hardhat-ethers": "^2.0.2",
"@nomiclabs/hardhat-waffle": "^2.0.1", "@nomiclabs/hardhat-waffle": "^2.0.1",

View File

@ -1,6 +1,6 @@
{ {
"name": "@cerc-io/test", "name": "@cerc-io/test",
"version": "0.2.29", "version": "0.2.30",
"main": "dist/index.js", "main": "dist/index.js",
"license": "AGPL-3.0", "license": "AGPL-3.0",
"private": true, "private": true,

View File

@ -1,6 +1,6 @@
{ {
"name": "@cerc-io/tracing-client", "name": "@cerc-io/tracing-client",
"version": "0.2.29", "version": "0.2.30",
"description": "ETH VM tracing client", "description": "ETH VM tracing client",
"private": true, "private": true,
"main": "dist/index.js", "main": "dist/index.js",

View File

@ -1,11 +1,11 @@
{ {
"name": "@cerc-io/util", "name": "@cerc-io/util",
"version": "0.2.29", "version": "0.2.30",
"main": "dist/index.js", "main": "dist/index.js",
"license": "AGPL-3.0", "license": "AGPL-3.0",
"dependencies": { "dependencies": {
"@apollo/utils.keyvaluecache": "^1.0.1", "@apollo/utils.keyvaluecache": "^1.0.1",
"@cerc-io/solidity-mapper": "^0.2.29", "@cerc-io/solidity-mapper": "^0.2.30",
"@ethersproject/providers": "^5.4.4", "@ethersproject/providers": "^5.4.4",
"@graphql-tools/schema": "^9.0.10", "@graphql-tools/schema": "^9.0.10",
"@graphql-tools/utils": "^9.1.1", "@graphql-tools/utils": "^9.1.1",
@ -37,8 +37,8 @@
"yargs": "^17.0.1" "yargs": "^17.0.1"
}, },
"devDependencies": { "devDependencies": {
"@cerc-io/cache": "^0.2.29", "@cerc-io/cache": "^0.2.30",
"@cerc-io/ipld-eth-client": "^0.2.29", "@cerc-io/ipld-eth-client": "^0.2.30",
"@nomiclabs/hardhat-waffle": "^2.0.1", "@nomiclabs/hardhat-waffle": "^2.0.1",
"@types/express": "^4.17.14", "@types/express": "^4.17.14",
"@types/fs-extra": "^9.0.11", "@types/fs-extra": "^9.0.11",