-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
Enable ethdebug debug info and output selection. #15289
base: develop
Are you sure you want to change the base?
Conversation
ccbe426
to
71bf655
Compare
ec729b3
to
ee2bc12
Compare
ee2bc12
to
9772d20
Compare
09fd459
to
53e12ef
Compare
4b5c548
to
a262eef
Compare
a262eef
to
c4cb445
Compare
fe6a4ca
to
7917ca3
Compare
7917ca3
to
13c0683
Compare
c4faae4
to
c9417ed
Compare
[](const Json& result) | ||
{ | ||
return result["contracts"]["fileA"]["contractA"]["evm"]["deployedBytecode"].contains("ethdebug") && | ||
result["contracts"]["fileB"]["contractB"]["evm"]["bytecode"].contains("ethdebug") ; |
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.
result["contracts"]["fileB"]["contractB"]["evm"]["bytecode"].contains("ethdebug") ; | |
result["contracts"]["fileB"]["contractB"]["evm"]["bytecode"].contains("ethdebug"); |
for (auto const& selectedArtifactJson: _outputSelection) | ||
{ | ||
std::string const& selectedArtifact = selectedArtifactJson.get<std::string>(); | ||
if ( | ||
_artifact == selectedArtifact || | ||
boost::algorithm::starts_with(_artifact, selectedArtifact + ".") | ||
) | ||
{ | ||
if (_artifact.find("ethdebug") != std::string::npos) | ||
// only accept exact matches for ethdebug, e.g. evm.bytecode.ethdebug |
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 you have this covered by a test, e.g. requesting ethdebugs
instead of ethdebug
?
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.
ah good point! I guess ethdebugs
will be detected too ;)
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.
ok.. this is not an issue because of the next line return selectedArtifact == _artifact;
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 just noticed that the error handling of the output selection is horrible.. there are no error messages at all, if someone selects a non-existing selection option.. thats why I will also not do anything about this.. I just checked, whether evm.bytecode.ethdebugs
/evm.deployedBytecode.ethdebugs
is accidentally selecting ethdebug - but this is not the case
return false; | ||
|
||
for (auto const& fileRequests: _outputSelection) | ||
for (auto const& requests: fileRequests) |
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.
requests
is just a list of contracts (wildcard included) right?
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.
yep exactly
std::nullopt, | ||
}, | ||
{ | ||
generateStandardJson(false, Json::array({"ethdebug"}), Json::array({"ir"})), |
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.
By the way, I still think you should have one or two cmdline tests for ethdebug - one for the CLI and one for StandardJSON. These should just be happy case smoke tests. I know they're covered here, but this is significantly more difficult to read than a cmdline test :D
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.
ah true! thanks for the reminder, I wanted to add some basic smoke tests
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.
It was definitely worth to add those tests, because it revealed a small bug in cli parameter handling in the context of strict assembly :) also with yul in standard json the top-level ethdebug object was missing in the output
4d01075
to
ada3616
Compare
ada3616
to
6b2efa0
Compare
6b2efa0
to
b8851f6
Compare
debug-info
was set toethdebug
ir
,irOptimized
and/orethdebug
was selected as output.standard_debug_info_in_yul_ethdebug_output_ir_optimized
,standard_debug_info_in_yul_ethdebug_output_no_ir
strict-assembly
e.g.solc --strict-assembly <yul> --debug-info ethdebug
debug-info
ethdebug
is excluded from the help on clidebug-info
ethdebug
is excluded fromall
on cli and wildcard selection*
in standard-jsonethdebug
was selected as outputdebug-info
was selected, it implicitly setdebug-info
toethdebug
.solc <contract> --ethdebug
via-ir
was not specified, it will error with a message stating thatethdebug
can only be selected as output, ifvia-ir
was defined.solc <contract> --ethdebug
only works with--via-ir
debug-info
was selected and did not containethdebug
, an error will be generated stating thatethdebug
need to be set indebug-info
solc <contract> --ethdebug --debug-info location
strict-assembly
will always work e.g.solc --strict-assembly <yul> --ethdebug
ethdebug
is not shown in cli helpethdebug
output selection is excluded from wildcard selection*
in standard-jsonUPDATE
After some discussion with @gnidan and @ekpyron it turned out that we need something slightly different:
ethdebug
output will now be enabled withevm.bytecode.ethdebug
(deploytime part) andevm.deployedBytecode.ethdebug
(runtime part)evm.bytecode
andevm.deployedBytecode
behave like a wildcard, so the ethdebug stuff is excluded here.--bin
and--bin-runtime
ethdebug selection will now work similar with--ethdebug
and--ethdebug-runtime