consensus/misc/eip4844, params: add more bpo checks

This commit is contained in:
Gary Rong 2025-07-08 15:01:45 +08:00 committed by Felix Lange
parent d8e71bec58
commit c79aea5271
2 changed files with 21 additions and 1 deletions

View file

@ -145,7 +145,7 @@ func latestBlobConfig(cfg *params.ChainConfig, time uint64) *params.BlobConfig {
}
}
// MaxBlobsPerBlock returns the maximum blob gas that can be spent in a block at the given timestamp.
// MaxBlobGasPerBlock returns the maximum blob gas that can be spent in a block at the given timestamp.
func MaxBlobGasPerBlock(cfg *params.ChainConfig, time uint64) uint64 {
return uint64(MaxBlobsPerBlock(cfg, time)) * params.BlobTxBlobGasPerBlob
}

View file

@ -779,6 +779,11 @@ func (c *ChainConfig) CheckConfigForkOrder() error {
{name: "pragueTime", timestamp: c.PragueTime, optional: true},
{name: "osakaTime", timestamp: c.OsakaTime, optional: true},
{name: "verkleTime", timestamp: c.VerkleTime, optional: true},
{name: "bpo1", timestamp: c.BPO1Time, optional: true},
{name: "bpo2", timestamp: c.BPO2Time, optional: true},
{name: "bpo3", timestamp: c.BPO3Time, optional: true},
{name: "bpo4", timestamp: c.BPO4Time, optional: true},
{name: "bpo5", timestamp: c.BPO5Time, optional: true},
} {
if lastFork.name != "" {
switch {
@ -933,6 +938,21 @@ func (c *ChainConfig) checkCompatible(newcfg *ChainConfig, headNumber *big.Int,
if isForkTimestampIncompatible(c.VerkleTime, newcfg.VerkleTime, headTimestamp) {
return newTimestampCompatError("Verkle fork timestamp", c.VerkleTime, newcfg.VerkleTime)
}
if isForkTimestampIncompatible(c.BPO1Time, newcfg.BPO1Time, headTimestamp) {
return newTimestampCompatError("BPO1 fork timestamp", c.BPO1Time, newcfg.BPO1Time)
}
if isForkTimestampIncompatible(c.BPO2Time, newcfg.BPO2Time, headTimestamp) {
return newTimestampCompatError("BPO2 fork timestamp", c.BPO2Time, newcfg.BPO2Time)
}
if isForkTimestampIncompatible(c.BPO3Time, newcfg.BPO3Time, headTimestamp) {
return newTimestampCompatError("BPO3 fork timestamp", c.BPO3Time, newcfg.BPO3Time)
}
if isForkTimestampIncompatible(c.BPO4Time, newcfg.BPO4Time, headTimestamp) {
return newTimestampCompatError("BPO4 fork timestamp", c.BPO4Time, newcfg.BPO4Time)
}
if isForkTimestampIncompatible(c.BPO5Time, newcfg.BPO5Time, headTimestamp) {
return newTimestampCompatError("BPO5 fork timestamp", c.BPO5Time, newcfg.BPO5Time)
}
return nil
}