-
Notifications
You must be signed in to change notification settings - Fork 438
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
6662 debug trace call many #7441
base: master
Are you sure you want to change the base?
Conversation
@MarekM25 does this look good for the debug_traceCallMany functionality? |
@smartprogrammer93 @LukaszRozmej requesting your review on this. |
@@ -33,6 +33,9 @@ public interface IDebugRpcModule : IRpcModule | |||
[JsonRpcMethod(Description = "This method lets you run an eth_call within the context of the given block execution using the final state of parent block as the base. The block can be specified either by hash or by number. It takes the same input object as a eth_call. It returns the same output as debug_traceTransaction.", IsImplemented = true, IsSharable = true)] | |||
ResultWrapper<GethLikeTxTrace> debug_traceCall(TransactionForRpc call, BlockParameter? blockParameter = null, GethTraceOptions? options = null); | |||
|
|||
[JsonRpcMethod(Description = "This method lets you run trace_callMany for a list of transactions.It doesn't charge fees. It returns a list of Trace objects.", IsImplemented = true, IsSharable = true)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure about the description. @rubo ?
txs[i] = tx; | ||
} | ||
|
||
Block block = new(headerSearch.Object!, txs, Enumerable.Empty<BlockHeader>()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This block is constructed but never used?
SearchResult<BlockHeader> headerSearch = _debugBridge.SearchBlockHeaderForTraceCall(blockParameter); | ||
if (headerSearch.IsError) | ||
{ | ||
return ResultWrapper<IEnumerable<GethLikeTxTrace>>.Fail(headerSearch); | ||
} | ||
|
||
if (!_debugBridge.HasStateForBlock(headerSearch.Object)) | ||
{ | ||
return ResultWrapper<IEnumerable<GethLikeTxTrace>>.Fail($"No state available for block {headerSearch.Object.ToString(BlockHeader.Format.FullHashAndNumber)}", ErrorCodes.ResourceUnavailable); | ||
} | ||
|
||
Dictionary<Hash256, ParityTraceTypes> traceTypeByTransaction = new(calls.Length); | ||
Transaction[] txs = new Transaction[calls.Length]; | ||
for (int i = 0; i < calls.Length; i++) | ||
{ | ||
calls[i].Transaction.EnsureDefaults(_jsonRpcConfig.GasCap); | ||
Transaction tx = calls[i].Transaction.ToTransaction(); | ||
tx.Hash = new Hash256(new UInt256((ulong)i).ToBigEndian()); | ||
txs[i] = tx; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All logic should live in GethStyleTracer
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey, I'm sorry but I didn't understand what you meant here. Did you mean using GethStyleTracer
instead of GethLikeTrace
as object?
return ResultWrapper<IEnumerable<GethLikeTxTrace>>.Fail($"No state available for block {headerSearch.Object.ToString(BlockHeader.Format.FullHashAndNumber)}", ErrorCodes.ResourceUnavailable); | ||
} | ||
|
||
Dictionary<Hash256, ParityTraceTypes> traceTypeByTransaction = new(calls.Length); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ParityTraceType's have no sense in Geth style tracing (debug module)
@@ -33,6 +33,9 @@ public interface IDebugRpcModule : IRpcModule | |||
[JsonRpcMethod(Description = "This method lets you run an eth_call within the context of the given block execution using the final state of parent block as the base. The block can be specified either by hash or by number. It takes the same input object as a eth_call. It returns the same output as debug_traceTransaction.", IsImplemented = true, IsSharable = true)] | |||
ResultWrapper<GethLikeTxTrace> debug_traceCall(TransactionForRpc call, BlockParameter? blockParameter = null, GethTraceOptions? options = null); | |||
|
|||
[JsonRpcMethod(Description = "This method lets you run trace_callMany for a list of transactions.It doesn't charge fees. It returns a list of Trace objects.", IsImplemented = true, IsSharable = true)] | |||
ResultWrapper<IEnumerable<GethLikeTxTrace>> debug_traceCallMany(TransactionForRpcWithTraceTypes[] calls, BlockParameter? blockParameter = null); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the signature should be different: https://www.chainnodes.org/docs/ethereum/debug_traceCallMany
For overrides, please wait for this PR: #7362
Resolves #6662
Changes
Types of changes
What types of changes does your code introduce?
Testing
Requires testing
If yes, did you write tests?
Documentation
Requires documentation update
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
If yes, fill in the details here. Remove if not applicable.