From 7620f16c54a065bec27bc3cbe094c3e328f8ca3e Mon Sep 17 00:00:00 2001 From: Frederic Heem Date: Thu, 24 Sep 2015 11:03:17 +0100 Subject: [PATCH 1/4] show grunt stacktrace --- boilerplate/Gruntfile.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/boilerplate/Gruntfile.coffee b/boilerplate/Gruntfile.coffee index 150ff372..279c1816 100644 --- a/boilerplate/Gruntfile.coffee +++ b/boilerplate/Gruntfile.coffee @@ -1,5 +1,6 @@ module.exports = (grunt) -> + grunt.option 'stack', true grunt.loadNpmTasks "grunt-embark" grunt.loadTasks "tasks" @@ -111,4 +112,3 @@ module.exports = (grunt) -> grunt.registerTask "deploy", ["coffee", "deploy_contracts", "concat", "copy", "server", "watch"] grunt.registerTask "build", ["clean", "deploy_contracts", "coffee", "concat", "uglify", "copy"] - From 3c17582bd5a392fa12c087b3bf253ec272bf14dc Mon Sep 17 00:00:00 2001 From: Frederic Heem Date: Fri, 25 Sep 2015 08:44:37 +0100 Subject: [PATCH 2/4] throw error when block cannot be found --- lib/chain_manager.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/chain_manager.js b/lib/chain_manager.js index edc48bbd..bc93be3b 100644 --- a/lib/chain_manager.js +++ b/lib/chain_manager.js @@ -28,6 +28,10 @@ ChainManager.prototype.loadConfig = function(config) { ChainManager.prototype.init = function(env, config) { web3.setProvider(new web3.providers.HttpProvider("http://" + config.rpcHost + ":" + config.rpcPort)); + var block = web3.eth.getBlock(0); + if(!block){ + throw new Error("Cannot get the genesis block, is embark blockchain running ?"); + } var chainId = web3.eth.getBlock(0).hash; if (this.chainManagerConfig[chainId] === undefined) { From 8f96834596bc9e5fcfbdd84aaa6b079332637789 Mon Sep 17 00:00:00 2001 From: Frederic Heem Date: Fri, 25 Sep 2015 08:47:51 +0100 Subject: [PATCH 3/4] add geth_extra_opts options, can be used to set --vmdebug to geth --- README.md | 1 + lib/blockchain.js | 4 ++++ lib/config/blockchain.js | 3 ++- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 4930ed01..88d3b449 100644 --- a/README.md +++ b/README.md @@ -258,6 +258,7 @@ The environment is a specific blockchain configuration that can be managed at co chains: chains_staging.json network_id: 0 console: true + geth_extra_opts: --vmdebug account: init: false address: 0x123 diff --git a/lib/blockchain.js b/lib/blockchain.js index 9ab37a5c..88f0c5db 100644 --- a/lib/blockchain.js +++ b/lib/blockchain.js @@ -16,6 +16,10 @@ Blockchain.prototype.generate_basic_command = function() { cmd += "--logfile=\"" + config.datadir + ".log\" "; } + if (config.geth_extra_opts) { + cmd += config.geth_extra_opts + " "; + } + cmd += "--port " + config.port + " "; cmd += "--rpc "; cmd += "--rpcport " + config.rpcPort + " "; diff --git a/lib/config/blockchain.js b/lib/config/blockchain.js index d0dcdd50..5af4395a 100644 --- a/lib/config/blockchain.js +++ b/lib/config/blockchain.js @@ -48,7 +48,8 @@ BlockchainConfig.prototype.config = function(env) { console_toggle: config.console || false, mine_when_needed: config.mine_when_needed || false, whisper: config.whisper || false, - account: config.account + account: config.account, + geth_extra_opts: config.geth_extra_opts } return config; From 6b7b88d58af26791b38bb6e07e78fafedbdd54e7 Mon Sep 17 00:00:00 2001 From: Frederic Heem Date: Fri, 25 Sep 2015 08:55:35 +0100 Subject: [PATCH 4/4] don-'t call web3.eth.getBlock twice --- lib/chain_manager.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/chain_manager.js b/lib/chain_manager.js index bc93be3b..abd0aea9 100644 --- a/lib/chain_manager.js +++ b/lib/chain_manager.js @@ -32,7 +32,7 @@ ChainManager.prototype.init = function(env, config) { if(!block){ throw new Error("Cannot get the genesis block, is embark blockchain running ?"); } - var chainId = web3.eth.getBlock(0).hash; + var chainId = block.hash; if (this.chainManagerConfig[chainId] === undefined) { this.chainManagerConfig[chainId] = {contracts: {}};