From 4563174b81ecff7ebed0135028c9c1201bdb0f18 Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Tue, 4 Feb 2025 13:56:33 +0100 Subject: [PATCH] consensus/misc/eip4844: clean up CalcBlobFee --- consensus/misc/eip4844/eip4844.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/consensus/misc/eip4844/eip4844.go b/consensus/misc/eip4844/eip4844.go index 00471da76e..1d76b21b30 100644 --- a/consensus/misc/eip4844/eip4844.go +++ b/consensus/misc/eip4844/eip4844.go @@ -78,14 +78,16 @@ func CalcExcessBlobGas(config *params.ChainConfig, parent *types.Header) uint64 // CalcBlobFee calculates the blobfee from the header's excess blob gas field. func CalcBlobFee(config *params.ChainConfig, header *types.Header) *big.Int { + var frac uint64 switch config.LatestFork(header.Time) { case forks.Prague: - return fakeExponential(minBlobGasPrice, new(big.Int).SetUint64(*header.ExcessBlobGas), new(big.Int).SetUint64(config.BlobScheduleConfig.Prague.UpdateFraction)) + frac = config.BlobScheduleConfig.Prague.UpdateFraction case forks.Cancun: - return fakeExponential(minBlobGasPrice, new(big.Int).SetUint64(*header.ExcessBlobGas), new(big.Int).SetUint64(config.BlobScheduleConfig.Cancun.UpdateFraction)) + frac = config.BlobScheduleConfig.Cancun.UpdateFraction default: panic("calculating blob fee on unsupported fork") } + return fakeExponential(minBlobGasPrice, new(big.Int).SetUint64(*header.ExcessBlobGas), new(big.Int).SetUint64(frac)) } // MaxBlobsPerBlock returns the max blobs per block for a block at the given timestamp.