Skip to content

Commit

Permalink
Merge pull request #178 from blocknative/TS_fixes
Browse files Browse the repository at this point in the history
Call BlockNativeInitHook in trace streams
  • Loading branch information
tyler-smith authored Jun 17, 2024
2 parents ffe489a + ec92838 commit 7600379
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions eth/filters/trace_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func (api *FilterAPI) NewPendingTransactionsWithTrace(ctx context.Context, trace
// first.
defer func() {
if r := recover(); r != nil {
log.Error("pending_txs_stream panic:", r)
log.Error("pending_txs_stream panic:", "err", r)
}
}()

Expand Down Expand Up @@ -197,7 +197,7 @@ func (api *FilterAPI) NewFullBlocksWithTrace(ctx context.Context, tracerOptsJSON
// first.
defer func() {
if r := recover(); r != nil {
log.Error("block_stream panic:", r)
log.Error("block_stream panic:", "err", r)
}
}()

Expand Down Expand Up @@ -294,6 +294,7 @@ func traceTx(tx *types.Transaction, message *core.Message, txCtx *tracers.Contex
vmenv := vm.NewEVM(vmctx, core.NewEVMTxContext(message), statedb, chainConfig, vm.Config{Tracer: hooks, NoBaseFee: true})
statedb.SetTxContext(txCtx.TxHash, txCtx.TxIndex)

hooks.BlockNativeInitHook(vmenv)
hooks.OnTxStart(vmenv.GetVMContext(), tx, message.From)
result, err := core.ApplyMessage(vmenv, message, new(core.GasPool).AddGas(message.GasLimit))
if err != nil {
Expand Down Expand Up @@ -323,6 +324,7 @@ func traceBlockTx(tx *types.Transaction, message *core.Message, txCtx *tracers.C
vmenv := vm.NewEVM(vmctx, core.NewEVMTxContext(message), statedb, chainConfig, vm.Config{Tracer: hooks, NoBaseFee: false})
statedb.SetTxContext(txCtx.TxHash, txCtx.TxIndex)

hooks.BlockNativeInitHook(vmenv)
hooks.OnTxStart(vmenv.GetVMContext(), tx, message.From)
result, err := core.ApplyMessage(vmenv, message, new(core.GasPool).AddGas(message.GasLimit))
if err != nil {
Expand Down

0 comments on commit 7600379

Please sign in to comment.