From af823f98b639fa0614e39027b9b5d3f809b5f7b6 Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Fri, 21 Sep 2018 17:51:33 -0400 Subject: [PATCH 1/7] clarify template option; hide ens option; update typo suggestion list --- cmd/cmd.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cmd/cmd.js b/cmd/cmd.js index aaea0c114..e0fe06ac2 100644 --- a/cmd/cmd.js +++ b/cmd/cmd.js @@ -94,7 +94,7 @@ class Cmd { .description(__('New Application')) .option('--simple', __('create a barebones project meant only for contract development')) .option('--locale [locale]', __('language to use (default: en)')) - .option('--template [url]', __('download template from a GitHub repository')) + .option('--template [name/url]', __('download a known template given its name or from a GitHub repository')) .action(function(name, options) { i18n.setOrDetectLocale(options.locale); if (name === undefined) { @@ -300,7 +300,7 @@ class Cmd { upload() { program .command('upload [environment]') - .option('--ens [ensDomain]', __('ENS domain to associate to')) + //.option('--ens [ensDomain]', __('ENS domain to associate to')) .option('--logfile [logfile]', __('filename to output logs (default: %s)', 'none')) .option('--loglevel [loglevel]', __('level of logging to display') + ' ["error", "warn", "info", "debug", "trace"]', /^(error|warn|info|debug|trace)$/i, 'debug') .option('--locale [locale]', __('language to use (default: en)')) @@ -401,7 +401,7 @@ class Cmd { .action(function(cmd) { console.log((__('unknown command') + ' "%s"').red, cmd); let utils = require('../lib/utils/utils.js'); - let dictionary = ['new', 'demo', 'build', 'run', 'blockchain', 'simulator', 'test', 'upload', 'version']; + let dictionary = ['new', 'demo', 'build', 'run', 'blockchain', 'simulator', 'test', 'upload', 'version', 'console', 'eject-webpack', 'graph', 'help', 'reset']; let suggestion = utils.proposeAlternative(cmd, dictionary); if (suggestion) { console.log((__('did you mean') + ' "%s"?').green, suggestion); From 4af91146812c876bf5e227db79c2541330a52a3e Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Fri, 21 Sep 2018 17:51:53 -0400 Subject: [PATCH 2/7] fix blockchain node not found msg so it actually shows red --- lib/modules/blockchain_connector/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/modules/blockchain_connector/index.js b/lib/modules/blockchain_connector/index.js index ce179cce5..8d81e48c4 100644 --- a/lib/modules/blockchain_connector/index.js +++ b/lib/modules/blockchain_connector/index.js @@ -140,7 +140,7 @@ class BlockchainConnector { self.web3._requestManager.send({method: 'web3_clientVersion', params: []}, (err, version) => { if (err) { self.isWeb3Ready = false; - return next(null, {name: "Ethereum node (version unknown)", status: 'on'}); + return next(null, {name: "Ethereum node not found", status: 'off'}); } if (version.indexOf("/") < 0) { self.events.emit(WEB3_READY); From 3b6251eeb192c1ba229a2ee056f87e28d33b1811 Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Fri, 21 Sep 2018 17:52:32 -0400 Subject: [PATCH 3/7] improve some deployment error messages --- lib/modules/deployment/contract_deployer.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/modules/deployment/contract_deployer.js b/lib/modules/deployment/contract_deployer.js index fe41b3131..4a8c5ba36 100644 --- a/lib/modules/deployment/contract_deployer.js +++ b/lib/modules/deployment/contract_deployer.js @@ -245,7 +245,7 @@ class ContractDeployer { deployObject = self.blockchain.deployContractObject(contractObject, {arguments: contractParams, data: dataCode}); } catch(e) { if (e.message.indexOf('Invalid number of parameters for "undefined"') >= 0) { - return next(new Error(__("attempted to deploy %s without specifying parameters", contract.className))); + return next(new Error(__("attempted to deploy %s without specifying parameters", contract.className)) + ". " + __("check if there are any params defined for this contract in this environment in the contracts configuration file")); } return next(new Error(e)); } @@ -267,7 +267,6 @@ class ContractDeployer { let estimatedCost = contract.gas * contract.gasPrice; self.logFunction(contract)(__("deploying") + " " + contract.className.bold.cyan + " " + __("with").green + " " + contract.gas + " " + __("gas at the price of").green + " " + contract.gasPrice + " " + __("Wei, estimated cost:").green + " " + estimatedCost + " Wei".green); - self.blockchain.deployContractFromObject(deployObject, { from: contract.deploymentAccount, gas: contract.gas, @@ -276,6 +275,9 @@ class ContractDeployer { if (error) { contract.error = error.message; self.events.emit("deploy:contract:error", contract); + if (error.message && error.message.indexOf('replacement transaction underpriced')) { + self.logger.warn("replacement transaction underpriced: This warning typically means a transaction exactly like this one is still pending on the blockchain") + } return next(new Error("error deploying =" + contract.className + "= due to error: " + error.message)); } self.logFunction(contract)(contract.className.bold.cyan + " " + __("deployed at").green + " " + receipt.contractAddress.bold.cyan + " " + __("using").green + " " + receipt.gasUsed + " " + __("gas").green); From 78814dc9d682ea66ad1f9a4e7158d8eca7cc3b8f Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Fri, 21 Sep 2018 17:53:42 -0400 Subject: [PATCH 4/7] only add & deploy fifs register if it's actually a non live env --- lib/modules/ens/index.js | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/lib/modules/ens/index.js b/lib/modules/ens/index.js index 5339e6d07..87ccfc26b 100644 --- a/lib/modules/ens/index.js +++ b/lib/modules/ens/index.js @@ -286,21 +286,23 @@ class ENS { if (this.registration && this.registration.rootDomain) { // Register root domain if it is defined - const rootNode = namehash.hash(this.registration.rootDomain); - config.default.contracts['FIFSRegistrar'] = { - "deploy": true, - "silent": true, - "args": ["$ENSRegistry", rootNode], - "onDeploy": [ - `ENSRegistry.methods.setOwner('${rootNode}', web3.eth.defaultAccount).send({from: web3.eth.defaultAccount}).then(() => { + if (this.isDev || this.env === 'privatenet' || this.env ==='development') { + const rootNode = namehash.hash(this.registration.rootDomain); + config.default.contracts['FIFSRegistrar'] = { + "deploy": true, + "silent": true, + "args": ["$ENSRegistry", rootNode], + "onDeploy": [ + `ENSRegistry.methods.setOwner('${rootNode}', web3.eth.defaultAccount).send({from: web3.eth.defaultAccount}).then(() => { ENSRegistry.methods.setResolver('${rootNode}', "$Resolver").send({from: web3.eth.defaultAccount}); var reverseNode = web3.utils.soliditySha3(web3.eth.defaultAccount.toLowerCase().substr(2) + '${reverseAddrSuffix}'); ENSRegistry.methods.setResolver(reverseNode, "$Resolver").send({from: web3.eth.defaultAccount}); Resolver.methods.setAddr('${rootNode}', web3.eth.defaultAccount).send({from: web3.eth.defaultAccount}); Resolver.methods.setName(reverseNode, '${this.registration.rootDomain}').send({from: web3.eth.defaultAccount}); })` - ] - }; + ] + }; + } } config.privatenet = config.development; this.embark.registerContractConfiguration(config); From cafe472727b48e41de6f98726e787829d4b8bb80 Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Fri, 21 Sep 2018 18:16:47 -0400 Subject: [PATCH 5/7] add missing space --- lib/modules/ens/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/modules/ens/index.js b/lib/modules/ens/index.js index 87ccfc26b..9da955bb8 100644 --- a/lib/modules/ens/index.js +++ b/lib/modules/ens/index.js @@ -286,7 +286,7 @@ class ENS { if (this.registration && this.registration.rootDomain) { // Register root domain if it is defined - if (this.isDev || this.env === 'privatenet' || this.env ==='development') { + if (this.isDev || this.env === 'privatenet' || this.env === 'development') { const rootNode = namehash.hash(this.registration.rootDomain); config.default.contracts['FIFSRegistrar'] = { "deploy": true, From 9ac3f56c98268949cb2bc15dcd7dd0f488ff4fb6 Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Fri, 21 Sep 2018 18:18:21 -0400 Subject: [PATCH 6/7] update template option message --- cmd/cmd.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/cmd.js b/cmd/cmd.js index e0fe06ac2..ea226f5c3 100644 --- a/cmd/cmd.js +++ b/cmd/cmd.js @@ -94,7 +94,7 @@ class Cmd { .description(__('New Application')) .option('--simple', __('create a barebones project meant only for contract development')) .option('--locale [locale]', __('language to use (default: en)')) - .option('--template [name/url]', __('download a known template given its name or from a GitHub repository')) + .option('--template [name/url]', __('download a template using a known name or a GitHub repository URL')) .action(function(name, options) { i18n.setOrDetectLocale(options.locale); if (name === undefined) { From 50effc0a6cd28dda254f5f4661fac26b7721372a Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Fri, 21 Sep 2018 18:26:18 -0400 Subject: [PATCH 7/7] revert change made on ens module --- lib/modules/ens/index.js | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/lib/modules/ens/index.js b/lib/modules/ens/index.js index 9da955bb8..5339e6d07 100644 --- a/lib/modules/ens/index.js +++ b/lib/modules/ens/index.js @@ -286,23 +286,21 @@ class ENS { if (this.registration && this.registration.rootDomain) { // Register root domain if it is defined - if (this.isDev || this.env === 'privatenet' || this.env === 'development') { - const rootNode = namehash.hash(this.registration.rootDomain); - config.default.contracts['FIFSRegistrar'] = { - "deploy": true, - "silent": true, - "args": ["$ENSRegistry", rootNode], - "onDeploy": [ - `ENSRegistry.methods.setOwner('${rootNode}', web3.eth.defaultAccount).send({from: web3.eth.defaultAccount}).then(() => { + const rootNode = namehash.hash(this.registration.rootDomain); + config.default.contracts['FIFSRegistrar'] = { + "deploy": true, + "silent": true, + "args": ["$ENSRegistry", rootNode], + "onDeploy": [ + `ENSRegistry.methods.setOwner('${rootNode}', web3.eth.defaultAccount).send({from: web3.eth.defaultAccount}).then(() => { ENSRegistry.methods.setResolver('${rootNode}', "$Resolver").send({from: web3.eth.defaultAccount}); var reverseNode = web3.utils.soliditySha3(web3.eth.defaultAccount.toLowerCase().substr(2) + '${reverseAddrSuffix}'); ENSRegistry.methods.setResolver(reverseNode, "$Resolver").send({from: web3.eth.defaultAccount}); Resolver.methods.setAddr('${rootNode}', web3.eth.defaultAccount).send({from: web3.eth.defaultAccount}); Resolver.methods.setName(reverseNode, '${this.registration.rootDomain}').send({from: web3.eth.defaultAccount}); })` - ] - }; - } + ] + }; } config.privatenet = config.development; this.embark.registerContractConfiguration(config);