mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-21 20:26:41 +00:00
core, params: let amsterdam inherit blob schedule instead of synthesizing one
a9415de4 worked around CheckConfigForkOrder rejecting --override.amsterdam by fabricating a blobSchedule.amsterdam entry copied from the latest prior fork. But the blob resolver (eip4844.latestBlobConfig) has no Amsterdam case: at an amsterdam-active time IsOsaka is still true, so it already falls through to Osaka's config and never reads BlobScheduleConfig.Amsterdam. The synthetic entry was data nothing consumes. Mark amsterdam as inheriting in CheckConfigForkOrder so its blob entry is validated when present but not required, matching the resolver. Drop the genesis-side workaround and the duplicated newest-first scan.
This commit is contained in:
parent
d826ffad51
commit
dde6608787
2 changed files with 6 additions and 26 deletions
|
|
@ -294,14 +294,6 @@ func (o *ChainOverrides) apply(cfg *params.ChainConfig) error {
|
||||||
}
|
}
|
||||||
if o.OverrideAmsterdam != nil {
|
if o.OverrideAmsterdam != nil {
|
||||||
cfg.AmsterdamTime = o.OverrideAmsterdam
|
cfg.AmsterdamTime = o.OverrideAmsterdam
|
||||||
// Amsterdam (EIP-7928 BAL) doesn't change blob parameters. When the
|
|
||||||
// bundled config has no amsterdam blobSchedule entry yet, inherit the
|
|
||||||
// most recent preceding fork's so CheckConfigForkOrder validates.
|
|
||||||
if cfg.BlobScheduleConfig != nil && cfg.BlobScheduleConfig.Amsterdam == nil {
|
|
||||||
if prev := latestBlobConfig(cfg.BlobScheduleConfig); prev != nil {
|
|
||||||
cfg.BlobScheduleConfig.Amsterdam = prev
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if o.OverrideBPO1 != nil {
|
if o.OverrideBPO1 != nil {
|
||||||
cfg.BPO1Time = o.OverrideBPO1
|
cfg.BPO1Time = o.OverrideBPO1
|
||||||
|
|
@ -315,22 +307,6 @@ func (o *ChainOverrides) apply(cfg *params.ChainConfig) error {
|
||||||
return cfg.CheckConfigForkOrder()
|
return cfg.CheckConfigForkOrder()
|
||||||
}
|
}
|
||||||
|
|
||||||
// latestBlobConfig returns the blob configuration of the most recent fork
|
|
||||||
// defined in bs (scanning newest-first, excluding Amsterdam/UBT), or nil if none
|
|
||||||
// is set. Used to give a newly-overridden fork sensible blob parameters.
|
|
||||||
func latestBlobConfig(bs *params.BlobScheduleConfig) *params.BlobConfig {
|
|
||||||
for _, c := range []*params.BlobConfig{
|
|
||||||
bs.BPO5, bs.BPO4, bs.BPO3, bs.BPO2, bs.BPO1,
|
|
||||||
bs.Osaka, bs.Prague, bs.Cancun,
|
|
||||||
} {
|
|
||||||
if c != nil {
|
|
||||||
return c
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// SetupGenesisBlock writes or updates the genesis block in db.
|
// SetupGenesisBlock writes or updates the genesis block in db.
|
||||||
// The block that will be used is:
|
// The block that will be used is:
|
||||||
//
|
//
|
||||||
|
|
|
||||||
|
|
@ -997,6 +997,7 @@ func (c *ChainConfig) CheckConfigForkOrder() error {
|
||||||
name string
|
name string
|
||||||
timestamp *uint64
|
timestamp *uint64
|
||||||
config *BlobConfig
|
config *BlobConfig
|
||||||
|
inherits bool // fork introduces no blob params; inherits the latest prior fork's schedule
|
||||||
}{
|
}{
|
||||||
{name: "cancun", timestamp: c.CancunTime, config: bsc.Cancun},
|
{name: "cancun", timestamp: c.CancunTime, config: bsc.Cancun},
|
||||||
{name: "prague", timestamp: c.PragueTime, config: bsc.Prague},
|
{name: "prague", timestamp: c.PragueTime, config: bsc.Prague},
|
||||||
|
|
@ -1006,14 +1007,17 @@ func (c *ChainConfig) CheckConfigForkOrder() error {
|
||||||
{name: "bpo3", timestamp: c.BPO3Time, config: bsc.BPO3},
|
{name: "bpo3", timestamp: c.BPO3Time, config: bsc.BPO3},
|
||||||
{name: "bpo4", timestamp: c.BPO4Time, config: bsc.BPO4},
|
{name: "bpo4", timestamp: c.BPO4Time, config: bsc.BPO4},
|
||||||
{name: "bpo5", timestamp: c.BPO5Time, config: bsc.BPO5},
|
{name: "bpo5", timestamp: c.BPO5Time, config: bsc.BPO5},
|
||||||
{name: "amsterdam", timestamp: c.AmsterdamTime, config: bsc.Amsterdam},
|
// Amsterdam (EIP-7928 BAL) doesn't change blob parameters. The blob
|
||||||
|
// resolver (eip4844.latestBlobConfig) has no Amsterdam case and falls
|
||||||
|
// through to Osaka, so an explicit amsterdam blob entry isn't required.
|
||||||
|
{name: "amsterdam", timestamp: c.AmsterdamTime, config: bsc.Amsterdam, inherits: true},
|
||||||
} {
|
} {
|
||||||
if cur.config != nil {
|
if cur.config != nil {
|
||||||
if err := cur.config.validate(); err != nil {
|
if err := cur.config.validate(); err != nil {
|
||||||
return fmt.Errorf("invalid chain configuration in blobSchedule for fork %q: %v", cur.name, err)
|
return fmt.Errorf("invalid chain configuration in blobSchedule for fork %q: %v", cur.name, err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if cur.timestamp != nil {
|
if cur.timestamp != nil && !cur.inherits {
|
||||||
// If the fork is configured, a blob schedule must be defined for it.
|
// If the fork is configured, a blob schedule must be defined for it.
|
||||||
if cur.config == nil {
|
if cur.config == nil {
|
||||||
return fmt.Errorf("invalid chain configuration: missing entry for fork %q in blobSchedule", cur.name)
|
return fmt.Errorf("invalid chain configuration: missing entry for fork %q in blobSchedule", cur.name)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue