-
Notifications
You must be signed in to change notification settings - Fork 2.2k
POC of interop filtering during block building #15348
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
POC of interop filtering during block building #15348
Conversation
23d8df4 to
263aaaa
Compare
emhane
left a comment
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.
as long as txns aren't marked invalid, this should work, since transactions are cloned when passed to BestPayloadTransactions
reth/crates/transaction-pool/src/pool/parked.rs
Lines 272 to 286 in dd76b42
| /// Returns all transactions that satisfy the given basefee. | |
| /// | |
| /// Note: this does _not_ remove the transactions | |
| #[allow(dead_code)] | |
| pub(crate) fn satisfy_base_fee_transactions( | |
| &self, | |
| basefee: u64, | |
| ) -> Vec<Arc<ValidPoolTransaction<T>>> { | |
| let ids = self.satisfy_base_fee_ids(basefee); | |
| let mut txs = Vec::with_capacity(ids.len()); | |
| for id in ids { | |
| txs.push(self.get(&id).expect("transaction exists").transaction.clone().into()); | |
| } | |
| txs | |
| } |
| // Check that cross chain tx is validated by supervisor for this block | ||
| if let Some(interop) = interop { | ||
| if !interop.is_valid(self.config.attributes.timestamp()) { | ||
| best_txs.mark_invalid(tx.signer(), tx.nonce()); |
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 line needs to be removed! otherwise the txns have no chance of ever becoming valid
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.
Okay, makes sense, because we will remove them on the next block update anyway
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.
But i think mark_invalid would work too, because we validate txs upon receiving for 1h, so we won't have a case when transaction that wasn't validated ends up in pending pool
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.
right, so we can guarantee this mark_invalid only effects the virtualisation BestTransactions over the pool, i.e. no message is sent to tx pool to change the status of the tx to invalid or similar
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.
the mark_invalid only affects the BestTransactions iterator, see:
this does not interact with the pool
so we need this here
| let interop = tx.interop(); | ||
| let tx = tx.into_consensus(); | ||
| // Check that cross chain tx is validated by supervisor for this block | ||
| if let Some(interop) = interop { |
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.
| if let Some(interop) = interop { | |
| if let Some(interop) = tx.interop() { |
nitpick, redundant bind which doesn't make code more simple to read
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.
The problem is that once i do let tx = tx.into_consensus(); i don't have access to interop
And to make invalid it need to do let tx = tx.into_consensus(); to get the signer :)
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.
Fixed be removing mark_invalid
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.
ah, makes sense, my bad. we can keep mark_invalid, see prev comment.
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.
Anyway presence/absence of mark_invalid won't do anything as we have proper maintenance in place
mattsse
left a comment
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.
yeah this is easier,
I still want the other feature but this isn't strictly required for sequencer support, and we likely need some additional features for the context, like evm access
| // maintenance job | ||
| if let Some(interop) = tx.interop() { | ||
| if !interop.is_valid(self.config.attributes.timestamp()) { | ||
| continue |
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.
we need to mark this one as invalid, so that the iter clears the sender's txs that we know won't be valid:
best_txs.mark_invalid(tx.signer(), tx.nonce());
we also should only do this after all the less expensive checks after the 4844 sanity check on L646
mattsse
left a comment
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.
lgtm
@nkysg for vis because this introduces another call to the interop fn
| continue | ||
| } | ||
| } | ||
| let interop = tx.interop(); |
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.
ah I overlooked the that we need to convert the tx, so we don't actually safe anything by moving the check down below
this is still fine
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.
Yes 😁
We save 1 instruction :)
mattsse
left a comment
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.
checking what's wrong with the tests
Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
…rrors into interop variants (paradigmxyz#15323) Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
|
fucked up the merge taking over |
| transaction.set_interop(TransactionInterop { | ||
| timeout: self.block_timestamp() + TRANSACTION_VALIDITY_WINDOW_SECS, | ||
| }); |
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 was the bug that now materialized after we checked it in the sequencer
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.
hm, but we should set interop of the validated tx
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.
still don't understand why the logic is faulty
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 always set the interop info even for non interop txs
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.
uh, my bad
Closes #15291