fix a couple of bugs caused by bounties

This commit is contained in:
Jonathan Rainville 2018-10-18 10:10:22 -04:00 committed by Pascal Precht
parent 7a70f5df26
commit ce3f9bdf25
No known key found for this signature in database
GPG Key ID: 0EE28D8D6FD85D7D
6 changed files with 34 additions and 15 deletions

View File

@ -556,7 +556,11 @@ class EmbarkController {
engine.startService("processManager");
engine.startService("libraryManager");
engine.startService("web3", {wait: true});
engine.startService("deployment");
engine.startService("deployment", {
trackContracts: false,
compileOnceOnly: true,
disableOptimizations: options.coverage
});
engine.startService("codeGenerator");
engine.startService("codeRunner");
engine.startService("codeCoverage");

View File

@ -197,16 +197,16 @@ Config.prototype.loadBlockchainConfigFile = function() {
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);
}
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);
}
if (this.blockchainConfig.account && this.blockchainConfig.account.balance && this.blockchainConfig.account.balance.match(unitRegex)) {
this.blockchainConfig.account.balance = utils.getWeiBalanceFromString(this.blockchainConfig.account.balance, web3);
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);
}
if (

View File

@ -377,12 +377,12 @@ class ENS {
function getResolverAddress(next) {
self.ensContract.methods.resolver(hashedName).call((err, resolverAddress) => {
if (err) {
next(err);
} else if(resolverAddress === '0x0000000000000000000000000000000000000000') {
next('Name not yet registered');
} else {
next(null, resolverAddress);
return next(err);
}
if(resolverAddress === '0x0000000000000000000000000000000000000000') {
return next('Name not yet registered');
}
next(null, resolverAddress);
});
},
function createResolverContract(resolverAddress, next) {
@ -395,7 +395,13 @@ class ENS {
function resolveName(resolverContract, 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);
});
}
}

View File

@ -92,6 +92,9 @@ class SpecialConfigs {
const self = this;
const logFunction = silent ? self.logger.trace.bind(self.logger) : self.logger.info.bind(self.logger);
async.each(onDeployCode, (cmd, eachCb) => {
if (!cmd) {
return eachCb();
}
logFunction("==== executing: " + cmd);
self.events.request('runcode:eval', cmd, (err) => {
if (err && err.message.indexOf("invalid opcode") >= 0) {
@ -123,7 +126,13 @@ class SpecialConfigs {
self.replaceWithAddresses(cmd, next);
},
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) => {
if (err) {
return cb(new Error("error running onDeploy for " + contract.className.cyan));

View File

@ -126,7 +126,7 @@ class TestRunner {
async.waterfall([
function setupGlobalNamespace(next) {
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.assert = assert;
global.config = test.config.bind(test);
@ -203,7 +203,7 @@ class TestRunner {
console.info('Running solc tests');
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;
async.waterfall([
function initEngine(next) {

View File

@ -82,7 +82,7 @@ describe("Token", function () {
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);
});
});