|
|
|
@ -49,7 +49,7 @@ func VerifyEIP4844Header(config *params.ChainConfig, parent, header *types.Heade |
|
|
|
|
return fmt.Errorf("blob gas used %d not a multiple of blob gas per blob %d", header.BlobGasUsed, params.BlobTxBlobGasPerBlob) |
|
|
|
|
} |
|
|
|
|
// Verify the excessBlobGas is correct based on the parent header
|
|
|
|
|
expectedExcessBlobGas := CalcExcessBlobGas(config, parent) |
|
|
|
|
expectedExcessBlobGas := CalcExcessBlobGas(config, parent, header) |
|
|
|
|
if *header.ExcessBlobGas != expectedExcessBlobGas { |
|
|
|
|
return fmt.Errorf("invalid excessBlobGas: have %d, want %d", *header.ExcessBlobGas, expectedExcessBlobGas) |
|
|
|
|
} |
|
|
|
@ -58,9 +58,9 @@ func VerifyEIP4844Header(config *params.ChainConfig, parent, header *types.Heade |
|
|
|
|
|
|
|
|
|
// CalcExcessBlobGas calculates the excess blob gas after applying the set of
|
|
|
|
|
// blobs on top of the excess blob gas.
|
|
|
|
|
func CalcExcessBlobGas(config *params.ChainConfig, parent *types.Header) uint64 { |
|
|
|
|
func CalcExcessBlobGas(config *params.ChainConfig, parent, header *types.Header) uint64 { |
|
|
|
|
var ( |
|
|
|
|
target = config.TargetBlobsPerBlock(parent.Time) * params.BlobTxBlobGasPerBlob |
|
|
|
|
target = config.TargetBlobsPerBlock(header.Time) * params.BlobTxBlobGasPerBlob |
|
|
|
|
parentExcessBlobGas uint64 |
|
|
|
|
parentBlobGasUsed uint64 |
|
|
|
|
) |
|
|
|
|