ethereum-optimism / optimism

Optimism is Ethereum, scaled.
https://optimism.io
MIT License
5.21k stars 2.99k forks source link

Interop: op-geth transaction pool validation #10890

Open tynes opened 4 months ago

tynes commented 4 months ago

Implement transaction pool validation so that only valid executing messages are included in the transaction pool

hamdiallam commented 4 months ago

cc @protolambda

First Approach: In the txpool module, we have this interface. Per our discussion, we'll definitely need to parallelize validation but i'm going to leave that as followup and do the simple path (iteration)

type OptimismTxPolicyStatus uint

const (
    OptimismTxPolicyUnknown OptimismTxPolicyStatus = iota
    OptimismTxPolicyInvalid
    OptimismTxPolicyValid
)

type OptimismTxPoolPolicy interface {
    ValidateTx(tx *types.Transaction) (OptimismTxPolicyStatus, error)
}

Introduce a new module txpool/policies where there can be different policies to be constructed & in the future composed together and supplied to the higher level TxPool. Only policy to exist for now is the SuperchainMessagingPolicy that maintains a connection to the superchain backend.

The tx pool keeps reference to the set policy and is invoked as transactions are added.

hamdiallam commented 4 months ago

For the high latency implementation, the tx pool will reject initiating messages that are not finalized or safe

protolambda commented 3 months ago

This needs to be adapted to handle the low-latency case.

protolambda commented 1 month ago

Related: https://github.com/ethereum-optimism/design-docs/pull/7