diff --git a/turbo/jsonrpc/tracing.go b/turbo/jsonrpc/tracing.go index bc3664107a5..0d6ef400337 100644 --- a/turbo/jsonrpc/tracing.go +++ b/turbo/jsonrpc/tracing.go @@ -84,16 +84,6 @@ func (api *PrivateDebugAPIImpl) traceBlock(ctx context.Context, blockNrOrHash rp } engine := api.engine() - _, blockCtx, _, ibs, _, err := transactions.ComputeTxEnv(ctx, engine, block, chainConfig, api._blockReader, tx, 0, api.historyV3(tx), false) - if err != nil { - stream.WriteNil() - return err - } - - signer := types.MakeSigner(chainConfig, block.NumberU64(), block.Time()) - rules := chainConfig.Rules(block.NumberU64(), block.Time()) - stream.WriteArrayStart() - txns := block.Transactions() var borStateSyncTxn types.Transaction if *config.BorTraceEnabled { @@ -109,6 +99,16 @@ func (api *PrivateDebugAPIImpl) traceBlock(ctx context.Context, blockNrOrHash rp } } + _, blockCtx, _, ibs, _, err := transactions.ComputeTxEnv(ctx, engine, block, chainConfig, api._blockReader, tx, 0, api.historyV3(tx), borStateSyncTxn != nil) + if err != nil { + stream.WriteNil() + return err + } + + signer := types.MakeSigner(chainConfig, block.NumberU64(), block.Time()) + rules := chainConfig.Rules(block.NumberU64(), block.Time()) + stream.WriteArrayStart() + for idx, txn := range txns { isBorStateSyncTxn := borStateSyncTxn == txn var txnHash common.Hash diff --git a/turbo/transactions/tracing.go b/turbo/transactions/tracing.go index a704a77cf73..1ee638bb558 100644 --- a/turbo/transactions/tracing.go +++ b/turbo/transactions/tracing.go @@ -128,7 +128,7 @@ func ComputeTxEnv(ctx context.Context, engine consensus.EngineReader, block *typ } if isBorStateSyncTxn && txIndex == len(block.Transactions()) { - // tx is a state sync transaction + // we can reach here if the block has 0 normal transactions but has state sync transactions return nil, blockContext, evmtypes.TxContext{}, statedb, reader, nil }