Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cherry-pick commit 310d4eb into release/v0.3.2 #2615

Merged
merged 1 commit into from
Oct 5, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions jsonrpc/endpoints_debug.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ func (d *DebugEndpoints) TraceBlockByNumber(number types.BlockNumber, cfg *trace
}

traces, rpcErr := d.buildTraceBlock(ctx, block.Transactions(), cfg, dbTx)
if err != nil {
if rpcErr != nil {
return nil, rpcErr
}

Expand All @@ -133,7 +133,7 @@ func (d *DebugEndpoints) TraceBlockByHash(hash types.ArgHash, cfg *traceConfig)
}

traces, rpcErr := d.buildTraceBlock(ctx, block.Transactions(), cfg, dbTx)
if err != nil {
if rpcErr != nil {
return nil, rpcErr
}

Expand Down Expand Up @@ -299,7 +299,7 @@ func (d *DebugEndpoints) buildTraceBlock(ctx context.Context, txs []*ethTypes.Tr
for _, tx := range txs {
traceTransaction, err := d.buildTraceTransaction(ctx, tx.Hash(), cfg, dbTx)
if err != nil {
errMsg := fmt.Sprintf("failed to get trace for transaction %v", tx.Hash().String())
errMsg := fmt.Sprintf("failed to get trace for transaction %v: %v", tx.Hash().String(), err.Error())
return RPCErrorResponse(types.DefaultErrorCode, errMsg, err)
}
traceBlockTransaction := traceBlockTransactionResponse{
Expand Down Expand Up @@ -334,8 +334,7 @@ func (d *DebugEndpoints) buildTraceTransaction(ctx context.Context, hash common.
if errors.Is(err, state.ErrNotFound) {
return RPCErrorResponse(types.DefaultErrorCode, "transaction not found", nil)
} else if err != nil {
const errorMessage = "failed to get trace"
log.Errorf("%v: %v", errorMessage, err)
errorMessage := fmt.Sprintf("failed to get trace: %v", err.Error())
return nil, types.NewRPCError(types.DefaultErrorCode, errorMessage)
}

Expand Down