-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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(transaction-pool): chaining & static txs for best transactions trait #12320
feat(transaction-pool): chaining & static txs for best transactions trait #12320
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this looks great!
I only have one suggestion so we can merge this and improve how we track invalid senders separately.
also I'm wondering, because the PayloadTransactions
are only intended for payload building and we likely want to add some evm related things to ctx
, perhaps the txpool crate isn't the best location for this.
but all of the other payload crates are currently also not using anything evm, so we can keep everything where it is for now, and instead move it later once we need to evm support
fn next( | ||
&mut self, | ||
// In the future, `ctx` can include access to state for block building purposes. | ||
ctx: (), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cool, this will be very useful shortly
impl<T: PoolTransaction<Consensus: Into<TransactionSignedEcRecovered>>> PayloadTransactions | ||
for Box<dyn crate::BestTransactions<Item = Arc<ValidPoolTransaction<T>>>> | ||
{ | ||
fn next(&mut self, _ctx: ()) -> Option<TransactionSignedEcRecovered> { | ||
Iterator::next(self).map(|tx| tx.to_recovered_transaction()) | ||
} | ||
|
||
fn mark_invalid(&mut self, _sender: Address, _nonce: u64) { | ||
// TODO: Implement this. Can't use BestTransactions::mark_invalid directly | ||
// because it requires a sender ID. | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I'd prefer not to mix these traits for now, and instead introduce a simple helper type that tracks invalid senders in a HashSet instead, this would unblock the pr entirely.
like
struct BestPayloadTransaction<I> {
invalid: HashSet<Address>,
best: I
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agree, updated, please check if that's what you had in mind.
…ransactions-composability # Conflicts: # crates/optimism/node/src/utils.rs # crates/optimism/payload/src/builder.rs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
awesome!
Issue #12307.
PayloadTransactionsChain
andPayloadTransactionsFixed
.PayloadTransactions
instead ofBestTransactions
in block composition. For a simple transition,BestPayloadTransactions
wrapper is introduced.