From 4306b3563a171baa9d7bf4872475a13c3434f834 Mon Sep 17 00:00:00 2001 From: Richard Moore Date: Wed, 23 Sep 2020 00:00:21 -0400 Subject: [PATCH] Updated CLI solc to versin 0.7.1. --- packages/cli/src.ts/solc.ts | 4 ++-- packages/tests/contracts/test-solc/consumer.sol | 2 +- .../tests/contracts/test-solc/libraries/lib.sol | 2 +- packages/tests/src.ts/test-solc.ts | 17 +++++++++++------ 4 files changed, 15 insertions(+), 10 deletions(-) diff --git a/packages/cli/src.ts/solc.ts b/packages/cli/src.ts/solc.ts index fbb3dde00..fd9bd54c9 100644 --- a/packages/cli/src.ts/solc.ts +++ b/packages/cli/src.ts/solc.ts @@ -68,8 +68,8 @@ function _compile(_solc: any, source: string, options?: CompilerOptions): Array< if (!ver || ver[1] !== "0") { throw new Error("unknown version"); } const version = parseFloat(ver[2] + "." + ver[3]); - //if (version < 4.11 || version >= 7) { - if (version < 5.0 || version >= 7.0) { + //if (version < 4.11 || version >= 8) { + if (version < 5.0 || version >= 8.0) { throw new Error(`unsupported version: ${ ver[1] }.${ ver[2] }.${ ver[3] }`); } diff --git a/packages/tests/contracts/test-solc/consumer.sol b/packages/tests/contracts/test-solc/consumer.sol index 2d836fffd..f88f53c45 100644 --- a/packages/tests/contracts/test-solc/consumer.sol +++ b/packages/tests/contracts/test-solc/consumer.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity ^0.7.1; import "./libraries/lib.sol"; diff --git a/packages/tests/contracts/test-solc/libraries/lib.sol b/packages/tests/contracts/test-solc/libraries/lib.sol index e7ca07cd0..c6d14c0ef 100644 --- a/packages/tests/contracts/test-solc/libraries/lib.sol +++ b/packages/tests/contracts/test-solc/libraries/lib.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity ^0.7.1; library Lib { function f() internal returns (uint) { diff --git a/packages/tests/src.ts/test-solc.ts b/packages/tests/src.ts/test-solc.ts index fcab57354..57a102029 100644 --- a/packages/tests/src.ts/test-solc.ts +++ b/packages/tests/src.ts/test-solc.ts @@ -11,12 +11,17 @@ describe('Test solc', function () { this.timeout(1200000); const filename = resolve(__dirname, '../contracts/test-solc/consumer.sol'); const source = fs.readFileSync(filename).toString(); - const code = solc.compile(source, { filename, optimize: true }) - .filter(((contract: any) => contract.name === 'Consumer'))[0]; - const { bytecode, interface: iface } = code; - assert(bytecode.length > 2, 'The bytecode should should have a length'); - assert(bytecode.startsWith('0x'), 'The bytecode should start with 0x'); - assert(iface.functions['f()'], 'The interface should have function f()'); + try { + const code = solc.compile(source, { filename, optimize: true }) + .filter(((contract: any) => contract.name === 'Consumer'))[0]; + const { bytecode, interface: iface } = code; + assert(bytecode.length > 2, 'The bytecode should should have a length'); + assert(bytecode.startsWith('0x'), 'The bytecode should start with 0x'); + assert(iface.functions['f()'], 'The interface should have function f()'); + } catch (error) { + console.log(error); + throw error; + } }); });