Merge branch 'develop'

This commit is contained in:
Iuri Matias 2015-07-29 22:12:10 -04:00
commit 7661e8c25a
16 changed files with 76 additions and 15 deletions

1
.gitignore vendored
View File

@ -1,2 +1,3 @@
node_modules
TODO
.node-xmlhttprequest-sync-*

View File

@ -25,7 +25,7 @@ var deploy = function(env, embarkConfig) {
}
program
.version('0.7.0')
.version('0.7.1')
program.command('new [name]').description('New application').action(function(name) {
if (name === undefined) {

View File

@ -3,8 +3,10 @@ development:
rpc_port: 8101
rpc_whitelist: "*"
minerthreads: 1
genesis_block: config/genesis/dev_genesis.json
datadir: /tmp/embark
mine_when_needed: true
max_peers: 0
gas_limit: 500000
gas_price: 10000000000000
console: false
@ -17,6 +19,7 @@ staging:
rpc_whitelist: "*"
datadir: default
network_id: 0
max_peers: 4
console: true
account:
init: false
@ -27,6 +30,7 @@ production:
rpc_whitelist: "*"
datadir: default
network_id: 1
max_peers: 4
console: true
account:
init: false

View File

@ -0,0 +1,12 @@
{
"nonce": "0x0000000000000042",
"difficulty": "0x40000",
"alloc": {
},
"mixhash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"coinbase": "0x0000000000000000000000000000000000000000",
"timestamp": "0x00",
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"extraData": "0x",
"gasLimit": "0x4c4b40"
}

View File

@ -10,7 +10,7 @@
"license": "ISC",
"homepage": "",
"devDependencies": {
"embark-framework": "^0.7.0",
"embark-framework": "^0.7.1",
"grunt-embark": "^0.2.0",
"grunt-contrib-clean": "^0.6.0",
"grunt-contrib-coffee": "^0.13.0",

View File

@ -3,6 +3,7 @@ development:
rpc_port: 8101
rpc_whitelist: "*"
minerthreads: 1
genesis_block: config/genesis/dev_genesis.json
datadir: /tmp/embark
mine_when_needed: true
gas_limit: 500000

View File

@ -0,0 +1,12 @@
{
"nonce": "0x0000000000000042",
"difficulty": "0x40000",
"alloc": {
},
"mixhash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"coinbase": "0x0000000000000000000000000000000000000000",
"timestamp": "0x00",
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"extraData": "0x",
"gasLimit": "0x4c4b40"
}

View File

@ -3,6 +3,7 @@ development:
rpc_port: 8101
rpc_whitelist: "*"
minerthreads: 1
genesis_block: config/genesis.json
datadir: /tmp/embark
mine_when_needed: true
gas_limit: 500000

View File

@ -0,0 +1,12 @@
{
"nonce": "0x0000000000000042",
"difficulty": "0x40000",
"alloc": {
},
"mixhash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"coinbase": "0x0000000000000000000000000000000000000000",
"timestamp": "0x00",
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"extraData": "0x",
"gasLimit": "0x4c4b40"
}

View File

@ -1,3 +1,4 @@
var mkdirp = require('mkdirp');
Blockchain = function(blockchainConfig) {
this.config = blockchainConfig;
@ -25,9 +26,12 @@ Blockchain.prototype.generate_basic_command = function() {
}
cmd += "--mine ";
if (config.genesisBlock !== void 0) {
cmd += "--genesis=\"" + config.genesisBlock + "\" ";
}
//TODO: this should be configurable
cmd += "--maxpeers 0 ";
cmd += "--maxpeers " + config.maxPeers + " ";
if (config.account.password !== void 0) {
cmd += "--password " + config.account.password + " ";
@ -73,6 +77,14 @@ Blockchain.prototype.get_address = function() {
var address = null;
if (config.account.init) {
// ensure datadir exists, bypassing the interactive liabilities prompt.
var newDir = mkdirp.sync(config.datadir);
if (newDir) {
console.log("=== datadir created");
} else {
console.log("=== datadir already exists");
}
console.log("running: " + this.list_command());
result = exec(this.list_command());
@ -96,4 +108,3 @@ Blockchain.prototype.startChain = function(use_tmp) {
}
module.exports = Blockchain

View File

@ -38,8 +38,10 @@ BlockchainConfig.prototype.config = function(env) {
gasPrice: config.gas_price || 10000000000000,
rpcWhitelist: config.rpc_whitelist,
minerthreads: config.minerthreads,
genesisBlock: config.genesis_block,
datadir: config.datadir,
networkId: networkId,
maxPeers: 4,
port: config.port || "30303",
console_toggle: config.console || false,
mine_when_needed: config.mine_when_needed || false,
@ -50,4 +52,3 @@ BlockchainConfig.prototype.config = function(env) {
};
module.exports = BlockchainConfig;

View File

@ -71,7 +71,7 @@ Deploy.prototype.deploy_contracts = function(env) {
console.log('trying to obtain ' + className + ' address...');
var receipt = null;
while ((receipt = web3.eth.getTransactionReceipt(transactionHash)) === null) {
while ((receipt = web3.eth.getTransactionReceipt(transactionHash)) === null || receipt.contractAddress === null) {
sleep.sleep(1);
}
var contractAddress = receipt.contractAddress;

View File

@ -1,6 +1,6 @@
{
"name": "embark-framework",
"version": "0.7.0",
"version": "0.7.1",
"description": "",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
@ -19,6 +19,7 @@
"jasmine": "^2.3.1",
"meteor-build-client": "^0.1.6",
"methodmissing": "^0.0.3",
"mkdirp": "^0.5.1",
"python": "^0.0.4",
"read-yaml": "^1.0.0",
"shelljs": "^0.5.0",

View File

@ -10,7 +10,7 @@ describe('embark.blockchain', function() {
var blockchain = new Blockchain(blockchainConfig);
it('should return correct cmd', function() {
assert.strictEqual(blockchain.generate_basic_command(), "geth --datadir=\"/tmp/embark\" --logfile=\"/tmp/embark.log\" --port 30303 --rpc --rpcport 8101 --networkid "+blockchainConfig.networkId+" --rpccorsdomain \"*\" --minerthreads \"1\" --mine --maxpeers 0 --password config/password ");
assert.strictEqual(blockchain.generate_basic_command(), "geth --datadir=\"/tmp/embark\" --logfile=\"/tmp/embark.log\" --port 30303 --rpc --rpcport 8101 --networkid "+blockchainConfig.networkId+" --rpccorsdomain \"*\" --minerthreads \"1\" --mine --genesis=\"config/genesis.json\" --maxpeers 4 --password config/password ");
});
});

View File

@ -41,6 +41,7 @@ describe('embark.config.blockchain', function() {
rpc_whitelist: "*",
network_id: 0,
minerthreads: 1,
genesis_block: 'config/genesis.json',
datadir: '/tmp/embark',
mine_when_needed: true,
gas_limit: 123,
@ -63,8 +64,10 @@ describe('embark.config.blockchain', function() {
gasPrice: 100,
rpcWhitelist: "*",
minerthreads: 1,
genesisBlock: 'config/genesis.json',
datadir: '/tmp/embark',
networkId: 0,
maxPeers: 4,
port: "30303",
console_toggle: false,
mine_when_needed: true,
@ -103,8 +106,10 @@ describe('embark.config.blockchain', function() {
gasPrice: 10000000000000,
rpcWhitelist: "*",
minerthreads: 1,
genesisBlock: undefined,
datadir: '/tmp/embark',
networkId: 0,
maxPeers: 4,
port: "30303",
console_toggle: false,
mine_when_needed: true,
@ -122,4 +127,3 @@ describe('embark.config.blockchain', function() {
});
});

View File

@ -3,6 +3,7 @@ development:
rpc_port: 8101
rpc_whitelist: "*"
minerthreads: 1
genesis_block: config/genesis.json
datadir: /tmp/embark
mine_when_needed: true
gas_limit: 500000