From 14b4cabb1b13069c70fdec60f27433bae33015e2 Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Sun, 6 Sep 2015 15:57:32 -0400 Subject: [PATCH 1/6] fix boilerplate .gitignore file to point to the correct development chain --- boilerplate/.gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/boilerplate/.gitignore b/boilerplate/.gitignore index 5620484f..418d4a6f 100644 --- a/boilerplate/.gitignore +++ b/boilerplate/.gitignore @@ -1,2 +1,2 @@ node_modules/ -chains/development.json +config/chains/development.json From a64dc60bab6fb751ef81c57dbe7f408920e1e710 Mon Sep 17 00:00:00 2001 From: Riccardo Casatta Date: Mon, 7 Sep 2015 11:32:57 +0200 Subject: [PATCH 2/6] Support for solc 0.1.2 --- lib/compiler.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/compiler.js b/lib/compiler.js index 7a98aac1..bcac64e6 100644 --- a/lib/compiler.js +++ b/lib/compiler.js @@ -23,7 +23,7 @@ Compiler.prototype.init = function(env) { Compiler.prototype.compile_solidity = function(contractFile) { var cmd, result, output, json, compiled_object; - cmd = "solc --input-file " + contractFile + " --combined-json binary,json-abi"; + cmd = "solc --input-file " + contractFile + " --combined-json bin,abi"; result = exec(cmd, {silent: true}); output = result.output; @@ -41,7 +41,7 @@ Compiler.prototype.compile_solidity = function(contractFile) { compiled_object[className] = {}; compiled_object[className].code = contract.binary; compiled_object[className].info = {}; - compiled_object[className].info.abiDefinition = JSON.parse(contract["json-abi"]); + compiled_object[className].info.abiDefinition = JSON.parse(contract["abi"]); } return compiled_object; From 1d54018d2e7ac08f5c78fbc1159bd2a160d07223 Mon Sep 17 00:00:00 2001 From: Joris Bontje Date: Tue, 8 Sep 2015 11:52:39 +0200 Subject: [PATCH 3/6] configurable deploy timeout per environment. fixes #63 --- demo/config/blockchain.yml | 1 + lib/config/blockchain.js | 1 + lib/deploy.js | 3 +-- test/config.blockchain.js | 3 +++ 4 files changed, 6 insertions(+), 2 deletions(-) diff --git a/demo/config/blockchain.yml b/demo/config/blockchain.yml index 5c17deba..f2d841fa 100644 --- a/demo/config/blockchain.yml +++ b/demo/config/blockchain.yml @@ -19,6 +19,7 @@ staging: rpc_whitelist: "*" datadir: default network_id: 0 + deploy_timeout: 45 console: true account: init: false diff --git a/lib/config/blockchain.js b/lib/config/blockchain.js index 15323a9a..d0dcdd50 100644 --- a/lib/config/blockchain.js +++ b/lib/config/blockchain.js @@ -41,6 +41,7 @@ BlockchainConfig.prototype.config = function(env) { genesisBlock: config.genesis_block, datadir: config.datadir, chains: config.chains, + deployTimeout: config.deploy_timeout || 20, networkId: networkId, maxPeers: 4, port: config.port || "30303", diff --git a/lib/deploy.js b/lib/deploy.js index e1c84709..d75f7e31 100644 --- a/lib/deploy.js +++ b/lib/deploy.js @@ -39,7 +39,7 @@ Deploy.prototype.deploy_contract = function(contractObject, contractParams) { while ((receipt = web3.eth.getTransactionReceipt(transactionHash)) === null || receipt.contractAddress === null) { sleep(1000); time += 1; - if (time >= 20) { + if (time >= this.blockchainConfig.deployTimeout) { return false; } } @@ -176,4 +176,3 @@ Deploy.prototype.generate_and_write_abi_file = function(destFile) { }; module.exports = Deploy; - diff --git a/test/config.blockchain.js b/test/config.blockchain.js index d9db6129..5f5cc9ff 100644 --- a/test/config.blockchain.js +++ b/test/config.blockchain.js @@ -44,6 +44,7 @@ describe('embark.config.blockchain', function() { genesis_block: 'config/genesis.json', datadir: '/tmp/embark', chains: 'chains_development.json', + deploy_timeout: 45, mine_when_needed: true, gas_limit: 123, gas_price: 100, @@ -69,6 +70,7 @@ describe('embark.config.blockchain', function() { genesisBlock: 'config/genesis.json', datadir: '/tmp/embark', chains: 'chains_development.json', + deployTimeout: 45, networkId: 0, maxPeers: 4, port: "30303", @@ -114,6 +116,7 @@ describe('embark.config.blockchain', function() { genesisBlock: undefined, datadir: '/tmp/embark', chains: undefined, + deployTimeout: 20, networkId: 0, maxPeers: 4, port: "30303", From fd46b0217dd08ba01648b52d7a7e31c5c42ccd98 Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Mon, 14 Sep 2015 21:01:42 -0400 Subject: [PATCH 4/6] support for both solc 0.1.1 and 0.1.2 --- lib/compiler.js | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/lib/compiler.js b/lib/compiler.js index bcac64e6..63919338 100644 --- a/lib/compiler.js +++ b/lib/compiler.js @@ -21,9 +21,20 @@ Compiler.prototype.init = function(env) { }; Compiler.prototype.compile_solidity = function(contractFile) { - var cmd, result, output, json, compiled_object; + var cmd, result, output, version, json, compiled_object; - cmd = "solc --input-file " + contractFile + " --combined-json bin,abi"; + cmd = "solc --version"; + + result = exec(cmd, {silent: true}); + output = result.output; + version = output.split('\n')[1].split(' ')[1].slice(0,5); + + if (version == '0.1.1') { + cmd = "solc --input-file " + contractFile + " --combined-json binary,json-abi"; + } + else { + cmd = "solc --input-file " + contractFile + " --combined-json bin,abi"; + } result = exec(cmd, {silent: true}); output = result.output; @@ -41,7 +52,7 @@ Compiler.prototype.compile_solidity = function(contractFile) { compiled_object[className] = {}; compiled_object[className].code = contract.binary; compiled_object[className].info = {}; - compiled_object[className].info.abiDefinition = JSON.parse(contract["abi"]); + compiled_object[className].info.abiDefinition = JSON.parse(contract["abi"] || contract["json-abi"]); } return compiled_object; From 052c2de4b92e9f2a0a7b1c0f8ac0e7936044587d Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Mon, 14 Sep 2015 21:35:44 -0400 Subject: [PATCH 5/6] get correct compiled code --- lib/compiler.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/compiler.js b/lib/compiler.js index 63919338..31b45e72 100644 --- a/lib/compiler.js +++ b/lib/compiler.js @@ -50,7 +50,7 @@ Compiler.prototype.compile_solidity = function(contractFile) { var contract = json[className]; compiled_object[className] = {}; - compiled_object[className].code = contract.binary; + compiled_object[className].code = contract.binary || contact.bin; compiled_object[className].info = {}; compiled_object[className].info.abiDefinition = JSON.parse(contract["abi"] || contract["json-abi"]); } From b383c24496806c2830f8da93a8c5dd268815ed7a Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Mon, 14 Sep 2015 21:38:32 -0400 Subject: [PATCH 6/6] update to 0.9.2 --- bin/embark | 2 +- boilerplate/package.json | 4 ++-- package.json | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/bin/embark b/bin/embark index f9141ca0..8a3b7ae7 100755 --- a/bin/embark +++ b/bin/embark @@ -29,7 +29,7 @@ var deploy = function(env, embarkConfig) { } program - .version('0.9.1') + .version('0.9.2') program.command('new [name]').description('New application').action(function(name) { if (name === undefined) { diff --git a/boilerplate/package.json b/boilerplate/package.json index c7235070..458c8ec2 100644 --- a/boilerplate/package.json +++ b/boilerplate/package.json @@ -10,8 +10,8 @@ "license": "ISC", "homepage": "", "devDependencies": { - "embark-framework": "^0.9.1", - "grunt-embark": "^0.4.1", + "embark-framework": "^0.9.2", + "grunt-embark": "^0.4.3", "grunt-contrib-clean": "^0.6.0", "grunt-contrib-coffee": "^0.13.0", "grunt-contrib-concat": "^0.5.1", diff --git a/package.json b/package.json index 2f8517ca..0f15b435 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "embark-framework", - "version": "0.9.1", + "version": "0.9.2", "description": "", "scripts": { "test": "echo \"Error: no test specified\" && exit 1"