Compare commits

...

6 Commits

Author SHA1 Message Date
Pearson White
f9282d3a2f bump chronicles version 2025-09-03 12:45:12 -04:00
akshaya
6c70603d7a Add info log for debugging 2025-08-01 06:37:01 -04:00
akshaya
7072e3e385 Add writeStackTrace() for debugging 2025-08-01 06:37:01 -04:00
akshaya
05367a08fe Change log level to info for debugging 2025-08-01 06:29:26 -04:00
akshaya
a83d648d2c Change log level to info for debugging 2025-08-01 06:29:26 -04:00
akshaya
74e216a095 Add log for debugging 2025-08-01 06:29:26 -04:00
5 changed files with 19 additions and 4 deletions

View File

@@ -9,7 +9,7 @@ skipDirs = @["tests", "examples", "Nim", "tools", "scripts", "docs"]
requires "nim >= 2.0.0",
"nimcrypto >= 0.6.0 & < 0.7.0", "dnsclient >= 0.3.0 & < 0.4.0", "bearssl >= 0.2.5",
"chronicles >= 0.11.0 & < 0.12.0", "chronos >= 4.0.4", "metrics", "secp256k1",
"chronicles >= 0.11.0", "chronos >= 4.0.4", "metrics", "secp256k1",
"stew >= 0.4.0", "websock >= 0.2.0", "unittest2", "results", "quic >= 0.2.10",
"https://github.com/vacp2p/nim-jwt.git#18f8378de52b241f321c1f9ea905456e89b95c6f"

View File

@@ -12,6 +12,7 @@
{.push raises: [].}
import std/[sets, sequtils]
import stew/[endians2]
import chronos, chronicles, metrics
import chronos/ratelimit
import
@@ -648,6 +649,8 @@ method rpcHandler*(
for m in rpcMsg.messages:
libp2p_pubsub_received_messages.inc(labelValues = [$peer.peerId, m.topic])
let fromPeerID = peer
trace "decoded msg from peer", peer, payload = rpcMsg.shortLog
await rateLimit(g, peer, g.messageOverhead(rpcMsg, msgSize))
@@ -716,6 +719,12 @@ method rpcHandler*(
# onto the next message
continue
if msg.data.len == 100:
info "Received message from handler",
msgid = uint64.fromBytesLE(msg.data[8 ..< 16]),
fromPeerID = fromPeerID,
orig = uint64.fromBytesLE(msg.data[0 ..< 8])
libp2p_gossipsub_received.inc()
# avoid processing messages we are not interested in

View File

@@ -770,7 +770,7 @@ proc getGossipPeers*(g: GossipSub): Table[PubSubPeer, ControlMessage] =
cacheWindowSize += midsSeq.len
trace "got messages to emit", size = midsSeq.len
info "got messages to emit", size = midsSeq.len
# not in spec
# similar to rust: https://github.com/sigp/rust-libp2p/blob/f53d02bc873fef2bf52cd31e3d5ce366a41d8a8c/protocols/gossipsub/src/behaviour.rs#L2101

View File

@@ -275,6 +275,9 @@ proc broadcast*(
else:
# Fast path that only encodes message once
let encoded = encodeRpcMsg(msg, p.anonymize)
info "SEND ENCODED MSG 1", data = shortLog(msg), useCustomConn, isHighPriority
for peer in sendPeers:
asyncSpawn peer.sendEncoded(encoded, isHighPriority, useCustomConn)

View File

@@ -382,7 +382,8 @@ proc sendMsgSlow(p: PubSubPeer, msg: seq[byte]) {.async: (raises: [CancelledErro
debug "No send connection", p, payload = shortLog(msg)
return
trace "sending encoded msg to peer", conn, encoded = shortLog(msg)
info "sending encoded msg to peer", conn, encoded = shortLog(msg)
writeStackTrace()
await sendMsgContinue(conn, conn.writeLp(msg))
proc sendMsg(
@@ -408,7 +409,7 @@ proc sendMsg(
(nil, ctSlow)
if not slowPath:
trace "sending encoded msg to peer",
info "sending encoded msg to peer",
conntype = $connType, conn = conn, encoded = shortLog(msg)
let f = conn.writeLp(msg)
if not f.completed():
@@ -545,9 +546,11 @@ proc send*(
if encoded.len > p.maxMessageSize and msg.messages.len > 1:
for encodedSplitMsg in splitRPCMsg(p, msg, p.maxMessageSize, anonymize):
asyncSpawn p.sendEncoded(encodedSplitMsg, isHighPriority, useCustomConn)
info "SEND ENCODED MSG 2", data = shortLog(msg), useCustomConn, isHighPriority
else:
# If the message size is within limits, send it as is
trace "sending msg to peer", peer = p, rpcMsg = shortLog(msg)
info "SEND ENCODED MSG 3", data = shortLog(msg), useCustomConn, isHighPriority
asyncSpawn p.sendEncoded(encoded, isHighPriority, useCustomConn)
proc canAskIWant*(p: PubSubPeer, msgId: MessageId): bool =