Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

Commit

Permalink
Update solc to v5 (#444)
Browse files Browse the repository at this point in the history
Update solc to v5
Update all contracts to compiler ^0.5.0
Update all tests to reflect new contracts and new solc input/output
Upgrade bootstrap, compile, deploy for new solc AND add the ability to pass compiler options
Add new helper function to compile individual files
Add CREATE2 test fixes #439
  • Loading branch information
nicholasjpaterno authored and davidmurdoch committed Jul 11, 2019
1 parent aa5e32c commit 4ad1c27
Show file tree
Hide file tree
Showing 41 changed files with 587 additions and 315 deletions.
178 changes: 170 additions & 8 deletions npm-shrinkwrap.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
"prettier": "^1.14.3",
"request": "^2.88.0",
"semver": "5.6.0",
"solc": "0.4.24",
"solc": "0.5.10",
"temp": "0.8.3",
"web3": "1.0.0-beta.35",
"webpack": "4.17.1",
Expand Down
4 changes: 2 additions & 2 deletions test/CallLibrary.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.4.24;
pragma solidity ^0.5.0;

import "./Library.sol";

Expand All @@ -12,4 +12,4 @@ contract CallLibrary {
}
return false;
}
}
}
4 changes: 2 additions & 2 deletions test/LargeContract.sol

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions test/Library.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.4.24;
pragma solidity ^0.5.0;

library Library {
function checkMsgSender() internal view returns (address) {
Expand All @@ -11,4 +11,4 @@ library Library {
address sender = checkMsgSender();
return sender;
}
}
}
15 changes: 0 additions & 15 deletions test/Oracle.sol

This file was deleted.

12 changes: 5 additions & 7 deletions test/block-tags.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
const assert = require("assert");
const initializeTestProvider = require("./helpers/web3/initializeTestProvider");
const { readFileSync } = require("fs");
const { compile } = require("solc");
const compile = require("./helpers/contract/singleFileCompile");

describe("Block Tags", function() {
let context;
Expand Down Expand Up @@ -38,11 +37,10 @@ describe("Block Tags", function() {

before("Make a transaction that changes the balance, code and nonce", async function() {
const { accounts, web3 } = context;
const source = readFileSync("./test/contracts/examples/Example.sol", { encoding: "utf8" });
const result = compile(source, 1);
const { result } = compile("./test/contracts/examples/", "Example");
const { contractAddress } = await web3.eth.sendTransaction({
from: accounts[0],
data: "0x" + result.contracts[":Example"].bytecode,
data: "0x" + result.contracts["Example.sol"].Example.evm.bytecode.object,
gas: 3141592
});

Expand Down Expand Up @@ -95,12 +93,12 @@ describe("Block Tags", function() {
assert.notStrictEqual(block.transactionsRoot, block.receiptsRoot, "Trie roots should not be equal.");
assert.strictEqual(
block.transactionsRoot,
"0xce8a25092b27c67e802dff9e3ec66aacf6232da66e2796243aaccdc0deaaa1db",
"0x474793ee3373c6d26f28a1f2d2f3250bdabb45cecb1363878faaf741e452fc6e",
"Should produce correct transactionsRoot"
);
assert.strictEqual(
block.receiptsRoot,
"0xa63df9d6e2147dbffa164b173ead7c10d14d95c6e83dbb879ddc45ad7e8dfc89",
"0xc892acfe66c3eccdc78fba6505871bc47a64fceb076d8aff440fb3545ef4a285",
"Should produce correct receiptsRoot"
);
});
Expand Down
2 changes: 1 addition & 1 deletion test/contracts/call/Call.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.4.2;
pragma solidity ^0.5.0;

contract Call {
constructor() public {}
Expand Down
2 changes: 1 addition & 1 deletion test/contracts/constantinople/ConstantinopleContract.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.4.2;
pragma solidity ^0.5.0;

// Changes to this file will make tests fail.
contract ConstantinopleContract {
Expand Down
8 changes: 4 additions & 4 deletions test/contracts/customContracts/LargeContract.sol

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions test/contracts/debug/DebugContract.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.4.2;
pragma solidity ^0.5.0;

// Changes to this file will make tests fail.
contract DebugContract {
Expand All @@ -15,11 +15,11 @@ contract DebugContract {
setValue(2);
}

function get() public returns (uint) {
function get() public view returns (uint) {
return value;
}

function getOther() public returns (uint) {
function getOther() public view returns (uint) {
return otherValue;
}
}
}
2 changes: 1 addition & 1 deletion test/contracts/debug/DebugContractStorage.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.4.2;
pragma solidity ^0.5.0;

import "./DebugContract.sol";

Expand Down
8 changes: 8 additions & 0 deletions test/contracts/events/EventTest.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
pragma solidity ^0.5.0;
contract EventTest {
event ExampleEvent(uint indexed first, uint indexed second);

function triggerEvent(uint _first, uint _second) public {
emit ExampleEvent(_first, _second);
}
}
8 changes: 4 additions & 4 deletions test/contracts/examples/Example.sol
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
pragma solidity ^0.4.2;
pragma solidity ^0.5.0;

contract Example {
uint public value;

event ValueSet(uint);

function Example() payable {
constructor() public payable {
value = 5;
}

function setValue(uint val) {
function setValue(uint val) public {
value = val;
ValueSet(val);
emit ValueSet(val);
}
}
5 changes: 2 additions & 3 deletions test/contracts/examples/Example2.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
pragma solidity ^0.4.2;

pragma solidity ^0.5.0;
contract Example2 {
constructor() public {
revert("I am not suppose to work");
}
}
}
Loading

0 comments on commit 4ad1c27

Please sign in to comment.