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

Automatically determine possible kwargs for solc_wrapper #80

Closed
iamdefinitelyahuman opened this issue Jun 10, 2020 · 1 comment
Closed
Labels
enhancement New feature or request

Comments

@iamdefinitelyahuman
Copy link
Contributor

Originally posted by @iamdefinitelyahuman in #78 (comment)

solc_wrapper kwargs should be generalized / future-proofed by regexing the solc --help output. This would reduce a lot of overhead around checking exactly which flags were added in which version. A few flags require specific logic but the vast majority are only setting a flag or setting a flag and adding a string after it.. shouldn't be that hard to do.

Here's a quick hacky experiment I did:

>>> help_output = solcx.wrapper.solc_wrapper(help=True)
>>> opts = [i.lstrip() for i in help_output.split('\n') if i.lstrip().startswith('-')]
>>> [next(x for x in i.split(' ') if x.startswith('--')) for i in opts]
['--help', '--version', '--license', '--evm-version', '--pretty-json', '--libraries', '--revert-strings', '--output-dir', '--overwrite', '--combined-json', '--gas', '--standard-json', '--import-ast', '--combined-json', '--assemble', '--machine,', '--yul-optimizations', '--yul', '--machine,', '--yul-optimizations', '--strict-assembly', '--yul-optimizations', '--yul-dialect', '--machine', '--link', '--libraries', '--metadata-hash', '--metadata-literal', '--allow-paths', '--base-path', '--color', '--no-color', '--old-reporter', '--error-recovery', '--ignore-missing', '--optimize', '--optimize-runs', '--optimize-yul', '--no-optimize-yul', '--yul-optimizations', '--ast-json', '--ast-compact-json', '--asm', '--asm-json', '--opcodes', '--bin', '--bin-runtime', '--abi', '--ir', '--ir-optimized', '--ewasm', '--hashes', '--userdoc', '--devdoc', '--metadata', '--storage-layout']

It will require fairly thorough testing and there's no guarantee it won't be broken in a future solc release - but I think this could be done in a way that's just as reliable as what we have today.

@iamdefinitelyahuman iamdefinitelyahuman added the enhancement New feature or request label Jun 10, 2020
@iamdefinitelyahuman iamdefinitelyahuman added this to the py-solc-x 1.0.0 milestone Jun 10, 2020
@iamdefinitelyahuman
Copy link
Contributor Author

Related - new layout for command-line help was merged 2 days ago.

ethereum/solidity#9076

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant