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: use network tx for Pool::Pooled #13159

Merged
merged 5 commits into from
Dec 5, 2024
Merged

feat: use network tx for Pool::Pooled #13159

merged 5 commits into from
Dec 5, 2024

Conversation

klkvr
Copy link
Collaborator

@klkvr klkvr commented Dec 5, 2024

Similar to #13086, but for Pooled transaction AT.

This relaxes bound on EthPoolTransaction, so they no longer require from/into traits for concrete PooledTransactionsEleement, and the conversion (Consensus, sidecar) -> Pooled is now abstracted as EthPoolTransaction::try_from_eip4844

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 only have one nit/suggestion, but this could also be done in a smol followup as good first issue

Comment on lines 1000 to 1002
.into_iter()
.map(|tx| tx.into_signed())
.collect::<Vec<_>>();
Copy link
Collaborator

Choose a reason for hiding this comment

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

this collect is a bit redundant and get_pooled_transaction_elements was a workaround to avoid the collect here

{
self.pool.get_pooled_transactions_as(tx_hashes, limit)
Copy link
Collaborator

Choose a reason for hiding this comment

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

this existed only so we can avoid a double-collect,
we can either find a way to enforce the
From<RecoveredTx<N::PooledTransaction>> again which would be a bit weird because this would always be into_signed.
or we add another helper fn to this trait that strips the Recovered layer away and returns just the pooled type

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

looks like this fn is only used here, so I've just made it return transactions with already stripped signer e6c0f18

Copy link
Collaborator

Choose a reason for hiding this comment

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

makes sense

Comment on lines +704 to +705
Pool::Transaction:
PoolTransaction<Consensus = N::BroadcastedTransaction, Pooled = N::PooledTransaction>,
Copy link
Collaborator

Choose a reason for hiding this comment

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

hmm, I think this would work for both OP and eth,
but for OP's case this would mean Consensus must be a different type that what we currently have for TransactionSigned (minus the deposit variant)

so Conensus really just means: All consensus variants that are allowed over p2p

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

couldn't Consensus be same as Pooled for OP?

Copy link
Collaborator

Choose a reason for hiding this comment

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

yes, for op these are the same type, basically TransactionSigned - Deposit

@@ -981,7 +967,7 @@ pub trait PoolTransaction:
type Consensus;

/// Associated type representing the recovered pooled variant of the transaction.
type Pooled: Encodable2718 + Into<Self>;
type Pooled: SignedTransaction;
Copy link
Collaborator

Choose a reason for hiding this comment

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

makes sense, we don't expect non signed txs here

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yeah, it's also more like a RecoverableTransaction

Comment on lines -1148 to -1152
PoolTransaction<
Pooled: From<PooledTransactionsElementEcRecovered>
+ Into<PooledTransactionsElementEcRecovered>
+ Into<PooledTransactionsElement>,
>
Copy link
Collaborator

Choose a reason for hiding this comment

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

amazing

@mattsse mattsse added the A-tx-pool Related to the transaction mempool label Dec 5, 2024
@klkvr klkvr enabled auto-merge December 5, 2024 17:06
@mattsse mattsse disabled auto-merge December 5, 2024 18:50
@mattsse mattsse merged commit 8226fa0 into main Dec 5, 2024
35 of 39 checks passed
@mattsse mattsse deleted the klkvr/pooled-recovered branch December 5, 2024 18:50
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