Skip to content

Commit c5b2e8c

Browse files
committed
column syncer group columns fix
1 parent 0236209 commit c5b2e8c

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

beacon_chain/sync/column_syncer.nim

+13-5
Original file line numberDiff line numberDiff line change
@@ -413,11 +413,19 @@ func groupAndFillColumnTable*[A, B](
413413
return err("DataColumnSidecar: unexpected signed_block_header")
414414
inc column_cursor
415415
# Make a table entry for the grouped columns
416-
man.column_syncer_table[forkyBlck.message.slot] =
417-
ColumnAndBlockResponse(
418-
blk: forkyBlck,
419-
columns: Opt.some(grouped[block_idx]))
420-
ok()
416+
if grouped[block_idx].len > 0:
417+
man.column_syncer_table[forkyBlck.message.slot] =
418+
ColumnAndBlockResponse(
419+
blk: forkyBlck,
420+
columns: Opt.some(grouped[block_idx]))
421+
422+
if column_cursor != columns.len:
423+
# we reached the end of blocks without consuming all columns,
424+
# so either we got too few blocks in the paired request, or the
425+
# columns sent to us by the peer is malicious
426+
ok()
427+
else:
428+
return err("DataColumnSidecar: invalid block/column is received")
421429

422430
proc serializeColumnTable*[A, B](
423431
man: ColumnManager[A, B]

0 commit comments

Comments
 (0)