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

feat: add a wrapper for BestTransactions prioritizing given senders #12123

Merged
merged 2 commits into from
Oct 28, 2024

Conversation

klkvr
Copy link
Collaborator

@klkvr klkvr commented Oct 28, 2024

Adds a type that wraps inner BestTransactions implementation and yields transactions from selected senders first until a certain gas limit cap.

@klkvr klkvr requested a review from mattsse as a code owner October 28, 2024 01:41
Copy link
Collaborator

@mattsse mattsse left a comment

Choose a reason for hiding this comment

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

this will work.

one nit

crates/transaction-pool/src/pool/best.rs Outdated Show resolved Hide resolved
T: PoolTransaction,
{
fn mark_invalid(&mut self, tx: &Self::Item) {
self.inner.mark_invalid(tx)
Copy link
Collaborator

Choose a reason for hiding this comment

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

we also need to remove all entries in the buffer, here I think?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

invalid transaction would already be not there so it would make sense to only remove transactions that depend on it, however, we don't yet have this logic in primary BestTransactions impl

i.e we just insert it but no transactions from all or independent are getting removed

pub(crate) fn mark_invalid(&mut self, tx: &Arc<ValidPoolTransaction<T::Transaction>>) {
self.invalid.insert(*tx.hash());
}

should we fix it?

Copy link
Collaborator

Choose a reason for hiding this comment

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

we just insert it but no transactions from all or independent are getting removed

oh, you're right. I'll open a good first issue for this then

@mattsse mattsse added the A-tx-pool Related to the transaction mempool label Oct 28, 2024
@mattsse mattsse merged commit d74730a into main Oct 28, 2024
38 of 40 checks passed
@mattsse mattsse deleted the klkvr/prio-senders branch October 28, 2024 12:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-tx-pool Related to the transaction mempool
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants