Skip to content

Commit

Permalink
change info to debug the log lines that were previously set to info
Browse files Browse the repository at this point in the history
  • Loading branch information
Ivansete-status committed Apr 30, 2024
1 parent b86fc11 commit ef72b2b
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 20 deletions.
10 changes: 6 additions & 4 deletions waku/node/waku_node.nim
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ proc registerRelayDefaultHandler(node: WakuNode, topic: PubsubTopic) =
return

proc traceHandler(topic: PubsubTopic, msg: WakuMessage) {.async, gcsafe.} =
info "waku.relay received",
debug "waku.relay received",
my_peer_id = node.peerId,
pubsubTopic = topic,
msg_hash = topic.computeMessageHash(msg).to0xHex(),
Expand Down Expand Up @@ -914,7 +914,9 @@ proc mountLightPush*(

if publishedCount == 0:
## Agreed change expected to the lightpush protocol to better handle such case. https://github.com/waku-org/pm/issues/93
info "Lightpush request has not been published to any peers"
let msgHash = computeMessageHash(pubsubTopic, message).to0xHex()
debug "Lightpush request has not been published to any peers",
msg_hash = msgHash

return ok()

Expand Down Expand Up @@ -955,15 +957,15 @@ proc lightpushPublish*(
): Future[WakuLightPushResult[void]] {.async, gcsafe.} =
let msgHash = pubsubTopic.computeMessageHash(message).to0xHex()
if not node.wakuLightpushClient.isNil():
info "publishing message with lightpush",
debug "publishing message with lightpush",
pubsubTopic = pubsubTopic,
contentTopic = message.contentTopic,
target_peer_id = peer.peerId,
msg_hash = msgHash
return await node.wakuLightpushClient.publish(pubsubTopic, message, peer)

if not node.wakuLightPush.isNil():
info "publishing message with self hosted lightpush",
debug "publishing message with self hosted lightpush",
pubsubTopic = pubsubTopic,
contentTopic = message.contentTopic,
target_peer_id = peer.peerId,
Expand Down
4 changes: 2 additions & 2 deletions waku/waku_archive/archive.nim
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,9 @@ proc handleMessage*(

(await self.driver.put(pubsubTopic, msg, msgDigest, msgHash, msgTimestamp)).isOkOr:
waku_archive_errors.inc(labelValues = [insertFailure])
debug "failed to insert message", err = error
error "failed to insert message", error = error

info "message archived",
debug "message archived",
msg_hash = msgHashHex,
pubsubTopic = pubsubTopic,
contentTopic = msg.contentTopic,
Expand Down
10 changes: 5 additions & 5 deletions waku/waku_filter_v2/protocol.nim
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ proc pushToPeers(
let msgHash =
messagePush.pubsubTopic.computeMessageHash(messagePush.wakuMessage).to0xHex()

info "pushing message to subscribed peers",
debug "pushing message to subscribed peers",
pubsubTopic = messagePush.pubsubTopic,
contentTopic = messagePush.wakuMessage.contentTopic,
target_peer_ids = targetPeerIds,
Expand Down Expand Up @@ -216,7 +216,7 @@ proc handleMessage*(
) {.async.} =
let msgHash = computeMessageHash(pubsubTopic, message).to0xHex()

info "handling message",
debug "handling message",
pubsubTopic = pubsubTopic, message = message, msg_hash = msgHash

let handleMessageStartTime = Moment.now()
Expand All @@ -226,7 +226,7 @@ proc handleMessage*(
let subscribedPeers =
wf.subscriptions.findSubscribedPeers(pubsubTopic, message.contentTopic)
if subscribedPeers.len == 0:
info "no subscribed peers found",
debug "no subscribed peers found",
pubsubTopic = pubsubTopic, contentTopic = message.contentTopic
return

Expand All @@ -243,7 +243,7 @@ proc handleMessage*(
target_peer_ids = subscribedPeers.mapIt(shortLog(it))
waku_filter_errors.inc(labelValues = [pushTimeoutFailure])
else:
info "pushed message succesfully to all subscribers",
debug "pushed message succesfully to all subscribers",
pubsubTopic = pubsubTopic,
contentTopic = message.contentTopic,
msg_hash = msgHash,
Expand Down Expand Up @@ -273,7 +273,7 @@ proc initProtocolHandler(wf: WakuFilter) =

let response = wf.handleSubscribeRequest(conn.peerId, request)

info "sending filter subscribe response",
debug "sending filter subscribe response",
peer_id = shortLog(conn.peerId), response = response

await conn.writeLp(response.encode().buffer) #TODO: toRPC() separation here
Expand Down
8 changes: 4 additions & 4 deletions waku/waku_lightpush/protocol.nim
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ type WakuLightPush* = ref object of LPProtocol

proc extractInfoFromReq(
self: PushRPC
): tuple[reqId: string, pubsubTopic: string, msgHash: string, message: WakuMessage] =
): tuple[requestId: string, pubsubTopic: string, msgHash: string, message: WakuMessage] =
## Simply extract a tuple with the underlying data stored in `PushRPC`

let requestId = self.requestId
Expand Down Expand Up @@ -70,7 +70,7 @@ proc handleRequest*(

error "lightpush request rejected due rate limit exceeded",
peer_id = peerId,
requestId = reqInfo.reqId,
requestId = reqInfo.requestId,
pubsubTopic = reqInfo.pubsubTopic,
msg_hash = reqInfo.msgHash

Expand All @@ -82,7 +82,7 @@ proc handleRequest*(

let reqInfo = reqDecodeRes.get().extractInfoFromReq()

requestId = reqInfo.reqId
requestId = reqInfo.requestId
pubsubTopic = reqInfo.pubsubTopic
msgHash = reqInfo.msgHash

Expand All @@ -98,7 +98,7 @@ proc handleRequest*(
pubsubTopic = pubsubTopic, msg_hash = msgHash, error = pushResponseInfo

if isSuccess:
info "lightpush request processed correctly",
debug "lightpush request processed correctly",
lightpush_client_peer_id = shortLog(peerId),
requestId = requestId,
pubsubTopic = pubsubTopic,
Expand Down
10 changes: 5 additions & 5 deletions waku/waku_relay/protocol.nim
Original file line number Diff line number Diff line change
Expand Up @@ -201,12 +201,11 @@ proc generateOrderedValidator(w: WakuRelay): auto {.gcsafe.} =
): Future[ValidationResult] {.async.} =
# can be optimized by checking if the message is a WakuMessage without allocating memory
# see nim-libp2p protobuf library
let msgRes = WakuMessage.decode(message.data)
if msgRes.isErr():
let msg = WakuMessage.decode(message.data).valueOr:
error "protocol generateOrderedValidator reject decode error",
pubsubTopic = pubsubTopic, error = msgRes.error
pubsubTopic = pubsubTopic, error = $error
return ValidationResult.Reject
let msg = msgRes.get()

let msgHash = computeMessageHash(pubsubTopic, msg).to0xHex()

# now sequentially validate the message
Expand All @@ -220,6 +219,7 @@ proc generateOrderedValidator(w: WakuRelay): auto {.gcsafe.} =
return validatorRes

return ValidationResult.Accept

return wrappedValidator

proc validateMessage*(
Expand Down Expand Up @@ -307,6 +307,6 @@ proc publish*(
let data = message.encode().buffer
let msgHash = computeMessageHash(pubsubTopic, message).to0xHex()

info "start publish Waku message", msg_hash = msgHash, pubsubTopic = pubsubTopic
debug "start publish Waku message", msg_hash = msgHash, pubsubTopic = pubsubTopic

return await procCall GossipSub(w).publish(pubsubTopic, data)

0 comments on commit ef72b2b

Please sign in to comment.