Merge pull request #1612 from ethereum/solidity050support

Remix module fixed version
pull/1/head
yann300 6 years ago committed by GitHub
commit 3cd86765b3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      contracts/src/gmbh/company.sol
  2. 2
      contracts/src/gmbh/contract.sol
  3. 2
      contracts/src/gmbh/test.sol
  4. 11
      package.json
  5. 2
      src/app/debugger/debugger/VmDebugger.js
  6. 16
      src/app/editor/example-contracts.js
  7. 2
      test-browser/tests/ballot.js
  8. 44
      test-browser/tests/compiling.js
  9. 9
      test-browser/tests/sharedFolderExplorer.js
  10. 51
      test-browser/tests/simpleContract.js
  11. 2
      test-browser/tests/staticanalysis.js
  12. 6
      test-browser/tests/units/testRecorder.js

@ -1,7 +1,7 @@
import "./contract.sol";
contract Assets {
uint[] proposals;
function add(uint8 _numProposals) {
function add(uint8 _numProposals) public {
proposals.length = _numProposals;
}
}

@ -1,6 +1,6 @@
contract gmbh {
uint[] proposals;
function register(uint8 _numProposals) {
function register(uint8 _numProposals) public {
proposals.length = _numProposals;
}
}

@ -1,6 +1,6 @@
contract test {
function Test(uint8 _numProposals) {
function Test(uint8 _numProposals) public {
proposals.length = _numProposals;
}
}

@ -37,15 +37,16 @@
"npm-link-local": "^1.1.0",
"npm-run-all": "^4.0.2",
"onchange": "^3.2.1",
"remix-debug": "latest",
"remix-analyzer": "latest",
"remix-lib": "latest",
"remix-solidity": "latest",
"remix-tests": "latest",
"remix-debug": "0.2.13",
"remix-analyzer": "0.2.12",
"remix-lib": "0.3.12",
"remix-solidity": "0.2.13",
"remix-tests": "0.0.19",
"remixd": "git+https://github.com/ethereum/remixd.git",
"request": "^2.83.0",
"rimraf": "^2.6.1",
"selenium-standalone": "^6.0.1",
"solc": "^0.5.0",
"standard": "^8.5.0",
"swarmgw": "^0.3.1",
"tape": "^4.5.1",

@ -195,7 +195,7 @@ class VmDebuggerLogic {
self.event.trigger('newTrace', [])
})
self.debugger.event.register('callTreeReady', function () {
self.debugger.event.register('callTreeReady', this, function () {
if (self.debugger.callTree.reducedTrace.length) {
return self.event.trigger('newCallTree', [])
}

@ -1,7 +1,6 @@
'use strict'
var ballot = `pragma solidity ^0.4.0;
contract Ballot {
var ballot = `contract Ballot {
struct Voter {
uint weight;
@ -18,7 +17,7 @@ contract Ballot {
Proposal[] proposals;
/// Create a new ballot with $(_numProposals) different proposals.
function Ballot(uint8 _numProposals) public {
constructor(uint8 _numProposals) public {
chairperson = msg.sender;
voters[chairperson].weight = 1;
proposals.length = _numProposals;
@ -56,7 +55,7 @@ contract Ballot {
proposals[toProposal].voteCount += sender.weight;
}
function winningProposal() public constant returns (uint8 _winningProposal) {
function winningProposal() public view returns (uint8 _winningProposal) {
uint256 winningVoteCount = 0;
for (uint8 prop = 0; prop < proposals.length; prop++)
if (proposals[prop].voteCount > winningVoteCount) {
@ -64,16 +63,17 @@ contract Ballot {
_winningProposal = prop;
}
}
}`
}
`
var ballotTest = `pragma solidity ^0.4.7;
var ballotTest = `
import "remix_tests.sol"; // this import is automatically injected by Remix.
import "./ballot.sol";
contract test3 {
Ballot ballotToTest;
function beforeAll () {
function beforeAll () public {
ballotToTest = new Ballot(2);
}
@ -82,7 +82,7 @@ contract test3 {
Assert.equal(ballotToTest.winningProposal(), uint(1), "1 should be the winning proposal");
}
function checkWinninProposalWithReturnValue () public constant returns (bool) {
function checkWinninProposalWithReturnValue () public view returns (bool) {
return ballotToTest.winningProposal() == 1;
}
}

@ -48,7 +48,7 @@ function runTests (browser, testData) {
.pause(2000)
.perform(function (client, done) {
console.log('goToVMtraceStep')
contractHelper.goToVMtraceStep(browser, 47, () => {
contractHelper.goToVMtraceStep(browser, 55, () => {
done()
})
})

@ -89,12 +89,12 @@ function testReturnValues (browser, callback) {
"1": "bytes2: _b2 0x1223",
"2": "bytes3: _b3 0x000000",
"3": "bytes: _blit 0x123498",
"4": "bytes5: _b5 0x0000043245",
"5": "bytes6: _b6 0x002345532532",
"4": "bytes5: _b5 0x0432450000",
"5": "bytes6: _b6 0x234553253200",
"6": "string: _str this is a long string _ this is a long string _ this is a long string _ this is a long string _ this is a long string _ this is a long string _ this is a long string _ this is a long string _ this is a long string _ this is a long string _ this is a long string _ this is a long string _ this is a long string _ this is a long string _ this is a long string",
"7": "bytes7: _b7 0x03252353253253",
"8": "bytes22: _b22 0x00000000000000000000325235235325325325235325",
"9": "bytes32: _b32 0x0000000000000000000000000000000000032523532532523532523532523532"
"8": "bytes22: _b22 0x32523523532532532523532500000000000000000000",
"9": "bytes32: _b32 0x0325235325325235325235325235320000000000000000000000000000000000"
}`).pause(500).testFunction('retunValues3 - transact (not payable)',
'0x94c4b4324bad773dec29af3ffe26a698c32b5caf8a1eedf8889563158639d28a',
'[vm]\nfrom:0xca3...a733c\nto:testReturnValues.retunValues3() 0x5e7...26e9f\nvalue:0 wei\ndata:0x033...e0a7d\nlogs:0\nhash:0x94c...9d28a', null, `{
@ -137,7 +137,7 @@ function testInputValues (browser, callback) {
"indexed": true,
"hash": "0x9c22ff5f21f0b81b113e63f7db6da94fedef11b2119b4088b89664fb9a3cb658"
},
"3": "0x00001234",
"3": "0x12340000",
"4": "test _ test _ test _ test test _ test test _ test test _ test test _ test test _ test test _ test ",
"_i": "-123",
"_u": "123",
@ -145,7 +145,7 @@ function testInputValues (browser, callback) {
"indexed": true,
"hash": "0x9c22ff5f21f0b81b113e63f7db6da94fedef11b2119b4088b89664fb9a3cb658"
},
"_b": "0x00001234",
"_b": "0x12340000",
"_notIndexed": "test _ test _ test _ test test _ test test _ test test _ test test _ test test _ test test _ test ",
"length": 5
}
@ -158,37 +158,37 @@ function testInputValues (browser, callback) {
// @TODO test: bytes8[3][] type as input
var sources = [
{'browser/Untitled.sol': {content: `pragma solidity ^0.4.0;
contract TestContract { function f() returns (uint) { return 8; }
function g() returns (uint, string, bool, uint) {
{'browser/Untitled.sol': {content: `
contract TestContract { function f() public returns (uint) { return 8; }
function g() public returns (uint, string memory, bool, uint) {
uint payment = 345;
bool payed = true;
string memory comment = "comment_comment_";
uint month = 4;
return (payment, comment, payed, month); } }`}},
{'browser/returnValues.sol': {content: `pragma solidity ^0.4.0;
{'browser/returnValues.sol': {content: `
contract testReturnValues {
enum ActionChoices { GoLeft, GoRight, GoStraight, SitStill }
function retunValues1 () returns (bool _b, uint _u, int _i, address _a) {
function retunValues1 () public returns (bool _b, uint _u, int _i, address _a) {
_b = true;
_u = 345;
_i = -345;
_a = msg.sender;
}
function retunValues2 () returns (byte _b, bytes2 _b2, bytes3 _b3, bytes _blit, bytes5 _b5, bytes6 _b6, string _str, bytes7 _b7, bytes22 _b22, bytes32 _b32) {
function retunValues2 () public returns (byte _b, bytes2 _b2, bytes3 _b3, bytes memory _blit, bytes5 _b5, bytes6 _b6, string memory _str, bytes7 _b7, bytes22 _b22, bytes32 _b32) {
_b = 0x12;
_b2 = 0x1223;
_b5 = 0x43245;
_b6 = 0x2345532532;
_b7 = 0x3252353253253;
_b22 = 0x325235235325325325235325;
_b32 = 0x32523532532523532523532523532;
_b5 = hex"043245";
_b6 = hex"2345532532";
_b7 = hex"03252353253253";
_b22 = hex"325235235325325325235325";
_b32 = hex"032523532532523532523532523532";
_blit = hex"123498";
_str = "this is a long string _ this is a long string _ this is a long string _ this is a long string _ this is a long string _ this is a long string _ this is a long string _ this is a long string _ this is a long string _ this is a long string _ this is a long string _ this is a long string _ this is a long string _ this is a long string _ this is a long string";
}
function retunValues3 () returns (ActionChoices _en, int[5][] _a1) {
function retunValues3 () public returns (ActionChoices _en, int[5][] memory _a1) {
_en = ActionChoices.GoStraight;
int[5][] memory a = new int[5][](3);
a[0] = [int(1),-45,-78,56,60];
@ -197,18 +197,18 @@ var sources = [
_a1 = a;
}
}`}},
{'browser/inputValues.sol': {content: `pragma solidity ^0.4.0;
{'browser/inputValues.sol': {content: `
contract test {
event event1(int _i, uint indexed _u, string indexed _str, bytes4 _b, string _notIndexed);
function inputValue1 (uint _u, int _i, string _str) returns (uint _uret, int _iret, string _strret) {
function inputValue1 (uint _u, int _i, string memory _str) public returns (uint _uret, int _iret, string memory _strret) {
_uret = _u;
_iret = _i;
_strret = _str;
}
function inputValue2 (uint[3] _n, bytes8[4] _b8) returns (uint[3] _nret, bytes8[4] _b8ret){
function inputValue2 (uint[3] memory _n, bytes8[4] memory _b8) public returns (uint[3] memory _nret, bytes8[4] memory _b8ret){
_nret = _n;
_b8ret = _b8;
event1(-123, 123, "test", 0x1234, "test _ test _ test _ test test _ test test _ test test _ test test _ test test _ test test _ test ");
emit event1(-123, 123, "test", hex"1234", "test _ test _ test _ test test _ test test _ test test _ test test _ test test _ test test _ test ");
}
}`}}
]

@ -6,23 +6,22 @@ var sauce = require('./sauce')
var assetsTestContract = `import "./contract.sol";
contract Assets {
uint[] proposals;
function add(uint8 _numProposals) {
function add(uint8 _numProposals) public {
proposals.length = _numProposals;
}
}
`
var gmbhTestContract = `
contract gmbh {
var gmbhTestContract = `contract gmbh {
uint[] proposals;
function register(uint8 _numProposals) {
function register(uint8 _numProposals) public {
proposals.length = _numProposals;
}
}
`
var sources = [
{
'localhost/folder1/contract2.sol': {content: 'contract test2 { function get () returns (uint) { return 11; }}'}
'localhost/folder1/contract2.sol': {content: 'contract test2 { function get () public returns (uint) { return 11; }}'}
},
{
'localhost/src/gmbh/company.sol': {content: assetsTestContract}

@ -169,16 +169,15 @@ function testGitHubImport (browser, callback) {
}
*/
var abstractENS = `pragma solidity ^0.4.0;
var abstractENS = `
contract AbstractENS {
function owner(bytes32 node) constant returns(address);
function resolver(bytes32 node) constant returns(address);
function ttl(bytes32 node) constant returns(uint64);
function setOwner(bytes32 node, address owner);
function setSubnodeOwner(bytes32 node, bytes32 label, address owner);
function setResolver(bytes32 node, address resolver);
function setTTL(bytes32 node, uint64 ttl);
function owner(bytes32 node) public view returns(address);
function resolver(bytes32 node) public view returns(address);
function ttl(bytes32 node) public view returns(uint64);
function setOwner(bytes32 node, address owner) public;
function setSubnodeOwner(bytes32 node, bytes32 label, address owner) public;
function setResolver(bytes32 node, address resolver) public;
function setTTL(bytes32 node, uint64 ttl) public;
// Logged when the owner of a node assigns a new owner to a subnode.
event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);
@ -211,35 +210,35 @@ contract ENS is AbstractENS {
// Permits modifications only by the owner of the specified node.
modifier only_owner(bytes32 node) {
if (records[node].owner != msg.sender) throw;
if (records[node].owner != msg.sender) revert();
_;
}
/**
* Constructs a new ENS registrar.
*/
function ENS() {
constructor() public {
records[0].owner = msg.sender;
}
/**
* Returns the address that owns the specified node.
*/
function owner(bytes32 node) constant returns (address) {
function owner(bytes32 node) public view returns (address) {
return records[node].owner;
}
/**
* Returns the address of the resolver for the specified node.
*/
function resolver(bytes32 node) constant returns (address) {
function resolver(bytes32 node) public view returns (address) {
return records[node].resolver;
}
/**
* Returns the TTL of a node, and any records associated with it.
*/
function ttl(bytes32 node) constant returns (uint64) {
function ttl(bytes32 node) public view returns (uint64) {
return records[node].ttl;
}
@ -249,8 +248,8 @@ contract ENS is AbstractENS {
* @param node The node to transfer ownership of.
* @param owner The address of the new owner.
*/
function setOwner(bytes32 node, address owner) only_owner(node) {
Transfer(node, owner);
function setOwner(bytes32 node, address owner) public only_owner(node) {
emit Transfer(node, owner);
records[node].owner = owner;
}
@ -261,9 +260,9 @@ contract ENS is AbstractENS {
* @param label The hash of the label specifying the subnode.
* @param owner The address of the new owner.
*/
function setSubnodeOwner(bytes32 node, bytes32 label, address owner) only_owner(node) {
var subnode = sha3(node, label);
NewOwner(node, label, owner);
function setSubnodeOwner(bytes32 node, bytes32 label, address owner) public only_owner(node) {
bytes32 subnode = keccak256(abi.encodePacked(node, label));
emit NewOwner(node, label, owner);
records[subnode].owner = owner;
}
@ -272,8 +271,8 @@ contract ENS is AbstractENS {
* @param node The node to update.
* @param resolver The address of the resolver.
*/
function setResolver(bytes32 node, address resolver) only_owner(node) {
NewResolver(node, resolver);
function setResolver(bytes32 node, address resolver) public only_owner(node) {
emit NewResolver(node, resolver);
records[node].resolver = resolver;
}
@ -282,8 +281,8 @@ contract ENS is AbstractENS {
* @param node The node to update.
* @param ttl The TTL in seconds.
*/
function setTTL(bytes32 node, uint64 ttl) only_owner(node) {
NewTTL(node, ttl);
function setTTL(bytes32 node, uint64 ttl) public only_owner(node) {
emit NewTTL(node, ttl);
records[node].ttl = ttl;
}
}`
@ -310,14 +309,14 @@ var sources = [
},
{
'browser/Untitled5.sol': {content: `library lib {
function get () returns (uint) {
function getInt () public view returns (uint) {
return 45;
}
}
contract test {
function get () constant returns (uint) {
return lib.get();
function get () public view returns (uint) {
return lib.getInt();
}
}`}
}

@ -11,7 +11,7 @@ contract test1 { address test = tx.origin; }
contract test2 {}
contract TooMuchGas {
uint x;
function() {
function() external {
x++;
uint test;
uint test1;

@ -61,11 +61,11 @@ module.exports = {
}
}
var sources = [{'browser/testRecorder.sol': {content: `pragma solidity ^0.4.0;contract testRecorder {
function testRecorder(uint p) {
var sources = [{'browser/testRecorder.sol': {content: `contract testRecorder {
constructor(uint p) public {
}
function set (uint _p) {
function set (uint _p) public {
}
}`}}]

Loading…
Cancel
Save