From 116ec9c266dfd0de0e78ec329a2b1878c18f1db7 Mon Sep 17 00:00:00 2001 From: Samyxandz Date: Sat, 14 Dec 2024 21:43:14 +0530 Subject: [PATCH] Cleaning up debug level log --- .../beacon/beacon_light_client_manager.nim | 1 + fluffy/network/beacon/beacon_network.nim | 3 ++- fluffy/network/history/history_network.nim | 16 ++++++++-------- fluffy/network/state/state_network.nim | 8 ++++---- fluffy/network/wire/portal_protocol.nim | 4 ++-- fluffy/network/wire/portal_stream.nim | 2 +- fluffy/tools/eth_data_exporter.nim | 2 +- .../tools/portal_bridge/portal_bridge_state.nim | 4 ++-- 8 files changed, 21 insertions(+), 19 deletions(-) diff --git a/fluffy/network/beacon/beacon_light_client_manager.nim b/fluffy/network/beacon/beacon_light_client_manager.nim index 95e663d195..2a61a2cb6c 100644 --- a/fluffy/network/beacon/beacon_light_client_manager.nim +++ b/fluffy/network/beacon/beacon_light_client_manager.nim @@ -233,6 +233,7 @@ proc workerTask[E]( didProgress = true else: + #maybe trace?? debug "Failed to receive value on request", value, endpoint = E.name except ResponseError as exc: warn "Received invalid response", error = exc.msg, endpoint = E.name diff --git a/fluffy/network/beacon/beacon_network.nim b/fluffy/network/beacon/beacon_network.nim index 9ee4de945a..d8c3a9216f 100644 --- a/fluffy/network/beacon/beacon_network.nim +++ b/fluffy/network/beacon/beacon_network.nim @@ -358,9 +358,10 @@ proc validateContent( let contentId = contentIdOpt.get() n.portalProtocol.storeContent(contentKey, contentId, contentItem) - +# trace debug "Received offered content validated successfully", srcNodeId, contentKey else: +# Trace debug "Received offered content failed validation", srcNodeId, contentKey, error = validation.error return false diff --git a/fluffy/network/history/history_network.nim b/fluffy/network/history/history_network.nim index b975e65d58..b0fe08af7b 100644 --- a/fluffy/network/history/history_network.nim +++ b/fluffy/network/history/history_network.nim @@ -136,7 +136,7 @@ proc getVerifiedBlockHeader*( # gets verified before storing. let localContent = n.getLocalContent(Header, contentKey, contentId) if localContent.isSome(): - debug "Fetched block header locally" + trace "Fetched block header locally" return localContent for i in 0 ..< (1 + n.contentRequestRetries): @@ -149,7 +149,7 @@ proc getVerifiedBlockHeader*( warn "Validation of block header failed", error = error continue - debug "Fetched valid block header from the network" + trace "Fetched valid block header from the network" # Content is valid, it can be stored and propagated to interested peers n.portalProtocol.storeContent( contentKey, contentId, headerContent.content, cacheContent = true @@ -180,7 +180,7 @@ proc getBlockBody*( let localContent = n.getLocalContent(BlockBody, contentKey, contentId, header) if localContent.isSome(): - debug "Fetched block body locally" + trace "Fetched block body locally" return localContent for i in 0 ..< (1 + n.contentRequestRetries): @@ -193,7 +193,7 @@ proc getBlockBody*( warn "Validation of block body failed", error continue - debug "Fetched block body from the network" + trace "Fetched block body from the network" # Content is valid, it can be stored and propagated to interested peers n.portalProtocol.storeContent( contentKey, contentId, bodyContent.content, cacheContent = true @@ -255,7 +255,7 @@ proc getReceipts*( let localContent = n.getLocalContent(seq[Receipt], contentKey, contentId) if localContent.isSome(): - debug "Fetched receipts locally" + trace "Fetched receipts locally" return localContent for i in 0 ..< (1 + n.contentRequestRetries): @@ -267,7 +267,7 @@ proc getReceipts*( warn "Validation of receipts failed", error continue - debug "Fetched receipts from the network" + trace "Fetched receipts from the network" # Content is valid, it can be stored and propagated to interested peers n.portalProtocol.storeContent( contentKey, contentId, receiptsContent.content, cacheContent = true @@ -375,9 +375,9 @@ proc validateContent( n.portalProtocol.storeContent(contentKey, contentId, contentItem) - debug "Received offered content validated successfully", srcNodeId, contentKey + trace "Received offered content validated successfully", srcNodeId, contentKey else: - debug "Received offered content failed validation", + trace "Received offered content failed validation", srcNodeId, contentKey, error = res.error return false diff --git a/fluffy/network/state/state_network.nim b/fluffy/network/state/state_network.nim index fe4f82e403..7893ca580e 100644 --- a/fluffy/network/state/state_network.nim +++ b/fluffy/network/state/state_network.nim @@ -94,7 +94,7 @@ proc getContent( let contentValue = V.decode(maybeLocalContent.get()).valueOr: raiseAssert("Unable to decode state local content value") - debug "Fetched state local content value" + trace "Fetched state local content value" return Opt.some(contentValue) for i in 0 ..< (1 + n.contentRequestRetries): @@ -112,13 +112,13 @@ proc getContent( error "Validation of retrieved state content failed" continue - debug "Fetched valid state content from the network" + trace "Fetched valid state content from the network" n.portalProtocol.storeContent( contentKeyBytes, contentId, contentValueBytes, cacheContent = true ) if maybeParentOffer.isSome() and lookupRes.nodesInterestedInContent.len() > 0: - debug "Sending content to interested nodes", + trace "Sending content to interested nodes", interestedNodesCount = lookupRes.nodesInterestedInContent.len() let offer = contentValue.toOffer(maybeParentOffer.get()) @@ -240,7 +240,7 @@ proc processContentLoop(n: StateNetwork) {.async: (raises: []).} = if offerRes.isOk(): state_network_offers_success.inc(labelValues = [$n.portalProtocol.protocolId]) - debug "Received offered content validated successfully", + trace "Received offered content validated successfully", srcNodeId, contentKeyBytes else: state_network_offers_failed.inc(labelValues = [$n.portalProtocol.protocolId]) diff --git a/fluffy/network/wire/portal_protocol.nim b/fluffy/network/wire/portal_protocol.nim index 0fc5cfcfec..0e1771434b 100644 --- a/fluffy/network/wire/portal_protocol.nim +++ b/fluffy/network/wire/portal_protocol.nim @@ -898,7 +898,7 @@ proc offer( acceptedKeysAmount.int64, labelValues = [$p.protocolId] ) if acceptedKeysAmount == 0: - debug "No content accepted" + trace "No content accepted" # Don't open an uTP stream if no content was requested return ok(m.contentKeys) @@ -971,7 +971,7 @@ proc offer( return ok(m.contentKeys) else: - debug "Offer failed due to accept request failure ", + trace "Offer failed due to accept request failure ", error = acceptMessageResponse.error return err("No or invalid accept response: " & acceptMessageResponse.error) diff --git a/fluffy/network/wire/portal_stream.nim b/fluffy/network/wire/portal_stream.nim index 06affad999..dcada5bc7b 100644 --- a/fluffy/network/wire/portal_stream.nim +++ b/fluffy/network/wire/portal_stream.nim @@ -94,7 +94,7 @@ proc canAddPendingTransfer( if (contentIds.len() < limit) and not contentIds.contains(contentId): return true else: - debug "Pending transfer limit reached for peer", nodeId, contentId + trace "Pending transfer limit reached for peer", nodeId, contentId return false except KeyError as e: raiseAssert(e.msg) diff --git a/fluffy/tools/eth_data_exporter.nim b/fluffy/tools/eth_data_exporter.nim index f750a8c327..bf62fd8048 100644 --- a/fluffy/tools/eth_data_exporter.nim +++ b/fluffy/tools/eth_data_exporter.nim @@ -363,7 +363,7 @@ when isMainModule: return err("Invalid block header: " & e.msg) headerHash = to0xHex(rlpHash(blockHeader).data) - debug "Header decoded successfully", + trace "Header decoded successfully", hash = headerHash, blockNumber = blockHeader.number else: warn "Skipping record, not a block header", typ = toHex(header.typ) diff --git a/fluffy/tools/portal_bridge/portal_bridge_state.nim b/fluffy/tools/portal_bridge/portal_bridge_state.nim index ea2ad31e0d..0f4cb600f7 100644 --- a/fluffy/tools/portal_bridge/portal_bridge_state.nim +++ b/fluffy/tools/portal_bridge/portal_bridge_state.nim @@ -335,7 +335,7 @@ proc runBackfillGossipBlockOffersLoop( try: let numPeers = await portalClient.portal_stateGossip(k.to0xHex(), v.to0xHex()) if numPeers > 0: - debug "Offer successfully gossipped to peers: ", numPeers, workerId + trace "Offer successfully gossipped to peers: ", numPeers, workerId elif numPeers == 0: warn "Offer gossipped to no peers", workerId retryGossip = true @@ -378,7 +378,7 @@ proc runBackfillGossipBlockOffersLoop( info "Finished gossiping offers for block number: ", workerId, blockNumber = blockOffers.blockNumber, offerCount = offersMap.len() else: - debug "Finished gossiping offers for block number: ", + trace "Finished gossiping offers for block number: ", workerId, blockNumber = blockOffers.blockNumber, offerCount = offersMap.len() blockOffers = await blockOffersQueue.popFirst()