-
Notifications
You must be signed in to change notification settings - Fork 465
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
Implementation trace get #3436
Merged
Merged
Implementation trace get #3436
Changes from all commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
902da85
added test for trace_transaction
kjazgar f6c8702
Changed trace_transaction and added test for it.
kjazgar 3906714
add tests
MarekM25 2595e37
add multi call tests
MarekM25 0ab560e
Merge branch 'trace_transaction_fixes' into changes_in_trace_module
kjazgar d4d48c6
add reward calculator to TraceRpcModuleTests
MarekM25 173bed4
Merge branch 'trace_transaction_fixes' into changes_in_trace_module
kjazgar 5e15799
And fix :)
MarekM25 a3c1163
build fixes
MarekM25 1d222e7
Merge branch 'trace_transaction_fixes' into changes_in_trace_module
kjazgar 522bfda
Changes in TraceTx.
kjazgar 9fe8971
Merge remote-tracking branch 'origin/master' into changes_in_trace_mo…
kjazgar 777804a
small refactoring
kjazgar e3dcd69
Changed TraceTx as not to return a SingleOrDefault value.
kjazgar 6284525
Deleted unnecessary part.
kjazgar 4742619
Fixed test.
kjazgar 50a0e8e
Implemented trace_callMany and added test.
kjazgar 786d7aa
Implemented trace_get and added test.
kjazgar 283d167
Changed params in trace_callMany.
kjazgar 7015aad
fix
kjazgar d2eeb66
Changed parameters, added class.
kjazgar 40390fe
fix
kjazgar 5e301a2
Changed parameters in trace_callMany - test.
kjazgar 99225c6
Merge branch 'implementation_trace_callMany' into implementation_trac…
kjazgar 5a3994d
Changes in trace_get - test.
kjazgar 892e4c6
Changes in trace_get.
kjazgar e2be58b
Changed parameter type in trace_get.
kjazgar accd501
Added error field to txTrace - test.
kjazgar 55785ae
Deleted unnecessary part.
kjazgar 15f5c73
Implementation of trace_get.
kjazgar cfa9b8a
Deleted unnecessary parts.
kjazgar 8463f1a
Deleted unnecessary part.
kjazgar 0667474
Added tests for trace_replayTransaction.
kjazgar File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
106 changes: 93 additions & 13 deletions
106
src/Nethermind/Nethermind.JsonRpc.Test/Modules/TraceRpcModuleTests.cs
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,7 @@ | |
|
||
using System; | ||
using System.Collections.Generic; | ||
using System.Collections.ObjectModel; | ||
using System.Linq; | ||
using System.Threading; | ||
using MathNet.Numerics.Distributions; | ||
|
@@ -129,7 +130,7 @@ public ResultWrapper<ParityTxTraceFromReplay> trace_replayTransaction(Keccak txH | |
|
||
Block block = blockSearch.Object; | ||
|
||
ParityLikeTxTrace txTrace = TraceTx(block, txHash, GetParityTypes(traceTypes)); | ||
IReadOnlyCollection<ParityLikeTxTrace> txTrace = TraceTx(block, txHash, GetParityTypes(traceTypes)); | ||
return ResultWrapper<ParityTxTraceFromReplay>.Success(new ParityTxTraceFromReplay(txTrace)); | ||
} | ||
|
||
|
@@ -189,9 +190,21 @@ public ResultWrapper<ParityTxTraceFromStore[]> trace_block(BlockParameter blockP | |
return ResultWrapper<ParityTxTraceFromStore[]>.Success(txTraces.SelectMany(ParityTxTraceFromStore.FromTxTrace).ToArray()); | ||
} | ||
|
||
public ResultWrapper<ParityTxTraceFromStore[]> trace_get(Keccak txHash, int[] positions) | ||
public ResultWrapper<ParityTxTraceFromStore[]> trace_get(Keccak txHash, long[] positions) | ||
{ | ||
throw new NotImplementedException(); | ||
ResultWrapper<ParityTxTraceFromStore[]> traceTransaction = trace_transaction(txHash); | ||
|
||
List<ParityTxTraceFromStore> traces = new(); | ||
foreach (long t in positions) | ||
{ | ||
if (traceTransaction.Data.Length > t+1) | ||
{ | ||
ParityTxTraceFromStore tr = traceTransaction.Data[t+1]; | ||
traces.Add(tr); | ||
} | ||
} | ||
|
||
return ResultWrapper<ParityTxTraceFromStore[]>.Success(traces.ToArray()); | ||
} | ||
|
||
public ResultWrapper<ParityTxTraceFromStore[]> trace_transaction(Keccak txHash) | ||
|
@@ -207,10 +220,10 @@ public ResultWrapper<ParityTxTraceFromStore[]> trace_transaction(Keccak txHash) | |
{ | ||
return ResultWrapper<ParityTxTraceFromStore[]>.Fail(blockSearch); | ||
} | ||
|
||
Block block = blockSearch.Object; | ||
|
||
ParityLikeTxTrace txTrace = TraceTx(block, txHash, ParityTraceTypes.Trace); | ||
IReadOnlyCollection<ParityLikeTxTrace> txTrace = TraceTx(block, txHash, ParityTraceTypes.Trace); | ||
return ResultWrapper<ParityTxTraceFromStore[]>.Success(ParityTxTraceFromStore.FromTxTrace(txTrace)); | ||
} | ||
|
||
|
@@ -224,16 +237,17 @@ private IReadOnlyCollection<ParityLikeTxTrace> TraceBlock(Block block, ParityTra | |
|
||
return listener.BuildResult(); | ||
} | ||
|
||
private ParityLikeTxTrace TraceTx(Block block, Keccak txHash, ParityTraceTypes traceTypes) | ||
private IReadOnlyCollection<ParityLikeTxTrace> TraceTx(Block block, Keccak txHash, ParityTraceTypes traceTypes) | ||
{ | ||
using CancellationTokenSource cancellationTokenSource = new(_cancellationTokenTimeout); | ||
CancellationToken cancellationToken = cancellationTokenSource.Token; | ||
|
||
ParityLikeBlockTracer listener = new(txHash, traceTypes); | ||
_tracer.Trace(block, listener.WithCancellation(cancellationToken)); | ||
|
||
return listener.BuildResult().SingleOrDefault(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you add the tests to trace_replayTransactions with Trace and Rewards flags? |
||
return listener.BuildResult(); | ||
} | ||
|
||
} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Consideration - not sure if implement - keep small cache of recently traced transactions?
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.
@LukaszRozmej agree with you, but firstly I think we need to correct trace bugs like:
#3422
#3034
#3312
#3298