Skip to content

Commit 7755ee3

Browse files
consensus/misc/eip4844: expose TargetBlobsPerBlock (#32991)
Rollups may want to use these to dynamically adjust blobs posted after BPO forks.
1 parent ebc7dc9 commit 7755ee3

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

consensus/misc/eip4844/eip4844.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,15 @@ func LatestMaxBlobsPerBlock(cfg *params.ChainConfig) int {
200200
return bcfg.Max
201201
}
202202

203+
// TargetBlobsPerBlock returns the target blobs per block for a block at the given timestamp.
204+
func TargetBlobsPerBlock(cfg *params.ChainConfig, time uint64) int {
205+
blobConfig := latestBlobConfig(cfg, time)
206+
if blobConfig == nil {
207+
return 0
208+
}
209+
return blobConfig.Target
210+
}
211+
203212
// fakeExponential approximates factor * e ** (numerator / denominator) using
204213
// Taylor expansion.
205214
func fakeExponential(factor, numerator, denominator *big.Int) *big.Int {

0 commit comments

Comments
 (0)