besu icon indicating copy to clipboard operation
besu copied to clipboard

feat: Implemented transaction selection time of high score transactions

Open Shivang14d04 opened this issue 2 weeks ago • 3 comments

PR description

This PR adds the time spent selecting high-scored transactions during block creation.

This change adds a new timing metric, txsSelectionHighScore, which is measured during transaction pool selection and logged alongside existing block creation timing metrics.

Fixed Issue(s)

fixes #9179

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

  • [x] 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:

  • [x] spotless: ./gradlew spotlessApply
  • [ ] unit tests: ./gradlew build
  • [ ] acceptance tests: ./gradlew acceptanceTest
  • [ ] integration tests: ./gradlew integrationTest
  • [ ] reference tests: ./gradlew ethereum:referenceTests:referenceTests
  • [ ] hive tests: Engine or other RPCs modified?

Shivang14d04 avatar Dec 09 '25 21:12 Shivang14d04

@Shivang14d04 thanks for the PR - can you rebase off latest main please, then we can get someone to review. Thanks!

macfarla avatar Dec 09 '25 21:12 macfarla

Hi @macfarla, I’ve rebased the PR on the latest main. The branch is now ready for review.

Shivang14d04 avatar Dec 10 '25 08:12 Shivang14d04

@ahamlat is this what you want? from the description I could assume that you only want the time spent processing tx with the highest score

I think this implementation doesn't address the issue I created. The idea of the issue is to have the "real selection time" in case of selection timeout. Let's say a block of 10 transactions was built where each transaction took 1ms to be selected, and the 11th transaction was too slow to be selected and triggered timeout :

  • Tx 1 selection time : 1 ms
  • Tx 2 selection time : 1 ms
  • Tx 3 selection time : 1 ms
  • ..
  • Tx 10 selection time : 1 ms
  • Tx 11 Timeout during transaction selection

In this, I would like to have the time it took to select tx 1 to tx 10, instead of just having 1.8 second in case of a 2 seconds block time.

@Shivang14d04 Your implementation should be reviewed to address the case I shared.

ahamlat avatar Dec 12 '25 12:12 ahamlat