From 28632d845891ec58cb23da8050aaddadcddc5ef7 Mon Sep 17 00:00:00 2001 From: Marek Kotewicz Date: Thu, 4 Jun 2015 10:17:14 +0200 Subject: [PATCH 1/2] configurable gas limit --- boilerplate/config/blockchain.yml | 1 + tasks/deploy.coffee | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/boilerplate/config/blockchain.yml b/boilerplate/config/blockchain.yml index 4aa39e7b6..5ee714e45 100644 --- a/boilerplate/config/blockchain.yml +++ b/boilerplate/config/blockchain.yml @@ -5,6 +5,7 @@ development: minerthreads: 1 datadir: /tmp/embark mine_when_needed: true + gas_limit: 2500000 console: false account: init: true diff --git a/tasks/deploy.coffee b/tasks/deploy.coffee index 59b6359cf..cf5968465 100644 --- a/tasks/deploy.coffee +++ b/tasks/deploy.coffee @@ -6,6 +6,7 @@ module.exports = (grunt) -> blockchainConfig = readYaml.sync("config/blockchain.yml") rpcHost = blockchainConfig[env || "development"].rpc_host rpcPort = blockchainConfig[env || "development"].rpc_port + gasLimit = blockchainConfig[env || "development"].gas_limit || 1000000 try web3.setProvider(new web3.providers.HttpProvider("http://#{rpcHost}:#{rpcPort}")) @@ -30,7 +31,7 @@ module.exports = (grunt) -> #TODO: refactor this into a common method if compiled_contracts.info is undefined for className, contract of compiled_contracts - contractAddress = web3.eth.sendTransaction({from: primaryAddress, data: contract.code}) + contractAddress = web3.eth.sendTransaction({from: primaryAddress, data: contract.code, gas: gasLimit}) grunt.log.writeln("deployed #{className} at #{contractAddress}") abi = JSON.stringify(contract.info.abiDefinition) @@ -41,7 +42,7 @@ module.exports = (grunt) -> else #for geth < 0.9.23 contract = compiled_contracts - contractAddress = web3.eth.sendTransaction({from: primaryAddress, data: contract.code}) + contractAddress = web3.eth.sendTransaction({from: primaryAddress, data: contract.code, gas: gasLimit}) grunt.log.writeln("deployed at #{contractAddress}") abi = JSON.stringify(contract.info.abiDefinition) From eb4fd7482bc372e3e5f1c1158f1016e61800920f Mon Sep 17 00:00:00 2001 From: Marek Kotewicz Date: Thu, 4 Jun 2015 10:37:09 +0200 Subject: [PATCH 2/2] reduced default value of gasLimit --- boilerplate/config/blockchain.yml | 2 +- tasks/deploy.coffee | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/boilerplate/config/blockchain.yml b/boilerplate/config/blockchain.yml index 5ee714e45..e38eea992 100644 --- a/boilerplate/config/blockchain.yml +++ b/boilerplate/config/blockchain.yml @@ -5,7 +5,7 @@ development: minerthreads: 1 datadir: /tmp/embark mine_when_needed: true - gas_limit: 2500000 + gas_limit: 100000 console: false account: init: true diff --git a/tasks/deploy.coffee b/tasks/deploy.coffee index cf5968465..ca13b4a4c 100644 --- a/tasks/deploy.coffee +++ b/tasks/deploy.coffee @@ -6,7 +6,7 @@ module.exports = (grunt) -> blockchainConfig = readYaml.sync("config/blockchain.yml") rpcHost = blockchainConfig[env || "development"].rpc_host rpcPort = blockchainConfig[env || "development"].rpc_port - gasLimit = blockchainConfig[env || "development"].gas_limit || 1000000 + gasLimit = blockchainConfig[env || "development"].gas_limit || 100000 try web3.setProvider(new web3.providers.HttpProvider("http://#{rpcHost}:#{rpcPort}"))