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

txview: run status and age checks on incoming transactions #4506

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

apfitzge
Copy link

Problem

  • view transaction parsing option in banking stage does not run status/age checks before inserting transactions into the buffer
  • this means that aged out, high priority, transactions may push out lower-priority but still valid transactions

Summary of Changes

  • Insert all valid transactions into the map on receive (map only, not priority queue)
  • Check ages in batches (batch size is equal to the extra capacity we reserved in the map)
  • Insert only valid transaction's id into priority queue, drop lowest priority if at capacity

Fixes #

@apfitzge apfitzge self-assigned this Jan 16, 2025
let mut run_status_age_checks =
|container: &mut TransactionViewStateContainer,
transaction_ids: &mut ArrayVec<usize, 64>| {
// Temporary scope so that transaction references are immediately
Copy link
Author

Choose a reason for hiding this comment

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

complexity here can go away once we have Bytes backed transactions coming from upstream, since we do not need to do the weird "insert to map only" pattern.

vacant_entry.insert(state);

// Push the transaction into the queue.
self.inner
Copy link
Author

Choose a reason for hiding this comment

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

No longer push into the queue here. We just let up to 64 (see EXTRA_CAPACITY const) additional transactions to live in the map. Once we reach end of incoming tx stream or hit 64 packets we run age checks and only THEN do we insert into the priority queue.
This means that txs that are already processed or too old will not push out transactions that can be processed.

@apfitzge apfitzge marked this pull request as ready for review January 16, 2025 23:11
@apfitzge apfitzge requested a review from jstarry January 16, 2025 23:12
@apfitzge
Copy link
Author

Follow-up to #3820

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.

1 participant