Skip to content
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

Non-interactive mode for yulopti. #12221

Merged
merged 2 commits into from
Nov 3, 2021
Merged

Non-interactive mode for yulopti. #12221

merged 2 commits into from
Nov 3, 2021

Conversation

ekpyron
Copy link
Member

@ekpyron ekpyron commented Nov 2, 2021

Background: make it possible to easily run isolated optimizer steps to aid in developing automated verification tools.

Not sure how much we want to refine this, the PR is just a quickly written version that seems to work.

@ekpyron ekpyron force-pushed the yulOptiNonInteractive branch from c53d7f7 to f91cfc7 Compare November 2, 2021 10:15
@ekpyron
Copy link
Member Author

ekpyron commented Nov 3, 2021

Ah, sigh, I mainly wanted to have something quickly to be able to get back to people who would need this :-).
But I guess I can refactor OptimiserSuite (e.g. runSequence currently is public, but the constructor is private, so there's still no way to run it, etc.) and do this properly in the process...

@cameel
Copy link
Member

cameel commented Nov 3, 2021

Oh, true, forgot that it's not public. Still, runSequence() can pretty easily be made into a static function and made public. The only state it needs are really m_context and m_debug used by the other overload. It's just a matter of passing these via parameters.

It's not a huge change and I think that not having two separate pieces of code executing these sequences is worth it. And people might want the ability to run bracketed and nested sequences anyway (we do have them in our default sequence after all).

@ekpyron ekpyron force-pushed the yulOptiNonInteractive branch 2 times, most recently from a037003 to 4213773 Compare November 3, 2021 11:16
@ekpyron
Copy link
Member Author

ekpyron commented Nov 3, 2021

Happier now :-)? We could spend a week to make this nicer, but I'd really just like to have anything working fast ;-).

@ekpyron ekpyron force-pushed the yulOptiNonInteractive branch 3 times, most recently from 261d13f to a06cb09 Compare November 3, 2021 11:36
@ekpyron ekpyron requested review from chriseth and cameel November 3, 2021 11:51
cameel
cameel previously approved these changes Nov 3, 2021
Copy link
Member

@cameel cameel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

I have some suggestions about stdin handling and exceptions but I'd only consider the ones about exceptions to be important (and I provided suggestions for them that you can just commit and squash) so in the interest of getting it through quickly, I'm approving already.

m_dialect,
m_nameDispenser,
m_reservedIdentifiers,
solidity::frontend::OptimiserSettings::standard().expectedExecutionsPerDeployment
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a question: I just noticed that we have it hard-coded. Isn't this parameter kinda important when playing with the optimizer? Maybe we should have a prameter for this (not in this PR of course)?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, when I stumbled across this now, I also thought, it should probably be configurable - it would be a bit annoying to do in interactive mode (i.e. allow changing it between steps on the fly), but at least a command line option might be nice. But yeah, we can do it separately.

Copy link
Member

@cameel cameel Nov 3, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a good easy task for an external contributor. I'll create an issue.

@ekpyron ekpyron force-pushed the yulOptiNonInteractive branch 2 times, most recently from c398990 to 4966717 Compare November 3, 2021 13:57
@ekpyron
Copy link
Member Author

ekpyron commented Nov 3, 2021

Updated. I also noticed that most parser errors are fatal and throw, so to properly report that, we need to catch in parse, too (and the exception does not provide useful info, but it rather remains in the error list).

It also doesn't ignore --help anymore now and has proper exit codes on usage errors and more similar minor changes.

@ekpyron ekpyron force-pushed the yulOptiNonInteractive branch from 4966717 to e809e8a Compare November 3, 2021 14:30
cameel
cameel previously approved these changes Nov 3, 2021
Copy link
Member

@cameel cameel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, I have some change suggestions but none of it is critical so I'm approving in case you just want to merge it as is.

@ekpyron
Copy link
Member Author

ekpyron commented Nov 3, 2021

Ok, I globalized the exception handling and while doing so eliminated some status returns :-).

cameel
cameel previously approved these changes Nov 3, 2021
@ekpyron
Copy link
Member Author

ekpyron commented Nov 3, 2021

Rebased in hopes of it fixing an hopefully random download error in external tests.

@cameel
Copy link
Member

cameel commented Nov 3, 2021

Was it a download error or a test error? #12187 was merged today so we will start getting errors if the upstream of these tests has breakage in its main branch. At least for OZ and ENS (and Gnosis after the respective PR gets merged).

@ekpyron
Copy link
Member Author

ekpyron commented Nov 3, 2021

Was it a download error or a test error? #12187 was merged today so we will start getting errors if the upstream of these tests has breakage in its main branch. At least for OZ and ENS (and Gnosis after the respective PR gets merged).

I didn't pay that much attention and don't see the run anymore... I think it was one of the t_ems_*_ext_zeppelin runs and it complained about not being able to fetch some 0.6 soljson.js (whyever it would want to do that)

@cameel
Copy link
Member

cameel commented Nov 3, 2021

t_ems_compile_ext_zeppelin. It does seem like a download failure:

Error BDLR503: Couldn't download compiler version 0.6.12. Checksum verification failed. Please check your connection or use local version 0.6.8

The fact that it tries to download the compiler is probably due to #10745 - it builds with hardhat but we only configure truffle. #12192 fixes that for good but restarting the test seems to have helped here.

@ekpyron ekpyron merged commit 4a49e6e into develop Nov 3, 2021
@ekpyron ekpyron deleted the yulOptiNonInteractive branch November 3, 2021 20:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants