Workaround for disallowed transaction superseding (#2181)

* Workaround for disallowed transaction superseding

The transaction spammer from Kurtosis keeps spamming transactions with
the same nonce because report 'pending' account nocne based on 'latest'
rather than actually considering the mempool. To avoid errors from
rejecting those, disable the required gas price bump when replacing
a transaction with a new nonce.

* Lint

* Skip superseding negative test
This commit is contained in:
Etan Kissling 2024-05-28 08:38:57 +02:00 committed by GitHub
parent b7a7745e24
commit 741fcca9b6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 18 additions and 9 deletions

View File

@ -77,7 +77,15 @@ proc supersede(xp: TxPoolRef; item: TxItemRef): Result[void,TxInfo]
return err(txInfoErrUnspecified) return err(txInfoErrUnspecified)
current = rc.value.data current = rc.value.data
# verify whether replacing is allowed, at all # TODO: To unblock `kurtosis-tech/ethereum-package` based testing,
# we have to accept superseding transactions temporarily until `rpc_utils.nim`
# supports the 'pending' tag by incorporating pending transactions from the
# mempool when returning the current account nonce. Until that is fixed,
# we keep telling the transaction spammer that their nonce has not changed,
# and it keeps spamming transactions with the same nonce repeatedly.
# Note: When this is fixed, update `tests/test_txpool.nim` and
# re-enable the "Superseding txs with sender and nonce variants" test case.
if false:
let bumpPrice = (current.tx.gasPrice * xp.priceBump.GasInt + 99) div 100 let bumpPrice = (current.tx.gasPrice * xp.priceBump.GasInt + 99) div 100
if item.tx.gasPrice < current.tx.gasPrice + bumpPrice: if item.tx.gasPrice < current.tx.gasPrice + bumpPrice:
return err(txInfoErrReplaceUnderpriced) return err(txInfoErrReplaceUnderpriced)

View File

@ -301,6 +301,7 @@ proc runTxPoolTests(noisy = true) =
check xq.nItems.total == testTxs.len check xq.nItems.total == testTxs.len
check xq.nItems.disposed == testTxs.len check xq.nItems.disposed == testTxs.len
if false: # Temporarily disabled, see `supersede` in `tx_add.nim`
# last update item was underpriced, so it must not have been # last update item was underpriced, so it must not have been
# replaced # replaced
var altLst = testTxs.toSeq.mapIt("alt " & it[0].info) var altLst = testTxs.toSeq.mapIt("alt " & it[0].info)