-
Notifications
You must be signed in to change notification settings - Fork 267
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
Adding Tracing Options #1644
Adding Tracing Options #1644
Conversation
effee40
to
3012153
Compare
0552134
to
83495b6
Compare
@@ -39,6 +39,17 @@ | |||
|
|||
private final Map<Keccak256, ProgramTrace> traces = new HashMap<>(); | |||
|
|||
private static TraceOptions traceOptions = 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.
does it need to be static
?
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.
Nope, I've refactored this class, also.
filterProvider.addFilter("opFilter", | ||
SimpleBeanPropertyFilter.serializeAllExcept(traceOptions.getDisabledFields())); | ||
|
||
return OBJECT_MAPPER.setFilterProvider(filterProvider).valueToTree(txTraces); |
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.
multiple threads may collide here. OBJECT_MAPPER
is static
one, so setting a filter here may not be a thread-safe operation.
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've changed that for THIS method only. 💪🏼
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.
(So the rest of them can perform as always)
disabledFields.add("storage"); | ||
} | ||
traceOptions.remove("disableStorage"); | ||
} |
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 would rather extract the branch if (traceOptions.containsKey("disableStorage")) {
to its own method, ie. setDisableStorage
, to ease readability: indentation is too high here IMO.
Same for the other branches alike this one.
WDYT?
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.
Yup! Let's do that!
if (Boolean.parseBoolean(traceOptions.get("disableMemory"))) { | ||
disabledFields.add("memory"); | ||
} | ||
traceOptions.remove("disableMemory"); |
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.
Also, as we discussed before, it would be better to not modify the received traceOptions
.
663e3c9
to
822a41d
Compare
pipeline:run |
} | ||
|
||
public ProgramTraceProcessor(TraceOptions options) { | ||
this(); |
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.
do we need this() call since we will overwrite traceOptions
in the next line?
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.
You're completely right! It remained like that after a refactoring was made. Solved!
pipeline:run |
61bd55c
to
62e2d42
Compare
Kudos, SonarCloud Quality Gate passed! |
pipeline:run |
3 similar comments
pipeline:run |
pipeline:run |
pipeline:run |
62e2d42
to
c5ca59e
Compare
c5ca59e
to
6161312
Compare
Kudos, SonarCloud Quality Gate passed! |
Adding tracing options to
debug_traceTransaction
methodDescription
As described in linked issue, there are some missing options for
debug_traceTransaction
method. This PR adds the ones regarding storage, memory and stack.Motivation and Context
It helps with ecosystem compatibility.
How Has This Been Tested?
By doing unit and manual tests
Types of changes
Checklist:
Fixes #1553