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

interop: Ingress Filtering for Interop Enabled Mempool #422

Merged
merged 5 commits into from
Nov 5, 2024

Conversation

axelKingsley
Copy link
Contributor

@axelKingsley axelKingsley commented Oct 29, 2024

What

Creates components for filtering Transactions out of the mempool if they create invalid Executing Messages

Ingress Filters

In the txpool package, IngressFilters take a Tx and return a boolean if the tx is acceptable to move forward.

InteropFilter

An implementation of an Ingress Filter, this takes and uses two functions to collect logs for the given Tx and ask the Supervisor about the validity of them.

txpool

TXPools now hold a slice of Ingress Filters. When calling Add, each transaction is passed through each filter, and if a filter would drop the transaction it is noted, and returned as a new FilteredOut error.

Ethereum Backend

The backend now features a function to get logs by simulating a transaction, called SimLogs. When creating a new backend, if Interop is enabled, the TX Pool is given an InteropFilter which is attached to the SimLogs and CheckMessages functions.

TODO:

  • No testing is done for SimLogs. CC @protolambda , I actually don't know how to test this function since it uses so many core components. I based this function on code in the Tracing components. EDIT: the best way will probably be to develop and E2E test in the monorepo which demonstrates it
  • The txpool or the filter might want to remember transaction hashes and cache the results to prevent a dos against it.

@axelKingsley axelKingsley requested a review from a team as a code owner October 29, 2024 20:54
@axelKingsley axelKingsley requested review from protolambda and removed request for a team October 29, 2024 20:54
@axelKingsley axelKingsley force-pushed the interop-mempool-filter branch from 91583bf to 0bbcfdd Compare October 29, 2024 22:21
@axelKingsley axelKingsley requested a review from tynes October 29, 2024 22:22
@protolambda protolambda force-pushed the interop-sequencer-check branch from e63bca4 to c4d09bc Compare October 31, 2024 18:07
Base automatically changed from interop-sequencer-check to optimism October 31, 2024 20:08
core/txpool/ingress_filters.go Outdated Show resolved Hide resolved
core/txpool/ingress_filters.go Outdated Show resolved Hide resolved
core/txpool/ingress_filters.go Outdated Show resolved Hide resolved
eth/interop/interop.go Outdated Show resolved Hide resolved
miner/worker.go Outdated Show resolved Hide resolved
@protolambda protolambda force-pushed the interop-mempool-filter branch 3 times, most recently from 8549c50 to ef9a639 Compare November 1, 2024 10:01
Co-authored-by: Tyler Smith <mail@tcry.pt>
Co-authored-by: Diederik Loerakker <proto@protolambda.com>
@protolambda protolambda force-pushed the interop-mempool-filter branch from ef9a639 to 007538b Compare November 1, 2024 10:05
@protolambda
Copy link
Collaborator

Rebased this, squashed the commits, moved some interop logic into its own file + documented it in the fork.yaml.
And made some changes:

  • The log-simulation now denies txs more eagerly. Safety over liveness of a tx. A user can resubmit if necessary. There are still ways to bypass the ingress filter, but we'll working on hardening that in later PRs.
  • The log-simulation now uses the block attributes, like the block fee-recipient, to better match the actual environment of tx execution. And uses the block gas limit, rather than the tx gas limit, to not go too high with gas allowance.
  • The tx-pool now has a filter-context, which is closed on tx-pool shutdown, to cancel any ongoing filter work. And the check-messsages RPC call has a timeout now.

@axelKingsley axelKingsley force-pushed the interop-mempool-filter branch from ed40f84 to 262842b Compare November 5, 2024 04:52
@axelKingsley axelKingsley merged commit d6a8b0b into optimism Nov 5, 2024
10 checks passed
@axelKingsley axelKingsley deleted the interop-mempool-filter branch November 5, 2024 22:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants