Skip to content

Commit dd0018b

Browse files
authored
downloader: skip blobGasUsed check for optimism chains on Jovian (#723)
* Add IsOptimismJovian check to validate BlobGasUsed header field Allow nonzero BlobGasUsed for Jovian headers on Optimism chains while validating blob gas usage for other chains as before. * tweak comment * space
1 parent d401af1 commit dd0018b

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

eth/downloader/queue.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ func (f *fetchResult) Done(kind uint) bool {
130130

131131
type OPStackChainConfig interface {
132132
IsOptimismIsthmus(time uint64) bool
133+
IsOptimismJovian(time uint64) bool
133134
}
134135

135136
// queue represents hashes that are either need fetching or are being fetched
@@ -626,7 +627,11 @@ func (q *queue) DeliverBodies(id string, txLists [][]*types.Transaction, txListH
626627
}
627628
}
628629
}
629-
if header.BlobGasUsed != nil {
630+
// OPStack diff: although there are no blobs on optimism chains,
631+
// header.BlobGasUsed can be nonzero after Jovian -- it stores the DA footprint.
632+
// If the header is _not_ from a Jovian enabled optimism chain, validate the blob gas used:
633+
isOptimismJovian := q.opConfig != nil && q.opConfig.IsOptimismJovian(header.Time)
634+
if header.BlobGasUsed != nil && !isOptimismJovian {
630635
if want := *header.BlobGasUsed / params.BlobTxBlobGasPerBlob; uint64(blobs) != want { // div because the header is surely good vs the body might be bloated
631636
return errInvalidBody
632637
}

0 commit comments

Comments
 (0)