Skip to content

Commit

Permalink
fix: traceTx function
Browse files Browse the repository at this point in the history
  • Loading branch information
anshalshukla committed Aug 22, 2024
1 parent f88af20 commit ab2db59
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
11 changes: 4 additions & 7 deletions eth/tracers/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -1392,20 +1392,17 @@ func (api *API) traceTx(ctx context.Context, tx *types.Transaction, message *cor
config.BorTx = newBoolPtr(false)
}

_, err = core.ApplyTransactionWithEVM(message, api.backend.ChainConfig(), new(core.GasPool).AddGas(message.GasLimit), statedb, vmctx.BlockNumber, txctx.BlockHash, tx, &usedGas, vmenv, context.Background())
if err != nil {
return nil, fmt.Errorf("tracing failed: %w", err)
}

if *config.BorTx {
callmsg := prepareCallMessage(*message)
// nolint : contextcheck
if _, err := statefull.ApplyBorMessage(vmenv, callmsg); err != nil {
return nil, fmt.Errorf("tracing failed: %w", err)
}
} else {
// nolint : contextcheck
if _, err = core.ApplyMessage(vmenv, message, new(core.GasPool).AddGas(message.GasLimit), context.Background()); err != nil {
// Call Prepare to clear out the statedb access list
statedb.SetTxContext(txctx.TxHash, txctx.TxIndex)
_, err = core.ApplyTransactionWithEVM(message, api.backend.ChainConfig(), new(core.GasPool).AddGas(message.GasLimit), statedb, vmctx.BlockNumber, txctx.BlockHash, tx, &usedGas, vmenv, context.Background())
if err != nil {
return nil, fmt.Errorf("tracing failed: %w", err)
}
}
Expand Down
1 change: 0 additions & 1 deletion eth/tracers/api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,6 @@ func TestTraceTransaction(t *testing.T) {
api := NewAPI(backend)

result, err := api.TraceTransaction(context.Background(), target, nil)
fmt.Println("Anshal trace txn - ", result)
if err != nil {
t.Errorf("Failed to trace transaction %v", err)
}
Expand Down

0 comments on commit ab2db59

Please sign in to comment.