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

Incompatible with solpp? #735

Closed
ddnexus opened this issue Aug 20, 2022 · 2 comments
Closed

Incompatible with solpp? #735

ddnexus opened this issue Aug 20, 2022 · 2 comments

Comments

@ddnexus
Copy link

ddnexus commented Aug 20, 2022

Not sure whether this is an issue that has some work around. The coverage is 0 on all contracts.

We need to use the hardhat-solpp plugin to inject addresses and other stuff at compilation.

The plugin configures solpp preprocessor so it processes the contracts sources in the contracts dir into the cache/solpp-generated-contracts and uses them when testing.

I suspect that running solpp with solidity-coverage HH plugin may remove the instrumentation solidity-coverage injects into the contracts (as reported in #715).

Is that a probable cause?

I guess that a possible workaround (that I don't know how to setup) would be making solitidy-coverage use the previously generated contracts in the cache/solpp-generated-contracts as the actual source (and disabling at the same time solpp).

Is there a way to tell solitidy-coverage to look into the generated dir for sources instead of in the contracts dir?

Thank you.

@ddnexus
Copy link
Author

ddnexus commented Aug 20, 2022

OK, so I tried my work around and it worked. Not sure whether this is the best solution, but it looks pretty clean to me.

// hardhat.config.ts
{
...
    paths: {
        sources: process.env["COVERAGE"] ? "./cache/solpp-generated-contracts" : "./contracts"
...
    solpp: {
        noPreprocessor: process.env["COVERAGE"] ? true : false
...
}

Then call the task with with COVERAGE=true hardhat coverage

@cgewecke
Copy link
Member

Looks good to me! Thanks for the workaround.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants