From dfcc89138f23b95cb9a104dee6a2010ceed80cc9 Mon Sep 17 00:00:00 2001 From: Agnish Ghosh Date: Sat, 12 Oct 2024 16:42:56 +0530 Subject: [PATCH] add more specifics to reconstruction and block addition conditions --- .../gossip_processing/block_processor.nim | 2 +- .../gossip_processing/eth2_processor.nim | 10 +++++--- beacon_chain/spec/eip7594_helpers.nim | 24 ++++++++++++++----- 3 files changed, 26 insertions(+), 10 deletions(-) diff --git a/beacon_chain/gossip_processing/block_processor.nim b/beacon_chain/gossip_processing/block_processor.nim index fe96d50a8..6de06e2bd 100644 --- a/beacon_chain/gossip_processing/block_processor.nim +++ b/beacon_chain/gossip_processing/block_processor.nim @@ -232,7 +232,7 @@ proc storeBackfillBlock( columnsOk = r.isOk() if not columnsOk: - if dataColumnsOpt.isSome: + if dataColumnsOpt.isSome and dataColumnsOpt.get.len >= (NUMBER_OF_COLUMNS div 2): let data_columns = dataColumnsOpt.get recovered_cps = diff --git a/beacon_chain/gossip_processing/eth2_processor.nim b/beacon_chain/gossip_processing/eth2_processor.nim index bd4a26a57..95a2b5735 100644 --- a/beacon_chain/gossip_processing/eth2_processor.nim +++ b/beacon_chain/gossip_processing/eth2_processor.nim @@ -398,11 +398,15 @@ proc processDataColumnSidecar*( let columnless = o.unsafeGet() withBlck(columnless): when consensusFork >= ConsensusFork.Deneb: - if self.dataColumnQuarantine[].hasEnoughDataColumns(forkyBlck): + if self.dataColumnQuarantine[].hasMissingDataColumns(forkyBlck): + self.blockProcessor[].enqueueBlock( + MsgSource.gossip, columnless, + Opt.none(BlobSidecars), + Opt.some(self.dataColumnQuarantine[].popDataColumns(block_root, forkyBlck))) + elif self.dataColumnQuarantine[].hasEnoughDataColumns(forkyBlck): let columns = self.dataColumnQuarantine[].gatherDataColumns(forkyBlck) - if columns.len >= (NUMBER_OF_COLUMNS div 2) or - self.dataColumnQuarantine[].supernode: + if columns.len >= (NUMBER_OF_COLUMNS div 2): let reconstructed_columns = self.processReconstructionFromGossip(forkyBlck, columns) diff --git a/beacon_chain/spec/eip7594_helpers.nim b/beacon_chain/spec/eip7594_helpers.nim index 2dd012505..fb8052271 100644 --- a/beacon_chain/spec/eip7594_helpers.nim +++ b/beacon_chain/spec/eip7594_helpers.nim @@ -191,8 +191,7 @@ proc recover_cells_and_proofs*( return err ("DataColumns do not have the same length") var - recovered_cps: seq[CellsAndProofs] - recovered_cps.setLen(blobCount) + recovered_cps = newSeq[CellsAndProofs](blobCount) for blobIdx in 0..