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

fix(txpool): respect propagate setting in the full tx stream #4362

Merged

Conversation

alexfertel
Copy link
Contributor

@alexfertel alexfertel commented Aug 25, 2023

This PR reuses some of the work in #4050 to avoid including non-propagatable tx in the full tx stream. Closes #4351.

struct TransactionListener<T: PoolTransaction> {
sender: mpsc::Sender<NewTransactionEvent<T>>,
/// Whether to include transactions that should not be propagated over the network.
kind: PendingTransactionListenerKind,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not that happy about reusing PendingTransactionListenerKind here. If this change is correct, how would you design this?

Copy link
Member

Choose a reason for hiding this comment

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

probably just rename it to TransactionListenerKind and replace the references in the docs for "pending" with something like "in this pool", wdyt @mattsse?

Copy link
Collaborator

Choose a reason for hiding this comment

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

yeah I like that, TransactionListenerKind is more appropriate

Comment on lines 147 to 153
fn new_pending_pool_transactions_listener(
&self,
) -> NewSubpoolTransactionStream<Self::Transaction> {
NewSubpoolTransactionStream::new(self.new_transactions_listener(), SubPool::Pending)
NewSubpoolTransactionStream::new(
self.new_transactions_listener_for(PendingTransactionListenerKind::PropagateOnly),
SubPool::Pending,
)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I didn't do the same refactor for SubPool::BaseFee or SubPool::Queued (right below this function) because I didn't see them used anywhere.

Copy link
Collaborator

Choose a reason for hiding this comment

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

this is reasonable, and we don't really have a usecase for this anyway

@alexfertel alexfertel marked this pull request as ready for review August 26, 2023 11:17
@onbjerg onbjerg added C-bug An unexpected or incorrect behavior A-tx-pool Related to the transaction mempool labels Aug 28, 2023
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.

awesome, sorry for the delay.

this is great, exactly what we wanted,

I only renamed the enum

struct TransactionListener<T: PoolTransaction> {
sender: mpsc::Sender<NewTransactionEvent<T>>,
/// Whether to include transactions that should not be propagated over the network.
kind: PendingTransactionListenerKind,
Copy link
Collaborator

Choose a reason for hiding this comment

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

yeah I like that, TransactionListenerKind is more appropriate

Comment on lines 147 to 153
fn new_pending_pool_transactions_listener(
&self,
) -> NewSubpoolTransactionStream<Self::Transaction> {
NewSubpoolTransactionStream::new(self.new_transactions_listener(), SubPool::Pending)
NewSubpoolTransactionStream::new(
self.new_transactions_listener_for(PendingTransactionListenerKind::PropagateOnly),
SubPool::Pending,
)
Copy link
Collaborator

Choose a reason for hiding this comment

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

this is reasonable, and we don't really have a usecase for this anyway

@mattsse mattsse enabled auto-merge August 29, 2023 03:04
@codecov
Copy link

codecov bot commented Aug 29, 2023

Codecov Report

Attention: Patch coverage is 51.16279% with 21 lines in your changes missing coverage. Please review.

Project coverage is 68.38%. Comparing base (863cc16) to head (c9f9426).
Report is 4691 commits behind head on main.

Files with missing lines Patch % Lines
crates/transaction-pool/src/pool/mod.rs 54.54% 10 Missing ⚠️
crates/transaction-pool/src/noop.rs 0.00% 7 Missing ⚠️
crates/transaction-pool/src/traits.rs 50.00% 4 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

Files with missing lines Coverage Δ
crates/transaction-pool/src/lib.rs 40.21% <100.00%> (+1.58%) ⬆️
crates/transaction-pool/src/traits.rs 10.91% <50.00%> (+2.39%) ⬆️
crates/transaction-pool/src/noop.rs 11.11% <0.00%> (-0.43%) ⬇️
crates/transaction-pool/src/pool/mod.rs 48.14% <54.54%> (+2.09%) ⬆️

... and 4 files with indirect coverage changes

Flag Coverage Δ
integration-tests 16.72% <51.16%> (+0.02%) ⬆️
unit-tests 63.62% <11.62%> (-0.03%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
reth binary 26.01% <ø> (ø)
blockchain tree 82.56% <ø> (ø)
pipeline 90.07% <ø> (ø)
storage (db) 74.72% <ø> (ø)
trie 94.84% <ø> (-0.04%) ⬇️
txpool 47.51% <51.16%> (+0.28%) ⬆️
networking 77.48% <ø> (ø)
rpc 57.96% <ø> (ø)
consensus 63.53% <ø> (ø)
revm 31.89% <ø> (ø)
payload builder 6.78% <ø> (ø)
primitives 86.29% <ø> (ø)

@mattsse mattsse added this pull request to the merge queue Aug 29, 2023
Merged via the queue into paradigmxyz:main with commit 03afe37 Aug 29, 2023
23 checks passed
@alexfertel alexfertel deleted the issue-4351-non-propagatable-tx-origin branch August 29, 2023 09:51
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 C-bug An unexpected or incorrect behavior
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Don't include non propagateable transaction origin in pending tx stream
3 participants