Skip to content

Conversation

@SozinM
Copy link
Contributor

@SozinM SozinM commented Mar 28, 2025

Closes #15291

@SozinM SozinM force-pushed the msozin/op-reth-builder-interop-workaround branch from 23d8df4 to 263aaaa Compare March 28, 2025 09:09
Copy link
Collaborator

@emhane emhane left a 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

/// 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
}
so they stay in the pool for interop maintenance #15295

// 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());
Copy link
Collaborator

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

Copy link
Contributor Author

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

Copy link
Contributor Author

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

Copy link
Collaborator

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

Copy link
Collaborator

@mattsse mattsse Mar 28, 2025

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:

#15348 (comment)

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 {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
if let Some(interop) = interop {
if let Some(interop) = tx.interop() {

nitpick, redundant bind which doesn't make code more simple to read

Copy link
Contributor Author

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 :)

Copy link
Contributor Author

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

Copy link
Collaborator

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.

Copy link
Contributor Author

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

@github-project-automation github-project-automation bot moved this from Todo to In Progress in Reth Tracker Mar 28, 2025
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.

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
Copy link
Collaborator

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 mattsse marked this pull request as ready for review March 28, 2025 10:33
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.

lgtm

@nkysg for vis because this introduces another call to the interop fn

continue
}
}
let interop = tx.interop();
Copy link
Collaborator

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

Copy link
Contributor Author

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 :)

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.

checking what's wrong with the tests

@mattsse mattsse requested a review from gakonst as a code owner March 28, 2025 12:01
@mattsse
Copy link
Collaborator

mattsse commented Mar 28, 2025

fucked up the merge

taking over

Comment on lines -193 to -195
transaction.set_interop(TransactionInterop {
timeout: self.block_timestamp() + TRANSACTION_VALIDITY_WINDOW_SECS,
});
Copy link
Collaborator

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

Copy link
Contributor Author

@SozinM SozinM Mar 28, 2025

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

Copy link
Contributor Author

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

Copy link
Collaborator

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

uh, my bad

@mattsse mattsse added this pull request to the merge queue Mar 28, 2025
Merged via the queue into paradigmxyz:main with commit d1ed669 Mar 28, 2025
42 checks passed
@github-project-automation github-project-automation bot moved this from In Progress to Done in Reth Tracker Mar 28, 2025
@SozinM SozinM deleted the msozin/op-reth-builder-interop-workaround branch March 28, 2025 12:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

New OpPayloadTransactions impl for interop

5 participants