Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Penalize invalid transient pending transactions in the layered transaction pool #7359

Merged
merged 4 commits into from
Jul 25, 2024

Conversation

fab-10
Copy link
Contributor

@fab-10 fab-10 commented Jul 22, 2024

PR description

This PR improve the layered txpool, avoiding that invalid transient* pending txs will be continuously evaluated for block inclusion, potentially preventing the evaluation of other valid pending txs that rank behind the former one.

The goal is simple, just penalize invalid transient pending txs, pushing then down in the rank, after all the other, so they will have a chance to be evaluated, but only after all the non-penalized, or less penalized, pending txs have been evaluated.
To achieve this, the PendingTransaction now has a score, that start with the max value (127) and it is decremented on every penalization, and that score is now taken in consideration when sorting pending transaction in the layers.

  • invalid transient pending tx means that the tx cannot be included now in the block, but it could be in a future block, because it has a transient issue, for example not enough balance in the sender wallet, or gas price below the min and so on, all conditions that could resolve in the future.

Fixed Issue(s)

Thanks for sending a pull request! Have you done the following?

  • Checked out our contribution guidelines?
  • Considered documentation and added the doc-change-required label to this PR if updates are required.
  • Considered the changelog and included an update if required.
  • For database changes (e.g. KeyValueSegmentIdentifier) considered compatibility and performed forwards and backwards compatibility tests

Locally, you can run these tests to catch failures early:

  • unit tests: ./gradlew build
  • acceptance tests: ./gradlew acceptanceTest
  • integration tests: ./gradlew integrationTest
  • reference tests: ./gradlew ethereum:referenceTests:referenceTests

@fab-10 fab-10 force-pushed the layered-txpool-scored-tx branch 2 times, most recently from c1ee077 to 9be3e6b Compare July 22, 2024 15:48
@fab-10 fab-10 marked this pull request as ready for review July 22, 2024 16:48
Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
Copy link
Contributor

@jflo jflo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the synchronization could be internalized to AbstractPrioritizedTransactions a little better, but not enough to block.

Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
@macfarla macfarla merged commit 30dfa66 into hyperledger:main Jul 25, 2024
40 checks passed
gconnect pushed a commit to gconnect/besu that referenced this pull request Aug 26, 2024
…ction pool (hyperledger#7359)

* Introduce score for pending transactions

Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>

* Introduce score for pending transactions

Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>

* Update package javadoc

Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>

---------

Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
Signed-off-by: gconnect <agatevureglory@gmail.com>
@fab-10 fab-10 deleted the layered-txpool-scored-tx branch September 4, 2024 14:34
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.

3 participants