-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
Accept empty optimizer sequence with Yul optimizer disabled #14657
Accept empty optimizer sequence with Yul optimizer disabled #14657
Conversation
e183552
to
100474a
Compare
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.
Seems correct in terms of logic. Still needs a changelog entry and docs.
And can be simplified in many ways - see my comments below.
test/cmdlineTests/standard_optimizer_yulDetails_optimiserSteps_no_yul/input.json
Outdated
Show resolved
Hide resolved
.../cmdlineTests/standard_optimizer_yulDetails_optimiserSteps_with_empty_sequence_no_yul/in.sol
Show resolved
Hide resolved
d778c59
to
b44e88d
Compare
0a35d7f
to
4b646b3
Compare
test/cmdlineTests/yul_optimizer_steps_without_optimize_empty_sequence/input.sol
Show resolved
Hide resolved
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.
There are still things we could improve but nothing so horrible that it would prevent us from shipping this :)
.../cmdlineTests/standard_optimizer_yulDetails_optimiserSteps_with_empty_sequence_no_yul/in.sol
Show resolved
Hide resolved
test/cmdlineTests/yul_optimizer_steps_without_optimize_empty_sequence/input.sol
Show resolved
Hide resolved
69eecc1
to
5855731
Compare
{ | ||
size_t delimiterCount{0}; | ||
for (char const step: _sequence) | ||
switch (step) | ||
{ | ||
case ':': | ||
if (++delimiterCount > 1) | ||
return false; | ||
break; | ||
case ' ': | ||
case '\n': | ||
break; | ||
default: | ||
return false; | ||
} | ||
return 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.
I mean, I'm very much fine with leaving this as is - but given that I think I even already saw some discussion in the channel around this on the side, I can't help but wonder: why the special handling of different counts of colons in here and all the fuzz (the sequence will separately be validated and arguably it even makes more sense to treat "::"
as empty but malformed rather than as non-empty...)?
This could just be (inline):
{ | |
size_t delimiterCount{0}; | |
for (char const step: _sequence) | |
switch (step) | |
{ | |
case ':': | |
if (++delimiterCount > 1) | |
return false; | |
break; | |
case ' ': | |
case '\n': | |
break; | |
default: | |
return false; | |
} | |
return true; | |
} | |
{ | |
return ranges::any_of(_sequence, [](auto _step) { return _step != ':' && _step != ' ' && _step != '\n'; }); | |
} |
in one case - and in the second case for standard json even simpler...
Without looking through this fully: how exactly does this bypass the fact that we don't enter the sequence to metadata if |
{ | ||
if (_details.isMember(_name)) | ||
{ | ||
if (_details[_name].isString()) | ||
{ | ||
std::string const fullSequence = _details[_name].asString(); | ||
if (!_runYulOptimizer && !OptimiserSuite::isEmptyOptimizerSequence(fullSequence)) | ||
return formatFatalError(Error::Type::JSONError, "If Yul optimizer is disabled, only an empty optimizerSteps sequence is accepted."); |
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.
return formatFatalError(Error::Type::JSONError, "If Yul optimizer is disabled, only an empty optimizerSteps sequence is accepted."); | |
return formatFatalError(Error::Type::JSONError, "When Yul optimizer is disabled, only an empty optimizerSteps sequence is accepted."); |
10136ff
to
1cbcc8e
Compare
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.
Without looking through this fully: how exactly does this bypass the fact that we don't enter the sequence to metadata if
runYulOptimiser
isfalse
? I'd expect to see some change accounting for that (i.e. inCompilerStack::createMetadata
), but I don't on a quick glance.
Right, good catch, it doesn't. createMetadata()
will skip the sequence when runYulOptimiser
is false
and this will result in metadata not recreating the bytecode. This needs to be fixed before we can merge the PR.
This was implemented this morning though. |
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.
Needs some asserts. Other than that seems good.
This was implemented this morning though.
An, right. Somehow I missed that when I skimmed though the PR and thought the changes were not applied yet.
else if | ||
( |
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.
else if | |
( | |
else if( |
Whitespace and newline validation for empty sequence Changelog and docs Kamil Revert "fixup! Accept empty optimizer sequence with Yul optimizer disabled" This reverts commit 1cbcc8e.
f0618dc
to
d899d9c
Compare
Fixes: #14621