@@ -421,51 +421,30 @@ func (miner *Miner) commitBlobTransaction(env *environment, tx *types.Transactio
421
421
return nil
422
422
}
423
423
424
- type LogInspector interface {
425
- GetLogs (hash common.Hash , blockNumber uint64 , blockHash common.Hash ) []* types.Log
426
- }
427
-
428
424
// applyTransaction runs the transaction. If execution fails, state and gas pool are reverted.
429
425
func (miner * Miner ) applyTransaction (env * environment , tx * types.Transaction ) (* types.Receipt , error ) {
430
426
var (
431
427
snap = env .state .Snapshot ()
432
428
gp = env .gasPool .Gas ()
433
429
)
434
- var extraOpts * core.ApplyTransactionOpts
435
- // If not just reproducing the block, check the interop executing messages.
436
430
if ! env .noTxs && miner .chain .Config ().IsInterop (env .header .Time ) {
437
- // Whenever there are `noTxs` it means we are building a block from pre-determined txs. There are two cases:
438
- // (1) it's derived from L1, and will be verified asynchronously by the op-node.
439
- // (2) it is a deposits-only empty-block by the sequencer, in which case there are no interop-txs to verify (as deposits do not emit any).
440
-
441
- // We have to insert as call-back, since we cannot revert the snapshot
442
- // after the tx is deemed successful and the journal has been cleared already.
443
- extraOpts = & core.ApplyTransactionOpts {
444
- PostValidation : func (evm * vm.EVM , result * core.ExecutionResult ) error {
445
- logInspector , ok := evm .StateDB .(LogInspector )
446
- if ! ok {
447
- return fmt .Errorf ("cannot get logs from StateDB type %T" , evm .StateDB )
448
- }
449
- logs := logInspector .GetLogs (tx .Hash (), env .header .Number .Uint64 (), common.Hash {})
450
- return miner .checkInterop (env .rpcCtx , tx , result .Failed (), logs , env .header .Time )
451
- },
431
+ // avoid execution if the interop check fails
432
+ if err := miner .checkInterop (env .rpcCtx , tx , env .header .Time ); err != nil {
433
+ return nil , err
452
434
}
453
435
}
454
- receipt , err := core .ApplyTransactionExtended (env .evm , env .gasPool , env .state , env .header , tx , & env .header .GasUsed , extraOpts )
436
+ receipt , err := core .ApplyTransaction (env .evm , env .gasPool , env .state , env .header , tx , & env .header .GasUsed )
455
437
if err != nil {
456
438
env .state .RevertToSnapshot (snap )
457
439
env .gasPool .SetGas (gp )
458
440
}
459
441
return receipt , err
460
442
}
461
443
462
- func (miner * Miner ) checkInterop (ctx context.Context , tx * types.Transaction , failed bool , logs [] * types. Log , logTimestamp uint64 ) error {
444
+ func (miner * Miner ) checkInterop (ctx context.Context , tx * types.Transaction , logTimestamp uint64 ) error {
463
445
if tx .Type () == types .DepositTxType {
464
446
return nil // deposit-txs are always safe
465
447
}
466
- if failed {
467
- return nil // failed txs don't persist any logs
468
- }
469
448
if tx .Rejected () {
470
449
return errors .New ("transaction was previously rejected" )
471
450
}
@@ -476,14 +455,11 @@ func (miner *Miner) checkInterop(ctx context.Context, tx *types.Transaction, fai
476
455
if ctx == nil { // check if the miner was set up correctly to interact with an RPC
477
456
return errors .New ("need RPC context to check executing messages" )
478
457
}
479
- executingMessages , err := interoptypes .ExecutingMessagesFromLogs (logs )
480
- if err != nil {
481
- return fmt .Errorf ("cannot parse interop messages from receipt of %s: %w" , tx .Hash (), err )
482
- }
483
- if len (executingMessages ) == 0 {
458
+ accessList := interoptypes .TxToInteropAccessList (tx )
459
+ if len (accessList ) == 0 {
484
460
return nil // avoid an RPC check if there are no executing messages to verify.
485
461
}
486
- if err := b .CheckMessages (ctx , executingMessages , interoptypes .CrossUnsafe , logTimestamp ); err != nil {
462
+ if err := b .CheckAccessList (ctx , accessList , interoptypes .CrossUnsafe , interoptypes. ExecutingDescriptor { Timestamp : logTimestamp , Timeout : 0 } ); err != nil {
487
463
if ctx .Err () != nil { // don't reject transactions permanently on RPC timeouts etc.
488
464
log .Debug ("CheckMessages timed out" , "err" , ctx .Err ())
489
465
return err
0 commit comments