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

Is truffle 5.0.0 supported? #309

Closed
alex-murashkin opened this issue Nov 30, 2018 · 14 comments
Closed

Is truffle 5.0.0 supported? #309

alex-murashkin opened this issue Nov 30, 2018 · 14 comments

Comments

@alex-murashkin
Copy link

The package.json currently specifies Truffle 4
https://github.com/sc-forks/solidity-coverage/blob/master/package.json#L49

Does solidity-coverage work with projects created using truffle 5.0.0?

@superduck35
Copy link

I'm running truffle 5.0.0-beta.2 and getting compilation errors on some solc 0.5.x specific code when executing solidity-coverage.

I am keen to know if support for the new solc version is currently in the pipeline?

@StefH
Copy link

StefH commented Dec 12, 2018

For a simple/small contract, I'm able to get coverage working
https://github.com/mstack/bootcamp-blockchain-smartcontracts/

See Lab 2 & Lab 2 - Completed
(Note the truffle-config.js and .solcover.js files for some detail.

However for a bigger complexer contract, I still get a lot of errors.

@angus-hamill
Copy link
Contributor

Couple of issues I've encountered and fixed:

  • Disconnecting from testrpc while running migrations: for some reason this happens when migrations are longer than ~150 lines, just split up any large migration into multiple small migrations.

  • calldata storage specifier giving a syntax error: I've opened a PR at Add calldata storage location specifier solidity-parser#17 for this. You should just be able to copy accross the changes to node_modules/solidity-parser-sc until this is merged/fixed

@celeduc
Copy link
Contributor

celeduc commented Dec 23, 2018

Truffle 5.0.0 now allows you to specify the version of solc you want to use to compile your contracts. This works with the default test runner, but not with solidity-coverage (which doesn't use the same test runner in truffle-compile).

It does not work with 5.0.0 for contracts which require solc 0.4.x.

See https://travis-ci.org/alfabc/braided/builds/471619698#L774

@alex-murashkin
Copy link
Author

alex-murashkin commented Jan 3, 2019

Thanks everyone. Sharing the following workaround that has worked for me for "truffle": "5.0.0-beta.2" and "solidity-coverage": "0.5.4",.
.solcover.js:

module.exports = {
    compileCommand: "cp ../truffle-coverage.js ./truffle.js && truffle compile",
    testCommand: "cp ../truffle-coverage.js ./truffle.js && truffle test",
    ...
};

truffle-coverage.js:

module.exports = {
  compilers: {
    solc: {
      optimizer: {
        enabled: true,
        runs: 200
      },
      version: "0.4.25"
    }
  },
  networks: {
    development: {
      host: "localhost",
      network_id: "*",
      port: 7545,
      gas: 0xfffffffffff,
      gasPrice: 0x01
    }
  }
};

Run: ./node_modules/.bin/solidity-coverage

IIRC, the "cp" step was necessary because by default, the compilers section isn't included in the generated truffle config file. I may have missed/forgotten some details as it was last year but that's the gist of it :)

@vibern0
Copy link

vibern0 commented Jan 4, 2019

Hi,
it wasn't supported. I was using solidity 0.5.x and truffle v5 and was not working. I did try to fix it and looks like it's working, at least with the project I was trying it started to work. You can see here the changes #311. Write some comment if you want 👍

@maxsam4
Copy link
Contributor

maxsam4 commented Jan 4, 2019

As a temporary fix, copy https://raw.githubusercontent.com/maxsam4/solidity-parser/solidity-0.5/build/parser.js to node_modules/solidity-parser-sc/build/parser.js

As I am doing in the truffle-5 branch for polymath-core, you may configure your CI to replace this file automatically using

curl -o node_modules/solidity-parser-sc/build/parser.js https://raw.githubusercontent.com/maxsam4/solidity-parser/solidity-0.5/build/parser.js

Waiting for @cgewecke to be active once again and merge sc-forks/solidity-parser#18 and 17.

@vibern0
Copy link

vibern0 commented Jan 5, 2019

But is your PR supporting truffle v5, solidity 0.5.x and using web3.js-1.0.0-beta.x ?

@rotcivegaf
Copy link

You can try this but its not official, I use the code of @maxsam4 and @angus-hamill, add my fork in your package.json
"solidity-coverage": "rotcivegaf/solidity-coverage"
Execute with ./node_modules/.bin/solidity-coverage
or
npm install -g "rotcivegaf/solidity-coverage" and solidity-coverage in a terminal

Works with calldata and address payable
RCN-circle-ci

@vibern0
Copy link

vibern0 commented Jan 16, 2019

Awesome, but what I see here is a bunch of forks.
Can we ask someone to start doing something?

@barlock
Copy link

barlock commented Jan 17, 2019

I believe this pr is #311.

Hasn't been touched in 2 weeks though.

@vibern0
Copy link

vibern0 commented Jan 18, 2019

I believe this pr is #311.

Hasn't been touched in 2 weeks though.

This PR actually fixes the problem, I've been using it for a while. The only thing failing is the tests because they are using old stuff, for example, very old examples of code from open zeppelin.

I have a lot more work to do so instead of just being here spending time for maybe nothing I decided to get in touch with truffle team. They know that this is not being maintained and they want to add coverage to their tests, but they might not use this framework.

This is the reason I gave up about it. It's too much work for nothing. Sorry to disappoint you. One thing I'm sure is that what is said on the PR #311 is working. Might need some changes, but so far, for me is working well.

@area
Copy link
Contributor

area commented Mar 2, 2019

For those interested in this issue, I would be interested in any peculiar results or behaviour you found when trying to use the leapdao branch in this repository, which should work. Note that it assumes solidity ^0.5.3 - for anyone wishing to use Truffle 5 with solidity 0.4.x, you should try setting your compiler version manually in truffle.js, but I have not tested that functionality at all, so there may be dragons.

@cgewecke
Copy link
Member

0.6.0

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