TxPool: rank calculator now include profit from blob fee (#2196)

* TxPool: rank calculator now include profit from blob fee

* Fix copyright year
This commit is contained in:
andri lim 2024-05-20 14:30:48 +07:00 committed by GitHub
parent 053fc79a8b
commit 38eaebc5c7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 4 deletions

View File

@ -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`

View File

@ -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