From 056ee68d700a47c68195ab0c9105acc1c9713938 Mon Sep 17 00:00:00 2001 From: Ben Burns Date: Fri, 1 Dec 2017 12:39:51 -0500 Subject: [PATCH 01/12] remove dependency on testrpc, and get server from ganache-core instead. --- package.json | 2 +- src/chain.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index e09857e16..8070676b5 100644 --- a/package.json +++ b/package.json @@ -145,9 +145,9 @@ "electron-forge-maker-appimage": "^19.30.3", "electron-settings": "^3.1.2", "electron-squirrel-startup": "^1.0.0", - "ethereumjs-testrpc": "^6.0.3", "ethereumjs-units": "^0.2.0", "find-process": "^1.1.0", + "ganache-core": "^2.0.2", "lodash": "^3.10.1", "moment": "^2.17.1", "moment-timezone": "^0.5.11", diff --git a/src/chain.js b/src/chain.js index 4eae6df41..68a16d824 100644 --- a/src/chain.js +++ b/src/chain.js @@ -1,5 +1,5 @@ #!/usr/bin/env node -var TestRPC = require("ethereumjs-testrpc") +var GanacheServer = require("ganache-core/lib/server") var path = require("path") var Web3 = require("web3") @@ -41,7 +41,7 @@ function startServer(options) { } } - server = TestRPC.server(options); + server = GanacheServer.create(options); // We'll also log all methods that aren't marked internal by Ganache var oldSendAsync = server.provider.sendAsync.bind(server.provider) From 014e05f3fb698f254f30ded7cbe0df3ee5287ac2 Mon Sep 17 00:00:00 2001 From: Ben Burns Date: Fri, 1 Dec 2017 13:27:58 -0500 Subject: [PATCH 02/12] rolling back last change, but using ganache-cli instead of testrpc --- package.json | 2 +- src/chain.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 8070676b5..8db85e0ee 100644 --- a/package.json +++ b/package.json @@ -147,7 +147,7 @@ "electron-squirrel-startup": "^1.0.0", "ethereumjs-units": "^0.2.0", "find-process": "^1.1.0", - "ganache-core": "^2.0.2", + "ganache-cli": "^6.0.3", "lodash": "^3.10.1", "moment": "^2.17.1", "moment-timezone": "^0.5.11", diff --git a/src/chain.js b/src/chain.js index 68a16d824..b0709a764 100644 --- a/src/chain.js +++ b/src/chain.js @@ -1,5 +1,5 @@ #!/usr/bin/env node -var GanacheServer = require("ganache-core/lib/server") +var ganacheLib = require("ganache-cli") var path = require("path") var Web3 = require("web3") @@ -41,7 +41,7 @@ function startServer(options) { } } - server = GanacheServer.create(options); + server = ganacheLib.server(options); // We'll also log all methods that aren't marked internal by Ganache var oldSendAsync = server.provider.sendAsync.bind(server.provider) From ceef86cac2c70c83ec4cc0a62480d087d928c839 Mon Sep 17 00:00:00 2001 From: Ben Burns Date: Fri, 1 Dec 2017 18:02:13 -0500 Subject: [PATCH 03/12] ignore vscode files --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index bae723592..13766594c 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,5 @@ out package-lock.json node_modules .DS_Store +.vscode From d8a5f3cb6626e48b396b5f99ed4333d4ef86b17c Mon Sep 17 00:00:00 2001 From: Ben Burns Date: Fri, 1 Dec 2017 18:03:53 -0500 Subject: [PATCH 04/12] Include last 500 log lines in bug report --- src/Components/AppShell/AppShell.js | 55 +++++++++++++++++++++-------- 1 file changed, 41 insertions(+), 14 deletions(-) diff --git a/src/Components/AppShell/AppShell.js b/src/Components/AppShell/AppShell.js index 20c00918d..381043937 100644 --- a/src/Components/AppShell/AppShell.js +++ b/src/Components/AppShell/AppShell.js @@ -108,25 +108,45 @@ class AppShell extends Component { onCloseFatalErrorModal = () => {} + // grabs the last 500 log lines as a string formatted for inclusion as a github issue + prepareLogLines () { + if (this.props.logs.lines) { + let firstLogTime = this.props.logs.lines[0].time.getTime() + return this.props.logs.lines + .slice(-500) + .map(v => `T+${v.time.getTime() - firstLogTime}ms: ${v.line}`) + .join('\n') + } + + return '' + } + + // Remove any user-specific paths in exception messages + sanitizePaths(message) { + // Prepare our paths so we *always* will get a match no matter + // path separator (oddly, on Windows, different errors will give + // us different path separators) + var appPath = app.getAppPath().replace(/\\/g, "/") + + // I couldn't figure out the regex, so a loop will do. + while (message.indexOf(appPath) >= 0) { + message = systemError.replace(appPath, "") + } + + return message; + } + render () { const path = this.props.location.pathname const segment = path.replace(/^\//g, '').replace(/\//g, '-') || 'root' let systemError = this.props.core.systemError - + let logLines = '' if (systemError) { systemError = systemError.stack || systemError - // Remove any user-specific paths in exception messages - // Prepare our paths so we *always* will get a match no matter - // path separator (oddly, on Windows, different errors will give - // us different path separators) - var appPath = app.getAppPath().replace(/\\/g, "/") - systemError = systemError.replace(/\\/g, "/") - - // I couldn't figure out the regex, so a loop will do. - while (systemError.indexOf(appPath) >= 0) { - systemError = systemError.replace(appPath, "") - } + // avoid leaking details about the user's environment + systemError = this.sanitizePaths(systemError) + logLines = this.sanitizePaths(this.prepareLogLines()) } return ( @@ -160,7 +180,14 @@ PLATFORM: ${process.platform} GANACHE VERSION: ${app.getVersion()} EXCEPTION: -${systemError}` +\`\`\` +${systemError} +\`\`\` + +APPLICATION LOG: +\`\`\` +${logLines} +\`\`\`` ).replace(/%09/g, '') shell.openExternal( @@ -187,4 +214,4 @@ ${systemError}` } } -export default connect(AppShell, "core", "settings") +export default connect(AppShell, "core", "settings", "logs") From 076e382db31aa132cab811eecb6eeb4564143215 Mon Sep 17 00:00:00 2001 From: Ben Burns Date: Fri, 1 Dec 2017 19:42:36 -0500 Subject: [PATCH 05/12] Break bug modal out & enforce GH issue max url length --- src/Components/AppShell/AppShell.js | 101 +-------------------- src/Components/AppShell/AppShell.scss | 15 --- src/Components/AppShell/BugModal.js | 126 ++++++++++++++++++++++++++ src/Components/AppShell/BugModal.scss | 16 ++++ src/index.js | 1 + 5 files changed, 146 insertions(+), 113 deletions(-) create mode 100644 src/Components/AppShell/BugModal.js create mode 100644 src/Components/AppShell/BugModal.scss diff --git a/src/Components/AppShell/AppShell.js b/src/Components/AppShell/AppShell.js index 381043937..c672c4c3a 100644 --- a/src/Components/AppShell/AppShell.js +++ b/src/Components/AppShell/AppShell.js @@ -7,11 +7,7 @@ import connect from '../Helpers/connect' import * as AppShellActions from '../../Actions/AppShell' import TopNavbar from './TopNavbar' -import OnlyIf from '../../Elements/OnlyIf' -import Modal from '../../Elements/Modal' - -import BugIcon from '../../Elements/icons/errorant.svg' - +import BugModal from './BugModal' import ua from 'universal-analytics' import ElectronCookies from '@exponent/electron-cookies' @@ -108,47 +104,8 @@ class AppShell extends Component { onCloseFatalErrorModal = () => {} - // grabs the last 500 log lines as a string formatted for inclusion as a github issue - prepareLogLines () { - if (this.props.logs.lines) { - let firstLogTime = this.props.logs.lines[0].time.getTime() - return this.props.logs.lines - .slice(-500) - .map(v => `T+${v.time.getTime() - firstLogTime}ms: ${v.line}`) - .join('\n') - } - - return '' - } - - // Remove any user-specific paths in exception messages - sanitizePaths(message) { - // Prepare our paths so we *always* will get a match no matter - // path separator (oddly, on Windows, different errors will give - // us different path separators) - var appPath = app.getAppPath().replace(/\\/g, "/") - - // I couldn't figure out the regex, so a loop will do. - while (message.indexOf(appPath) >= 0) { - message = systemError.replace(appPath, "") - } - - return message; - } - render () { const path = this.props.location.pathname - const segment = path.replace(/^\//g, '').replace(/\//g, '-') || 'root' - let systemError = this.props.core.systemError - let logLines = '' - if (systemError) { - systemError = systemError.stack || systemError - - // avoid leaking details about the user's environment - systemError = this.sanitizePaths(systemError) - logLines = this.sanitizePaths(this.prepareLogLines()) - } - return (
@@ -156,62 +113,10 @@ class AppShell extends Component {
{this.props.children}
- - - -
- -

Uh Oh... That's a bug.

-

- Ganache encountered an error. Help us fix it by raising a GitHub issue!

Mention the following error information when writing your ticket, and please include as much information as possible. Sorry about that! -

-