-
Notifications
You must be signed in to change notification settings - Fork 6k
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
Fix custom cleanup sequence missing from metadata when other optimizer settings have default values #15859
base: develop
Are you sure you want to change the base?
Conversation
This needs a changelog entry and a regression test that reproduces it. Also, pinging @kuzdogan. Sourcify may need a workaround for this. We should check which versions are affected (I guess it was introduced along with the cleanup sequence?). |
7aaf41b
to
cc03b19
Compare
The setting was introduced in v0.8.18 (including it not being part of |
cc03b19
to
8e704f5
Compare
8e704f5
to
c1c10ac
Compare
"yulDetails": { | ||
// default optimization sequence with a custom (truncated) cleanup sequence. | ||
// 0.8.18 - 0.8.28 this would spuriously be interpreted as defaulted optimizer settings in metadata. | ||
"optimizerSteps": "dhfoDgvulfnTUtnIf[xa[r]EscLMcCTUtTOntnfDIulLculVcul [j]Tpeulxa[rul]xa[r]cLgvifCTUca[r]LSsTFOtfDnca[r]Iulc]jmul[jul] VcTOcul jmul: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.
I don't like this test so much actually. We won't regress if the default sequence changes at some point and it goes unnoticed to update it here as well. Something more elaborate would be first asserting that with the correct sequence it does produce default output and then truncating it in one of these ~
-prefixed 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.
Another option would be to add this case to boost-based metadata tests:
solidity/test/libsolidity/Metadata.cpp
Lines 452 to 459 in 9005353
std::vector<std::tuple<std::string, std::string>> sequences = | |
{ | |
// {"<optimizer sequence>", "<optimizer cleanup sequence>"} | |
{"", ""}, | |
{"", "fDn"}, | |
{"dhfoDgvulfnTUtnIf", "" }, | |
{"dhfoDgvulfnTUtnIf", "fDn"} | |
}; |
There you can refer to OptimiserSettings
and the default sequence without hard-coding it.
@@ -13,6 +13,7 @@ Compiler Features: | |||
|
|||
Bugfixes: | |||
* General: Fix internal compiler error when requesting IR AST outputs for interfaces and abstract contracts. | |||
* Metadata: Fix custom cleanup sequence missing from metadata when other optimizer settings have default values |
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.
* Metadata: Fix custom cleanup sequence missing from metadata when other optimizer settings have default values | |
* Metadata: Fix custom cleanup sequence missing from metadata when other optimizer settings have default values. |
"yulDetails": { | ||
// default optimization sequence with a custom (truncated) cleanup sequence. | ||
// 0.8.18 - 0.8.28 this would spuriously be interpreted as defaulted optimizer settings in metadata. | ||
"optimizerSteps": "dhfoDgvulfnTUtnIf[xa[r]EscLMcCTUtTOntnfDIulLculVcul [j]Tpeulxa[rul]xa[r]cLgvifCTUca[r]LSsTFOtfDnca[r]Iulc]jmul[jul] VcTOcul jmul: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.
Another option would be to add this case to boost-based metadata tests:
solidity/test/libsolidity/Metadata.cpp
Lines 452 to 459 in 9005353
std::vector<std::tuple<std::string, std::string>> sequences = | |
{ | |
// {"<optimizer sequence>", "<optimizer cleanup sequence>"} | |
{"", ""}, | |
{"", "fDn"}, | |
{"dhfoDgvulfnTUtnIf", "" }, | |
{"dhfoDgvulfnTUtnIf", "fDn"} | |
}; |
There you can refer to OptimiserSettings
and the default sequence without hard-coding it.
Extracted from PR #15834, see #15834 (comment).
The previous implementation did not make use of the
yulOptimiserCleanupSteps
. As @cameel suspected, providing a custom cleanup sequence under the default optimization sequence previously simply yielded a"optimizer": "enabled":true, "runs": 200}
which potentially (or: most likely) doesn't reproduce the original compilation results.I think it is a bit mitigated by there not being a specific field for the cleanup sequence in the standard-json input but one would rather have to reproduce the entire default optimization sequence, add a colon, and then modify the cleanup sequence.