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

debug_traceTransaction RPC tracer null throw exception #6914

Closed
FatTigerWang opened this issue Apr 12, 2024 · 0 comments · Fixed by #6915
Closed

debug_traceTransaction RPC tracer null throw exception #6914

FatTigerWang opened this issue Apr 12, 2024 · 0 comments · Fixed by #6915

Comments

@FatTigerWang
Copy link
Contributor

FatTigerWang commented Apr 12, 2024

Description

An error occurs when debug_traceTransaction is requested with default parameters (only with txhash), but the request succeeds when "tracer" = "", which should not be correct behavior:

// success
{
    "params": [
        "0xf50d56ca5e77504129d685db24144f2b8f8cb44d83906c09441b1094e2828f3d", // any latest txhash
        {
            "tracer": ""
        }
    ]
}

// failed
{
    "params": [
        "0xf50d56ca5e77504129d685db24144f2b8f8cb44d83906c09441b1094e2828f3d" // any latest txhash
    ]
}

Steps to Reproduce

curl --location 'http://127.0.0.1:8545\
--header 'Content-Type: application/json' \
--data '{
    "jsonrpc": "2.0",
    "id": 0,
    "method": "debug_traceTransaction",
    "params": [
        "0x4869212634482b05728a591d976f53b9167b8c15449537a67ff49cb8374da961" // any latest txhash
    ]
}'

Actual behavior

{
    "jsonrpc": "2.0",
    "error": {
        "code": -32603,
        "message": "Internal error",
        "data": "System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.\n ---> System.ArgumentNullException: Value cannot be null. (Parameter 'key')\n   at System.Collections.Generic.Dictionary`2.FindValue(TKey key)\n   at Nethermind.Consensus.Tracing.GethStyleTracer.CreateOptionsTracer(BlockHeader block, GethTraceOptions options)\n   at Nethermind.Consensus.Tracing.GethStyleTracer.Trace(Block block, Hash256 txHash, CancellationToken cancellationToken, GethTraceOptions options)\n   at Nethermind.Consensus.Tracing.GethStyleTracer.Trace(Hash256 txHash, GethTraceOptions traceOptions, CancellationToken cancellationToken)\n   at Nethermind.JsonRpc.Modules.DebugModule.DebugRpcModule.debug_traceTransaction(Hash256 transactionHash, GethTraceOptions options)\n   at InvokeStub_IDebugRpcModule.debug_traceTransaction(Object, Span`1)\n   at System.Reflection.MethodBaseInvoker.InvokeWithFewArgs(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)\n   --- End of inner exception stack trace ---\n   at System.Reflection.MethodBaseInvoker.InvokeWithFewArgs(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)\n   at Nethermind.JsonRpc.JsonRpcService.ExecuteAsync(JsonRpcRequest request, String methodName, ResolvedMethodInfo method, JsonRpcContext context)"
    },
    "id": 0
}

Expected behavior

{
    "jsonrpc": "2.0",
    "result": {
        "gas": "0x9d9c",
        "failed": false,
        "returnValue": "0x0000000000000000000000000000000000000000000000000000000000000001",
        "structLogs": [
            {
                "pc": 0,
                "op": "PUSH1",
                "gas": 23766,
                "gasCost": 3,
                "depth": 1,
                "error": null,
                "stack": [],
                "storage": {}
            },
            ...
       ]
   }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant