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

catch rlp exception: debug_traceBlock #7204

Merged
merged 7 commits into from
Jun 25, 2024
Merged

catch rlp exception: debug_traceBlock #7204

merged 7 commits into from
Jun 25, 2024

Conversation

rjnrohit
Copy link
Contributor

Fixes #7195

Please choose one of the keywords above to refer to the issue this PR solves followed by the issue number (e.g. Fixes #000). If no issue number, remove the line. Also, remove everything marked optional that is not applicable. Remove this note after reading.

Changes

  • List the changes

Types of changes

What types of changes does your code introduce?

  • Bugfix (a non-breaking change that fixes an issue)
  • New feature (a non-breaking change that adds functionality)
  • Breaking change (a change that causes existing functionality not to work as expected)
  • Optimization
  • Refactoring
  • Documentation update
  • Build-related changes
  • Other: Description

Testing

Requires testing

  • Yes
  • No

If yes, did you write tests?

  • Yes
  • No

Notes on testing

Optional. Remove if not applicable.

Documentation

Requires documentation update

  • Yes
  • No

If yes, link the PR to the docs update or the issue with the details labeled docs. Remove if not applicable.

Requires explanation in Release Notes

  • Yes
  • No

If yes, fill in the details here. Remove if not applicable.

Remarks

Optional. Remove if not applicable.

@LukaszRozmej
Copy link
Member

Can you take a look also what happens in debug_traceBlockByNumber and debug_traceBlockByHash on genesis block?

@rjnrohit
Copy link
Contributor Author

Can you take a look also what happens in debug_traceBlockByNumber and debug_traceBlockByHash on genesis block?

I'm getting similar errors , I added exception for them as well

{
    "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 'block')\n   at System.ArgumentNullException.Throw(String paramName)\n   at System.ArgumentNullException.ThrowIfNull(Object argument, String paramName)\n   at Nethermind.Consensus.Tracing.GethStyleTracer.TraceBlock(Block block, GethTraceOptions options, CancellationToken cancellationToken) in /_/src/Nethermind/Nethermind.Consensus/Tracing/GethStyleTracer.cs:line 196\n   at Nethermind.JsonRpc.Modules.DebugModule.DebugRpcModule.debug_traceBlockByHash(Hash256 blockHash, GethTraceOptions options) in /_/src/Nethermind/Nethermind.JsonRpc/Modules/DebugModule/DebugRpcModule.cs:line 190\n   at InvokeStub_IDebugRpcModule.debug_traceBlockByHash(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) in /_/src/Nethermind/Nethermind.JsonRpc/JsonRpcService.cs:line 169"
    },
    "id": 1
}

Comment on lines +178 to +181
catch (ArgumentNullException)
{
return ResultWrapper<IReadOnlyCollection<GethLikeTxTrace>>.Fail($"Couldn't find any block", ErrorCodes.InvalidInput);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this can't happen here as it is RLP

Copy link
Contributor Author

@rjnrohit rjnrohit Jun 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It can be inside the TraceBlock function

@rjnrohit rjnrohit requested a review from LukaszRozmej June 21, 2024 10:51
Copy link
Contributor

@MarekM25 MarekM25 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What will we return for genesis after this PR?
What about debug_traceTransaction and other tracing methods?

@rjnrohit
Copy link
Contributor Author

What will we return for genesis after this PR? What about debug_traceTransaction and other tracing methods?

In case of genesis block, the results are

{
    "jsonrpc": "2.0",
    "result": [],
    "id": 1
}

for both the cases. And, for debug_traceTransaction & other tracing methods , exceptions are being handled imo. Also, ArgumentNullExceptions won't occur for them.

@rjnrohit rjnrohit requested a review from MarekM25 June 24, 2024 04:55
@MarekM25 MarekM25 merged commit 3f3a1bf into master Jun 25, 2024
68 checks passed
@MarekM25 MarekM25 deleted the rlp_exception branch June 25, 2024 15:04
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 this pull request may close these issues.

Can't trace Genesis block
3 participants