@@ -279,7 +279,7 @@ func (api *API) traceChain(start, end *types.Block, config *TraceConfig, closed
279279 TxIndex : i ,
280280 TxHash : tx .Hash (),
281281 }
282- res , err := api .traceTx (ctx , tx , msg , txctx , blockCtx , task .statedb , config )
282+ res , err := api .traceTx (ctx , tx , msg , txctx , blockCtx , task .statedb , config , nil )
283283 if err != nil {
284284 task .results [i ] = & txTraceResult {TxHash : tx .Hash (), Error : err .Error ()}
285285 log .Warn ("Tracing failed" , "hash" , tx .Hash (), "block" , task .block .NumberU64 (), "err" , err )
@@ -632,7 +632,7 @@ func (api *API) traceBlock(ctx context.Context, block *types.Block, config *Trac
632632 TxIndex : i ,
633633 TxHash : tx .Hash (),
634634 }
635- res , err := api .traceTx (ctx , tx , msg , txctx , blockCtx , statedb , config )
635+ res , err := api .traceTx (ctx , tx , msg , txctx , blockCtx , statedb , config , nil )
636636 if err != nil {
637637 return nil , err
638638 }
@@ -676,7 +676,7 @@ func (api *API) traceBlockParallel(ctx context.Context, block *types.Block, stat
676676 // concurrent use.
677677 // See: https://github.com/ethereum/go-ethereum/issues/29114
678678 blockCtx := core .NewEVMBlockContext (block .Header (), api .chainContext (ctx ), nil )
679- res , err := api .traceTx (ctx , txs [task .index ], msg , txctx , blockCtx , task .statedb , config )
679+ res , err := api .traceTx (ctx , txs [task .index ], msg , txctx , blockCtx , task .statedb , config , nil )
680680 if err != nil {
681681 results [task .index ] = & txTraceResult {TxHash : txs [task .index ].Hash (), Error : err .Error ()}
682682 continue
@@ -894,7 +894,7 @@ func (api *API) TraceTransaction(ctx context.Context, hash common.Hash, config *
894894 TxIndex : int (index ),
895895 TxHash : hash ,
896896 }
897- return api .traceTx (ctx , tx , msg , txctx , vmctx , statedb , config )
897+ return api .traceTx (ctx , tx , msg , txctx , vmctx , statedb , config , nil )
898898}
899899
900900// TraceCall lets you trace a given eth_call. It collects the structured logs
@@ -907,10 +907,11 @@ func (api *API) TraceTransaction(ctx context.Context, hash common.Hash, config *
907907func (api * API ) TraceCall (ctx context.Context , args ethapi.TransactionArgs , blockNrOrHash rpc.BlockNumberOrHash , config * TraceCallConfig ) (interface {}, error ) {
908908 // Try to retrieve the specified block
909909 var (
910- err error
911- block * types.Block
912- statedb * state.StateDB
913- release StateReleaseFunc
910+ err error
911+ block * types.Block
912+ statedb * state.StateDB
913+ release StateReleaseFunc
914+ precompiles vm.PrecompiledContracts
914915 )
915916 if hash , ok := blockNrOrHash .Hash (); ok {
916917 block , err = api .blockByHash (ctx , hash )
@@ -952,7 +953,7 @@ func (api *API) TraceCall(ctx context.Context, args ethapi.TransactionArgs, bloc
952953 config .BlockOverrides .Apply (& vmctx )
953954 rules := api .backend .ChainConfig ().Rules (vmctx .BlockNumber , vmctx .Random != nil , vmctx .Time )
954955
955- precompiles : = vm .ActivePrecompiledContracts (rules )
956+ precompiles = vm .ActivePrecompiledContracts (rules )
956957 if err := config .StateOverrides .Apply (statedb , precompiles ); err != nil {
957958 return nil , err
958959 }
@@ -977,13 +978,13 @@ func (api *API) TraceCall(ctx context.Context, args ethapi.TransactionArgs, bloc
977978 if config != nil {
978979 traceConfig = & config .TraceConfig
979980 }
980- return api .traceTx (ctx , tx , msg , new (Context ), vmctx , statedb , traceConfig )
981+ return api .traceTx (ctx , tx , msg , new (Context ), vmctx , statedb , traceConfig , precompiles )
981982}
982983
983984// traceTx configures a new tracer according to the provided configuration, and
984985// executes the given message in the provided environment. The return value will
985986// be tracer dependent.
986- func (api * API ) traceTx (ctx context.Context , tx * types.Transaction , message * core.Message , txctx * Context , vmctx vm.BlockContext , statedb * state.StateDB , config * TraceConfig ) (interface {}, error ) {
987+ func (api * API ) traceTx (ctx context.Context , tx * types.Transaction , message * core.Message , txctx * Context , vmctx vm.BlockContext , statedb * state.StateDB , config * TraceConfig , precompiles vm. PrecompiledContracts ) (interface {}, error ) {
987988 var (
988989 tracer * Tracer
989990 err error
@@ -1009,6 +1010,9 @@ func (api *API) traceTx(ctx context.Context, tx *types.Transaction, message *cor
10091010 }
10101011 tracingStateDB := state .NewHookedState (statedb , tracer .Hooks )
10111012 evm := vm .NewEVM (vmctx , tracingStateDB , api .backend .ChainConfig (), vm.Config {Tracer : tracer .Hooks , NoBaseFee : true })
1013+ if precompiles != nil {
1014+ evm .SetPrecompiles (precompiles )
1015+ }
10121016
10131017 // Define a meaningful timeout of a single transaction trace
10141018 if config .Timeout != nil {
0 commit comments