I'm new with blockchain development. I'm working on an old project which use solidity 0.4.17 and truffle ^4.0.0-beta.2; These versions were in the package.json file of the project.
When I installed truffle and solidity globally, it installed the latest version for them. And the project was also using these latest versions(check with "truffle version" command). But when I changed old pragma versions to the latest, the project had a lot of errors and warnings(too many to handle manually). So I decided to downgrade truffle and solc to be able to compile the project.
The project finally compiled and some of the tests passed successfully. But when I tried running "npm run coverage" it couldn't find these files from one of the contract:
import "truffle/Assert.sol";
import "truffle/DeployedAddresses.sol";
Then I found Assert.sol file in truffle repo on github and referenced it from node_modules. but new error is this:
Error: Could not find truffle/AssertString.sol from any sources; imported from truffle/Assert.sol
at C:\Users\giusha9\Desktop\Authcoin-Qtum-master-old-version\node_modules\truffle\build\cli.bundled.js:59552:23
at C:\Users\giusha9\Desktop\Authcoin-Qtum-master-old-version\node_modules\truffle\build\cli.bundled.js:155895:16
at next (C:\Users\giusha9\Desktop\Authcoin-Qtum-master-old-version\node_modules\truffle\build\cli.bundled.js:167654:18)
at C:\Users\giusha9\Desktop\Authcoin-Qtum-master-old-version\node_modules\truffle\build\cli.bundled.js:59540:7
at C:\Users\giusha9\Desktop\Authcoin-Qtum-master-old-version\node_modules\truffle\build\cli.bundled.js:190397:5
at C:\Users\giusha9\Desktop\Authcoin-Qtum-master-old-version\node_modules\truffle\build\cli.bundled.js:167559:16
at replenish (C:\Users\giusha9\Desktop\Authcoin-Qtum-master-old-version\node_modules\truffle\build\cli.bundled.js:155865:25)
at iterateeCallback (C:\Users\giusha9\Desktop\Authcoin-Qtum-master-old-version\node_modules\truffle\build\cli.bundled.js:155855:17)
at C:\Users\giusha9\Desktop\Authcoin-Qtum-master-old-version\node_modules\truffle\build\cli.bundled.js:155895:16
at ReadFileContext.callback (C:\Users\giusha9\Desktop\Authcoin-Qtum-master-old-version\node_modules\truffle\build\cli.bundled.js:190393:14)
Cleaning up...
This is the package.json:
"scripts": {
"compile": "truffle compile",
"build": "truffle build",
"deploy": "truffle deploy",
"postinstall": "truffle install",
"console": "truffle console",
"testrpc": "testrpc --gasLimit 60000000",
"testrpc:coverage": "node_modules/.bin/testrpc-sc --port 8555",
"truffle-test": "truffle test",
"test": "run-p --aggregate-output --race testrpc truffle-test",
"solidity-coverage": "node_modules/.bin/solidity-coverage",
"coverage": "run-p --aggregate-output --race testrpc:coverage solidity-coverage",
"lint": "node_modules/.bin/solium --dir ./contracts"
},
"devDependencies": {
"concurrently": "^3.5.0",
"ethereumjs-testrpc": "^6.0.3",
"npm-run-all": "^4.1.1",
"solidity-coverage": "^0.2.7",
"solium": "^0.5.5",
"truffle": "v4.0.0-beta.2",
"ethereumjs-util": "^5.1.2"
},
"dependencies": {
"chai": "^4.1.2"
}
I have three questions:
How can I solve this last error about assert.sol and DeployedAddresses.sol?
Does it worth to downgrade solidity and truffle versions? because it seems that these last errors won't be the last one I have to deal with, It seems that a lot has changed since 0.4.17 version.
If I will use a new version of truffle and solidity is there any way to avoid basically rewriting all of the contracts?
Any help will be appreciated.