Parse solc 6.x contracts (#477)

string-interpolation
cgewecke 5 years ago committed by GitHub
parent 171dc5cb7c
commit e5a5b95ad8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      lib/instrumenter.js
  2. 2
      lib/preprocessor.js
  3. 8
      package.json
  4. 2
      test/integration/projects/solc-6/buidler.config.js
  5. 4
      test/integration/projects/solc-6/contracts/ContractA.sol
  6. 2
      test/integration/projects/solc-6/test/test.js
  7. 2
      test/integration/projects/solc-6/truffle-config.js
  8. 20
      test/units/buidler/standard.js
  9. 20
      test/units/truffle/standard.js
  10. 956
      yarn.lock

@ -1,4 +1,4 @@
const SolidityParser = require('solidity-parser-antlr');
const SolidityParser = require('solidity-parser-diligence');
const path = require('path');
const Injector = require('./injector');

@ -1,4 +1,4 @@
const SolidityParser = require('solidity-parser-antlr');
const SolidityParser = require('solidity-parser-diligence');
const crRegex = /[\r\n ]+$/g;
const OPEN = '{';

@ -39,13 +39,13 @@
"recursive-readdir": "^2.2.2",
"sc-istanbul": "^0.4.5",
"shelljs": "^0.8.3",
"solidity-parser-antlr": "0.4.7",
"solidity-parser-diligence": "^0.4.16",
"web3": "1.2.6"
},
"devDependencies": {
"@nomiclabs/buidler": "^1.0.2",
"@nomiclabs/buidler-truffle5": "^1.0.2",
"@nomiclabs/buidler-web3": "^1.0.2",
"@nomiclabs/buidler": "^1.1.2",
"@nomiclabs/buidler-truffle5": "^1.1.2",
"@nomiclabs/buidler-web3": "^1.1.2",
"@truffle/contract": "^4.0.36",
"decache": "^4.5.1",
"ganache-core-sc": "^2.7.0-sc.0",

@ -5,6 +5,6 @@ usePlugin("@nomiclabs/buidler-truffle5");
module.exports={
defaultNetwork: "buidlerevm",
solc: {
version: "0.6.0"
version: "0.6.2"
}
};

@ -45,12 +45,12 @@ contract ContractA is ContractB {
}
}
function arraySlice() public pure {
function arraySlice(uint _a, uint b_) public pure {
abi.decode(msg.data[4:], (uint, uint));
}
function payableFn() public pure {
address x;
address y = payable(x);
//address y = payable(x); // parser-diligence crashing here...
}
}

@ -18,7 +18,7 @@ contract("contracta", function(accounts) {
});
it('arraySlice', async function(){
await instance.arraySlice();
await instance.arraySlice(5,7);
});
it('payableFn', async function(){

@ -3,7 +3,7 @@ module.exports = {
mocha: {},
compilers: {
solc: {
version: "0.6.0"
version: "0.6.2"
}
}
}

@ -274,4 +274,24 @@ describe('Buidler Plugin: standard use cases', function() {
`Should run "on" hooks : ${mock.loggerOutput.val}`
);
});
it('solc 0.6.x', async function(){
mock.installFullProject('solc-6');
mock.buidlerSetupEnv(this);
await this.env.run("coverage");
const expected = [
{
file: mock.pathToContract(buidlerConfig, 'ContractA.sol'),
pct: 100
},
{
file: mock.pathToContract(buidlerConfig, 'ContractB.sol'),
pct: 0,
}
];
verify.lineCoverage(expected);
})
})

@ -413,4 +413,24 @@ describe('Truffle Plugin: standard use cases', function() {
`Should run "on" hooks : ${mock.loggerOutput.val}`
);
});
// Fails with Truffle 5.0.31, but newer Truffle causes OOM when running whole suite.
// Running the same test with Buidler though...
it.skip('solc 0.6.x', async function(){
mock.installFullProject('solc-6');
await plugin(truffleConfig);
const expected = [
{
file: mock.pathToContract(truffleConfig, 'ContractA.sol'),
pct: 100
},
{
file: mock.pathToContract(truffleConfig, 'ContractB.sol'),
pct: 0,
}
];
verify.lineCoverage(expected);
})
})

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save