Commit Graph

5252 Commits

Author SHA1 Message Date
Jonathan Rainville 99dcd785bc fix(cockpit/contract): remove contract profiling and use functions 2019-03-11 18:21:54 -04:00
Michael Bradley, Jr a9c5e1ade5 feat: add repository.directory field to package.json
See: https://github.com/npm/rfcs/blob/latest/implemented/0010-monorepo-subdirectory-declaration.md

Make changes by running this command in the root of the monorepo:

```shell
npx lerna exec --concurrency 1 --stream -- \
    'DIRPATH=$(realpath $PWD --relative-to=$LERNA_ROOT_PATH); \
    npx json -I -f package.json -e \
    "this.repository=\
        {\"directory\": \"$DIRPATH\", \
         \"type\": \"git\", \
         \"url\": \"https://github.com/embark-framework/embark.git\"}"'
```

Don't commit changes to private packages, with the exceptions of embark-typings
and embark-reset because those may switch from private to public, and also
because the latter will be included in `node_modules` of embark even if it is
private since embark-reset is presently a bundled dependency of embark.

Don't include the repository field in dapps generated from the template
packages, except for the demo.
2019-03-11 18:21:24 -04:00
Andre Medeiros f12ca22edb fix: limit cockpit editor file size 2019-03-11 18:20:56 -04:00
Andre Medeiros 616af6d765 fix: validate whisper channel name in communication tab 2019-03-11 18:19:00 -04:00
Andre Medeiros 4340a9b482 fix: editor wasn't saving changes 2019-03-11 18:18:52 -04:00
emizzle a6b15ae98f fix(@embark/cockpit): Switching between tabs resets logs
Switching between the two tabs shown on the Dashboard for the cockpit was removing some of the logs that were previously displayed. This was due to an overlap in `id`’s being assigned to the logs from different processes.

To alleviate this, the reducers has been updated to not only check `id` but also `process.name`.

Additionally, the reducer was updated so that the number of logs for **each process** is set to `ELEMENTS_LIMIT`. For example, our `ELEMENT_LIMIT` is currently set to `200` and it would have meant that the total number of process logs across all processes would have been capped at 200. The current changes in this PR allow for 400 total logs, given that we have two processes being monitored for logs.
2019-03-11 17:39:05 -04:00
emizzle 128ecd4c51 fix(@embark/core): Prevent unnecessary re-renderings
The services websocket was initiated in the AppContainer and causing all child components to continuously re-render every time there was a service check (which is effectively every second). In addition, the socket was never stopped when not needed (ie when the services component was unmounted).

Create a ServicesContainer that initiates the websocket as part of the container, and stops the socket when the container is unmounted.

Move the ContractsList to be part of the ContractsContainer with a `mode` switch.

Add Deployment page title and description.
2019-03-11 17:38:33 -04:00
Jonathan Rainville cc495c5cab hotfix(cockpit/editor): remove test alert 2019-03-11 16:00:26 -04:00
Jonathan Rainville c30c420ae8 fix(cockpit/editor): remove delay on tooltips
This caused issues when moving from one tooltip to the other
2019-03-11 09:05:49 -04:00
Jonathan Rainville 7720eac74f codacy fix 2019-03-11 09:05:15 -04:00
Jonathan Rainville ecdfd473df feat(cockpit/editor): add status messages for file operations 2019-03-11 09:05:15 -04:00
Jonathan Rainville 3f488e1d88 fix(cockpit/editor): add delete modal to confirm deletion
Also fix cases where modals closed for no reason
2019-03-11 09:04:45 -04:00
emizzle 563ba154a3 fix(@embark/tests): Make `web3` available in test descriptions
Previous to this PR, `web3` was only made available to each test case, as it was put in to the global namespace after each test deploy. This was causing issues for tests that use `web3` in the test description (ie in `describe()` or `contract()` functions), as the deploy had not happened yet, and thus `web3` was not yet available. The error encountered in these cases was `web3 is not defined`.

This PR puts `web3` in the global namespace before setting up the tests, making it available to test descriptions.
2019-03-11 12:15:45 +11:00
Jonathan Rainville da76c8d804 fix(cockpit/deployment): filter out silent contracts 2019-03-08 12:55:58 -05:00
Jonathan Rainville 0648824646 fix(cockpit/header): fix nav not highlighted for children pages 2019-03-08 12:55:05 -05:00
Jonathan Rainville 35648eefa0 fix(cockpit): fix converter inputs and copy-button position 2019-03-08 12:55:05 -05:00
Jonathan Rainville 359c28f5b5 fix(cockpit:editor): fix arrow not turning 2019-03-08 09:26:13 -05:00
Jonathan Rainville fac29e1601 revert console to only show cockpit results in cockpit 2019-03-08 08:54:30 -05:00
Jonathan Rainville 6662731898 fix(logger): filter undefined and null out of logs 2019-03-08 08:54:30 -05:00
Jonathan Rainville 32e8bd2ee1 fix(console/logger): fix console and logger not outputting objects
Also makes the logger smarter by stringifying objects
And revert repl changes
2019-03-08 08:54:30 -05:00
Jonathan Rainville e20c08ac6f fix(console): fix ENS tests not working with embark side by side 2019-03-08 08:54:30 -05:00
emizzle 9ea0383046 fix(@embark/storage): Allow upload when storage disabled
Allow `embark upload` to upload to IPFS/Swarm even if the storage module is disabled in the storage config.

An easy way to test this is to set `config/storage.js` > `enabled` to `false` in the demo. Then run `embark upload`.
2019-03-08 12:43:00 +11:00
emizzle c233dbc7fb fix(@embark/core): Metamask + geth warning to enable regular txs
A console warning is meant to appear in the browser console when the dapp is connecting to web3 using metamask and the blockchain client is geth. The warning displays information telling the user they should enable regular transactions to prevent known issues regarding transactions getting stuck.

The issue fixed here pertained to `warnAboutMetamask` vs `warnIfMetamask` - maybe there was a change that introduced this issue upstream.

Additionally, enabling and disabling of regular transactions via an API endpoint did not

Add ability to stop regular txs via query string, and validate request parameters.
2019-03-08 12:41:13 +11:00
Jonathan Rainville 0e63d6bcf9 feat(cockpit/contracts): don't display contracts marked as silent 2019-03-05 16:21:39 -05:00
Jonathan Rainville d80641c4e1 fix(ens/logger): add ens contracts to contract manager before deploy 2019-03-05 16:21:39 -05:00
André Medeiros 58ab76d2ca
fix: format \n as <br> in cockpit console (#1385) 2019-03-05 14:29:57 -05:00
André Medeiros 913b4e1817
fix: upgrade packages with vulnerabilities (#1388) 2019-03-05 14:29:36 -05:00
Michael Bradley, Jr eb1b6933af fix: revise test urls to reflect test_dapps/ -> dapps/tests/ 2019-03-05 13:26:38 -06:00
André Medeiros 73a06725ac
fix: don't eval function calls for suggestions (#1382) 2019-03-05 14:26:08 -05:00
André Medeiros 78201ce9df
fix: prevent HTML injection in the cockpit (#1381) 2019-03-05 14:14:58 -05:00
André Medeiros 41256cfb00
fix: blockchain logs show in cockpit (#1367) 2019-03-05 14:14:41 -05:00
André Medeiros 891174eda3
fix: cockpit search with tx hash shows tx page (#1386)
This issue was caused by a string to integer conversion. In JavaScript,
when converting a string that starts with `0` (which is the case for tx
hashes) to an integer using `parseInt` it will always yield 0. That,
combined with a block with number 0 would always return a block result
instead of the transaction.

```
> parseInt("0xluri", 10)
0
```

This PR checks if the resulting number equals the string that was
provided on top of checking for the block number.
2019-03-05 14:14:05 -05:00
Michael Bradley, Jr de0f02d00a build: make DApp templates member packages of the monorepo
Previously, templates were in a subdirectory of `packages/embark`. Reorganize
them so that they are member packages of the monorepo. This allows them to
cleanly depend on other members of the monorepo,
e.g. `embarkjs-connector-web3`.

It is desirable for the templates, in the context of the monorepo, to specify
embark as a dependency, to take advantage of `npx embark test` (and it's a
"forward looking" setup re: how we plan to evolve embark). However, if embark
were to specify the template packages as dependencies a circular relationship
would be introduced, which is [unsupported by Lerna][circular]. Therefore,
revise the template generator so that all templates are resolved / fetched at
runtime, i.e. `boilerplate`, `demo`, and `simple` are no longer
"built-ins" *per se*. This change won't be apparent to embark's users, but it
does mean that the template generator won't work (in a production install of
embark) if it can't connect to the npm registry, i.e. when the user runs
`embark demo` or `embark new [--simple]`. When embark is inside the monorepo,
templates are resolved and copied from the yarn workspace rather than being
fetched from the registry, which is convenient for development. Also, any
template dependencies that are members of the monorepo are linked into the
copied template's `node_modules` rather than being installed from the registry,
again for convenience. During template generation, remove scripts and
dependencies that pertain only to membership in the monorepo; for now, that
involves removing embark as a dependency since we're not quite ready for that
arrangement to be the default, i.e. outside of the monorepo.

Refactor the root scripts so that more of them can consistently be used with
Lerna's filter options, e.g. `--scope` and `--ignore`. "Combo" scripts that
don't support filtering generally have a `:full` postfix.

Flip `clean` and `reset` scripts at the root and in the member packages for
consistency re: Lerna's notion of `clean` and embark's notion of `reset`. Have
each package run its `reset` script when its `clean` script is invoked (and
that's all for now), relying on `lerna clean` to delete packages'
`node_modules` in view of how Lerna's topological sorting works.

Lift the implementation of `embark reset` into a private package in
`packages/embark-reset` and make it a bundled dependency of embark. Packages in
`dapps/*` depend on `embark-reset` directly and make use of it with `npx
embark-reset` (but only in monorepo context). This removes a "wart" where
reboots could show errors when embark's sources aren't already built in
`packages/embark/dist`. Users will not notice any difference since `embark
reset` works as before, transparently making use of the `embark-reset`
package. The only downside to having it be a bundled dependency of embark is
that bundled deps have all of their `node_modules` included in the tarball
built with `npm pack` (that's why having the templates as bundled dependencies
of embark isn't a viable approach). However, `embark-reset` only has one
dependency, `rimraf`, which is a tiny module, so the cost seems acceptable.

As part of the reorganization, move `test_dapps` into `dapps/tests` and
`packages/embark/templates` into `dapps/templates`. Keep the directory names
short but revise the package names to facilitate simple filtering with
`embark-dapp-*`. Consolidate `.yarnrc` and `.gitignore` and clean up some
redundant ignore listings.

Scripts run with `--scope embark-dapp-*` use `--concurrency=1` to avoid
conflicts that could arise over network ports. The `ci:full` and `qa:full`
scripts use `--concurrency=1` in all scopes, for two reasons: resource
limitations on Travis and AppVeyor result in slower runs with concurrency >1,
and if something fails in those contexts it's easier to see what went wrong
when Lerna's output isn't interleaved from a bunch of scripts in `packages/*`.

Bump the Lerna version.

[circular]: https://github.com/lerna/lerna/issues/1198#issuecomment-442278902
2019-03-05 10:20:57 -06:00
emizzle f957ba55dd fix(@embark/cockpit): Fix decode transaction error
Reproduce:
1. Go to cockpit > transactions
2. Click a transaction
3. There will be a flicker of an error, then the decoded tx displays OK. Inspecting the network requests, there is a 500 error with a response of
```
AssertionError [ERR_ASSERTION]: invalid remainder
```
This error is also printed in the console.

The issue is that the transaction is not a raw transaction, so instead of trying to decode the non-raw transaction, the transaction can be decoded by web3.
2019-03-05 12:01:07 +11:00
emizzle 9bd33a9de5 feature(@embark/console): Suggestions improvements
**Cache suggestions**
Suggestions are cached for better performance on each request. When contracts are deployed, the suggestion cache is cleared, allowing for updated contract methods to be built in to the suggestions.

** Handle edge cases **
Handle cases when console command is parsed as an empty string, or possibly returns an empty object, which would cause `Object.getOwnPropertyNames` to throw an error (that is ultimately swallowed).
2019-03-05 08:56:15 +11:00
emizzle 14323f5430 fix(@embark/swarm): Fix swarm not being registered
Swarm was not being registered as a service due to a recent change that introduced a bug. The previous change was meant to register “swarm” as a console command to provide output for the `swarm` console command when swarm had not been registered in the VM. The bug, however, returned too early in the cases when swarm was meant to be enabled, thus effectively not registering the entire process.

The fix simply returns only when swarm is in fact, disabled, and also alters slightly the way swarm is determined to be enabled (the changes of which have been copied over to `ipfs`).
2019-03-05 08:19:48 +11:00
emizzle 9fad77715b fix(@embark/core): Allow errors in event actions
Add the ability to pass an error in the callback of an event action.

Currently, event actions could either pass back a an error OR a result, but not both, and with no way to distinguish between the two parameters. This PR adds the ability to pass an error as the first parameter of the action callback.

An example of a use case that this fixed: errors on `deployIf` were silently swallowed, which has now been fixed.

All instances of `events.request(“deploy:contracts”)` were given an `error` parameter in their callback, and errors printed if it is not undefined.

All instances of `registerActionForEvent` were combed to ensure any callbacks were passing the expected error and result.
2019-03-04 12:35:35 +11:00
Jonathan Rainville 0639717d0c fix(blockchain): check if node is synched after connection 2019-03-01 11:04:14 -05:00
Jonathan Rainville 217357640a feat(test/reporter): only show tx details on option 2019-03-01 10:58:57 -05:00
Jonathan Rainville 87d92b6091 feat(test/reporter): log tx functions during tests
Extract function log function to utils to use in the reporter
  to show txs in tests
2019-03-01 10:58:57 -05:00
emizzle 89753c11e3 feature(@embark/cockpit): Add contract state changes to cockpit
Add contract state changes to the cockpit by sending contract state updates via the websocket.
2019-02-28 16:37:19 +11:00
emizzle bb86b605de fix(@embark/core): `web3.eth.getAccounts` returning empty
`web3.eth.getAccounts` was returning an empty array in the console due to a change, that I’m unsure of what the original intention was for.

@andremederios, could you please take a look, and let me know if this breaks the intention of the original changes?
2019-02-28 16:36:11 +11:00
emizzle a67a4ad96e fix(@embark/cockpit): Fix whisper messages not being received
Cockpit whisper messages were not being subscribed to due to a inocuous bug that would swallow errors and ultimately not be subscribed to the `rxjs` observer.
2019-02-27 14:51:24 +11:00
Jonathan Rainville c708bad8bb chore(cockpit/estimator): always return an integer for getGasPrice 2019-02-26 13:01:50 -05:00
Jonathan Rainville 1759aac8aa fix(cockpit/estimator): make estimator clearer 2019-02-26 13:01:50 -05:00
Jonathan Rainville 57cd6d3da1 feat(console): print console results as log so cockpit gets it 2019-02-26 12:55:58 -05:00
Jonathan Rainville e3396417da feat(cockpit/console): display cmds from cockpit in embark console 2019-02-26 12:55:58 -05:00
Anthony Laibe 46221a3bc0 feat(coverage): load contracts from plugin 2019-02-26 14:37:58 +00:00
Anthony Laibe f5f610d520 fix(embark-ui): pagination 2019-02-26 14:37:58 +00:00
Anthony Laibe 24a6a4701f fix: handle the case where account is an object 2019-02-26 14:37:58 +00:00