consensus/misc/eip4844: expose TargetBlobsPerBlock (#32991)

Rollups may want to use these to dynamically adjust blobs posted after
BPO forks.
This commit is contained in:
Tristan-Wilson 2025-11-10 09:38:28 +01:00 committed by Alvarez
parent 0b465b62a3
commit cd45794c1c

View file

@ -200,6 +200,15 @@ func LatestMaxBlobsPerBlock(cfg *params.ChainConfig) int {
return bcfg.Max return bcfg.Max
} }
// TargetBlobsPerBlock returns the target blobs per block for a block at the given timestamp.
func TargetBlobsPerBlock(cfg *params.ChainConfig, time uint64) int {
blobConfig := latestBlobConfig(cfg, time)
if blobConfig == nil {
return 0
}
return blobConfig.Target
}
// fakeExponential approximates factor * e ** (numerator / denominator) using // fakeExponential approximates factor * e ** (numerator / denominator) using
// Taylor expansion. // Taylor expansion.
func fakeExponential(factor, numerator, denominator *big.Int) *big.Int { func fakeExponential(factor, numerator, denominator *big.Int) *big.Int {