Skip to content

Commit ef00a6e

Browse files
params: add osaka blob schedule (#31174)
Prevents crashes when running execution spec tests for osaka
1 parent 32c6aa8 commit ef00a6e

File tree

4 files changed

+28
-0
lines changed

4 files changed

+28
-0
lines changed

consensus/misc/eip4844/eip4844.go

+8
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@ func CalcExcessBlobGas(config *params.ChainConfig, parent *types.Header, headTim
8383
func CalcBlobFee(config *params.ChainConfig, header *types.Header) *big.Int {
8484
var frac uint64
8585
switch config.LatestFork(header.Time) {
86+
case forks.Osaka:
87+
frac = config.BlobScheduleConfig.Osaka.UpdateFraction
8688
case forks.Prague:
8789
frac = config.BlobScheduleConfig.Prague.UpdateFraction
8890
case forks.Cancun:
@@ -103,6 +105,8 @@ func MaxBlobsPerBlock(cfg *params.ChainConfig, time uint64) int {
103105
s = cfg.BlobScheduleConfig
104106
)
105107
switch {
108+
case cfg.IsOsaka(london, time) && s.Osaka != nil:
109+
return s.Osaka.Max
106110
case cfg.IsPrague(london, time) && s.Prague != nil:
107111
return s.Prague.Max
108112
case cfg.IsCancun(london, time) && s.Cancun != nil:
@@ -125,6 +129,8 @@ func LatestMaxBlobsPerBlock(cfg *params.ChainConfig) int {
125129
return 0
126130
}
127131
switch {
132+
case s.Osaka != nil:
133+
return s.Osaka.Max
128134
case s.Prague != nil:
129135
return s.Prague.Max
130136
case s.Cancun != nil:
@@ -144,6 +150,8 @@ func targetBlobsPerBlock(cfg *params.ChainConfig, time uint64) int {
144150
s = cfg.BlobScheduleConfig
145151
)
146152
switch {
153+
case cfg.IsOsaka(london, time) && s.Osaka != nil:
154+
return s.Osaka.Target
147155
case cfg.IsPrague(london, time) && s.Prague != nil:
148156
return s.Prague.Target
149157
case cfg.IsCancun(london, time) && s.Cancun != nil:

core/genesis_test.go

+1
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,7 @@ func TestVerkleGenesisCommit(t *testing.T) {
281281
BlobScheduleConfig: &params.BlobScheduleConfig{
282282
Cancun: params.DefaultCancunBlobConfig,
283283
Prague: params.DefaultPragueBlobConfig,
284+
Osaka: params.DefaultOsakaBlobConfig,
284285
Verkle: params.DefaultPragueBlobConfig,
285286
},
286287
}

params/config.go

+9
Original file line numberDiff line numberDiff line change
@@ -317,10 +317,17 @@ var (
317317
Max: 9,
318318
UpdateFraction: 5007716,
319319
}
320+
// DefaultOsakaBlobConfig is the default blob configuration for the Osaka fork.
321+
DefaultOsakaBlobConfig = &BlobConfig{
322+
Target: 6,
323+
Max: 9,
324+
UpdateFraction: 5007716,
325+
}
320326
// DefaultBlobSchedule is the latest configured blob schedule for test chains.
321327
DefaultBlobSchedule = &BlobScheduleConfig{
322328
Cancun: DefaultCancunBlobConfig,
323329
Prague: DefaultPragueBlobConfig,
330+
Osaka: DefaultOsakaBlobConfig,
324331
}
325332
)
326333

@@ -501,6 +508,7 @@ type BlobConfig struct {
501508
type BlobScheduleConfig struct {
502509
Cancun *BlobConfig `json:"cancun,omitempty"`
503510
Prague *BlobConfig `json:"prague,omitempty"`
511+
Osaka *BlobConfig `json:"osaka,omitempty"`
504512
Verkle *BlobConfig `json:"verkle,omitempty"`
505513
}
506514

@@ -732,6 +740,7 @@ func (c *ChainConfig) CheckConfigForkOrder() error {
732740
}{
733741
{name: "cancun", timestamp: c.CancunTime, config: bsc.Cancun},
734742
{name: "prague", timestamp: c.PragueTime, config: bsc.Prague},
743+
{name: "osaka", timestamp: c.OsakaTime, config: bsc.Osaka},
735744
} {
736745
if cur.config != nil {
737746
if err := cur.config.validate(); err != nil {

tests/init.go

+10
Original file line numberDiff line numberDiff line change
@@ -431,6 +431,11 @@ var Forks = map[string]*params.ChainConfig{
431431
PragueTime: u64(0),
432432
OsakaTime: u64(0),
433433
DepositContractAddress: params.MainnetChainConfig.DepositContractAddress,
434+
BlobScheduleConfig: &params.BlobScheduleConfig{
435+
Cancun: params.DefaultCancunBlobConfig,
436+
Prague: params.DefaultPragueBlobConfig,
437+
Osaka: params.DefaultOsakaBlobConfig,
438+
},
434439
},
435440
"PragueToOsakaAtTime15k": {
436441
ChainID: big.NewInt(1),
@@ -453,6 +458,11 @@ var Forks = map[string]*params.ChainConfig{
453458
PragueTime: u64(0),
454459
OsakaTime: u64(15_000),
455460
DepositContractAddress: params.MainnetChainConfig.DepositContractAddress,
461+
BlobScheduleConfig: &params.BlobScheduleConfig{
462+
Cancun: params.DefaultCancunBlobConfig,
463+
Prague: params.DefaultPragueBlobConfig,
464+
Osaka: params.DefaultOsakaBlobConfig,
465+
},
456466
},
457467
}
458468

0 commit comments

Comments
 (0)