Merge pull request #517 from ethereum/latestSolVersion

update default Solidity version to 0.7.4
pull/5370/head
yann300 4 years ago committed by GitHub
commit 010d01fba3
  1. 12
      apps/remix-ide-e2e/src/examples/example-contracts.ts
  2. 13
      apps/remix-ide-e2e/src/tests/debugger.test.ts
  3. 2
      apps/remix-ide-e2e/src/tests/fileManager_api.test.ts
  4. 8
      apps/remix-ide-e2e/src/tests/runAndDeploy.ts
  5. 2
      apps/remix-ide-e2e/src/tests/signingMessage.test.ts
  6. 30
      apps/remix-ide-e2e/src/tests/solidityUnittests.test.ts
  7. 5
      apps/remix-ide-e2e/src/tests/staticAnalysis.test.ts
  8. 2
      apps/remix-ide/ci/makeMockCompiler.js
  9. 12
      apps/remix-ide/src/app/editor/example-contracts.js
  10. 2
      apps/remix-ide/src/app/tabs/compileTab/compilerContainer.js
  11. 2
      apps/remix-ide/src/app/tabs/testTab/testTab.js
  12. 2
      libs/remix-tests/sol/tests.sol.ts
  13. 2
      package.json

@ -1,6 +1,6 @@
'use strict' 'use strict'
const storage = `pragma solidity >=0.4.22 <0.7.0; const storage = `pragma solidity >=0.7.0 <0.8.0;
/** /**
* @title Storage * @title Storage
@ -27,7 +27,7 @@ contract Storage {
} }
}` }`
const owner = `pragma solidity >=0.4.22 <0.7.0; const owner = `pragma solidity >=0.7.0 <0.8.0;
/** /**
* @title Owner * @title Owner
@ -54,7 +54,7 @@ contract Owner {
/** /**
* @dev Set contract deployer as owner * @dev Set contract deployer as owner
*/ */
constructor() public { constructor() {
owner = msg.sender; // 'msg.sender' is sender of current call, contract deployer for a constructor owner = msg.sender; // 'msg.sender' is sender of current call, contract deployer for a constructor
emit OwnerSet(address(0), owner); emit OwnerSet(address(0), owner);
} }
@ -77,7 +77,7 @@ contract Owner {
} }
}` }`
const ballot = `pragma solidity >=0.4.22 <0.7.0; const ballot = `pragma solidity >=0.7.0 <0.8.0;
/** /**
* @title Ballot * @title Ballot
@ -109,7 +109,7 @@ contract Ballot {
* @dev Create a new ballot to choose one of 'proposalNames'. * @dev Create a new ballot to choose one of 'proposalNames'.
* @param proposalNames names of proposals * @param proposalNames names of proposals
*/ */
constructor(bytes32[] memory proposalNames) public { constructor(bytes32[] memory proposalNames) {
chairperson = msg.sender; chairperson = msg.sender;
voters[chairperson].weight = 1; voters[chairperson].weight = 1;
@ -281,7 +281,7 @@ contract Ballot {
} }
}` }`
const ballotTest = `pragma solidity >=0.4.22 <0.7.0; const ballotTest = `pragma solidity >=0.4.22 <0.8.0;
import "remix_tests.sol"; // this import is automatically injected by Remix. import "remix_tests.sol"; // this import is automatically injected by Remix.
import "../3_Ballot.sol"; import "../3_Ballot.sol";

@ -16,7 +16,7 @@ module.exports = {
'Should launch debugger': function (browser: NightwatchBrowser) { 'Should launch debugger': function (browser: NightwatchBrowser) {
browser.addFile('blah.sol', sources[0]['browser/blah.sol']) browser.addFile('blah.sol', sources[0]['browser/blah.sol'])
.clickLaunchIcon('udapp') .clickLaunchIcon('udapp')
.waitForElementPresent('*[title="Deploy - transact (not payable)"]') .waitForElementPresent('*[title="Deploy - transact (not payable)"]', 45000)
.click('*[title="Deploy - transact (not payable)"]') .click('*[title="Deploy - transact (not payable)"]')
.debugTransaction(0) .debugTransaction(0)
.assert.containsText('*[data-id="sidePanelSwapitTitle"]', 'DEBUGGER') .assert.containsText('*[data-id="sidePanelSwapitTitle"]', 'DEBUGGER')
@ -78,8 +78,10 @@ module.exports = {
browser browser
.clickLaunchIcon('solidity') .clickLaunchIcon('solidity')
.setSolidityCompilerVersion('soljson-v0.6.12+commit.27d51765.js') .setSolidityCompilerVersion('soljson-v0.6.12+commit.27d51765.js')
.pause(2000)
.clickLaunchIcon('udapp') .clickLaunchIcon('udapp')
.testContracts('externalImport.sol', sources[1]['browser/externalImport.sol'], ['ERC20']) .testContracts('externalImport.sol', sources[1]['browser/externalImport.sol'], ['ERC20'])
.waitForElementPresent('*[title="Deploy - transact (not payable)"]', 35000)
.selectContract('ERC20') .selectContract('ERC20')
.createContract('"tokenName", "symbol"') .createContract('"tokenName", "symbol"')
.debugTransaction(2) .debugTransaction(2)
@ -134,7 +136,9 @@ module.exports = {
'Should load more solidity locals array': function (browser: NightwatchBrowser) { 'Should load more solidity locals array': function (browser: NightwatchBrowser) {
browser.addFile('locals.sol', sources[3]['browser/locals.sol']) browser.addFile('locals.sol', sources[3]['browser/locals.sol'])
.clickLaunchIcon('udapp') .clickLaunchIcon('udapp')
.waitForElementPresent('*[title="Deploy - transact (not payable)"]', 40000)
.createContract('') .createContract('')
.pause(2000)
.clickInstance(3) .clickInstance(3)
.clickFunction('t - transact (not payable)') .clickFunction('t - transact (not payable)')
.pause(2000) .pause(2000)
@ -155,6 +159,7 @@ module.exports = {
.clickLaunchIcon('solidity') .clickLaunchIcon('solidity')
.setSolidityCompilerVersion('soljson-v0.7.2+commit.51b20bc0.js') .setSolidityCompilerVersion('soljson-v0.7.2+commit.51b20bc0.js')
.clickLaunchIcon('udapp') .clickLaunchIcon('udapp')
.pause(2000)
.testContracts('withGeneratedSources.sol', sources[4]['browser/withGeneratedSources.sol'], ['A']) .testContracts('withGeneratedSources.sol', sources[4]['browser/withGeneratedSources.sol'], ['A'])
.createContract('') .createContract('')
.clickInstance(4) .clickInstance(4)
@ -178,7 +183,7 @@ const sources = [
{ {
'browser/blah.sol': { 'browser/blah.sol': {
content: ` content: `
pragma solidity >=0.4.22 <0.6.0; pragma solidity >=0.7.0 <0.8.0;
contract Kickstarter { contract Kickstarter {
@ -193,7 +198,7 @@ const sources = [
Project[] public projects; Project[] public projects;
constructor() public { constructor() {
} }
@ -236,7 +241,7 @@ const sources = [
{ {
'browser/locals.sol': { 'browser/locals.sol': {
content: ` content: `
pragma solidity ^0.6.0; pragma solidity ^0.7.0;
contract test { contract test {
function t () public { function t () public {
uint[] memory array = new uint[](150); uint[] memory array = new uint[](150);

@ -55,7 +55,7 @@ module.exports = {
.addFile('copyFile.js', { content: executeCopyFile }) .addFile('copyFile.js', { content: executeCopyFile })
.executeScript(`remix.exeCurrent()`) .executeScript(`remix.exeCurrent()`)
.pause(2000) .pause(2000)
.journalLastChildIncludes('pragma solidity >=0.4.22 <0.7.0;') .journalLastChildIncludes('pragma solidity >=0.7.0 <0.8.0;')
}, },
'Should execute `rename` api from file manager external api': function (browser: NightwatchBrowser) { 'Should execute `rename` api from file manager external api': function (browser: NightwatchBrowser) {

@ -44,12 +44,12 @@ module.exports = {
.addFile('Greet.sol', sources[0]['browser/Greet.sol']) .addFile('Greet.sol', sources[0]['browser/Greet.sol'])
.clickLaunchIcon('udapp') .clickLaunchIcon('udapp')
.selectAccount('0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c') .selectAccount('0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c')
.waitForElementPresent('*[data-id="Deploy - transact (not payable)"]') .waitForElementPresent('*[data-id="Deploy - transact (not payable)"]', 45000)
.click('*[data-id="Deploy - transact (not payable)"]') .click('*[data-id="Deploy - transact (not payable)"]')
.pause(5000) .pause(5000)
.testFunction('0xc39ee005c1e1368c84f02e458de4b41dbb966631a8714d15ef8362dada249ede', { .testFunction('0x82f6c88a909b49d6cc003fb302a6e0184c3f08e942b62e1c95dec326d4c6020b', {
status: 'true Transaction mined and execution succeed', status: 'true Transaction mined and execution succeed',
'transaction hash': '0xc39ee005c1e1368c84f02e458de4b41dbb966631a8714d15ef8362dada249ede' 'transaction hash': '0x82f6c88a909b49d6cc003fb302a6e0184c3f08e942b62e1c95dec326d4c6020b'
}) })
}, },
@ -191,7 +191,7 @@ const sources = [
'browser/Greet.sol': { 'browser/Greet.sol': {
content: content:
` `
pragma solidity ^0.6.0; pragma solidity ^0.7.0;
contract helloWorld { contract helloWorld {
string public message; string public message;

@ -55,7 +55,7 @@ module.exports = {
const sources = [ const sources = [
{ {
'browser/signMassage.sol': {content: ` 'browser/signMassage.sol': {content: `
pragma solidity >=0.4.22 <0.7.0; pragma solidity >=0.4.22 <0.8.0;
contract SignMassageTest { contract SignMassageTest {
function testRecovery(bytes32 h, uint8 v, bytes32 r, bytes32 s) public pure returns (address) { function testRecovery(bytes32 h, uint8 v, bytes32 r, bytes32 s) public pure returns (address) {
return ecrecover(h, v, r, s); return ecrecover(h, v, r, s);

@ -90,7 +90,7 @@ module.exports = {
.scrollAndClick('*[data-id="testTabRunTestsTabRunAction"]') .scrollAndClick('*[data-id="testTabRunTestsTabRunAction"]')
.pause(5000) .pause(5000)
.click('*[data-id="testTabRunTestsTabStopAction"]') .click('*[data-id="testTabRunTestsTabStopAction"]')
.pause(1000) // .pause(1000)
.assert.containsText('*[data-id="testTabRunTestsTabStopAction"]', 'Stopping') .assert.containsText('*[data-id="testTabRunTestsTabStopAction"]', 'Stopping')
.waitForElementPresent('*[data-id="testTabSolidityUnitTestsOutputheader"]', 40000) .waitForElementPresent('*[data-id="testTabSolidityUnitTestsOutputheader"]', 40000)
.assert.containsText('*[data-id="testTabSolidityUnitTestsOutput"]', 'browser/tests/ks2b_test.sol') .assert.containsText('*[data-id="testTabSolidityUnitTestsOutput"]', 'browser/tests/ks2b_test.sol')
@ -172,7 +172,7 @@ function runTests (browser: NightwatchBrowser) {
.pause(500) .pause(500)
.scrollAndClick('#runTestsTabRunAction') .scrollAndClick('#runTestsTabRunAction')
.waitForElementPresent('*[data-id="testTabSolidityUnitTestsOutputheader"]', 40000) .waitForElementPresent('*[data-id="testTabSolidityUnitTestsOutputheader"]', 40000)
.waitForElementPresent('#solidityUnittestsOutput div[class^="testPass"]', 7000) .waitForElementPresent('#solidityUnittestsOutput div[class^="testPass"]', 10000)
.assert.containsText('#solidityUnittestsOutput', 'browser/tests/4_Ballot_test.sol') .assert.containsText('#solidityUnittestsOutput', 'browser/tests/4_Ballot_test.sol')
.assert.containsText('#solidityUnittestsOutput', '✓ Check winning proposal') .assert.containsText('#solidityUnittestsOutput', '✓ Check winning proposal')
.assert.containsText('#solidityUnittestsOutput', '✓ Check winnin proposal with return value') .assert.containsText('#solidityUnittestsOutput', '✓ Check winnin proposal with return value')
@ -183,12 +183,12 @@ const sources = [
{ {
'browser/simple_storage.sol': { 'browser/simple_storage.sol': {
content: ` content: `
pragma solidity >=0.4.22 <0.7.0; pragma solidity >=0.4.22 <0.8.0;
contract SimpleStorage { contract SimpleStorage {
uint public storedData; uint public storedData;
constructor() public { constructor() {
storedData = 100; storedData = 100;
} }
@ -204,7 +204,7 @@ const sources = [
}, },
'browser/tests/simple_storage_test.sol': { 'browser/tests/simple_storage_test.sol': {
content: ` content: `
pragma solidity >=0.4.22 <0.7.0; pragma solidity >=0.4.22 <0.8.0;
import "remix_tests.sol"; import "remix_tests.sol";
import "../simple_storage.sol"; import "../simple_storage.sol";
@ -233,7 +233,7 @@ const sources = [
}, },
'browser/ks2a.sol': { 'browser/ks2a.sol': {
content: ` content: `
pragma solidity >=0.4.22 <0.6.0; pragma solidity >=0.4.22 <0.8.0;
contract Kickstarter { contract Kickstarter {
enum State { Started, Completed } enum State { Started, Completed }
@ -246,14 +246,14 @@ const sources = [
State state; State state;
mapping(address => uint) funders; // added mapping(address => uint) funders; // added
} }
uint numProjects;
Project[] public projects; Project[] public projects;
constructor() public { constructor() {
} }
function createProject(string memory name, uint goal) public { function createProject(string memory name, uint goal) public {
projects.length++; // new line projects.push(); // new line
Project storage project = projects[projects.length - 1]; Project storage project = projects[projects.length - 1];
project.name = name; project.name = name;
project.goal = goal; project.goal = goal;
@ -287,7 +287,7 @@ const sources = [
}, },
'browser/tests/ks2b_test.sol': { 'browser/tests/ks2b_test.sol': {
content: ` content: `
pragma solidity >=0.4.22 <0.6.0; pragma solidity >=0.4.22 <0.8.0;
pragma experimental ABIEncoderV2; pragma experimental ABIEncoderV2;
import "remix_tests.sol"; // this import is automatically injected by Remix. import "remix_tests.sol"; // this import is automatically injected by Remix.
@ -336,7 +336,7 @@ const sources = [
} }
function checkProjectIsFundable () public { function checkProjectIsFundable () public {
kickstarter.fundProject.value(120000)(0); kickstarter.fundProject{value:120000}(0);
(address owner, string memory name, uint goal, uint fundsAvailable, uint amountContributed, Kickstarter.State state) = kickstarter.projects(0); (address owner, string memory name, uint goal, uint fundsAvailable, uint amountContributed, Kickstarter.State state) = kickstarter.projects(0);
Assert.equal(amountContributed, 120000, "contributed amount is incorrect"); Assert.equal(amountContributed, 120000, "contributed amount is incorrect");
} }
@ -346,7 +346,7 @@ const sources = [
}, },
'browser/compilationError_test.sol': { 'browser/compilationError_test.sol': {
content: ` content: `
pragma solidity ^0.6.1; pragma solidity ^0.7.0;
contract failOnCompilation { contract failOnCompilation {
fallback() { fallback() {
@ -357,10 +357,10 @@ const sources = [
}, },
'browser/tests/deployError_test.sol': { 'browser/tests/deployError_test.sol': {
content: ` content: `
pragma solidity ^0.6.0; pragma solidity ^0.7.0;
contract failingDeploy { contract failingDeploy {
constructor() public { constructor() {
revert('Deploy Failed'); revert('Deploy Failed');
} }
} }
@ -368,7 +368,7 @@ const sources = [
}, },
'browser/tests/methodFailure_test.sol': { 'browser/tests/methodFailure_test.sol': {
content: ` content: `
pragma solidity ^0.6.0; pragma solidity ^0.7.0;
contract methodfailure { contract methodfailure {
function add(uint a, uint b) public { function add(uint a, uint b) public {

@ -6,12 +6,12 @@ import sauce from './sauce'
const sources = [ const sources = [
{ {
'browser/Untitled.sol': {content: ` 'browser/Untitled.sol': {content: `
pragma solidity >=0.4.22 <0.6.0; pragma solidity >=0.6.0 <0.8.0;
contract test1 { address test = tx.origin; } contract test1 { address test = tx.origin; }
contract test2 {} contract test2 {}
contract TooMuchGas { contract TooMuchGas {
uint x; uint x;
function() external { fallback() external {
x++; x++;
uint test; uint test;
uint test1; uint test1;
@ -36,6 +36,7 @@ function runTests (browser: NightwatchBrowser) {
browser browser
.waitForElementVisible('#icon-panel', 10000) .waitForElementVisible('#icon-panel', 10000)
.clickLaunchIcon('solidity') .clickLaunchIcon('solidity')
.pause(10000)
.testContracts('Untitled.sol', sources[0]['browser/Untitled.sol'], ['TooMuchGas', 'test1', 'test2']) .testContracts('Untitled.sol', sources[0]['browser/Untitled.sol'], ['TooMuchGas', 'test1', 'test2'])
.clickLaunchIcon('solidityStaticAnalysis') .clickLaunchIcon('solidityStaticAnalysis')
.click('#staticanalysisView button') .click('#staticanalysisView button')

@ -3,7 +3,7 @@
var fs = require('fs') var fs = require('fs')
var compiler = require('solc') var compiler = require('solc')
var compilerInput = require('@remix-project/remix-solidity').CompilerInput var compilerInput = require('@remix-project/remix-solidity').CompilerInput
var defaultVersion = 'v0.6.6+commit.6c089d02' var defaultVersion = 'v0.7.4+commit.3f05b770'
const path = require('path') const path = require('path')
compiler.loadRemoteVersion(defaultVersion, (error, solcSnapshot) => { compiler.loadRemoteVersion(defaultVersion, (error, solcSnapshot) => {

@ -1,6 +1,6 @@
'use strict' 'use strict'
const storage = `pragma solidity >=0.4.22 <0.7.0; const storage = `pragma solidity >=0.7.0 <0.8.0;
/** /**
* @title Storage * @title Storage
@ -27,7 +27,7 @@ contract Storage {
} }
}` }`
const owner = `pragma solidity >=0.4.22 <0.7.0; const owner = `pragma solidity >=0.7.0 <0.8.0;
/** /**
* @title Owner * @title Owner
@ -54,7 +54,7 @@ contract Owner {
/** /**
* @dev Set contract deployer as owner * @dev Set contract deployer as owner
*/ */
constructor() public { constructor() {
owner = msg.sender; // 'msg.sender' is sender of current call, contract deployer for a constructor owner = msg.sender; // 'msg.sender' is sender of current call, contract deployer for a constructor
emit OwnerSet(address(0), owner); emit OwnerSet(address(0), owner);
} }
@ -77,7 +77,7 @@ contract Owner {
} }
}` }`
const ballot = `pragma solidity >=0.4.22 <0.7.0; const ballot = `pragma solidity >=0.7.0 <0.8.0;
/** /**
* @title Ballot * @title Ballot
@ -109,7 +109,7 @@ contract Ballot {
* @dev Create a new ballot to choose one of 'proposalNames'. * @dev Create a new ballot to choose one of 'proposalNames'.
* @param proposalNames names of proposals * @param proposalNames names of proposals
*/ */
constructor(bytes32[] memory proposalNames) public { constructor(bytes32[] memory proposalNames) {
chairperson = msg.sender; chairperson = msg.sender;
voters[chairperson].weight = 1; voters[chairperson].weight = 1;
@ -215,7 +215,7 @@ contract Ballot {
} }
` `
var ballotTest = `pragma solidity >=0.4.22 <0.7.0; var ballotTest = `pragma solidity >=0.7.0 <0.8.0;
import "remix_tests.sol"; // this import is automatically injected by Remix. import "remix_tests.sol"; // this import is automatically injected by Remix.
import "../3_Ballot.sol"; import "../3_Ballot.sol";

@ -23,7 +23,7 @@ class CompilerContainer {
timeout: 300, timeout: 300,
allversions: null, allversions: null,
selectedVersion: null, selectedVersion: null,
defaultVersion: 'soljson-v0.6.6+commit.6c089d02.js' // this default version is defined: in makeMockCompiler (for browser test) and in package.json (downloadsolc_root) for the builtin compiler defaultVersion: 'soljson-v0.7.4+commit.3f05b770.js' // this default version is defined: in makeMockCompiler (for browser test) and in package.json (downloadsolc_root) for the builtin compiler
} }
} }

@ -63,7 +63,7 @@ class TestTabLogic {
let relative = remixPath.relative(this.currentPath, remixPath.dirname(fileToImport)) let relative = remixPath.relative(this.currentPath, remixPath.dirname(fileToImport))
if (relative === '') relative = '.' if (relative === '') relative = '.'
const comment = hasCurrent ? `import "${relative}/${remixPath.basename(fileToImport)}";` : '// Import here the file to test.' const comment = hasCurrent ? `import "${relative}/${remixPath.basename(fileToImport)}";` : '// Import here the file to test.'
return `pragma solidity >=0.4.22 <0.7.0; return `pragma solidity >=0.4.22 <0.8.0;
import "remix_tests.sol"; // this import is automatically injected by Remix. import "remix_tests.sol"; // this import is automatically injected by Remix.
${comment} ${comment}

@ -1,5 +1,5 @@
module.exports = ` module.exports = `
pragma solidity >=0.4.22 <0.7.0; pragma solidity >=0.4.22 <0.8.0;
library Assert { library Assert {

@ -50,7 +50,7 @@
"bumpVersion:libs": "gulp; gulp syncLibVersions;", "bumpVersion:libs": "gulp; gulp syncLibVersions;",
"browsertest": "sleep 5 && npm run nightwatch_local", "browsertest": "sleep 5 && npm run nightwatch_local",
"csslint": "csslint --ignore=order-alphabetical --errors='errors,duplicate-properties,empty-rules' --exclude-list='apps/remix-ide/assets/css/font-awesome.min.css' apps/remix-ide/assets/css/", "csslint": "csslint --ignore=order-alphabetical --errors='errors,duplicate-properties,empty-rules' --exclude-list='apps/remix-ide/assets/css/font-awesome.min.css' apps/remix-ide/assets/css/",
"downloadsolc_root": "wget --no-check-certificate https://solc-bin.ethereum.org/bin/soljson-v0.6.6+commit.6c089d02.js -O ./apps/remix-ide/soljson.js", "downloadsolc_root": "wget --no-check-certificate https://solc-bin.ethereum.org/bin/soljson-v0.7.4+commit.3f05b770.js -O ./apps/remix-ide/soljson.js",
"make-mock-compiler": "node apps/remix-ide/ci/makeMockCompiler.js", "make-mock-compiler": "node apps/remix-ide/ci/makeMockCompiler.js",
"minify": "uglifyjs --in-source-map inline --source-map-inline -c warnings=false", "minify": "uglifyjs --in-source-map inline --source-map-inline -c warnings=false",
"nightwatch_parallel": "nx build remix-ide-e2e; nx e2e remix-ide-e2e -env=chrome,firefox", "nightwatch_parallel": "nx build remix-ide-e2e; nx e2e remix-ide-e2e -env=chrome,firefox",

Loading…
Cancel
Save