Changing workflow of consuming buffered packets #23086
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
For leader to prioritize transactions by
total_fee/total_cu
(#22820), it needs access all buffered packets as deserialized and sanitized transactions in order to get transaction CUs and total fee. In currentretain_mut
loop, no good place to convert all buffered unprocessed packets into transactions.Proposal:
To replace current "process packets while looping through buffer" with following workflow:
consume_buffered_packets
iterate through buffered packet_batches for all unprocessed packet, produce Vec< packet_locator >, wherepacket_locator
is (batch_index, packet_index). Therefore, the total number of packet_locator is the number of unprocessed packets in buffer;buffer[batch_index, packet_index]
) into SanitizedTransactions, produceHashMap< packet_locator, SanitizedTransaction >
tot_fee / tot_CUs
for each transaction in above HashMap, produceHashMap< fee/cu, packet_locator>
chunk
of SanitizedTransactions toBankingStage::process_transactions()
.Concerns:
Consume_buffered_packets()
), itis now processing transaction-by-transaction, instead ofcan still processchunk
of transactions to amortize account locking/loading cost and preserve entry size (thanks @sakridge )Summary of Changes
Fixes #