From cdc75c91e1c9b5b2dd6610c884a98e5edaf22d08 Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Thu, 29 Jun 2017 07:39:12 -0400 Subject: [PATCH 1/2] fix contract extension file matching --- lib/contracts/compiler.js | 3 +- .../app/contracts/invalid_file.sol__tmp__ | 66 +++++++++++++++++++ 2 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 test_app/app/contracts/invalid_file.sol__tmp__ diff --git a/lib/contracts/compiler.js b/lib/contracts/compiler.js index 4644d4be..05b3e072 100644 --- a/lib/contracts/compiler.js +++ b/lib/contracts/compiler.js @@ -32,7 +32,8 @@ class Compiler { function (extension, compiler, callback) { // TODO: warn about files it doesn't know how to compile let matchingFiles = contractFiles.filter(function (file) { - return (file.filename.match(/\.[0-9a-z]+$/)[0] === extension); + let fileMatch = file.filename.match(/\.[0-9a-z]+$/); + return (fileMatch && (fileMatch[0] === extension)); }); compiler.call(compiler, matchingFiles || [], function (err, compileResult) { diff --git a/test_app/app/contracts/invalid_file.sol__tmp__ b/test_app/app/contracts/invalid_file.sol__tmp__ new file mode 100644 index 00000000..0eff9e71 --- /dev/null +++ b/test_app/app/contracts/invalid_file.sol__tmp__ @@ -0,0 +1,66 @@ +// https://github.com/nexusdev/erc20/blob/master/contracts/base.sol + +pragma solidity ^0.4.2; +contract Token { + + event Transfer(address indexed from, address indexed to, uint value); + event Approval( address indexed owner, address indexed spender, uint value); + + mapping( address => uint ) _balances; + mapping( address => mapping( address => uint ) ) _approvals; + uint public _supply; + //uint public _supply2; + function Token( uint initial_balance ) { + _balances[msg.sender] = initial_balance; + _supply = initial_balance; + } + function totalSupply() constant returns (uint supply) { + return _supply; + } + function balanceOf( address who ) constant returns (uint value) { + return _balances[who]; + } + function transfer( address to, uint value) returns (bool ok) { + if( _balances[msg.sender] < value ) { + throw; + } + if( !safeToAdd(_balances[to], value) ) { + throw; + } + _balances[msg.sender] -= value; + _balances[to] += value; + Transfer( msg.sender, to, value ); + return true; + } + function transferFrom( address from, address to, uint value) returns (bool ok) { + // if you don't have enough balance, throw + if( _balances[from] < value ) { + throw; + } + // if you don't have approval, throw + if( _approvals[from][msg.sender] < value ) { + throw; + } + if( !safeToAdd(_balances[to], value) ) { + throw; + } + // transfer and return true + _approvals[from][msg.sender] -= value; + _balances[from] -= value; + _balances[to] += value; + Transfer( from, to, value ); + return true; + } + function approve(address spender, uint value) returns (bool ok) { + // TODO: should increase instead + _approvals[msg.sender][spender] = value; + Approval( msg.sender, spender, value ); + return true; + } + function allowance(address owner, address spender) constant returns (uint _allowance) { + return _approvals[owner][spender]; + } + function safeToAdd(uint a, uint b) internal returns (bool) { + return (a + b >= a); + } +} From a73f0868fc8518c86306dab01cbb52f0ee5238da Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Thu, 29 Jun 2017 07:42:53 -0400 Subject: [PATCH 2/2] update to 2.5.1 --- README.md | 2 +- boilerplate/package.json | 2 +- demo/package.json | 2 +- docs/conf.py | 2 +- package.json | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index c834c161..b1e3ea19 100644 --- a/README.md +++ b/README.md @@ -55,7 +55,7 @@ Table of Contents Installation ====== -Requirements: geth (1.6.5 or higher), node (6.9.1 or higher is recommended) and npm +Requirements: geth (1.6.5 or higher recommended, 1.6.0 or lower for whisper support), node (6.9.1 or higher is recommended) and npm Optional: testrpc (3.0 or higher) if using the simulator or the test functionality. Further: depending on the dapp stack you choose: [IPFS](https://ipfs.io/) diff --git a/boilerplate/package.json b/boilerplate/package.json index 33d7fc4b..64f510d4 100644 --- a/boilerplate/package.json +++ b/boilerplate/package.json @@ -9,7 +9,7 @@ "license": "ISC", "homepage": "", "devDependencies": { - "embark": "^2.5.0", + "embark": "^2.5.1", "mocha": "^2.2.5" } } diff --git a/demo/package.json b/demo/package.json index 4c7b4bd5..4c8b060e 100644 --- a/demo/package.json +++ b/demo/package.json @@ -10,7 +10,7 @@ "license": "ISC", "homepage": "", "devDependencies": { - "embark": "^2.5.0", + "embark": "^2.5.1", "mocha": "^2.2.5" } } diff --git a/docs/conf.py b/docs/conf.py index 1544c450..f254edd1 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -60,7 +60,7 @@ author = u'Iuri Matias' # The short X.Y version. version = u'2.5' # The full version, including alpha/beta/rc tags. -release = u'2.5.0' +release = u'2.5.1' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/package.json b/package.json index 0b71a348..74c8eae4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "embark", - "version": "2.5.0", + "version": "2.5.1", "description": "Embark is a framework that allows you to easily develop and deploy DApps", "scripts": { "test": "grunt jshint && mocha test/ --no-timeouts"