@@ -345,6 +345,14 @@ func (c *Clique) verifyCascadingFields(chain consensus.ChainHeaderReader, header
345345 // Verify the header's EIP-1559 attributes.
346346 return err
347347 }
348+ if ! chain .Config ().IsSharding (header .Number ) {
349+ if header .ExcessBlobs != nil {
350+ return fmt .Errorf ("invalid excessBlobs before fork: have %d, want <nil>" , * header .ExcessBlobs )
351+ }
352+ } else if err := misc .VerifyEip4844Header (chain .Config (), parent , header ); err != nil {
353+ // Verify the header's EIP-4844 attributes.
354+ return err
355+ }
348356 // Retrieve the snapshot needed to verify this header and cache it
349357 snap , err := c .snapshot (chain , number - 1 , header .ParentHash , parents )
350358 if err != nil {
@@ -568,8 +576,10 @@ func (c *Clique) Finalize(chain consensus.ChainHeaderReader, header *types.Heade
568576 // No block rewards in PoA, so the state remains as is and uncles are dropped
569577 header .Root = state .IntermediateRoot (chain .Config ().IsEIP158 (header .Number ))
570578 header .UncleHash = types .CalcUncleHash (nil )
571- if parent := chain .GetHeaderByHash (header .ParentHash ); parent != nil {
572- header .ExcessBlobs = misc .CalcExcessBlobTransactions (parent , uint64 (misc .CountBlobs (txs )))
579+ if chain .Config ().IsSharding (header .Number ) {
580+ if parent := chain .GetHeaderByHash (header .ParentHash ); parent != nil {
581+ header .SetExcessBlobs (misc .CalcExcessBlobTransactions (parent , uint64 (misc .CountBlobs (txs ))))
582+ }
573583 }
574584}
575585
@@ -746,7 +756,9 @@ func encodeSigHeader(w io.Writer, header *types.Header) {
746756 if header .BaseFee != nil {
747757 enc = append (enc , header .BaseFee )
748758 }
749- enc = append (enc , header .ExcessBlobs )
759+ if header .ExcessBlobs != nil {
760+ enc = append (enc , header .ExcessBlobs )
761+ }
750762 if err := rlp .Encode (w , enc ); err != nil {
751763 panic ("can't encode: " + err .Error ())
752764 }
0 commit comments