From 38eaebc5c7c4c6d4770410eb333ae349976a53a7 Mon Sep 17 00:00:00 2001 From: andri lim Date: Mon, 20 May 2024 14:30:48 +0700 Subject: [PATCH] TxPool: rank calculator now include profit from blob fee (#2196) * TxPool: rank calculator now include profit from blob fee * Fix copyright year --- nimbus/core/tx_pool/tx_tabs/tx_sender.nim | 7 ++++--- nimbus/core/tx_pool/tx_tasks/tx_packer.nim | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/nimbus/core/tx_pool/tx_tabs/tx_sender.nim b/nimbus/core/tx_pool/tx_tabs/tx_sender.nim index d4cfc5f3b..f000ada6b 100644 --- a/nimbus/core/tx_pool/tx_tabs/tx_sender.nim +++ b/nimbus/core/tx_pool/tx_tabs/tx_sender.nim @@ -1,5 +1,5 @@ # Nimbus -# Copyright (c) 2018 Status Research & Development GmbH +# Copyright (c) 2018-2024 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) @@ -17,7 +17,8 @@ import ../tx_info, ../tx_item, eth/[common], - stew/[results, keyed_queue, keyed_queue/kq_debug, sorted_set] + stew/[results, keyed_queue, keyed_queue/kq_debug, sorted_set], + ../../eip4844 {.push raises: [].} @@ -120,7 +121,7 @@ proc getRank(schedData: TxSenderSchedRef): int64 = proc maxProfit(item: TxItemRef; baseFee: GasPrice): float64 = ## Profit calculator - item.tx.gasLimit.float64 * item.tx.effectiveGasTip(baseFee).float64 + item.tx.gasLimit.float64 * item.tx.effectiveGasTip(baseFee).float64 + item.tx.getTotalBlobGas.float64 proc recalcProfit(nonceData: TxSenderNonceRef; baseFee: GasPrice) = ## Re-calculate profit value depending on `baseFee` diff --git a/nimbus/core/tx_pool/tx_tasks/tx_packer.nim b/nimbus/core/tx_pool/tx_tasks/tx_packer.nim index c021d0387..4d48529fa 100644 --- a/nimbus/core/tx_pool/tx_tasks/tx_packer.nim +++ b/nimbus/core/tx_pool/tx_tasks/tx_packer.nim @@ -195,7 +195,7 @@ proc vmExecGrabItem(pst: TxPackerStateRef; item: TxItemRef): Result[bool,void] # EIP-4844 if pst.numBlobPerBlock + item.tx.versionedHashes.len > MAX_BLOBS_PER_BLOCK: - return err() # stop collecting + return ok(false) # continue with next account pst.numBlobPerBlock += item.tx.versionedHashes.len # Verify we have enough gas in gasPool