added debug logs in sync queue

This commit is contained in:
Agnish Ghosh 2024-10-22 14:44:00 +05:30
parent f85b3df45e
commit 04e3dc218b
1 changed files with 29 additions and 28 deletions

View File

@ -726,37 +726,37 @@ proc push*[T](sq: SyncQueue[T], sr: SyncRequest[T],
# Nim versions, remove workaround and move `res` into for loop # Nim versions, remove workaround and move `res` into for loop
res: Result[void, VerifierError] res: Result[void, VerifierError]
var i=0 # var i=0
for blk, blb in sq.blocks(item): # for blk, blb in sq.blocks(item):
res = await sq.blockVerifier(blk[], blb, Opt.none(DataColumnSidecars), maybeFinalized) # res = await sq.blockVerifier(blk[], blb, Opt.none(DataColumnSidecars), maybeFinalized)
inc(i) # inc(i)
if res.isOk(): # if res.isOk():
goodBlock = some(blk[].slot) # goodBlock = some(blk[].slot)
else: # else:
case res.error() # case res.error()
of VerifierError.MissingParent: # of VerifierError.MissingParent:
missingParentSlot = some(blk[].slot) # missingParentSlot = some(blk[].slot)
break # break
of VerifierError.Duplicate: # of VerifierError.Duplicate:
# Keep going, happens naturally # # Keep going, happens naturally
discard # discard
of VerifierError.UnviableFork: # of VerifierError.UnviableFork:
# Keep going so as to register other unviable blocks with the # # Keep going so as to register other unviable blocks with the
# quarantine # # quarantine
if unviableBlock.isNone: # if unviableBlock.isNone:
# Remember the first unviable block, so we can log it # # Remember the first unviable block, so we can log it
unviableBlock = some((blk[].root, blk[].slot)) # unviableBlock = some((blk[].root, blk[].slot))
of VerifierError.Invalid: # of VerifierError.Invalid:
hasInvalidBlock = true # hasInvalidBlock = true
let req = item.request # let req = item.request
notice "Received invalid sequence of blocks", request = req, # notice "Received invalid sequence of blocks", request = req,
blocks_count = len(item.data), # blocks_count = len(item.data),
blocks_map = getShortMap(req, item.data) # blocks_map = getShortMap(req, item.data)
req.item.updateScore(PeerScoreBadValues) # req.item.updateScore(PeerScoreBadValues)
break # break
var counter = 0 var counter = 0
for blk, col in sq.das_blocks(item): for blk, col in sq.das_blocks(item):
@ -764,6 +764,7 @@ proc push*[T](sq: SyncQueue[T], sr: SyncRequest[T],
inc counter inc counter
if res.isOk: if res.isOk:
debugEcho "Column into sync queue"
goodBlock = some(blk[].slot) goodBlock = some(blk[].slot)
else: else:
case res.error() case res.error()