Commit Graph

5092 Commits

Author SHA1 Message Date
Jonathan Rainville 9c37f9738e fix(debugger): fix debugger displays 2018-12-20 19:04:21 -05:00
Jonathan Rainville e207537d6e fix(profiler): do not exit on error but print it 2018-12-20 17:42:54 -05:00
Andre Medeiros b0c226a13f feature: disallow eval and require in cockpit 2018-12-20 17:41:03 -05:00
Jonathan Rainville af48788ab5 fix(test): use logger instead of engine.logger 2018-12-20 17:39:45 -05:00
Jonathan Rainville 7811211f91 fix(blockchain/geth): create geth dev account before other accounts 2018-12-20 17:39:45 -05:00
Michael Bradley, Jr 6c7782c435 fix(@embark/cli): start the dashboard after services are started
Start the `embark run` dashboard after services have been started so the REPL
instantiated by the dashboard can successfully request the `console:history`
event.

Delete `cmd/dashboard/command_history.js` since it's no longer in use.
2018-12-20 17:19:18 -05:00
Anthony Laibe e3a7b74284 feat: apply contract change to test
Give the same ability to config function on test
than when running with embark run
2018-12-20 16:38:14 -05:00
Andre Medeiros 3a8808e2f5 fix: allow message signing with wallet address 2018-12-20 16:36:22 -05:00
Pascal Precht 2195475fe6 fix(@embark/ens): make resolve() work with promises and callbacks
Changes in c64c093a48 resulted in a regression
that ENS functions within console/dashboard didn't work properly anymore.

This commit ensures that both APIs, `EmbarkJS.Names.resolve()` as well as
`EmbarkJS.Names.lookup()` can be either used using `async/await` or promised
based syntax within the console/dashboard.

Example:

```
await EmbarkJS.Names.resolve('me.eth.eth');

EmbarkJS.Names.resolve('me.eth.eth').then(val => ..., err => ...)

EmbarkJS.Names.resolve('me.eth.eth', (err, val) => ...)
```

Same with:

```
await EmbarkJS.Names.lookup('0x...');

EmbarkJS.Names.lookup('0x...').then(val => ..., err => ...)

EmbarkJS.Names.lookup('0x...', (err, val) => ...)
```
2018-12-20 16:33:41 -05:00
emizzle ffcff4a16c fix(@embark/core): Proxy support for raw transactions
Contract logs were not occuring in the test_app for reasons unknown, except that it seemed to be pinned to the fact that accounts were being defined using a mnemonic. Turns out this caused transactions to be signed, and therefore sent using `eth_sendRawTransaction`.

Add ability to decode raw transactions in the proxy so that those transactions are also logged.

Refactor Proxy in to a class and add a Proxy unit test test.

Remove RLP package, as there is another way to decode a tx without needed an additional package.

Replace eth transaction methods with constants throughout the codebase.

Add unit tests for Console Listener.
2018-12-20 16:29:33 -05:00
emizzle f1206b4cb9 fix(@embark/core): Fix `—template` URL support
Support for all template URL syntax as spec’d in https://our.status.im/embark-3-2-much-more-than-a-moonshot/ (Everyone Gets A Template section).

Unit tests were added for all missing cases.

| Test case        | Command           | Successful?  | Output |
| :----------------------------------------- | :--------------------------------------------------------- | :---: | :-------- |
| 1a. Normal React template, no URL  			| `embark new 1-normal-template-react --template react` | No | see below |
```
Installing template from https://github.com/embark-framework/embark-react-template/tree/4.0
Downloading template...
Download failed, response code 404
Retrying with the default branch...
It may not be compatible with your Embark version 4.0.0-alpha.2
Installing template from https://github.com/embark-framework/embark-react-template
Downloading template...
Download failed, response code 404
Does the template really exist?
Embark's supported templates: https://embark.status.im/templates/
```
**Failure reason**: https://github.com/embark-framework/embark-react-template repo doesn't exist

| Test case        | Command           | Successful?  | Output |
| :----------------------------------------- | :--------------------------------------------------------- | :---: | :-------- |
| 1b. Normal TypeScript template, no URL  			| `embark new 1-normal-template-typescript --template typescript` |  Yes | see below |
```
Installing template from https://github.com/embark-framework/embark-typescript-template/tree/4.0
Downloading template...
Download failed, response code 404
Retrying with the default branch...
It may not be compatible with your Embark version 4.0.0-alpha.2
Installing template from https://github.com/embark-framework/embark-typescript-template
Downloading template...
Installing packages...
Init complete

App ready at 1-normal-template-typescript
```
| Test case        | Command           | Successful?  | Output |
| :----------------------------------------- | :--------------------------------------------------------- | :---: | :-------- |
| 1c. Normal Vyper template, no URL  			| `embark new 1-normal-template-vyper --template vyper` | Yes |see below |
```
Installing template from https://github.com/embark-framework/embark-vyper-template/tree/4.0
Downloading template...
Download failed, response code 404
Retrying with the default branch...
It may not be compatible with your Embark version 4.0.0-alpha.2
Installing template from https://github.com/embark-framework/embark-vyper-template
Downloading template...
Installing packages...
Init complete

App ready at 1-normal-template-vyper
```
| Test case        | Command           | Successful?  | Output |
| :----------------------------------------- | :--------------------------------------------------------- | :---: | :-------- |
| 1d. Normal Vue.js template, no URL  			| `embark new 1-normal-template-vue --template vue` |  Yes |see below|
```
Installing template from https://github.com/embark-framework/embark-vue-template/tree/4.0
Downloading template...
Download failed, response code 404
Retrying with the default branch...
It may not be compatible with your Embark version 4.0.0-alpha.2
Installing template from https://github.com/embark-framework/embark-vue-template
Downloading template...
Installing packages...
Init complete

App ready at 1-normal-template-vue
```
| Test case        | Command           | Successful?  | Output |
| :----------------------------------------- | :--------------------------------------------------------- | :---: | :-------- |
| 1e. Normal Bamboo template, no URL  			| `embark new 1-normal-template-bamboo --template bamboo` |  Yes |see below|
```
Installing template from https://github.com/embark-framework/embark-bamboo-template/tree/4.0
Downloading template...
Download failed, response code 404
Retrying with the default branch...
It may not be compatible with your Embark version 4.0.0-alpha.2
Installing template from https://github.com/embark-framework/embark-bamboo-template
Downloading template...
Installing packages...
Init complete

App ready at 1-normal-template-bamboo
```
| Test case        | Command           | Successful?  | Output |
| :----------------------------------------- | :--------------------------------------------------------- | :---: | :-------- |
| 2. Github repo download  	 			| `embark new 2-github-repo --template status-im/dreddit-devcon`      |   Yes  |see below|
```
Installing template from https://github.com/status-im/dreddit-devcon
Downloading template...
Installing packages...
Init complete

App ready at 2-github-repo
```
| Test case        | Command           | Successful?  | Output |
| :----------------------------------------- | :--------------------------------------------------------- | :---: | :-------- |
| 3a. Github template with non-existant branch  	| `embark new 3-github-branch --template status-im/dreddit-devcon#start-here`      |  Yes   |
```
Installing template from https://github.com/status-im/dreddit-devcon/tree/start-here
Downloading template...
Download failed, response code 404
Does the template really exist?
```
| Test case        | Command           | Successful?  | Output |
| :----------------------------------------- | :--------------------------------------------------------- | :---: | :-------- |
| 3b. Github template with other branch  	| `embark new 3-github-branch --template status-im/dreddit-devcon#start`      |  Yes  |see below|
```
Installing template from https://github.com/status-im/dreddit-devcon/tree/start
Downloading template...
Installing packages...
Init complete

App ready at 3-github-branch
```
| Test case        | Command           | Successful?  | Output |
| :----------------------------------------- | :--------------------------------------------------------- | :---: | :-------- |
| 4. Github download with git url  		| `embark new 4-github-git-url --template git@github.com/status-im/dreddit-devcon`      |  No  |see below|
```
Unsupported template name or git host URL
```
**Failure reason:** Incorrect syntax. Repo owner need to postfix the host, ie `git@github.com:status-im/dreddit-devcon`. Fixed in this PR.

| Test case        | Command           | Successful?  | Output |
| :----------------------------------------- | :--------------------------------------------------------- | :---: | :-------- |
| 5. Github download with https url  		| `embark new 5-github-https-url --template https://github.com/status-im/dappcon-workshop-dapp` |  Yes  |see below|
```
Installing template from https://github.com/status-im/dappcon-workshop-dapp
Downloading template...
Installing packages...
Init complete

App ready at 5-github-https-url
```
| Test case        | Command           | Successful?  | Output |
| :----------------------------------------- | :--------------------------------------------------------- | :---: | :-------- |
| 6. Github download with no protocol  	| `embark new 6-github-url-no-protocol --template github.com/status-im/dappcon-workshop-dapp` |  No  |see below|
```
Unsupported template name or git host URL
```
**Failure reason:** Incorrect syntax. Can remove the github host, ie `status-im/dappcon-workshop-dapp`. Fixed in this PR.

| Test case        | Command           | Successful?  | Output |
| :----------------------------------------- | :--------------------------------------------------------- | :---: | :-------- |
| 7. Github repo with no branch, and a default branch that is not `master` | `embark new 7-github-default-branch-not-master --template status-im/dreddit-devcon`      |  Yes  |see below|
```
Installing template from https://github.com/status-im/dreddit-devcon
Downloading template...
Installing packages...
Init complete

App ready at 7-github-default-branch-not-master
```

Update replacements for less variance

Update URL replacements for less result variance if the `hosted-git-info` library were to change it’s functionality.

Move replacements to a constant.

Add unit test for additional `bitbucket.org/gitlab.com` URL shortcuts.
2018-12-20 16:21:58 -05:00
Anthony Laibe 0118b1a409 feat(coverage): gas usage improvements
Do not submit event for function and branch
but detect where the statement is
2018-12-20 16:21:31 -05:00
Anthony Laibe 8a6d075cd1 feat: add coverage events
Instead of looking at the transaction, instrument the
source to publish coverage event
2018-12-20 16:21:31 -05:00
Andre Medeiros 7574e141fa fix: consistent service order in cockpit 2018-12-20 16:18:01 -05:00
Jonathan Rainville 33d6e29286 fix(logHandler): stringify objects instead of trying to split it 2018-12-20 08:33:12 -05:00
Michael Bradley, Jr 1a4b0aaf07 test(@embark/cli): remove the cli_shim demo scripts
The demo scripts in `src/test/cli_shim`, while very useful when developing the
shim, were never fully completed and are not part of embark's CI, so remove
them. A future cross-platform test suite of the shim should be written in the
usual way (with TS/JS) instead of using bash scripts running in a Docker
container.
2018-12-19 10:48:41 -06:00
Michael Bradley, Jr 27ad343dfa fix(@embark/whisper): use a new WebsocketProvider on each retry
`waitForWeb3Ready` was never making it to the point it sets
`this.web3Ready = true` and invokes its callback because once the provider's
connection's `readyState` is `3` ("closed or couldn't be opened") there is no
possibility it will change to `1` ("open and ready").

Call the `connectToProvider` method before setting up a retry with `setTimeout`
so that a new instance of `Web3.providers.WebsocketProvider` is used on each
retry.
2018-12-19 10:46:44 -06:00
Jonathan Rainville bf8629dadd fix(blockchain): add cert options to blockchain initialization 2018-12-19 10:01:14 -05:00
Jonathan Rainville 34d5923d54 fix(simulator): fix simulator when there is no accounts 2018-12-19 10:00:52 -05:00
Jonathan Rainville 06553b5981 fix(ens): fix error message by checking for directives before 2018-12-19 10:00:31 -05:00
Jonathan Rainville 50858dc063 fix(names): fix ens console commands 2018-12-19 10:00:31 -05:00
Michael Bradley, Jr 735e38017e refactor(@embark/utils): use a 'ws' websocket client in pingEndpoint
This PR replaces #1166. The "stuck sockets" bug is addressed in #1195 so there
is no longer a need to use timeouts. However a few aspects of the original PR
are still useful, and lessons learned from #1166, #1181, and #1195 can be put
to good use.

Use a websocket client from the `ws` package when pinging websocket endpoints
instead of manually building a request header. The `'upgrade'` event being
listened for was never actually firing; and though a response was received for
those pings, the response messages indicated problems with those requests. It
seems cleaner to use a proper websocket client and callback success upon the
`ws` client's `'open'` event.

Abstract error and success handling across websocket and http pings.

Report network errors other than `ECONNREFUSED`. Only `ECONNREFUSED` is
expected, as that genuinely indicates an endpoint isn't accepting connections
at the specified host and port. If other kinds of network errors are occurring,
it will be helpful to have a visual indicator to prompt investigation.

After success or the first error, cleanup the ping's request/connection
immediately since we're not awaiting `'data'` events on an http request and we
don't want to leave a websocket connection open. Don't callback any `'error'`
events that might fire after the first `'error'` event or a success event, but
do report them.
2018-12-18 14:08:05 -06:00
Michael Bradley, Jr aba551e84f refactor(proxy): proxy blockchain accounts so that they are available in the Dapp 2018-12-18 14:07:46 -06:00
Michael Bradley, Jr acf62668ab refactor(@embark/blockchain_process): remove http-proxy-middleware
The problems described in embark PR #1166 can be resolved by implementing the
blockchain proxy with `http-proxy` directly instead of using `express` together
with `http-proxy-middleware`. The ultimate cause of the buggy behavior (the
"stuck sockets" problems described in #1166) is unknown.

The need to swallow some errors as described in embark PR #1181 is also
eliminated by dropping `http-proxy-middleware` and `express`.
2018-12-18 14:07:46 -06:00
Anthony Laibe 944b392cc5 feat: code runner use fs overrided 2018-12-17 18:31:22 +00:00
Jonathan Rainville a147e2706b refactor: change registerConsoleCommands to the new API 2018-12-17 09:59:03 -05:00
Anthony Laibe bbcfe9b1de fix: all ws endpoint use new technique
This is dues to those 2 endpoints being added
as the same time of the new technique
2018-12-17 10:05:58 +00:00
Iuri Matias a7ff02997b refactor(@embark/compiler): refactor/simplify compiler module 2018-12-16 11:09:34 -05:00
Iuri Matias 0c5e725b68 chore(@embark/compiler): move compiler to typescript 2018-12-16 11:09:34 -05:00
Andre Medeiros 6aa8781ff5 fix(@embark): single use tokens 2018-12-16 10:28:18 -05:00
Iuri Matias ac32cdbfc7 test(@embark): move solidity test to folder structure matching src/; add compiler test 2018-12-14 18:34:23 -05:00
Iuri Matias caf97af0f5 chore(@embark): run tests for all matching files in the test subfolders 2018-12-14 18:34:23 -05:00
Iuri Matias b4e0fb4557 documentation(@embark/compiler): document compiler module 2018-12-14 18:34:23 -05:00
Pascal Precht fd311f9d24 fix(@embark/whisper): ensure web3 is ready when whisper info is requested
In 1461e95c39 we've introduced a guard that ensures whisper isn't crashing
when Embark is used with the Simulator. This unfortunately also introduced
code that tries to connect to an existing websocket provider that isn't actually
ready at the time it tries to connect.

This commit ensures `web3.shh.getInfo()` is only called once `web3` is ready
and therefore the WS connection as well.
2018-12-14 18:14:08 -05:00
Jonathan Rainville 503a79ca7a fix(test/console): register in the console in tests when ipc connected 2018-12-14 18:07:23 -05:00
Praveen Gupta 0950df242d Fixes webserver protocol 2018-12-14 17:54:17 -05:00
Praveen Gupta ca358b4622 Adds log for missing webserver cert and minor fixes 2018-12-14 17:54:17 -05:00
Praveen Gupta 26d66f6e09 Adds reverse proxy for geth 2018-12-14 17:54:17 -05:00
Praveen Gupta dffb3b3bb0 Adds https support for dev server 2018-12-14 17:54:17 -05:00
Andre Medeiros 435e1e6471 fix: record contract transaction history 2018-12-14 17:50:47 -05:00
Iuri Matias 93eca0b551 documentation(@embark/ens): document ens module 2018-12-14 17:34:25 -05:00
Jonathan Rainville 6a03a8f4e8 add doc link 2018-12-14 13:35:22 -05:00
Jonathan Rainville ae61792d5b change to isArray and fix history with length 2018-12-14 13:35:22 -05:00
Jonathan Rainville 79fe28d62e more review comments
- remove useless comment
- change use to usage
- better log
2018-12-14 13:35:22 -05:00
Jonathan Rainville 3342c28fae fix intefrace function 2018-12-14 13:35:22 -05:00
Jonathan Rainville 9c657c310b change to new new api 2018-12-14 13:35:22 -05:00
Jonathan Rainville cf8f7720d0 make api only options, add interface and deprecate old api 2018-12-14 13:35:22 -05:00
Jonathan Rainville 983921e917 refactor: change some console commands to the new api
- history
- ens functions
- versions
2018-12-14 13:35:22 -05:00
Jonathan Rainville 3229e15841 feat(console): add new api to register console commands
Enables us to add help commands without putting the logic in console
2018-12-14 13:35:22 -05:00
Michael Bradley, Jr e738efe15a refactor(@embark/blockchain_process): swallow errors, revise streams
For reasons unknown, `ECONNRESET` errors on websocket connections to embark's
blockchain proxy are not automatically handled on Windows as they are on macOS
and Linux (or those errors aren't happening on those platforms, it's difficult
to determine). Explicitly swallow such errors so the blockchain process doesn't
crash. Prior to this PR, the crash-behavior can be reproduced on Windows by
running `embark blockchain` and `embark run` in separate terminals and quitting
`embark run` while `embark blockchain` is still running.

Consistently use the `simples` package's `WsParser` to process websocket
traffic instead of using `WsParser` for requests and the `ws` package's
`Websocket.Receiver` for responses.

Consistently use `pump` to connect parser streams instead of using `pump` in
some places and `chain` in others. Drop use of `cloneable` (and the package
dependency) since it was used previously in hopes it would fix the errors, but
it's unnecessary and didn't fix them.
2018-12-13 16:28:08 +01:00