Skip to content

Improve interop revalidation #15389

Closed
@mattsse

Description

@mattsse

Describe the feature

we currently filter out stale interop txs and revalidate them

if !to_revalidate.is_empty() {
let checks_stream =
futures_util::stream::iter(to_revalidate.into_iter().map(|tx| {
let supervisor_client = supervisor_client.clone();
async move {
let check = supervisor_client
.is_valid_cross_tx(
tx.transaction.access_list(),
tx.transaction.hash(),
timestamp,
Some(TRANSACTION_VALIDITY_WINDOW),
// We could assume that interop is enabled, because
// tx.transaction.interop() would be set only in
// this case
true,
)
.await;
(tx.clone(), check)
}
}))
.buffered(MAX_SUPERVISOR_QUERIES);
futures_util::pin_mut!(checks_stream);
while let Some((tx, check)) = checks_stream.next().await {
if let Some(Err(err)) = check {
// We remove only bad transaction. If error caused by supervisor instability
// or other fixable issues transaction would be validated on next state
// change, so we ignore it
if err.is_bad_transaction() {
to_remove.push(*tx.transaction.hash());
}
} else {
tx.transaction.set_interop(TransactionInterop {
timeout: timestamp + TRANSACTION_VALIDITY_WINDOW,
})
}
}
}

this section can be improved a bit and ideally moved into the supervisorclient that returns a new stream type that yields the results.

this would be cleaner and would allow us to easily add batch request shortly.

TODO

  • move revalidation into SupervisorClient, ideally this new function returns a new Stream type that uses futures::stream under the hood

blocked by #15388

Additional context

No response

Metadata

Metadata

Assignees

Labels

A-op-rethRelated to Optimism and op-rethA-tx-poolRelated to the transaction mempoolC-debtA clean up/refactor of existing codeD-good-first-issueNice and easy! A great choice to get startedOP-interopLabels for Optimism interop features

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions