Skip to content

Commit

Permalink
Add trace to ApplyTransactionWithResult
Browse files Browse the repository at this point in the history
  • Loading branch information
lukanus committed Oct 18, 2023
1 parent 2f57577 commit 08c7a1b
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion core/state_processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,14 +236,21 @@ func ProcessBeaconBlockRoot(beaconRoot common.Hash, vmenv *vm.EVM, statedb *stat
}

func ApplyTransactionWithResult(config *params.ChainConfig, bc ChainContext, author *common.Address, gp *GasPool, statedb *state.StateDB, header *types.Header, tx *types.Transaction, usedGas *uint64, cfg vm.Config) (*types.Receipt, *ExecutionResult, error) {
// Create a blocknative tracer to get execution traces.
tracer, err := blocknative.NewTracerWithOpts(blocknative.TracerOpts{
Decode: true,
})
if err != nil {
return nil, nil, err
}
msg, err := TransactionToMessage(tx, types.MakeSigner(config, header.Number, header.Time), header.BaseFee)
if err != nil {
return nil, nil, err
}
// Create a new context to be used in the EVM environment
blockContext := NewEVMBlockContext(header, bc, author)
vmenv := vm.NewEVM(blockContext, vm.TxContext{}, statedb, config, cfg)
receipt, result, _, err := applyTransactionWithResult(msg, config, bc, author, gp, statedb, header, msg, usedGas, vmenv, nil)
receipt, result, _, err := applyTransactionWithResult(msg, config, bc, author, gp, statedb, header, msg, usedGas, vmenv, tracer)
return receipt, result, err
}

Expand Down

0 comments on commit 08c7a1b

Please sign in to comment.