Merge branch 'gas_limit' of https://github.com/debris/embark-framework into debris-gas_limit

This commit is contained in:
Iuri Matias 2015-06-04 07:28:52 -04:00
commit f750507970
2 changed files with 4 additions and 2 deletions

View File

@ -5,6 +5,7 @@ development:
minerthreads: 1 minerthreads: 1
datadir: /tmp/embark datadir: /tmp/embark
mine_when_needed: true mine_when_needed: true
gas_limit: 100000
console: false console: false
account: account:
init: true init: true

View File

@ -6,6 +6,7 @@ module.exports = (grunt) ->
blockchainConfig = readYaml.sync("config/blockchain.yml") blockchainConfig = readYaml.sync("config/blockchain.yml")
rpcHost = blockchainConfig[env || "development"].rpc_host rpcHost = blockchainConfig[env || "development"].rpc_host
rpcPort = blockchainConfig[env || "development"].rpc_port rpcPort = blockchainConfig[env || "development"].rpc_port
gasLimit = blockchainConfig[env || "development"].gas_limit || 100000
try try
web3.setProvider(new web3.providers.HttpProvider("http://#{rpcHost}:#{rpcPort}")) web3.setProvider(new web3.providers.HttpProvider("http://#{rpcHost}:#{rpcPort}"))
@ -30,7 +31,7 @@ module.exports = (grunt) ->
#TODO: refactor this into a common method #TODO: refactor this into a common method
if compiled_contracts.info is undefined if compiled_contracts.info is undefined
for className, contract of compiled_contracts for className, contract of compiled_contracts
contractAddress = web3.eth.sendTransaction({from: primaryAddress, data: contract.code, gas: 100000}) contractAddress = web3.eth.sendTransaction({from: primaryAddress, data: contract.code, gas: gasLimit})
grunt.log.writeln("deployed #{className} at #{contractAddress}") grunt.log.writeln("deployed #{className} at #{contractAddress}")
abi = JSON.stringify(contract.info.abiDefinition) abi = JSON.stringify(contract.info.abiDefinition)
@ -41,7 +42,7 @@ module.exports = (grunt) ->
else else
#for geth < 0.9.23 #for geth < 0.9.23
contract = compiled_contracts 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}") grunt.log.writeln("deployed at #{contractAddress}")
abi = JSON.stringify(contract.info.abiDefinition) abi = JSON.stringify(contract.info.abiDefinition)