Skip to content

Commit

Permalink
Fix missing baseFeeUpdateFraction fallback
Browse files Browse the repository at this point in the history
  • Loading branch information
jangko committed Jan 27, 2025
1 parent ca86ad2 commit 47ed980
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion nimbus/common/chain_config.nim
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,10 @@ proc configureBlobSchedule(conf: ChainConfig) =
for fork in Prague..HardFork.high:
if conf.blobSchedule[fork].isNone:
conf.blobSchedule[fork] = conf.blobSchedule[prevFork]
if conf.blobSchedule[fork].baseFeeUpdateFraction == 0:
# Set fallback to Cancun's baseFeeUpdateFraction and prevent division by zero
warn "baseFeeUpdateFraction not set, fallback to Cancun's", fork=fork
conf.blobSchedule[fork].baseFeeUpdateFraction = 3_338_477'u64
prevFork = fork

proc parseGenesis*(data: string): Genesis
Expand Down Expand Up @@ -487,7 +491,7 @@ func defaultBlobSchedule*(): array[Cancun..HardFork.high, Opt[BlobSchedule]] =
[
Cancun: Opt.some(BlobSchedule(target: 3'u64, max: 6'u64, baseFeeUpdateFraction: 3_338_477'u64)),
Prague: Opt.some(BlobSchedule(target: 6'u64, max: 9'u64, baseFeeUpdateFraction: 5_007_716'u64)),
Osaka : Opt.some(BlobSchedule(target: 6'u64, max: 9'u64, baseFeeUpdateFraction: 5_007_716'u64)),
Osaka : Opt.some(BlobSchedule(target: 9'u64, max: 12'u64, baseFeeUpdateFraction: 5_007_716'u64)),
]

func chainConfigForNetwork*(id: NetworkId): ChainConfig =
Expand Down
2 changes: 1 addition & 1 deletion tests/test_txpool.nim
Original file line number Diff line number Diff line change
Expand Up @@ -642,7 +642,7 @@ proc txPoolMain*() =
# override current blobSchedule
let bs = cc.blobSchedule[Cancun]
cc.blobSchedule[Cancun] = Opt.some(
BlobSchedule(target: 2, max: 3)
BlobSchedule(target: 2, max: 3, baseFeeUpdateFraction: 3338477)
)

# allow 3 blobs
Expand Down

0 comments on commit 47ed980

Please sign in to comment.