ethereum / populus

The Ethereum development framework with the most cute animal pictures
http://populus.readthedocs.org/
321 stars 321 forks source link

solidity compiler settings in project.json don't work as expected #468

Open voith opened 6 years ago

voith commented 6 years ago

What was wrong?

providing any command_line option like evm_version in the example below doesn't work

"SolcAutoBackend": {
        "class": "populus.compilation.backends.SolcAutoBackend",
        "settings": {
          "optimize": true,
          "command_line_options": {
            "allow_paths": "/",
            "evm_version": "homestead"
          }
}

This is because populus uses standard-json as input to py-solc: https://github.com/ethereum/populus/blob/c256cbac0e343a1ce477a2e6128ef6a6c77b8c3c/populus/compilation/backends/solc_standard_json.py#L134-L145 Whenever standard-json is passed to py-solc all other options are ignored.

$solc --help
...
 --standard-json      Switch to Standard JSON input / output mode, ignoring
                       all options. It reads from standard input and provides
                       the result on the standard output.
...

Cute Animal Picture

voith commented 6 years ago

However, populus provides another way to configure settings in standard-json. Use stdin instead of command_line_options

"SolcAutoBackend": {
        "class": "populus.compilation.backends.SolcAutoBackend",
        "settings": {
          "optimize": true,
          "output_values": [
            "abi",
            "bin",
            "bin-runtime",
            "metadata"
          ],
          "command_line_options": {
            "allow_paths": "/"
          },
          "stdin": {
            "evmVersion": "homestead"
          }
}

However, allow_paths seems to work for some reason.