Skip to content

Conversation

@danielradu10
Copy link
Contributor

@danielradu10 danielradu10 commented Dec 10, 2025

Reasoning behind the pull request

  • At the moment, when we insert a new transaction in pool, we also have to insert the transaction in the list for sender. Currently, the list of transactions for a specific sender is a doubly linked list. This means that for finding the insertion place of a new txs, we have to iterate over the list. In the worst scenario, this might not be the best solution.

This PR introduces a new data structure, a Red Black Tree (a balanced BST) which allows us finding the insertion place of a new element in O(log n).

Proposed changes

  • added transactions red black tree
  • make use of the tree
  • unit tests, benchmarks

Testing procedure

Pre-requisites

Based on the Contributing Guidelines the PR author and the reviewers must check the following requirements are met:

  • was the PR targeted to the correct branch?
  • if this is a larger feature that probably needs more than one PR, is there a feat branch created?
  • if this is a feat branch merging, do all satellite projects have a proper tag inside go.mod?

@danielradu10 danielradu10 self-assigned this Dec 10, 2025
@codecov
Copy link

codecov bot commented Dec 10, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 77.60%. Comparing base (18aaf4c) to head (9d0f673).
⚠️ Report is 1 commits behind head on feat/supernova-async-exec.

Additional details and impacted files
@@                    Coverage Diff                     @@
##           feat/supernova-async-exec    #7525   +/-   ##
==========================================================
  Coverage                      77.60%   77.60%           
==========================================================
  Files                            874      875    +1     
  Lines                         119875   119897   +22     
==========================================================
+ Hits                           93031    93049   +18     
- Misses                         20749    20754    +5     
+ Partials                        6095     6094    -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

return (node.Key).(*list.Element), nil
}

return nil, nil
Copy link
Contributor

Choose a reason for hiding this comment

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

return nil, nil should not happen.


if insertionPlace == nil {
listForSender.items.PushFront(tx)
element := listForSender.items.PushFront(tx)
Copy link
Contributor

Choose a reason for hiding this comment

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

I get this is how it was used, but returning nil, nil from findInsertionPlace is a bad design, you could return and extra bool, and solve with that.

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