Skip to content

Commit

Permalink
Beacon sync logging updates (#2930)
Browse files Browse the repository at this point in the history
* Cosmetics, add some metrics updates to smoothen curves

why:
  Progress downloading blocks was just a jump from none to full

* Reclassifying some syncer gossip from TRC to DBG

why:
  Might help debugging without full trace logs
  • Loading branch information
mjfh authored Dec 12, 2024
1 parent 674e65f commit cbc5ec9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
3 changes: 3 additions & 0 deletions nimbus/sync/beacon/worker/blocks_staged.nim
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,9 @@ proc blocksStagedCollect*(
# response length from the network.
nBlkBlocks = blk.blocks.len

# Update, so it can be followed nicely
ctx.updateMetrics()

# Fetch and extend staging record
if not await buddy.fetchAndCheck(ivReq, blk, info):

Expand Down
12 changes: 6 additions & 6 deletions nimbus/sync/beacon/worker/update.nim
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import
# Private functions
# ------------------------------------------------------------------------------

func syncState(ctx: BeaconCtxRef; info: static[string]): SyncLayoutState =
proc syncState(ctx: BeaconCtxRef; info: static[string]): SyncLayoutState =
## Calculate `SyncLayoutState` from the download context

let
Expand Down Expand Up @@ -98,7 +98,7 @@ func syncState(ctx: BeaconCtxRef; info: static[string]): SyncLayoutState =
# o---------------------o----------------o
# | <-- unprocessed --> | <-- linked --> |
#
trace info & ": inconsistent state",
debug info & ": inconsistent state",
B=(if b == c: "C" else: b.bnStr),
C=(if c == l: "L" else: c.bnStr),
L=(if l == d: "D" else: l.bnStr),
Expand All @@ -121,7 +121,7 @@ proc startHibernating(ctx: BeaconCtxRef; info: static[string]) =

ctx.hibernate = true

trace info & ": suspending syncer", L=ctx.chain.latestNumber.bnStr
debug 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

trace info & ": sync state changed", prevState, thisState,
debug 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
trace info & ": sync state changed",
debug 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
trace info & ": activating syncer", B=b.bnStr,
debug 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 cbc5ec9

Please sign in to comment.