From dde6608787b3f46b8771209b1ec0d3259709902b Mon Sep 17 00:00:00 2001 From: Rafael Matias Date: Fri, 26 Jun 2026 10:32:41 +0200 Subject: [PATCH] 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. --- core/genesis.go | 24 ------------------------ params/config.go | 8 ++++++-- 2 files changed, 6 insertions(+), 26 deletions(-) diff --git a/core/genesis.go b/core/genesis.go index 24318ab72c..910a3fb0f5 100644 --- a/core/genesis.go +++ b/core/genesis.go @@ -294,14 +294,6 @@ func (o *ChainOverrides) apply(cfg *params.ChainConfig) error { } if o.OverrideAmsterdam != nil { 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 { cfg.BPO1Time = o.OverrideBPO1 @@ -315,22 +307,6 @@ func (o *ChainOverrides) apply(cfg *params.ChainConfig) error { 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. // The block that will be used is: // diff --git a/params/config.go b/params/config.go index 1d69335f97..f31e53dde7 100644 --- a/params/config.go +++ b/params/config.go @@ -997,6 +997,7 @@ func (c *ChainConfig) CheckConfigForkOrder() error { name string timestamp *uint64 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: "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: "bpo4", timestamp: c.BPO4Time, config: bsc.BPO4}, {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 err := cur.config.validate(); err != nil { 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 cur.config == nil { return fmt.Errorf("invalid chain configuration: missing entry for fork %q in blobSchedule", cur.name)