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

Apparent enabling optimizations error #609

Closed
gbalabasquer opened this issue Feb 11, 2021 · 8 comments
Closed

Apparent enabling optimizations error #609

gbalabasquer opened this issue Feb 11, 2021 · 8 comments

Comments

@gbalabasquer
Copy link
Contributor

We just deployed a contract using latest released version and DAPP_SOLC_OPTIMIZE=true and the contract got deployed without optimization.
It seems the variable being check is actually: DAPP_BUILD_OPTIMIZE:

if os.getenv('DAPP_BUILD_OPTIMIZE') == '1':

I'm not really sure if I'm losing some linking between those two variables or if I'm looking to the wrong place, but the fact that the contract deployed without optimization makes me think there is actually the problem.

Btw is it possible to see the solc output again when running dapp build?, these kind of errors would be probably caught better if we could still see the what the final solc command looks like.

@MrChico
Copy link
Member

MrChico commented Feb 11, 2021

the solc output will not tell you much anymore, because the compiler options have been bundled into the standard-json. The actual invocation will just look like:

solc --standard-json $(dapp mk-standard-json)

If you want to see the compiler options, you can look at the output of dapp mk-standard-json. Thanks for spotting the change in the env var. This should be addressed

@gbalabasquer
Copy link
Contributor Author

Oh yes, you are right, dapp mk-standard-json has what I want. Thanks.

@gbalabasquer
Copy link
Contributor Author

It seems even using the two flags doesn't build with optimization:

DAPP_SOLC_OPTIMIZE=true DAPP_BUILD_OPTIMIZE=true DAPP_SOLC_OPTIMIZE_RUNS=200 dapp --use solc:0.6.11 build

So far I think there is no option to deploy with optimization, as if I use --legacy:

SOLC_FLAGS="--optimize --optimize-runs 200" dapp --use solc:0.6.11 build --legacy

Then when we run dapp create <CONTRACT_NAME> we get the following:

dapp-create: error: <CONTRACT_NAME> not found

If we do:

DAPP_SOLC_OPTIMIZE=true DAPP_BUILD_OPTIMIZE=1 DAPP_SOLC_OPTIMIZE_RUNS=200 dapp --use solc:0.6.11 build

Then dapp create throws:

jq: error (at <stdin>:1): null (null) has no keys
dapp-create: error: DssExecLib not found

@MrChico
Copy link
Member

MrChico commented Feb 15, 2021

The flag is DAPP_BUILD_OPTIMIZE=1. The dapp create error seems to be a different problem. Did you give the full path when doing dapp create? As in dapp create src/execlib.sol:DssExecLib?

@gbalabasquer
Copy link
Contributor Author

No, I haven't tried with the full path, the file is src/DssExecLib.sol. Gonna try the full path.

@gbalabasquer
Copy link
Contributor Author

Actually never mind, the not found has to do with an error in the compilation due the optimizer is on. DAPP_BUILD_OPTIMIZE=1 just works, the only real issue is updating the flag.

@d-xo
Copy link
Contributor

d-xo commented Feb 17, 2021

btw @gbalabasquer we just merged support for DAPP_BUILD_OPTIMIZE_RUNS in #613

@gbalabasquer
Copy link
Contributor Author

Yes, thanks!

@MrChico MrChico closed this as completed Apr 29, 2021
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

No branches or pull requests

3 participants