-
Notifications
You must be signed in to change notification settings - Fork 269
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
Internal calls from constructor fail to compile #433
Comments
This seems very similar to this issue on older versions of the Solidity compiler. Not sure what would make it show up again - the above was compiled with |
Thanks for the quick response. We're currently using the latest stable release, I'll try 1) compiling with the optimizer disabled and 2) a coverage run with the 0.7.0-beta and let you know the results. Thanks! |
@mrice32 Ah cool ok, just lmk if you run into problems...there are links to the 0.7.0 docs and an upgrade guide at the top of the current README. |
I tried compiling with the optimizer off, and I had no problems, which leads me to believe that this may be a distinct issue from #417 As for the beta, do you suspect that installing it may solve this issue assuming it's not a duplicate of #417? I only ask because the beta may take me a bit longer to set up since we have a bit of custom plumbing built around the |
@mrice32 Yes I do suspect that (unfortunately). The beta uses a much less problematic instrumentation strategy and if you can compile without optimization normally you shouldn't see that error. Could I ask what your additional plumbing is like? |
It's not super complicated, it's just these files: https://github.com/UMAprotocol/protocol/blob/master/ci/coverage.sh I'll need to work through the beta instructions, which will almost certainly get rid of or simplify most of this code. I'll move to the beta and let you know what I find! Thanks! |
The contracts seem to compile correctly with the beta, which is great news! Thanks for your help. I've attempted to upgrade our repo to the beta, but I've run into an issue that I can't seem to resolve. I'm not sure if it's a coverage issue or a truffle issue. This error throws before any tests are run.
Not sure why the error has no description, but I narrowed it to this line in our migrations: https://github.com/UMAprotocol/protocol/blob/285311051c2a0847ac2b0ede399d6e066e6d64c3/core/migrations/10_deploy_tokenized_derivative_creator.js#L31. It's the only place where we link a library, so my guess is it has something to do with linking. Are you aware of any issues related to linking libraries? Side note: this error does not show up when running tests normally. |
Also, please let me know if you'd prefer that I move this discussion to a new issue since it's unrelated to the title. |
In your package.json Truffle looks pinned at 5.0.21. Is it possible to upgrade to a newer Truffle version and see if the regular tests work? Then, if they do - try solidity-coverage again with the newer version. The beta relies on plugin resources that were added after 5.0.31. It tries to handle older Truffle versions but maybe that's not working too well. This thread is fine! Super into finding and fixing any bugs on the beta. |
Thanks for the tip - I'l make sure I run with
|
Also @mrice32 if you push your change-set to UMA I'd be happy to take a look and debug locally. |
Sure, here's the branch I'm using: https://github.com/mrice32/protocol/tree/coverage. Sorry if it's a little messy! |
To run coverage you'll need to run the following commands from the top level directory: npm install
./ci/coverage.sh core |
Awesome, checking it out rn. |
Ok! In coverage.sh - $(npm bin)/truffle run coverage --network coverage
+ $(npm bin)/truffle run coverage --network ci ...gets the tests running. Still debugging though because I see a couple failing. |
But I see this set of errors - not sure what's expected here. Can you clarify?
One thing that might be important is to set the In .solcover.js I think you'd put: module.exports = {
providerOptions: {
network_id: 1234
},
skipFiles: ["Migrations.sol", "echidna_tests", "test"]
}; |
Gotcha. That makes a lot of sense. Just out of curiosity, why can't you just use I'm guessing those test errors have to do with some of the other stuff that I changed, but I'll dig in and double check. Regardless, I think this is really close to working. I really appreciate you taking the time to help! |
@mrice32 "*" is very likely fine, was just mentioning it in case there's some network id specific logic in your code. Often people give that a concrete value when they're using it to toggle something on/off.
No problem! Thanks for trying the beta and just ping this ticket if there's more to fix. Closing for now though because the 0.6.x branch isn't going to get further development. |
We've been running into a compilation issue related to calling internal functions from a constructor (I think this used to be an issue in
solc
). The following contract fails to compile after being instrumented:The error that the compiler gives is:
We've noticed that moving the internal call to a
public
method seems to avoid the issue. The following contract compiles fine after being instrumented:Two other things to note:
solc
.cc @ptare
The text was updated successfully, but these errors were encountered: