diff --git a/hive_integration/nodocker/engine/cancun/helpers.nim b/hive_integration/nodocker/engine/cancun/helpers.nim index bafb26efb6..62befc710b 100644 --- a/hive_integration/nodocker/engine/cancun/helpers.nim +++ b/hive_integration/nodocker/engine/cancun/helpers.nim @@ -1,5 +1,5 @@ # Nimbus -# Copyright (c) 2023-2024 Status Research & Development GmbH +# Copyright (c) 2023-2025 Status Research & Development GmbH # Licensed under either of # * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or # http://www.apache.org/licenses/LICENSE-2.0) @@ -39,19 +39,27 @@ const DATAHASH_START_ADDRESS* = toAddress(0x20000.u256) DATAHASH_ADDRESS_COUNT* = 1000 -func getMinExcessBlobGasForBlobGasPrice(data_gas_price: uint64, electra: bool): uint64 = +func getCancunBlobBaseFee*(excessBlobGas: uint64): UInt256 = + const blobBaseFeeUpdateFraction = 3338477.u256 + fakeExponential( + MIN_BLOB_GASPRICE.u256, + excessBlobGas.u256, + blobBaseFeeUpdateFraction + ) + +func getMinExcessBlobGasForBlobGasPrice(data_gas_price: uint64): uint64 = var current_excess_data_gas = 0'u64 current_data_gas_price = 1'u64 while current_data_gas_price < data_gas_price: current_excess_data_gas += GAS_PER_BLOB.uint64 - current_data_gas_price = getBlobBaseFee(current_excess_data_gas, electra).truncate(uint64) + current_data_gas_price = getCancunBlobBaseFee(current_excess_data_gas).truncate(uint64) return current_excess_data_gas -func getMinExcessBlobsForBlobGasPrice*(data_gas_price: uint64, electra: bool): uint64 = - return getMinExcessBlobGasForBlobGasPrice(data_gas_price, electra) div GAS_PER_BLOB.uint64 +func getMinExcessBlobsForBlobGasPrice*(data_gas_price: uint64): uint64 = + return getMinExcessBlobGasForBlobGasPrice(data_gas_price) div GAS_PER_BLOB.uint64 proc addBlobTransaction*(pool: TestBlobTxPool, tx: PooledTransaction) = let txHash = rlpHash(tx) diff --git a/hive_integration/nodocker/engine/cancun/step_newpayloads.nim b/hive_integration/nodocker/engine/cancun/step_newpayloads.nim index fe8dace943..e60b4c191e 100644 --- a/hive_integration/nodocker/engine/cancun/step_newpayloads.nim +++ b/hive_integration/nodocker/engine/cancun/step_newpayloads.nim @@ -1,5 +1,5 @@ # Nimbus -# Copyright (c) 2023-2024 Status Research & Development GmbH +# Copyright (c) 2023-2025 Status Research & Development GmbH # Licensed under either of # * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or # http://www.apache.org/licenses/LICENSE-2.0) @@ -96,7 +96,7 @@ proc verifyPayload(step: NewPayloads, var totalBlobCount = 0 - expectedBlobGasPrice = getBlobBaseFee(expectedExcessBlobGas, com.isPragueOrLater(payload.timestamp.EthTime)) + expectedBlobGasPrice = getCancunBlobBaseFee(expectedExcessBlobGas) for tx in blobTxsInPayload: let blobCount = tx.versionedHashes.len diff --git a/hive_integration/nodocker/engine/cancun_tests.nim b/hive_integration/nodocker/engine/cancun_tests.nim index 41e09dbb0d..ed03674c2e 100644 --- a/hive_integration/nodocker/engine/cancun_tests.nim +++ b/hive_integration/nodocker/engine/cancun_tests.nim @@ -1,5 +1,5 @@ # Nimbus -# Copyright (c) 2023-2024 Status Research & Development GmbH +# Copyright (c) 2023-2025 Status Research & Development GmbH # Licensed under either of # * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or # http://www.apache.org/licenses/LICENSE-2.0) @@ -41,7 +41,7 @@ import # Precalculate the first data gas cost increase const - DATA_GAS_COST_INCREMENT_EXCEED_BLOBS = getMinExcessBlobsForBlobGasPrice(2, false).int + DATA_GAS_COST_INCREMENT_EXCEED_BLOBS = getMinExcessBlobsForBlobGasPrice(2).int TARGET_BLOBS_PER_BLOCK = int(TARGET_BLOB_GAS_PER_BLOCK div GAS_PER_BLOB) proc getGenesis(param: NetworkParams) = diff --git a/nimbus/common/chain_config.nim b/nimbus/common/chain_config.nim index 05b6cd5712..a4f2b40462 100644 --- a/nimbus/common/chain_config.nim +++ b/nimbus/common/chain_config.nim @@ -394,10 +394,18 @@ proc validateChainConfig(conf: ChainConfig): bool = proc configureBlobSchedule(conf: ChainConfig) = var prevFork = Cancun if conf.blobSchedule[Cancun].isNone: - conf.blobSchedule[Cancun] = Opt.some(BlobSchedule(target: 3'u64, max: 6'u64)) + conf.blobSchedule[Cancun] = Opt.some(BlobSchedule(target: 3'u64, max: 6'u64, baseFeeUpdateFraction: 3_338_477'u64)) + else: + if conf.blobSchedule[Cancun].value.baseFeeUpdateFraction == 0: + conf.blobSchedule[Cancun].value.baseFeeUpdateFraction = 3_338_477'u64 + for fork in Prague..HardFork.high: if conf.blobSchedule[fork].isNone: conf.blobSchedule[fork] = conf.blobSchedule[prevFork] + if conf.blobSchedule[fork].value.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].value.baseFeeUpdateFraction = 3_338_477'u64 prevFork = fork proc parseGenesis*(data: string): Genesis @@ -485,9 +493,9 @@ proc parseGenesisAlloc*(data: string, ga: var GenesisAlloc): bool func defaultBlobSchedule*(): array[Cancun..HardFork.high, Opt[BlobSchedule]] = [ - Cancun: Opt.some(BlobSchedule(target: 3'u64, max: 6'u64)), - Prague: Opt.some(BlobSchedule(target: 6'u64, max: 9'u64)), - Osaka : Opt.some(BlobSchedule(target: 6'u64, max: 9'u64)), + 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: 9'u64, max: 12'u64, baseFeeUpdateFraction: 5_007_716'u64)), ] func chainConfigForNetwork*(id: NetworkId): ChainConfig = diff --git a/nimbus/common/common.nim b/nimbus/common/common.nim index 53853040b8..d22438b2b5 100644 --- a/nimbus/common/common.nim +++ b/nimbus/common/common.nim @@ -288,6 +288,9 @@ func toEVMFork*(com: CommonRef, forkDeterminer: ForkDeterminationInfo): EVMFork let fork = com.toHardFork(forkDeterminer) ToEVMFork[fork] +func toEVMFork*(com: CommonRef, header: Header): EVMFork = + com.toEVMFork(forkDeterminationInfo(header)) + func isSpuriousOrLater*(com: CommonRef, number: BlockNumber): bool = com.toHardFork(number.forkDeterminationInfo) >= Spurious @@ -424,6 +427,10 @@ func targetBlobsPerBlock*(com: CommonRef, fork: HardFork): uint64 = doAssert(fork >= Cancun) com.config.blobSchedule[fork].expect("blobSchedule initialized").target +func baseFeeUpdateFraction*(com: CommonRef, fork: HardFork): uint64 = + doAssert(fork >= Cancun) + com.config.blobSchedule[fork].expect("blobSchedule initialized").baseFeeUpdateFraction + # ------------------------------------------------------------------------------ # Setters # ------------------------------------------------------------------------------ diff --git a/nimbus/common/hardforks.nim b/nimbus/common/hardforks.nim index 25fb58ccab..02b3be36e9 100644 --- a/nimbus/common/hardforks.nim +++ b/nimbus/common/hardforks.nim @@ -137,6 +137,7 @@ type BlobSchedule* = object target*: uint64 max* : uint64 + baseFeeUpdateFraction*: uint64 # if you add more fork block # please update forkBlockField constant too diff --git a/nimbus/constants.nim b/nimbus/constants.nim index 98696b2835..e23804f1cb 100644 --- a/nimbus/constants.nim +++ b/nimbus/constants.nim @@ -86,13 +86,11 @@ const GAS_PER_BLOB* = (1 shl 17).uint64 # 2^17 TARGET_BLOB_GAS_PER_BLOCK* = 393216 MIN_BLOB_GASPRICE* = 1'u64 - BLOB_BASE_FEE_UPDATE_FRACTION* = 3338477 MAX_BLOB_GAS_PER_BLOCK* = 786432 MAX_BLOBS_PER_BLOCK* = int(MAX_BLOB_GAS_PER_BLOCK div GAS_PER_BLOB) MAX_BLOB_GAS_PER_BLOCK_ELECTRA* = 1179648 TARGET_BLOB_GAS_PER_BLOCK_ELECTRA* = 786432 - BLOB_BASE_FEE_UPDATE_FRACTION_ELECTRA* = 5007716 MAX_BLOBS_PER_BLOCK_ELECTRA* = int(MAX_BLOB_GAS_PER_BLOCK_ELECTRA div GAS_PER_BLOB) # EIP-4788 addresses diff --git a/nimbus/core/eip4844.nim b/nimbus/core/eip4844.nim index 7bed3200d6..01751d3ae6 100644 --- a/nimbus/core/eip4844.nim +++ b/nimbus/core/eip4844.nim @@ -1,5 +1,5 @@ # Nimbus -# Copyright (c) 2023-2024 Status Research & Development GmbH +# Copyright (c) 2023-2025 Status Research & Development GmbH # Licensed under either of # * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or # http://www.apache.org/licenses/LICENSE-2.0) @@ -115,19 +115,22 @@ proc getTotalBlobGas*(versionedHashesLen: int): uint64 = GAS_PER_BLOB * versionedHashesLen.uint64 # getBlobBaseFee implements get_data_gas_price from EIP-4844 -func getBlobBaseFee*(excessBlobGas: uint64, electra: bool): UInt256 = - let blobBaseFeeUpdateFraction = getBlobBaseFeeUpdateFraction(electra).u256 - fakeExponential( - MIN_BLOB_GASPRICE.u256, - excessBlobGas.u256, - blobBaseFeeUpdateFraction - ) +func getBlobBaseFee*(excessBlobGas: uint64, com: CommonRef, fork: EVMFork): UInt256 = + if fork >= FkCancun: + let blobBaseFeeUpdateFraction = com.getBlobBaseFeeUpdateFraction(fork).u256 + fakeExponential( + MIN_BLOB_GASPRICE.u256, + excessBlobGas.u256, + blobBaseFeeUpdateFraction + ) + else: + 0.u256 proc calcDataFee*(versionedHashesLen: int, excessBlobGas: uint64, - electra: bool): UInt256 = + com: CommonRef, fork: EVMFork): UInt256 = getTotalBlobGas(versionedHashesLen).u256 * - getBlobBaseFee(excessBlobGas, electra) + getBlobBaseFee(excessBlobGas, com, fork) func blobGasUsed(txs: openArray[Transaction]): uint64 = for tx in txs: diff --git a/nimbus/core/eip7691.nim b/nimbus/core/eip7691.nim index 2cadf76ed9..14742e897e 100644 --- a/nimbus/core/eip7691.nim +++ b/nimbus/core/eip7691.nim @@ -24,10 +24,6 @@ func getTargetBlobGasPerBlock*(electra: bool): uint64 = if electra: TARGET_BLOB_GAS_PER_BLOCK_ELECTRA.uint64 else: TARGET_BLOB_GAS_PER_BLOCK.uint64 -func getBlobBaseFeeUpdateFraction*(electra: bool): uint64 = - if electra: BLOB_BASE_FEE_UPDATE_FRACTION_ELECTRA.uint64 - else: BLOB_BASE_FEE_UPDATE_FRACTION.uint64 - const EVMForkToFork: array[FkCancun..EVMFork.high, HardFork] = [ Cancun, @@ -38,3 +34,7 @@ const func getMaxBlobsPerBlock*(com: CommonRef, fork: EVMFork): uint64 = doAssert(fork >= FkCancun) com.maxBlobsPerBlock(EVMForkToFork[fork]) + +func getBlobBaseFeeUpdateFraction*(com: CommonRef, fork: EVMFork): uint64 = + doAssert(fork >= FkCancun) + com.baseFeeUpdateFraction(EVMForkToFork[fork]) diff --git a/nimbus/core/tx_pool/tx_desc.nim b/nimbus/core/tx_pool/tx_desc.nim index 289bcb1717..ea2091884a 100644 --- a/nimbus/core/tx_pool/tx_desc.nim +++ b/nimbus/core/tx_pool/tx_desc.nim @@ -184,8 +184,7 @@ proc classifyValid(xp: TxPoolRef; tx: Transaction, sender: Address): bool = if tx.txType == TxEip4844: let excessBlobGas = xp.excessBlobGas - electra = xp.vmState.fork >= FkPrague - blobGasPrice = getBlobBaseFee(excessBlobGas, electra) + blobGasPrice = getBlobBaseFee(excessBlobGas, xp.vmState.com, xp.vmState.fork) if tx.maxFeePerBlobGas < blobGasPrice: debug "Invalid transaction: maxFeePerBlobGas lower than blobGasPrice", maxFeePerBlobGas = tx.maxFeePerBlobGas, diff --git a/nimbus/core/validate.nim b/nimbus/core/validate.nim index dc600e7b75..17bc6751c2 100644 --- a/nimbus/core/validate.nim +++ b/nimbus/core/validate.nim @@ -346,7 +346,7 @@ proc validateTransaction*( if tx.txType == TxEip4844: # ensure that the user was willing to at least pay the current data gasprice - let blobGasPrice = getBlobBaseFee(excessBlobGas, fork >= FkPrague) + let blobGasPrice = getBlobBaseFee(excessBlobGas, com, fork) if tx.maxFeePerBlobGas < blobGasPrice: return err("invalid tx: maxFeePerBlobGas smaller than blobGasPrice. " & &"maxFeePerBlobGas={tx.maxFeePerBlobGas}, blobGasPrice={blobGasPrice}") diff --git a/nimbus/rpc/oracle.nim b/nimbus/rpc/oracle.nim index 0a26073b06..6a8498a131 100644 --- a/nimbus/rpc/oracle.nim +++ b/nimbus/rpc/oracle.nim @@ -1,5 +1,5 @@ # Nimbus -# Copyright (c) 2024 Status Research & Development GmbH +# Copyright (c) 2024-2025 Status Research & Development GmbH # Licensed under either of # * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) # * MIT license ([LICENSE-MIT](LICENSE-MIT)) @@ -100,13 +100,13 @@ func calcBaseFee(com: CommonRef, bc: BlockContent): UInt256 = # fills in the rest of the fields. proc processBlock(oracle: Oracle, bc: BlockContent, percentiles: openArray[float64]): ProcessedFees = let - electra = com.isPragueOrLater(bc.header.timestamp) + fork = com.toEVMFork(bc.header) maxBlobGasPerBlock = getMaxBlobGasPerBlock(electra) result = ProcessedFees( baseFee: bc.header.baseFeePerGas.get(0.u256), - blobBaseFee: getBlobBaseFee(bc.header.excessBlobGas.get(0'u64), electra), + blobBaseFee: getBlobBaseFee(bc.header.excessBlobGas.get(0'u64), com, fork), nextBaseFee: calcBaseFee(oracle.com, bc), - nextBlobBaseFee: getBlobBaseFee(calcExcessBlobGas(bc.header, electra), electra), + nextBlobBaseFee: getBlobBaseFee(calcExcessBlobGas(bc.header, com, fork), com, fork), gasUsedRatio: float64(bc.header.gasUsed) / float64(bc.header.gasLimit), blobGasUsedRatio: float64(bc.header.blobGasUsed.get(0'u64)) / float64(maxBlobGasPerBlock) ) diff --git a/nimbus/rpc/rpc_utils.nim b/nimbus/rpc/rpc_utils.nim index 4475a05f4a..176bb3c864 100644 --- a/nimbus/rpc/rpc_utils.nim +++ b/nimbus/rpc/rpc_utils.nim @@ -1,5 +1,5 @@ # Nimbus -# Copyright (c) 2018-2024 Status Research & Development GmbH +# Copyright (c) 2018-2025 Status Research & Development GmbH # Licensed under either of # * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) # * MIT license ([LICENSE-MIT](LICENSE-MIT)) @@ -180,7 +180,7 @@ proc populateBlockObject*(blockHash: Hash32, result.requestsHash = header.requestsHash proc populateReceipt*(receipt: Receipt, gasUsed: GasInt, tx: Transaction, - txIndex: uint64, header: Header, electra: bool): ReceiptObject = + txIndex: uint64, header: Header, com: CommonRef): ReceiptObject = let sender = tx.recoverSender() var res = ReceiptObject() res.transactionHash = tx.rlpHash @@ -236,7 +236,7 @@ proc populateReceipt*(receipt: Receipt, gasUsed: GasInt, tx: Transaction, if tx.txType == TxEip4844: res.blobGasUsed = Opt.some(Quantity(tx.versionedHashes.len.uint64 * GAS_PER_BLOB.uint64)) - res.blobGasPrice = Opt.some(getBlobBaseFee(header.excessBlobGas.get(0'u64), electra)) + res.blobGasPrice = Opt.some(getBlobBaseFee(header.excessBlobGas.get(0'u64), com, com.toEVMFork(header))) return res diff --git a/nimbus/rpc/server_api.nim b/nimbus/rpc/server_api.nim index 468f4e7758..c4ef733805 100644 --- a/nimbus/rpc/server_api.nim +++ b/nimbus/rpc/server_api.nim @@ -368,7 +368,7 @@ proc setupServerAPI*(api: ServerAPIRef, server: RpcServer, ctx: EthContext) = let gasUsed = receipt.cumulativeGasUsed - prevGasUsed prevGasUsed = receipt.cumulativeGasUsed if idx == txDetails.index: - return populateReceipt(receipt, gasUsed, tx, txDetails.index, header, api.com.isPragueOrLater(header.timestamp)) + return populateReceipt(receipt, gasUsed, tx, txDetails.index, header, api.com) idx.inc else: # Receipt in memory @@ -382,8 +382,7 @@ proc setupServerAPI*(api: ServerAPIRef, server: RpcServer, ctx: EthContext) = if txid == idx: return populateReceipt( receipt, gasUsed, blkdesc.blk.transactions[txid], txid, blkdesc.blk.header, - api.com.isPragueOrLater(blkdesc.blk.header.timestamp) - ) + api.com) idx.inc @@ -666,7 +665,7 @@ proc setupServerAPI*(api: ServerAPIRef, server: RpcServer, ctx: EthContext) = for receipt in receipts: let gasUsed = receipt.cumulativeGasUsed - prevGasUsed prevGasUsed = receipt.cumulativeGasUsed - recs.add populateReceipt(receipt, gasUsed, txs[index], index, header, api.com.isPragueOrLater(header.timestamp)) + recs.add populateReceipt(receipt, gasUsed, txs[index], index, header, api.com) inc index return Opt.some(recs) except CatchableError: @@ -692,7 +691,7 @@ proc setupServerAPI*(api: ServerAPIRef, server: RpcServer, ctx: EthContext) = if header.excessBlobGas.isNone: raise newException(ValueError, "excessBlobGas missing from latest header") let blobBaseFee = - getBlobBaseFee(header.excessBlobGas.get, api.com.isPragueOrLater(header.timestamp)) * header.blobGasUsed.get.u256 + getBlobBaseFee(header.excessBlobGas.get, api.com, api.com.toEVMFork(header)) * header.blobGasUsed.get.u256 if blobBaseFee > high(uint64).u256: raise newException(ValueError, "blobBaseFee is bigger than uint64.max") return w3Qty blobBaseFee.truncate(uint64) diff --git a/nimbus/transaction/call_common.nim b/nimbus/transaction/call_common.nim index fff91ed248..703fd5c590 100644 --- a/nimbus/transaction/call_common.nim +++ b/nimbus/transaction/call_common.nim @@ -135,7 +135,7 @@ proc setupHost(call: CallParams, keepStack: bool): TransactionHost = origin : call.origin.get(call.sender), gasPrice : call.gasPrice, versionedHashes: call.versionedHashes, - blobBaseFee : getBlobBaseFee(vmState.blockCtx.excessBlobGas, vmState.fork >= FkPrague), + blobBaseFee : getBlobBaseFee(vmState.blockCtx.excessBlobGas, vmState.com, vmState.fork), ) # reset global gasRefund counter each time @@ -232,7 +232,7 @@ proc prepareToRunComputation(host: TransactionHost, call: CallParams) = # EIP-4844 if fork >= FkCancun: let blobFee = calcDataFee(call.versionedHashes.len, - vmState.blockCtx.excessBlobGas, fork >= FkPrague) + vmState.blockCtx.excessBlobGas, vmState.com, fork) db.subBalance(call.sender, blobFee) proc calculateAndPossiblyRefundGas(host: TransactionHost, call: CallParams): GasInt = diff --git a/tests/customgenesis/blobschedule_cancun_osaka.json b/tests/customgenesis/blobschedule_cancun_osaka.json index c6b7414e33..314b8b7998 100644 --- a/tests/customgenesis/blobschedule_cancun_osaka.json +++ b/tests/customgenesis/blobschedule_cancun_osaka.json @@ -16,11 +16,13 @@ "blobSchedule": { "cancun": { "target": 3, - "max": 6 + "max": 6, + "baseFeeUpdateFraction": 3338477 }, "osaka": { "target": 6, - "max": 9 + "max": 9, + "baseFeeUpdateFraction": 5007716 } } } diff --git a/tests/customgenesis/blobschedule_cancun_prague.json b/tests/customgenesis/blobschedule_cancun_prague.json index 3ca75e5fd5..89477a04d4 100644 --- a/tests/customgenesis/blobschedule_cancun_prague.json +++ b/tests/customgenesis/blobschedule_cancun_prague.json @@ -16,11 +16,13 @@ "blobSchedule": { "cancun": { "target": 3, - "max": 6 + "max": 6, + "baseFeeUpdateFraction": 3338477 }, "prague": { "target": 6, - "max": 9 + "max": 9, + "baseFeeUpdateFraction": 5007716 } } } diff --git a/tests/customgenesis/blobschedule_nobasefee.json b/tests/customgenesis/blobschedule_nobasefee.json new file mode 100644 index 0000000000..3ca75e5fd5 --- /dev/null +++ b/tests/customgenesis/blobschedule_nobasefee.json @@ -0,0 +1,27 @@ +{ + "config": { + "chainId": 7, + "homesteadBlock": 0, + "eip150Block": 0, + "eip150Hash": "0x5de1ee4135274003348e80b788e5afa4b18b18d320a5622218d5c493fedf5689", + "eip155Block": 0, + "eip158Block": 0, + "byzantiumBlock": 0, + "constantinopleBlock": 0, + "petersburgBlock": 0, + "istanbulBlock": 0, + "muirGlacierBlock": 0, + "berlinBlock": 0, + "londonBlock": 0, + "blobSchedule": { + "cancun": { + "target": 3, + "max": 6 + }, + "prague": { + "target": 6, + "max": 9 + } + } + } +} diff --git a/tests/customgenesis/blobschedule_prague.json b/tests/customgenesis/blobschedule_prague.json index 932db723d4..083ce9c3b6 100644 --- a/tests/customgenesis/blobschedule_prague.json +++ b/tests/customgenesis/blobschedule_prague.json @@ -16,7 +16,8 @@ "blobSchedule": { "prague": { "target": 6, - "max": 9 + "max": 9, + "baseFeeUpdateFraction": 5007716 } } } diff --git a/tests/customgenesis/merge.json b/tests/customgenesis/merge.json index 2948a8cb6f..533d1e08e6 100644 --- a/tests/customgenesis/merge.json +++ b/tests/customgenesis/merge.json @@ -11,16 +11,18 @@ "petersburgBlock": 0, "istanbulBlock": 0, "muirGlacierBlock": 0, - "berlinBlock": 0, + "berlinBlock": 0, "londonBlock": 0, "blobSchedule": { "cancun": { "target": 3, - "max": 6 + "max": 6, + "baseFeeUpdateFraction": 3338477 }, "prague": { "target": 6, - "max": 9 + "max": 9, + "baseFeeUpdateFraction": 5007716 } } }, diff --git a/tests/test_genesis.nim b/tests/test_genesis.nim index 09c37d8595..4a62d82e9f 100644 --- a/tests/test_genesis.nim +++ b/tests/test_genesis.nim @@ -152,28 +152,34 @@ proc customGenesisTest() = ]) == EmptyRequestsHash test "BlobSchedule": - template validateBlobSchedule(cg, fork, tgt, mx) = + template validateBlobSchedule(cg, fork, tgt, mx, fee) = check cg.config.blobSchedule[fork].isSome if cg.config.blobSchedule[fork].isSome: let bs = cg.config.blobSchedule[fork].get check bs.target == tgt check bs.max == mx + check bs.baseFeeUpdateFraction == fee var cg: NetworkParams check loadNetworkParams("blobschedule_cancun_prague.json".findFilePath, cg) - validateBlobSchedule(cg, Cancun, 3, 6) - validateBlobSchedule(cg, Prague, 6, 9) - validateBlobSchedule(cg, Osaka, 6, 9) + validateBlobSchedule(cg, Cancun, 3, 6, 3338477) + validateBlobSchedule(cg, Prague, 6, 9, 5007716) + validateBlobSchedule(cg, Osaka, 6, 9, 5007716) check loadNetworkParams("blobschedule_cancun_osaka.json".findFilePath, cg) - validateBlobSchedule(cg, Cancun, 3, 6) - validateBlobSchedule(cg, Prague, 3, 6) - validateBlobSchedule(cg, Osaka, 6, 9) + validateBlobSchedule(cg, Cancun, 3, 6, 3338477) + validateBlobSchedule(cg, Prague, 3, 6, 3338477) + validateBlobSchedule(cg, Osaka, 6, 9, 5007716) check loadNetworkParams("blobschedule_prague.json".findFilePath, cg) - validateBlobSchedule(cg, Cancun, 3, 6) # default fallback case - validateBlobSchedule(cg, Prague, 6, 9) - validateBlobSchedule(cg, Osaka, 6, 9) + validateBlobSchedule(cg, Cancun, 3, 6, 3338477) # default fallback case + validateBlobSchedule(cg, Prague, 6, 9, 5007716) + validateBlobSchedule(cg, Osaka, 6, 9, 5007716) + + check loadNetworkParams("blobschedule_nobasefee.json".findFilePath, cg) + validateBlobSchedule(cg, Cancun, 3, 6, 3338477) + validateBlobSchedule(cg, Prague, 6, 9, 3338477) + validateBlobSchedule(cg, Osaka, 6, 9, 3338477) proc genesisMain*() = genesisTest() diff --git a/tests/test_txpool.nim b/tests/test_txpool.nim index 79175a3f3f..2af6d692e1 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