@@ -194,10 +194,24 @@ proc verifySidecars(
194194): Result [void , VerifierError ] =
195195 const consensusFork = typeof (signedBlock).kind
196196
197- when consensusFork == ConsensusFork .Gloas :
198- # For Gloas, we still need to store the columns if they're provided
199- # but skip validation since we don't have kzg_commitments in the block
200- debugGloasComment " potentially validate against payload envelope"
197+ when consensusFork >= ConsensusFork .Gloas :
198+ if sidecarsOpt.isSome:
199+ let
200+ signedEnvelope = envelopeOpt.valueOr:
201+ return err (VerifierError .Invalid )
202+ columns = sidecarsOpt.get ()
203+ kzgCommits = signedEnvelope.message.blob_kzg_commitments.asSeq
204+ if columns.len > 0 and kzgCommits.len > 0 :
205+ for i in 0 ..< columns.len:
206+ let r = verify_data_column_sidecar_kzg_proofs (columns[i][])
207+ if r.isErr ():
208+ debug " data column validation failed" ,
209+ blockRoot = shortLog (signedBlock.root),
210+ column_sidecar = shortLog (columns[i][]),
211+ blck = shortLog (signedBlock.message),
212+ signature = shortLog (signedBlock.signature),
213+ msg = r.error ()
214+ return err (VerifierError .Invalid )
201215 elif consensusFork == ConsensusFork .Fulu :
202216 if sidecarsOpt.isSome:
203217 let columns = sidecarsOpt.get ()
@@ -262,15 +276,18 @@ proc storeSidecars(self: BlockProcessor, sidecarsOpt: NoSidecars) =
262276proc enqueuePayload * (self: ref BlockProcessor , blck: gloas.SignedBeaconBlock )
263277
264278proc storeBackfillBlock (
265- self: var BlockProcessor ,
279+ self: ref BlockProcessor ,
266280 signedBlock: ForkySignedBeaconBlock ,
267281 sidecarsOpt: SomeOptSidecars ,
268282): Result [void , VerifierError ] =
269283 let quarantine = self.consensusManager.quarantine
270284 # In case the block was added to any part of the quarantine..
271285 quarantine[].remove (signedBlock)
272286
273- ? verifySidecars (signedBlock, sidecarsOpt)
287+ const consensusFork = typeof (signedBlock).kind
288+
289+ when consensusFork <= ConsensusFork .Fulu :
290+ ? verifySidecars (signedBlock, sidecarsOpt)
274291
275292 let res = self.consensusManager.dag.addBackfillBlock (signedBlock)
276293
@@ -300,8 +317,13 @@ proc storeBackfillBlock(
300317 of VerifierError .Duplicate :
301318 res
302319 else :
303- # Only store side cars after successfully establishing block viability.
304- self.storeSidecars (sidecarsOpt)
320+ when consensusFork >= ConsensusFork .Gloas :
321+ # Columns are in quarantine as they didn't pop from `rmanBlockVerifier`,
322+ # we simply enqueue with the valid block.
323+ self.enqueuePayload (signedBlock)
324+ else :
325+ # Only store side cars after successfully establishing block viability.
326+ self[].storeSidecars (sidecarsOpt)
305327
306328 res
307329
@@ -387,7 +409,7 @@ proc enqueueBlock*(
387409 if blck.message.slot <= self.consensusManager.dag.finalizedHead.slot:
388410 # let backfill blocks skip the queue - these are always "fast" to process
389411 # because there are no state rewinds to deal with
390- discard self[] .storeBackfillBlock (blck, sidecarsOpt)
412+ discard self.storeBackfillBlock (blck, sidecarsOpt)
391413 return
392414
393415 # `discard` here means that the `async` task will continue running even though
@@ -411,9 +433,8 @@ proc enqueueQuarantine(self: ref BlockProcessor, parent: BlockRef) =
411433 debug " Block from quarantine" , parent, quarantined = shortLog (quarantined.root)
412434
413435 withBlck (quarantined):
414- when consensusFork == ConsensusFork .Gloas :
415- debugGloasComment " "
416- const sidecarsOpt = noSidecars
436+ when consensusFork >= ConsensusFork .Gloas :
437+ let sidecarsOpt = Opt .none (gloas.DataColumnSidecars )
417438 elif consensusFork == ConsensusFork .Fulu :
418439 let sidecarsOpt =
419440 if len (forkyBlck.message.body.blob_kzg_commitments) == 0 :
@@ -649,7 +670,8 @@ proc storeBlock(
649670
650671 let newPayloadTick = Moment .now ()
651672
652- ? verifySidecars (signedBlock, sidecarsOpt)
673+ when consensusFork <= ConsensusFork .Fulu :
674+ ? verifySidecars (signedBlock, sidecarsOpt)
653675
654676 let blck =
655677 ? dag.addHeadBlockWithParent (
@@ -667,7 +689,8 @@ proc storeBlock(
667689 self[].lastPayload = signedBlock.message.slot
668690
669691 # write blobs now that block has been written.
670- self[].storeSidecars (sidecarsOpt)
692+ when consensusFork <= ConsensusFork .Fulu :
693+ self[].storeSidecars (sidecarsOpt)
671694
672695 let addHeadBlockTick = Moment .now ()
673696
@@ -717,6 +740,11 @@ proc storeBlock(
717740 blck = shortLog (blck),
718741 validationDur, queueDur, newPayloadDur, addHeadBlockDur, updateHeadDur
719742
743+ when consensusFork >= ConsensusFork .Gloas :
744+ # Enqueue payload here instead of `addBlock` for the consistency of payload
745+ # processing with backfilling.
746+ self.enqueuePayload (signedBlock)
747+
720748 ok (blck)
721749
722750proc addBlock * (
@@ -749,7 +777,7 @@ proc addBlock*(
749777 if blck.message.slot <= dag.finalizedHead.slot:
750778 # let backfill blocks skip the queue - these are always "fast" to process
751779 # because there are no state rewinds to deal with
752- return self[] .storeBackfillBlock (blck, sidecarsOpt)
780+ return self.storeBackfillBlock (blck, sidecarsOpt)
753781
754782 let queueTick = Moment .now ()
755783 let res =
0 commit comments