Skip to content

Introduce a timeout for the evaluation of a single tx during block creation#6089

Closed
fab-10 wants to merge 76 commits intohyperledger:mainfrom
fab-10:time-limited-tx-processing-block-creation
Closed

Introduce a timeout for the evaluation of a single tx during block creation#6089
fab-10 wants to merge 76 commits intohyperledger:mainfrom
fab-10:time-limited-tx-processing-block-creation

Conversation

@fab-10
Copy link
Contributor

@fab-10 fab-10 commented Oct 25, 2023

PR description

This PR is built on top of #6044, so please check it first. Diff between PRs

This PR is a continuation of #6044, and introduce the possibility to configure a max amount of time the evaluation of a single tx could take during block creation, this to avoid that a single slow processing tx consumes all the time dedicated to the block creation.
If a tx evaluation hit the timeout, the tx is removed from the txpool, to avoid that it will tried again on a future block creation.

This timeout is configurable using the new experimental option:

  • --Xtxs-selection-per-tx-max-time in milliseconds

that by default is set to the same value of --Xtxs-selection-max-time, so by default a single tx is allowed to use all the time reserved for block creation, but could be set to a lower value.

In case of a tx evaluation timeout a warning is logged:

Interrupting transaction evaluation since it is taking more than the max configured time of 10ms. Tx with hash: 0xab34d5061d5daee4a5f58f3f9ff76935963aff3ed8990474d1d7e140d6d41787 will be removed from the pool

fab-10 and others added 30 commits October 10, 2023 15:44
Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
# Conflicts:
#	ethereum/blockcreation/src/main/java/org/hyperledger/besu/ethereum/blockcreation/txselection/BlockTransactionSelector.java
#	ethereum/blockcreation/src/test/java/org/hyperledger/besu/ethereum/blockcreation/AbstractBlockTransactionSelectorTest.java
#	plugin-api/build.gradle
Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
This reverts commit e89a244.

Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
# Conflicts:
#	ethereum/blockcreation/src/main/java/org/hyperledger/besu/ethereum/blockcreation/txselection/selectors/PriceTransactionSelector.java
Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
# Conflicts:
#	consensus/merge/src/main/java/org/hyperledger/besu/consensus/merge/blockcreation/MergeCoordinator.java
#	consensus/merge/src/test/java/org/hyperledger/besu/consensus/merge/blockcreation/MergeReorgTest.java
#	ethereum/blockcreation/src/main/java/org/hyperledger/besu/ethereum/blockcreation/PoWMinerExecutor.java
#	plugin-api/src/main/java/org/hyperledger/besu/plugin/data/TransactionSelectionResult.java
Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
to avoid that a long running tx processing invalidates the already
computed world state

Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
# Conflicts:
#	CHANGELOG.md
#	ethereum/blockcreation/src/test/java/org/hyperledger/besu/ethereum/blockcreation/AbstractBlockTransactionSelectorTest.java
#	plugin-api/build.gradle
Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
[skip ci]
Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
# Conflicts:
#	CHANGELOG.md
#	ethereum/blockcreation/src/test/java/org/hyperledger/besu/ethereum/blockcreation/AbstractBlockTransactionSelectorTest.java
#	plugin-api/build.gradle
Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
…ssing-block-creation

# Conflicts:
#	CHANGELOG.md
#	besu/src/main/java/org/hyperledger/besu/cli/options/MiningOptions.java
#	besu/src/test/java/org/hyperledger/besu/cli/options/MiningOptionsTest.java
#	ethereum/blockcreation/src/main/java/org/hyperledger/besu/ethereum/blockcreation/txselection/BlockTransactionSelector.java
#	ethereum/blockcreation/src/test/java/org/hyperledger/besu/ethereum/blockcreation/AbstractBlockTransactionSelectorTest.java
#	ethereum/blockcreation/src/test/java/org/hyperledger/besu/ethereum/blockcreation/LondonFeeMarketBlockTransactionSelectorTest.java
#	plugin-api/build.gradle
@fab-10 fab-10 force-pushed the time-limited-tx-processing-block-creation branch from 5ffbc3a to ae9dbd1 Compare November 2, 2023 19:38
Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
# Conflicts:
#	CHANGELOG.md
#	besu/src/main/java/org/hyperledger/besu/controller/CliqueBesuControllerBuilder.java
#	consensus/clique/src/main/java/org/hyperledger/besu/consensus/clique/blockcreation/CliqueMinerExecutor.java
#	consensus/clique/src/test/java/org/hyperledger/besu/consensus/clique/blockcreation/CliqueMinerExecutorTest.java
Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
…ssing-block-creation

# Conflicts:
#	CHANGELOG.md
Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
@fab-10 fab-10 force-pushed the time-limited-tx-processing-block-creation branch 2 times, most recently from a4ccdb5 to 677ecbd Compare November 3, 2023 17:27
Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
@fab-10 fab-10 force-pushed the time-limited-tx-processing-block-creation branch from 677ecbd to 8fab043 Compare November 3, 2023 18:16
# Conflicts:
#	CHANGELOG.md
#	plugin-api/build.gradle
…ssing-block-creation

# Conflicts:
#	plugin-api/build.gradle
Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
@fab-10 fab-10 force-pushed the time-limited-tx-processing-block-creation branch from 2baf2ad to 1b2f62f Compare November 6, 2023 12:46
# Conflicts:
#	CHANGELOG.md
#	ethereum/blockcreation/src/main/java/org/hyperledger/besu/ethereum/blockcreation/AbstractBlockCreator.java
#	ethereum/blockcreation/src/main/java/org/hyperledger/besu/ethereum/blockcreation/txselection/BlockTransactionSelector.java
#	ethereum/blockcreation/src/test/java/org/hyperledger/besu/ethereum/blockcreation/AbstractBlockTransactionSelectorTest.java
#	plugin-api/build.gradle
@fab-10 fab-10 marked this pull request as draft November 7, 2023 12:57
…ssing-block-creation

# Conflicts:
#	ethereum/blockcreation/src/main/java/org/hyperledger/besu/ethereum/blockcreation/txselection/BlockTransactionSelector.java
#	plugin-api/build.gradle
…meout

Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
# Conflicts:
#	CHANGELOG.md
#	besu/src/main/java/org/hyperledger/besu/cli/options/MiningOptions.java
#	besu/src/test/java/org/hyperledger/besu/cli/options/MiningOptionsTest.java
#	consensus/merge/src/test/java/org/hyperledger/besu/consensus/merge/blockcreation/MergeCoordinatorTest.java
#	ethereum/blockcreation/src/main/java/org/hyperledger/besu/ethereum/blockcreation/txselection/BlockTransactionSelector.java
#	ethereum/blockcreation/src/test/java/org/hyperledger/besu/ethereum/blockcreation/AbstractBlockTransactionSelectorTest.java
#	ethereum/blockcreation/src/test/java/org/hyperledger/besu/ethereum/blockcreation/LondonFeeMarketBlockTransactionSelectorTest.java
#	ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/MiningParameters.java
#	ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/manager/EthScheduler.java
#	plugin-api/build.gradle
#	plugin-api/src/main/java/org/hyperledger/besu/plugin/data/TransactionSelectionResult.java
@fab-10
Copy link
Contributor Author

fab-10 commented Nov 22, 2023

Closing since implementing this require making tx processing thread safe, implemented a lighter version of this in #6163

@fab-10 fab-10 closed this Nov 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants