Skip to content

Commit

Permalink
rpcdaemon: fix on FeeHistory check on GetMaxBlobGasPerBlock() method …
Browse files Browse the repository at this point in the history
…of chainConfig (#12655)

To read MaxBlobGasPerBlock it is necessary use the method
GetMaxBlobGasPerBlock() that returns MAX_BLOB_GAS_PER_BLOCK (EIP-4844)
if not override in config with custom value MaxBlobGasPerBlock
  • Loading branch information
lupin012 authored Nov 7, 2024
1 parent fb6f8f4 commit 4846740
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions eth/gasprice/feehistory.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,14 +115,16 @@ func (oracle *Oracle) processBlock(bf *blockFees, percentiles []float64) {
bf.nextBlobBaseFee = new(big.Int)
}
bf.gasUsedRatio = float64(bf.header.GasUsed) / float64(bf.header.GasLimit)

if blobGasUsed := bf.header.BlobGasUsed; blobGasUsed != nil && chainconfig.GetMaxBlobGasPerBlock() != 0 {
bf.blobGasUsedRatio = float64(*blobGasUsed) / float64(chainconfig.GetMaxBlobGasPerBlock())
}

if len(percentiles) == 0 {
// rewards were not requested, return null
return
}

if blobGasUsed := bf.header.BlobGasUsed; blobGasUsed != nil && chainconfig.MaxBlobGasPerBlock != nil {
bf.blobGasUsedRatio = float64(*blobGasUsed) / float64(*chainconfig.MaxBlobGasPerBlock)
}
if bf.block == nil || (bf.receipts == nil && len(bf.block.Transactions()) != 0) {
oracle.log.Error("Block or receipts are missing while reward percentiles are requested")
return
Expand Down

0 comments on commit 4846740

Please sign in to comment.