diff --git a/arbos/block_processor.go b/arbos/block_processor.go index 006e9f5fdd..5025cd16f9 100644 --- a/arbos/block_processor.go +++ b/arbos/block_processor.go @@ -263,15 +263,6 @@ func ProduceBlockAdvanced( return nil, nil, err } - if err = hooks.PreTxFilter(chainConfig, header, statedb, state, tx, options, sender, l1Info); err != nil { - return nil, nil, err - } - - // Additional pre-transaction validity check - if err = extraPreTxFilter(chainConfig, header, statedb, state, tx, options, sender, l1Info); err != nil { - return nil, nil, err - } - if basefee.Sign() > 0 { dataGas = math.MaxUint64 brotliCompressionLevel, err := state.BrotliCompressionLevel() @@ -306,7 +297,22 @@ func ProduceBlockAdvanced( return nil, nil, core.ErrGasLimitReached } + if statedb.IsTxFiltered() { + return nil, nil, errors.New("cannot process a new transaction when the previous one was filtered and the statedb wasn't reverted to a snapshot") + } snap := statedb.Snapshot() + + if err = hooks.PreTxFilter(chainConfig, header, statedb, state, tx, options, sender, l1Info); err != nil { + statedb.RevertToSnapshot(snap) + return nil, nil, err + } + + // Additional pre-transaction validity check + if err = extraPreTxFilter(chainConfig, header, statedb, state, tx, options, sender, l1Info); err != nil { + statedb.RevertToSnapshot(snap) + return nil, nil, err + } + statedb.SetTxContext(tx.Hash(), len(receipts)) // the number of successful state transitions gasPool := gethGas diff --git a/go-ethereum b/go-ethereum index 30abfa28d1..c7f6a03869 160000 --- a/go-ethereum +++ b/go-ethereum @@ -1 +1 @@ -Subproject commit 30abfa28d13911257bc4a94631268ae46934db43 +Subproject commit c7f6a0386939b3f2dc9366613d8bae7f6c9812f7 diff --git a/system_tests/seq_filter_test.go b/system_tests/seq_filter_test.go index 35e35a68a6..d728d091c7 100644 --- a/system_tests/seq_filter_test.go +++ b/system_tests/seq_filter_test.go @@ -95,8 +95,8 @@ func setupSequencerFilterTest(t *testing.T, withBlock bool) (*NodeBuilder, *arbo } return nil } - postTxFilter := func(_ *types.Header, statedb *state.StateDB, _ *arbosState.ArbosState, _ *types.Transaction, _ common.Address, _ uint64, _ *core.ExecutionResult) error { - if statedb.IsTxInvalid() { + postTxFilter := func(_ *types.Header, statedb *state.StateDB, _ *arbosState.ArbosState, tx *types.Transaction, _ common.Address, _ uint64, _ *core.ExecutionResult) error { + if statedb.IsTxFiltered() { return errors.New("internal error") } return nil