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(payload builder): transaction pool filter #10542

Merged
merged 12 commits into from
Oct 24, 2024

Conversation

greged93
Copy link
Contributor

  • Adds a TransactionFilter trait, exposing a is_valid function that can be called in order to verify if the provided transaction passes the filtering implemented.
  • Implements the above mentioned trait on a NoOpTransactionFilter which lets all transactions pass.

Closes #10437

@greged93 greged93 changed the title feat: tx filter feat(payload builder): transaction pool filter Aug 26, 2024
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.

sorry about the delay.

this direction makes sense,
I'd like to move the trait to txpool crate so we can also reuse it for OP and because this is only really relevant when used on the pool, then we can easily add more filters and helpers to combine with the BestTransactions for example

Comment on lines 89 to 100
default_ethereum_payload_builder(
self.evm_config.clone(),
args,
NoOpTransactionFilter::new(),
)
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'd like to tackle this feature differently, by giving the

pub struct EthereumPayloadBuilder<EvmConfig = EthEvmConfig> {

an instance of a filter

crates/ethereum/payload/src/filter.rs Outdated Show resolved Hide resolved
@mattsse mattsse added A-block-building Related to block building A-tx-pool Related to the transaction mempool labels Sep 3, 2024
@greged93 greged93 force-pushed the feat/pool-tx-attributes branch from bd2ca25 to 33ecdbc Compare September 5, 2024 14:44
@greged93 greged93 requested a review from gakonst as a code owner September 5, 2024 14:44
Comment on lines 236 to 239
let payload_builder = reth_ethereum_payload_builder::EthereumPayloadBuilder::new(
self.evm_config,
NoopTransactionFilter::new(),
);
Copy link
Contributor Author

@greged93 greged93 Sep 5, 2024

Choose a reason for hiding this comment

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

I know this isn't great and would probably be better to have the filter in EthereumPayloadBuilder here too, but this added a lot of constraints:

  • either we added a generic TxFilter to it as done lower, which meant we add to add this generic to EthereumNode::componentsand the to Node trait implementation. I think this generic shouldn't be present on either of these.

  • we have a default filter which would be NoopTransactionFilter but it requires a GAT Transaction which represents the transaction we are filtering over (in this case a pool transaction).

I feel like the second solution is better but not quite doable in a clean way yet, since I think we need FullNodeTypes to expose the pool transaction type.

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.

last suggestions

reth_ethereum_payload_builder::EthereumPayloadBuilder::new(self.evm_config);
let payload_builder = reth_ethereum_payload_builder::EthereumPayloadBuilder::new(
self.evm_config,
NoopTransactionFilter::new(),
Copy link
Collaborator

Choose a reason for hiding this comment

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

this should not break, noop is default and should not be necessary here

use tracing::{debug, trace, warn};

/// Ethereum payload builder
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct EthereumPayloadBuilder<EvmConfig = EthEvmConfig> {
pub struct EthereumPayloadBuilder<TxFilter, EvmConfig = EthEvmConfig> {
Copy link
Collaborator

Choose a reason for hiding this comment

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

the positions should be flipped with TxFilter as a default

Comment on lines 789 to 800
pub const fn new() -> Self {
Self(std::marker::PhantomData)
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

this function should be replaced with a default impl

Copy link
Collaborator

Choose a reason for hiding this comment

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

these changes can be reverted if we keep the new function as is

@greged93 greged93 force-pushed the feat/pool-tx-attributes branch 2 times, most recently from 9062b0c to 2d62b26 Compare September 6, 2024 13:38
@greged93
Copy link
Contributor Author

@mattsse slight bump on this :)

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.

cool, I'm marking this as completed.

I have another idea about the default_ethereum_payload_builder call, but I need to check this first.

ty

@mattsse mattsse self-assigned this Sep 10, 2024
@greged93 greged93 force-pushed the feat/pool-tx-attributes branch 2 times, most recently from dc2b554 to 42000c9 Compare September 10, 2024 13:26
@greged93 greged93 force-pushed the feat/pool-tx-attributes branch from 42000c9 to 0d3a3ea Compare September 20, 2024 06:50
@mattsse mattsse force-pushed the feat/pool-tx-attributes branch from 696d1d8 to 8838b81 Compare October 24, 2024 12:58
@mattsse mattsse force-pushed the feat/pool-tx-attributes branch from 8838b81 to 98b3f8a Compare October 24, 2024 12:59
@mattsse
Copy link
Collaborator

mattsse commented Oct 24, 2024

I've undone the payload builder integration because I have something else in mind now

@mattsse mattsse enabled auto-merge October 24, 2024 13:01
@mattsse mattsse added this pull request to the merge queue Oct 24, 2024
Merged via the queue into paradigmxyz:main with commit 11149d2 Oct 24, 2024
39 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-block-building Related to block building A-tx-pool Related to the transaction mempool
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Extend PayloadBuilder Attributes with pool settings
2 participants