From 25a58980519f0330f6e063e2d77d228f450cc4b4 Mon Sep 17 00:00:00 2001 From: Aakil Fernandes Date: Sat, 30 Jan 2016 11:40:36 -0500 Subject: [PATCH 01/17] use last part of contract file rather than 1st --- lib/compiler.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/compiler.js b/lib/compiler.js index 253bbc13f..9a3105788 100644 --- a/lib/compiler.js +++ b/lib/compiler.js @@ -74,7 +74,8 @@ Compiler.prototype.compile_serpent = function(contractFile) { Compiler.prototype.compile = function(contractFile) { - var extension = contractFile.split('.')[1]; + var contractFileParts = contractFile.split('.')[1] + ,extension = contractFileParts[contractFileParts.length-1]; if (extension === 'sol') { return this.compile_solidity(contractFile); From bf7a8ba00fbaacb2517629c7f4130089859c38d5 Mon Sep 17 00:00:00 2001 From: Aakil Fernandes Date: Sat, 30 Jan 2016 12:16:11 -0500 Subject: [PATCH 02/17] drop extra [1] --- lib/compiler.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/compiler.js b/lib/compiler.js index 9a3105788..6c0a550f3 100644 --- a/lib/compiler.js +++ b/lib/compiler.js @@ -74,7 +74,7 @@ Compiler.prototype.compile_serpent = function(contractFile) { Compiler.prototype.compile = function(contractFile) { - var contractFileParts = contractFile.split('.')[1] + var contractFileParts = contractFile.split('.') ,extension = contractFileParts[contractFileParts.length-1]; if (extension === 'sol') { From ee0820b56f6be75dd5e0e17cec8f6e7f55e270fd Mon Sep 17 00:00:00 2001 From: Aakil Fernandes Date: Sun, 31 Jan 2016 13:10:12 -0500 Subject: [PATCH 03/17] console log deploy errors --- lib/deploy.js | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/deploy.js b/lib/deploy.js index 0c6087e22..5d17cfdfc 100644 --- a/lib/deploy.js +++ b/lib/deploy.js @@ -37,6 +37,7 @@ Deploy.prototype.deploy_contract = function(contractObject, contractParams, cb) } else { console.log("error deploying"); + console.log(e) exit(); } }; From c2ae0c5b4f1b3eb3a920a10563840310f9a98152 Mon Sep 17 00:00:00 2001 From: Aakil Fernandes Date: Thu, 25 Feb 2016 13:40:09 -0500 Subject: [PATCH 04/17] rebase --- lib/deploy.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/deploy.js b/lib/deploy.js index 03f169e05..5d17cfdfc 100644 --- a/lib/deploy.js +++ b/lib/deploy.js @@ -36,9 +36,9 @@ Deploy.prototype.deploy_contract = function(contractObject, contractParams, cb) cb(contract.address); } else { - //console.log(arguments); - //console.log("error deploying"); - //exit(); + console.log("error deploying"); + console.log(e) + exit(); } }; From cb0ac1e3caf10fad95d821b55939aa418266d51f Mon Sep 17 00:00:00 2001 From: Aakil Fernandes Date: Sat, 30 Jan 2016 11:40:36 -0500 Subject: [PATCH 05/17] use last part of contract file rather than 1st --- lib/compiler.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/compiler.js b/lib/compiler.js index 6c2866df9..146ecd5ad 100644 --- a/lib/compiler.js +++ b/lib/compiler.js @@ -89,7 +89,9 @@ Compiler.prototype.compile = function(contractFiles) { var solidity = [], serpent = []; for (var i = 0; i < contractFiles.length; i++) { - var extension = contractFiles[i].split('.')[1]; + var contractParts = contractFiles[i].split('.'), + extension = contractParts[contractParts.length-1] + if (extension === 'sol') { solidity.push(contractFiles[i]); } From 83520affa3c84b5f50f4fabd1966fd2802e85caa Mon Sep 17 00:00:00 2001 From: Aakil Fernandes Date: Wed, 14 Oct 2015 10:54:07 -0400 Subject: [PATCH 06/17] add contractdb --- lib/deploy.js | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/deploy.js b/lib/deploy.js index 03f169e05..c903222a4 100644 --- a/lib/deploy.js +++ b/lib/deploy.js @@ -188,6 +188,7 @@ Deploy.prototype.generate_abi_file = function() { result += className + "Contract = web3.eth.contract(" + className + "Abi);"; result += className + " = " + className + "Contract.at('" + contractAddress + "');"; } + result += 'contractDB = '+JSON.stringify(this.contractDB)+';' return result; }; From 171fefbda12df5bf313bae1dbd5851c366a38324 Mon Sep 17 00:00:00 2001 From: Aakil Fernandes Date: Fri, 16 Oct 2015 13:07:28 -0400 Subject: [PATCH 07/17] expose runtimeBytecode --- lib/compiler.js | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/compiler.js b/lib/compiler.js index 6c2866df9..d843a5a49 100644 --- a/lib/compiler.js +++ b/lib/compiler.js @@ -36,6 +36,7 @@ Compiler.prototype.compile_solidity = function(contractFiles) { compiled_object[className] = {}; compiled_object[className].code = contract.bytecode; + compiled_object[className].runtimeBytecode = contract.runtimeBytecode; compiled_object[className].info = {}; compiled_object[className].info.abiDefinition = JSON.parse(contract.interface); } From bd76193ac8052d55f829451ea81a01329dc5cff9 Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Wed, 21 Oct 2015 17:26:57 -0400 Subject: [PATCH 08/17] add bignumber to dependencies so BigNumber can be used in onDeploy --- lib/deploy.js | 1 + package.json | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/deploy.js b/lib/deploy.js index c903222a4..11ee3a9e1 100644 --- a/lib/deploy.js +++ b/lib/deploy.js @@ -3,6 +3,7 @@ var fs = require('fs'); var grunt = require('grunt'); var readYaml = require('read-yaml'); var Config = require('./config/config.js'); +var BigNumber = require('bignumber.js'); Deploy = function(env, contractFiles, blockchainConfig, contractsConfig, chainManager, withProvider, withChain, _web3) { if (_web3 !== undefined) { diff --git a/package.json b/package.json index 5817c1b63..9da36b7c2 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,8 @@ "shelljs": "^0.5.0", "solc": "^0.1.6", "toposort": "^0.2.10", - "web3": "^0.15.0", + "web3": "^0.8.1", + "bignumber.js": "debris/bignumber.js#master", "wrench": "^1.5.8", "ethersim": "^0.1.1" }, From 7dac3c083218b03e7d721882eb9e3484a4207ab0 Mon Sep 17 00:00:00 2001 From: Aakil Fernandes Date: Fri, 20 Nov 2015 13:02:18 -0500 Subject: [PATCH 09/17] deploy_synchronously --- lib/config/blockchain.js | 4 +++- lib/deploy.js | 25 ++++++++++++++++++++++++- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/lib/config/blockchain.js b/lib/config/blockchain.js index d2110ed2f..30514f334 100644 --- a/lib/config/blockchain.js +++ b/lib/config/blockchain.js @@ -54,7 +54,9 @@ BlockchainConfig.prototype.config = function(env) { whisper: config.whisper || false, account: config.account, geth_extra_opts: config.geth_extra_opts || [], - testnet: config.testnet || false + testnet: config.testnet || false, + geth_extra_opts: config.geth_extra_opts, + deploy_synchronously: config.deploy_synchronously || false } return config; diff --git a/lib/deploy.js b/lib/deploy.js index 11ee3a9e1..d5d2db29a 100644 --- a/lib/deploy.js +++ b/lib/deploy.js @@ -54,7 +54,10 @@ Deploy.prototype.deploy_contracts = function(env, cb) { this.contractDB = this.contractsManager.contractDB; this.deployedContracts = {}; - this.deploy_contract_list(all_contracts.length, env, all_contracts, cb); + if(this.blockchainConfig.deploy_synchronously) + this.deploy_contract_list_sync(env, all_contracts, cb); + else + this.deploy_contract_list(all_contracts.length, env, all_contracts, cb); } Deploy.prototype.deploy_contract_list = function(index, env, all_contracts, cb) { @@ -70,6 +73,26 @@ Deploy.prototype.deploy_contract_list = function(index, env, all_contracts, cb) } } +Deploy.prototype.deploy_contract_list_synchronously = function(env, all_contracts, cb) { + + var _this = this; + + all_contracts.forEach(function(className){ + _this.deploy_a_contract(env, className, function(){ + mark_contract_as_deployed() + }); + }) + + var deployed_contracts_count = 0; + + function mark_contract_as_deployed(){ + deployed_contracts_count ++; + + if(deployed_contracts_count === all_contracts.length) + cb() + } +} + Deploy.prototype.deploy_a_contract = function(env, className, cb) { var contractDependencies = this.contractsManager.contractDependencies; var contract = this.contractDB[className]; From 8ea13b4da5544afc1c467b3c8123f9be0726972f Mon Sep 17 00:00:00 2001 From: Aakil Fernandes Date: Fri, 20 Nov 2015 13:11:12 -0500 Subject: [PATCH 10/17] sync->synchronously --- lib/deploy.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/deploy.js b/lib/deploy.js index d5d2db29a..f8f2207c0 100644 --- a/lib/deploy.js +++ b/lib/deploy.js @@ -55,7 +55,7 @@ Deploy.prototype.deploy_contracts = function(env, cb) { this.deployedContracts = {}; if(this.blockchainConfig.deploy_synchronously) - this.deploy_contract_list_sync(env, all_contracts, cb); + this.deploy_contract_list_synchronously(env, all_contracts, cb); else this.deploy_contract_list(all_contracts.length, env, all_contracts, cb); } From 8af4282ed760e39f17f237ee5a863f2055ca9791 Mon Sep 17 00:00:00 2001 From: Aakil Fernandes Date: Mon, 23 Nov 2015 12:49:51 -0500 Subject: [PATCH 11/17] deployed_contracts_count fix --- lib/deploy.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/deploy.js b/lib/deploy.js index f8f2207c0..4ed07210a 100644 --- a/lib/deploy.js +++ b/lib/deploy.js @@ -75,7 +75,8 @@ Deploy.prototype.deploy_contract_list = function(index, env, all_contracts, cb) Deploy.prototype.deploy_contract_list_synchronously = function(env, all_contracts, cb) { - var _this = this; + var _this = this + ,deployed_contracts_count = 0 all_contracts.forEach(function(className){ _this.deploy_a_contract(env, className, function(){ @@ -83,8 +84,6 @@ Deploy.prototype.deploy_contract_list_synchronously = function(env, all_contract }); }) - var deployed_contracts_count = 0; - function mark_contract_as_deployed(){ deployed_contracts_count ++; From 07ec9067667c3adbb8acdfc38c8f1ca1b55b58aa Mon Sep 17 00:00:00 2001 From: Aakil Fernandes Date: Wed, 2 Dec 2015 18:42:36 -0500 Subject: [PATCH 12/17] add blockchain config to abi --- lib/config/blockchain.js | 1 + lib/deploy.js | 2 ++ 2 files changed, 3 insertions(+) diff --git a/lib/config/blockchain.js b/lib/config/blockchain.js index 30514f334..46b14f7bb 100644 --- a/lib/config/blockchain.js +++ b/lib/config/blockchain.js @@ -33,6 +33,7 @@ BlockchainConfig.prototype.config = function(env) { config = { + env:env, rpcHost: config.rpc_host, rpcPort: config.rpc_port, gasLimit: config.gas_limit || 500000, diff --git a/lib/deploy.js b/lib/deploy.js index 4ed07210a..bad650392 100644 --- a/lib/deploy.js +++ b/lib/deploy.js @@ -198,6 +198,8 @@ Deploy.prototype.generate_provider_file = function() { Deploy.prototype.generate_abi_file = function() { var result = ""; + result += 'blockchain = '+JSON.stringify(this.blockchainConfig)+';'; + for(className in this.deployedContracts) { var deployedContract = this.deployedContracts[className]; var contract = this.contractDB[className]; From e6ee0395d012753c204ebdf4fd44590432ff326c Mon Sep 17 00:00:00 2001 From: Aakil Fernandes Date: Thu, 10 Dec 2015 13:35:08 -0500 Subject: [PATCH 13/17] localhost --- boilerplate/config/blockchain.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/boilerplate/config/blockchain.yml b/boilerplate/config/blockchain.yml index 2e4b60e4f..1599e2d32 100644 --- a/boilerplate/config/blockchain.yml +++ b/boilerplate/config/blockchain.yml @@ -1,8 +1,8 @@ development: rpc_host: localhost rpc_port: 8101 - rpc_whitelist: "*" mine: false + rpc_whitelist: localhost minerthreads: 1 genesis_block: config/genesis/dev_genesis.json datadir: /tmp/embark @@ -18,7 +18,7 @@ development: staging: rpc_host: localhost rpc_port: 8101 - rpc_whitelist: "*" + rpc_whitelist: localhost datadir: default mine: false network_id: 0 @@ -34,7 +34,7 @@ staging: production: rpc_host: localhost rpc_port: 8101 - rpc_whitelist: "*" + rpc_whitelist: localhost datadir: default network_id: 1 mine: false From c1195b4e031f8c141b142025b50141589e622dfa Mon Sep 17 00:00:00 2001 From: Aakil Fernandes Date: Thu, 10 Dec 2015 13:59:35 -0500 Subject: [PATCH 14/17] remove extra quotes --- lib/blockchain.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/blockchain.js b/lib/blockchain.js index 2abb08afb..0622e971d 100644 --- a/lib/blockchain.js +++ b/lib/blockchain.js @@ -25,7 +25,7 @@ Blockchain.prototype.generate_basic_command = function() { cmd += "--rpcport " + config.rpcPort + " "; cmd += "--rpcaddr " + config.rpcHost + " "; cmd += "--networkid " + config.networkId + " "; - cmd += "--rpccorsdomain \"" + config.rpcWhitelist + "\" "; + cmd += "--rpccorsdomain " + config.rpcWhitelist + " "; if(config.testnet){ cmd += "--testnet " From 54eb8771f340430d60f99e3617e3128d59d8cea6 Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Mon, 29 Feb 2016 09:48:51 -0500 Subject: [PATCH 15/17] update web3 to 0.15.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 9da36b7c2..f488f7b15 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,7 @@ "shelljs": "^0.5.0", "solc": "^0.1.6", "toposort": "^0.2.10", - "web3": "^0.8.1", + "web3": "^0.15.0", "bignumber.js": "debris/bignumber.js#master", "wrench": "^1.5.8", "ethersim": "^0.1.1" From f0322565524fcc86b7d5ab9e830323a07473f92b Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Mon, 29 Feb 2016 09:50:17 -0500 Subject: [PATCH 16/17] remove exit - for now - when getting an error deploying --- lib/deploy.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/deploy.js b/lib/deploy.js index 7d9635547..b12668be2 100644 --- a/lib/deploy.js +++ b/lib/deploy.js @@ -39,7 +39,7 @@ Deploy.prototype.deploy_contract = function(contractObject, contractParams, cb) else { console.log("error deploying"); console.log(e) - exit(); + //exit(); } }; From 32ef27212b49d064f4c1425f0838e88ff9d4f9fb Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Mon, 29 Feb 2016 09:59:34 -0500 Subject: [PATCH 17/17] update specs; remove unused env config --- lib/config/blockchain.js | 2 -- test/config.blockchain.js | 2 ++ 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/config/blockchain.js b/lib/config/blockchain.js index 46b14f7bb..bec3d87fd 100644 --- a/lib/config/blockchain.js +++ b/lib/config/blockchain.js @@ -33,7 +33,6 @@ BlockchainConfig.prototype.config = function(env) { config = { - env:env, rpcHost: config.rpc_host, rpcPort: config.rpc_port, gasLimit: config.gas_limit || 500000, @@ -56,7 +55,6 @@ BlockchainConfig.prototype.config = function(env) { account: config.account, geth_extra_opts: config.geth_extra_opts || [], testnet: config.testnet || false, - geth_extra_opts: config.geth_extra_opts, deploy_synchronously: config.deploy_synchronously || false } diff --git a/test/config.blockchain.js b/test/config.blockchain.js index 94b6a1f90..021e413e0 100644 --- a/test/config.blockchain.js +++ b/test/config.blockchain.js @@ -74,6 +74,7 @@ describe('embark.config.blockchain', function() { datadir: '/tmp/embark', chains: 'chains_development.json', deployTimeout: 45, + deploy_synchronously: false, networkId: 0, maxPeers: 4, mine: false, @@ -125,6 +126,7 @@ describe('embark.config.blockchain', function() { datadir: '/tmp/embark', chains: undefined, deployTimeout: 20, + deploy_synchronously: false, networkId: 0, maxPeers: 4, mine: false,