Skip to content
This repository was archived by the owner on Jul 5, 2024. It is now read-only.

Commit 1b1a8a8

Browse files
zemseChihChengLiang
andcommitted
fix bug in new geth logic
Co-authored-by: Chih Cheng Liang <[email protected]>
1 parent b309ed5 commit 1b1a8a8

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

geth-utils/gethutil/trace.go

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -255,15 +255,22 @@ func Trace(config TraceConfig) ([]*ExecutionResult, error) {
255255
stateDB.SetTxContext(tx.Hash(), i)
256256

257257
_, err = core.ApplyTransactionWithEVM(&message, &chainConfig, new(core.GasPool).AddGas(message.GasLimit), stateDB, blockCtx.BlockNumber, common.Hash{}, &tx, &usedGas, evm)
258-
if err != nil {
259-
return nil, fmt.Errorf("tracing failed: %w", err)
260-
}
261-
raw, _ = tracer.GetResult()
262-
263258
var result ExecutionResult
264-
err = json.Unmarshal(raw, &result)
265259
if err != nil {
266-
return nil, fmt.Errorf("failed to unmarshal result: %w", err)
260+
result = ExecutionResult{
261+
Gas: 0,
262+
Failed: true,
263+
Invalid: true,
264+
ReturnValue: fmt.Sprintf("%v", err),
265+
StructLogs: []StructLogRes{},
266+
}
267+
} else {
268+
raw, _ = tracer.GetResult()
269+
270+
err = json.Unmarshal(raw, &result)
271+
if err != nil {
272+
return nil, fmt.Errorf("failed to unmarshal result: %w", err)
273+
}
267274
}
268275

269276
executionResults[i] = &result

0 commit comments

Comments
 (0)