fix a couple of bugs caused by bounties
This commit is contained in:
parent
7a70f5df26
commit
ce3f9bdf25
|
@ -556,7 +556,11 @@ class EmbarkController {
|
||||||
engine.startService("processManager");
|
engine.startService("processManager");
|
||||||
engine.startService("libraryManager");
|
engine.startService("libraryManager");
|
||||||
engine.startService("web3", {wait: true});
|
engine.startService("web3", {wait: true});
|
||||||
engine.startService("deployment");
|
engine.startService("deployment", {
|
||||||
|
trackContracts: false,
|
||||||
|
compileOnceOnly: true,
|
||||||
|
disableOptimizations: options.coverage
|
||||||
|
});
|
||||||
engine.startService("codeGenerator");
|
engine.startService("codeGenerator");
|
||||||
engine.startService("codeRunner");
|
engine.startService("codeRunner");
|
||||||
engine.startService("codeCoverage");
|
engine.startService("codeCoverage");
|
||||||
|
|
|
@ -197,15 +197,15 @@ Config.prototype.loadBlockchainConfigFile = function() {
|
||||||
this.blockchainConfig.default = true;
|
this.blockchainConfig.default = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.blockchainConfig.targetGasLimit && this.blockchainConfig.targetGasLimit.match(unitRegex)) {
|
if (this.blockchainConfig.targetGasLimit && this.blockchainConfig.targetGasLimit.toString().match(unitRegex)) {
|
||||||
this.blockchainConfig.targetGasLimit = utils.getWeiBalanceFromString(this.blockchainConfig.targetGasLimit, web3);
|
this.blockchainConfig.targetGasLimit = utils.getWeiBalanceFromString(this.blockchainConfig.targetGasLimit, web3);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.blockchainConfig.gasPrice && this.blockchainConfig.gasPrice.match(unitRegex)) {
|
if (this.blockchainConfig.gasPrice && this.blockchainConfig.gasPrice.toString().match(unitRegex)) {
|
||||||
this.blockchainConfig.gasPrice = utils.getWeiBalanceFromString(this.blockchainConfig.gasPrice, web3);
|
this.blockchainConfig.gasPrice = utils.getWeiBalanceFromString(this.blockchainConfig.gasPrice, web3);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.blockchainConfig.account && this.blockchainConfig.account.balance && this.blockchainConfig.account.balance.match(unitRegex)) {
|
if (this.blockchainConfig.account && this.blockchainConfig.account.balance && this.blockchainConfig.account.balance.toString().match(unitRegex)) {
|
||||||
this.blockchainConfig.account.balance = utils.getWeiBalanceFromString(this.blockchainConfig.account.balance, web3);
|
this.blockchainConfig.account.balance = utils.getWeiBalanceFromString(this.blockchainConfig.account.balance, web3);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -377,12 +377,12 @@ class ENS {
|
||||||
function getResolverAddress(next) {
|
function getResolverAddress(next) {
|
||||||
self.ensContract.methods.resolver(hashedName).call((err, resolverAddress) => {
|
self.ensContract.methods.resolver(hashedName).call((err, resolverAddress) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
next(err);
|
return next(err);
|
||||||
} else if(resolverAddress === '0x0000000000000000000000000000000000000000') {
|
|
||||||
next('Name not yet registered');
|
|
||||||
} else {
|
|
||||||
next(null, resolverAddress);
|
|
||||||
}
|
}
|
||||||
|
if(resolverAddress === '0x0000000000000000000000000000000000000000') {
|
||||||
|
return next('Name not yet registered');
|
||||||
|
}
|
||||||
|
next(null, resolverAddress);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
function createResolverContract(resolverAddress, next) {
|
function createResolverContract(resolverAddress, next) {
|
||||||
|
@ -395,7 +395,13 @@ class ENS {
|
||||||
function resolveName(resolverContract, next) {
|
function resolveName(resolverContract, next) {
|
||||||
resolverContract.methods.addr(hashedName).call(next);
|
resolverContract.methods.addr(hashedName).call(next);
|
||||||
}
|
}
|
||||||
], cb);
|
], (err, result) => {
|
||||||
|
if (err) {
|
||||||
|
self.logger.error(__('Failed to resolve the ENS name: %s', name));
|
||||||
|
return cb(err);
|
||||||
|
}
|
||||||
|
cb(null, result);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -92,6 +92,9 @@ class SpecialConfigs {
|
||||||
const self = this;
|
const self = this;
|
||||||
const logFunction = silent ? self.logger.trace.bind(self.logger) : self.logger.info.bind(self.logger);
|
const logFunction = silent ? self.logger.trace.bind(self.logger) : self.logger.info.bind(self.logger);
|
||||||
async.each(onDeployCode, (cmd, eachCb) => {
|
async.each(onDeployCode, (cmd, eachCb) => {
|
||||||
|
if (!cmd) {
|
||||||
|
return eachCb();
|
||||||
|
}
|
||||||
logFunction("==== executing: " + cmd);
|
logFunction("==== executing: " + cmd);
|
||||||
self.events.request('runcode:eval', cmd, (err) => {
|
self.events.request('runcode:eval', cmd, (err) => {
|
||||||
if (err && err.message.indexOf("invalid opcode") >= 0) {
|
if (err && err.message.indexOf("invalid opcode") >= 0) {
|
||||||
|
@ -123,7 +126,13 @@ class SpecialConfigs {
|
||||||
self.replaceWithAddresses(cmd, next);
|
self.replaceWithAddresses(cmd, next);
|
||||||
},
|
},
|
||||||
self.replaceWithENSAddress.bind(self)
|
self.replaceWithENSAddress.bind(self)
|
||||||
], nextMapCb);
|
], (err, code) => {
|
||||||
|
if (err) {
|
||||||
|
self.logger.error(err.message || err);
|
||||||
|
return nextMapCb(); // Don't return error as we just skip the failing command
|
||||||
|
}
|
||||||
|
nextMapCb(null, code);
|
||||||
|
});
|
||||||
}, (err, onDeployCode) => {
|
}, (err, onDeployCode) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
return cb(new Error("error running onDeploy for " + contract.className.cyan));
|
return cb(new Error("error running onDeploy for " + contract.className.cyan));
|
||||||
|
|
|
@ -126,7 +126,7 @@ class TestRunner {
|
||||||
async.waterfall([
|
async.waterfall([
|
||||||
function setupGlobalNamespace(next) {
|
function setupGlobalNamespace(next) {
|
||||||
const test = new Test({loglevel: options.loglevel, node: options.node, events: self.events, logger: self.logger,
|
const test = new Test({loglevel: options.loglevel, node: options.node, events: self.events, logger: self.logger,
|
||||||
config: self.embark.config, ipc: self.ipc});
|
config: self.embark.config, ipc: self.ipc, coverage: options.coverage});
|
||||||
global.embark = test;
|
global.embark = test;
|
||||||
global.assert = assert;
|
global.assert = assert;
|
||||||
global.config = test.config.bind(test);
|
global.config = test.config.bind(test);
|
||||||
|
@ -203,7 +203,7 @@ class TestRunner {
|
||||||
console.info('Running solc tests');
|
console.info('Running solc tests');
|
||||||
|
|
||||||
let solcTest = new SolcTest({loglevel: options.loglevel, node: options.node, events: this.events, logger: this.logger,
|
let solcTest = new SolcTest({loglevel: options.loglevel, node: options.node, events: this.events, logger: this.logger,
|
||||||
config: this.embark.config, ipc: this.ipc});
|
config: this.embark.config, ipc: this.ipc, coverage: options.coverage});
|
||||||
global.embark = solcTest;
|
global.embark = solcTest;
|
||||||
async.waterfall([
|
async.waterfall([
|
||||||
function initEngine(next) {
|
function initEngine(next) {
|
||||||
|
|
|
@ -82,7 +82,7 @@ describe("Token", function () {
|
||||||
assert.strictEqual(result, MyToken.options.address);
|
assert.strictEqual(result, MyToken.options.address);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should not deploy if deployIf returns false", async function() {
|
it("should not deploy if deployIf returns false", function() {
|
||||||
assert.ok(!SomeContract.options.address);
|
assert.ok(!SomeContract.options.address);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue