mirror of
https://github.com/status-im/nimbus-eth2.git
synced 2025-02-23 19:58:22 +00:00
fix test
This commit is contained in:
parent
d527648610
commit
2f5e216039
@ -644,24 +644,15 @@ func getOpt(data_columns: Opt[seq[DataColumnSidecars]], i: int): Opt[DataColumnS
|
||||
Opt.none DataColumnSidecars
|
||||
|
||||
iterator blocks[T](sq: SyncQueue[T],
|
||||
sr: SyncResult[T]): (ref ForkedSignedBeaconBlock, Opt[BlobSidecars]) =
|
||||
sr: SyncResult[T]): (ref ForkedSignedBeaconBlock, Opt[BlobSidecars],
|
||||
Opt[DataColumnSidecars]) =
|
||||
case sq.kind
|
||||
of SyncQueueKind.Forward:
|
||||
for i in countup(0, len(sr.data) - 1):
|
||||
yield (sr.data[i], sr.blobs.getOpt(i))
|
||||
yield (sr.data[i], sr.blobs.getOpt(i), sr.dataColumns.getOpt(i))
|
||||
of SyncQueueKind.Backward:
|
||||
for i in countdown(len(sr.data) - 1, 0):
|
||||
yield (sr.data[i], sr.blobs.getOpt(i))
|
||||
|
||||
iterator das_blocks[T](sq: SyncQueue[T],
|
||||
sr: SyncResult[T]): (ref ForkedSignedBeaconBlock, Opt[DataColumnSidecars]) =
|
||||
case sq.kind
|
||||
of SyncQueueKind.Forward:
|
||||
for i in countup(0, len(sr.data) - 1):
|
||||
yield (sr.data[i], sr.data_columns.getOpt(i))
|
||||
of SyncQueueKind.Backward:
|
||||
for i in countdown(len(sr.data) - 1, 0):
|
||||
yield (sr.data[i], sr.data_columns.getOpt(i))
|
||||
yield (sr.data[i], sr.blobs.getOpt(i), sr.dataColumns.getOpt(i))
|
||||
|
||||
proc advanceOutput*[T](sq: SyncQueue[T], number: uint64) =
|
||||
case sq.kind
|
||||
@ -795,8 +786,8 @@ proc push*[T](sq: SyncQueue[T], sr: SyncRequest[T],
|
||||
res: Result[void, VerifierError]
|
||||
|
||||
var i=0
|
||||
for blk, blb in sq.blocks(item):
|
||||
res = await sq.blockVerifier(blk[], blb, Opt.none(DataColumnSidecars), maybeFinalized)
|
||||
for blk, blb, cols in sq.blocks(item):
|
||||
res = await sq.blockVerifier(blk[], blb, cols, maybeFinalized)
|
||||
inc(i)
|
||||
|
||||
if res.isOk():
|
||||
@ -826,39 +817,6 @@ proc push*[T](sq: SyncQueue[T], sr: SyncRequest[T],
|
||||
req.item.updateScore(PeerScoreBadValues)
|
||||
break
|
||||
|
||||
var counter = 0
|
||||
for blk, col in sq.das_blocks(item):
|
||||
res =
|
||||
await sq.blockVerifier(blk[], Opt.none(BlobSidecars), col, maybeFinalized)
|
||||
inc counter
|
||||
|
||||
if res.isOk:
|
||||
goodBlock = some(blk[].slot)
|
||||
else:
|
||||
case res.error()
|
||||
of VerifierError.MissingParent:
|
||||
missingParentSlot = some(blk[].slot)
|
||||
break
|
||||
of VerifierError.Duplicate:
|
||||
# Keep going, happens naturally
|
||||
discard
|
||||
of VerifierError.UnviableFork:
|
||||
# Keep going so as to register other unviable blocks with the
|
||||
# quarantine
|
||||
if unviableBlock.isNone:
|
||||
# Remember the first unviable block, so we can log it
|
||||
unviableBlock = some((blk[].root, blk[].slot))
|
||||
|
||||
of VerifierError.Invalid:
|
||||
hasInvalidBlock = true
|
||||
|
||||
let req = item.request
|
||||
notice "Received invalid sequence of blocks", request = req,
|
||||
blocks_count = len(item.data),
|
||||
blocks_map = getShortMap(req, item.data)
|
||||
req.item.updateScore(PeerScoreBadValues)
|
||||
break
|
||||
|
||||
# When errors happen while processing blocks, we retry the same request
|
||||
# with, hopefully, a different peer
|
||||
let retryRequest =
|
||||
|
@ -399,7 +399,6 @@ suite "SyncManager test suite":
|
||||
Opt.none(seq[BlobSidecars]),
|
||||
Opt.none(seq[DataColumnSidecars]))
|
||||
await validatorFut.cancelAndWait()
|
||||
|
||||
waitFor runSmokeTest()
|
||||
case kkind
|
||||
of SyncQueueKind.Forward:
|
||||
|
Loading…
x
Reference in New Issue
Block a user