Skip to content

Commit

Permalink
bring syncer logs to info & debug level
Browse files Browse the repository at this point in the history
  • Loading branch information
advaita-saha committed Jan 3, 2025
1 parent 95d4d1a commit 7648088
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
6 changes: 3 additions & 3 deletions nimbus/sync/beacon/worker/blocks_staged.nim
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Nimbus
# Copyright (c) 2023-2024 Status Research & Development GmbH
# Copyright (c) 2023-2025 Status Research & Development GmbH
# Licensed and distributed under either of
# * MIT license (license terms in the root directory or at
# https://opensource.org/licenses/MIT).
Expand Down Expand Up @@ -290,7 +290,7 @@ proc blocksStagedImport*(
nBlocks = qItem.data.blocks.len
iv = BnRange.new(qItem.key, qItem.key + nBlocks.uint64 - 1)

debug info & ": import blocks ..", iv, nBlocks,
info info & ": import blocks ..", iv, nBlocks,
B=ctx.chain.baseNumber.bnStr, L=ctx.chain.latestNumber.bnStr

var maxImport = iv.maxPt
Expand Down Expand Up @@ -365,7 +365,7 @@ proc blocksStagedImport*(
# Update, so it can be followed nicely
ctx.updateMetrics()

debug info & ": import done", iv, nBlocks, B=ctx.chain.baseNumber.bnStr,
info info & ": import done", iv, nBlocks, B=ctx.chain.baseNumber.bnStr,
L=ctx.chain.latestNumber.bnStr, F=ctx.layout.final.bnStr
return true

Expand Down
14 changes: 7 additions & 7 deletions nimbus/sync/beacon/worker/headers_staged.nim
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Nimbus
# Copyright (c) 2023-2024 Status Research & Development GmbH
# Copyright (c) 2023-2025 Status Research & Development GmbH
# Licensed and distributed under either of
# * MIT license (license terms in the root directory or at
# https://opensource.org/licenses/MIT).
Expand Down Expand Up @@ -76,7 +76,7 @@ proc headerStagedUpdateTarget*(
if hash != ctx.target.finalHash:
# Oops
buddy.ctrl.zombie = true
trace info & ": finalised header hash mismatch", peer, hash,
debug info & ": finalised header hash mismatch", peer, hash,
expected=ctx.target.finalHash
else:
ctx.updateFinalBlockHeader(rc.value[0], ctx.target.finalHash, info)
Expand Down Expand Up @@ -162,7 +162,7 @@ proc headersStagedCollect*(
fetchHeadersProcessErrThresholdCount < buddy.only.nHdrProcErrors:
# Make sure that this peer does not immediately reconnect
buddy.ctrl.zombie = true
trace info & ": current header list discarded", peer, iv, ivReq,
debug info & ": current header list discarded", peer, iv, ivReq,
isOpportunistic, ctrl=buddy.ctrl.state, hdrErrors=buddy.hdrErrors
ctx.headersUnprocCommit(iv.len, iv)
# At this stage allow a task switch so that some other peer might try
Expand All @@ -173,7 +173,7 @@ proc headersStagedCollect*(

# So it is deterministic and there were some headers downloaded already.
# Turn back unused data and proceed with staging.
trace info & ": partially failed", peer, iv, ivReq,
debug info & ": partially failed", peer, iv, ivReq,
unused=BnRange.new(iv.minPt,ivTop), isOpportunistic
# There is some left over to store back
ctx.headersUnprocCommit(iv.len, iv.minPt, ivTop)
Expand Down Expand Up @@ -203,7 +203,7 @@ proc headersStagedCollect*(
if not haveError:
buddy.only.nHdrProcErrors = 0

trace info & ": staged a list of headers", peer, topBlock=iv.maxPt.bnStr,
info info & ": staged a list of headers", peer, topBlock=iv.maxPt.bnStr,
nHeaders=lhc.revHdrs.len, nStaged=ctx.hdr.staged.len, isOpportunistic,
ctrl=buddy.ctrl.state, hdrErrors=buddy.hdrErrors

Expand All @@ -223,7 +223,7 @@ proc headersStagedProcess*(ctx: BeaconCtxRef; info: static[string]): int =
dangling = ctx.layout.dangling
iv = BnRange.new(qItem.key - qItem.data.revHdrs.len.uint64 + 1, qItem.key)
if iv.maxPt+1 < dangling:
trace info & ": there is a gap", iv, D=dangling.bnStr, nStashed=result
debug info & ": there is a gap", iv, D=dangling.bnStr, nStashed=result
break # there is a gap -- come back later

# Overlap must not happen
Expand All @@ -240,7 +240,7 @@ proc headersStagedProcess*(ctx: BeaconCtxRef; info: static[string]): int =
if qItem.data.hash != ctx.dbHeaderParentHash(dangling).expect "Hash32":
# Discard wrong chain and merge back the range into the `unproc` list.
ctx.headersUnprocCommit(0,iv)
trace info & ": discarding staged header list", iv, D=dangling.bnStr,
debug info & ": discarding staged header list", iv, D=dangling.bnStr,
nStashed=result, nDiscarded=qItem.data.revHdrs.len
break

Expand Down
10 changes: 5 additions & 5 deletions nimbus/sync/beacon/worker/update.nim
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Nimbus
# Copyright (c) 2023-2024 Status Research & Development GmbH
# Copyright (c) 2023-2025 Status Research & Development GmbH
# Licensed and distributed under either of
# * MIT license (license terms in the root directory or at
# https://opensource.org/licenses/MIT).
Expand Down Expand Up @@ -121,7 +121,7 @@ proc startHibernating(ctx: BeaconCtxRef; info: static[string]) =

ctx.hibernate = true

debug info & ": suspending syncer", L=ctx.chain.latestNumber.bnStr
info info & ": suspending syncer", L=ctx.chain.latestNumber.bnStr

# Update, so it can be followed nicely
ctx.updateMetrics()
Expand Down Expand Up @@ -288,7 +288,7 @@ proc updateSyncState*(ctx: BeaconCtxRef; info: static[string]) =
return
# Notreached

debug info & ": sync state changed", prevState, thisState,
info info & ": sync state changed", prevState, thisState,
L=ctx.chain.latestNumber.bnStr,
C=(if ctx.layout.coupler == ctx.layout.dangling: "D"
else: ctx.layout.coupler.bnStr),
Expand All @@ -304,7 +304,7 @@ proc updateSyncState*(ctx: BeaconCtxRef; info: static[string]) =
thisState == finishedHeaders and
ctx.linkIntoFc(info): # commit downloading headers
ctx.setupProcessingBlocks info # start downloading block bodies
debug info & ": sync state changed",
info info & ": sync state changed",
prevState=thisState, thisState=ctx.syncState(info)
return
# Notreached
Expand Down Expand Up @@ -338,7 +338,7 @@ proc updateFinalBlockHeader*(
# Activate running (unless done yet)
if ctx.hibernate:
ctx.hibernate = false
debug info & ": activating syncer", B=b.bnStr,
info info & ": activating syncer", B=b.bnStr,
finalised=f.bnStr, head=ctx.target.consHead.bnStr

# Update, so it can be followed nicely
Expand Down

0 comments on commit 7648088

Please sign in to comment.