From 47ed980cf4230c66df37ececb07ba0fd81f138af Mon Sep 17 00:00:00 2001 From: jangko Date: Mon, 27 Jan 2025 15:57:27 +0700 Subject: [PATCH] Fix missing baseFeeUpdateFraction fallback --- nimbus/common/chain_config.nim | 6 +++++- tests/test_txpool.nim | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/nimbus/common/chain_config.nim b/nimbus/common/chain_config.nim index 76f16b64b..155d55c4c 100644 --- a/nimbus/common/chain_config.nim +++ b/nimbus/common/chain_config.nim @@ -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 @@ -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 = diff --git a/tests/test_txpool.nim b/tests/test_txpool.nim index 79175a3f3..2af6d692e 100644 --- a/tests/test_txpool.nim +++ b/tests/test_txpool.nim @@ -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