Commit Graph

804 Commits

Author SHA1 Message Date
emizzle 1e1172e86c fix(@embark/debugger): Prevent error if contract not tracked by Embark
Null check to prevent an error during automated debugging for failed transactions.
2020-01-09 11:37:25 -05:00
Pascal Precht 6797a8a9fc chore(@embark/proxy): suppress error logs when inside test-runner context
When running tests that expect the EVM to fail, Embark's proxy keeps logging
the VM errors to stdout making it look like tests weren't successful, while they
are actually passing.

Inside a test-runner it's probably expected not to see any error logs when the
tests in question expect errors.

This commit changes the proxy to use `debug()` logs instead of `error()`, making
it configurable through log verbosity how much errors are seen.
2020-01-09 11:36:18 -05:00
emizzle 5843a8e03e fix(@embark/transaction-logger): Circular JSON log and unknown contract log level
## Issue
Transaction logs for contracts that were unknown to Embark (ie not in the dapp) would often log super large objects (filling the terminal) that were not formatted with spaces so were hard to read without actually be that useful. In addition, occasionally the object logged would throw the error `TypeError: Converting circular structure to JSON`.

## Fix
Set the log level for transaction logs that are not from a known contract to `debug`, so that they do not flood the terminal with often usused information.

Use `util.inspect` to print the transaction log instead of `JSON.stringify` to prevent circular structure errors.
2020-01-09 11:34:43 -05:00
Michael Bradley, Jr ba0d6d17f3 chore(release): 5.0.0 2020-01-07 12:14:37 -06:00
Jonathan Rainville c8f86e55f0 fix(@embark/watcher): endless loop when artifacts are put in src
The problem was that putting the artifacts in src caused them to be watched
and thus creating an infinite loop, because a change in src triggers the build of the artifacts
This was fixed by ignoring the artifacts by chokidar, wherever they are
2020-01-06 10:46:33 -05:00
dependabot-preview[bot] a5c6a9e170 build(deps): [security] bump handlebars from 4.2.0 to 4.3.0
Bumps [handlebars](https://github.com/wycats/handlebars.js) from 4.2.0 to 4.3.0. **This update includes a security fix.**
- [Release notes](https://github.com/wycats/handlebars.js/releases)
- [Changelog](https://github.com/wycats/handlebars.js/blob/master/release-notes.md)
- [Commits](https://github.com/wycats/handlebars.js/compare/v4.2.0...v4.3.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-01-06 09:05:25 -06:00
Michael Bradley, Jr 902dba0c02 chore(release): 5.0.0-beta.0 2020-01-03 09:37:36 -06:00
emizzle 2295f94ae0 fix(@embark/snark): Allow dapp to have no contracts
If using `embark-snark` in the dapp as a plugin, and the dapp didn’t have any contracts, the `embark-snark` plugin would not simply exit early and essentially do nothing.

Fix `embark-snark` plugin so that it will run its routine regardless of whether or not the dapp has contracts or not.

Bump `circom` and `snarkjs` to their latest patch version.
2020-01-03 13:50:06 +01:00
Iuri Matias b02b7ec751 chore(release): 5.0.0-alpha.10 2019-12-24 15:27:23 -05:00
Michael Bradley, Jr 441db4fd18 bugfix(@embark/scaffolding): upgrade scaffolding so it can be used in embark v5
WIP: refactor so that embark-scaffolding can be used in embark v5

fix scaffold cmd

fix generated files path
2019-12-24 14:50:26 -05:00
emizzle 8f9f631758 fix(@embark/embarkjs): Fix event name misspelling
Fix misspelling in event name. This event is new to v5, so there is no deprecation or major version bump needed.
2019-12-24 12:59:10 -05:00
emizzle 349b2691c3 fix(@embark/ens): Handle cases when no “register” in config
## Issue 1 - “register” section missing
When the “register” section of `namesystem.json` was missing, ENS would not deploy the ENS contracts nor create the contracts’ artifacts.

### Fix 1
Fix ENS deployment routine to always deploy the ENS contracts. In the case of testnet/mainnet, the contracts’ addresses will be known and therefore will be understood as “already deployed” by the contract deployer.

## Issue 2 - “register” section exists for non-dev environment
Additionally, if a root domain was specified in the “register” section and the DApp connected to an external node where we do not own the ENS contracts (ie testnet), attempting to register a root domain would not be possible as we do not own the ENS contracts.

### Fix 2
Fix ENS deployment routine to check if we are on a network in which we own the ENS contracts. If we are not, and we have specified a “register” section, print a warning to the user that the  registration will be ignored. Additionally, remove the “register” section.
2019-12-20 18:35:18 -05:00
Iuri Matias 472efbbf6e chore(release): 5.0.0-alpha.9 2019-12-20 18:13:47 -05:00
Jonathan Rainville 1e9b8d8595 fix(@embark/tests): fix slow embark test because of the tx-logger
The transaction-logger was slowing down tests because each Tx, it
would read a file and write to it, but that's slow and even got
slower as the file grew bigger
To fix, I removed the Tx-logger from text, along with the profiler
as they are useless for tests

(cherry picked from commit a656eea7dda83ad970615cffd51cce5d53a1d034)
2019-12-20 16:16:16 -05:00
Pascal Precht 765e889121 fix(@embark/coverage): ensure handlers for 'tests:finished' are run as actions
There was a race condition in which the coverage module tried to read a generated
coverage report before it was actually generated.
The issue was that the coverage generation was done on Embark's `tests:finished` event
in a fire and forget manner via `emit('tests:finished')` which doesn't
ensure control flow.
This commit changes it to use `runActionsForEvent('tests:finished')` instead and also
registers the handler for coverage report generation as action via `registerActionForEvent()`.

This ensures that those actions are run first, before the code moves on with other
operations that might rely on the result of any of those actions.
2019-12-20 16:11:48 -05:00
Michael Bradley, Jr 09e2dbe49d fix(@embark/cli): find ejectable webpack files within embark-basic-pipeline 2019-12-20 10:04:16 -06:00
Michael Bradley, Jr 7e550f0e6f build(deps): bump web3[-*] from 1.2.1 to 1.2.4
Refactor typings as necessary. In order for `bignumber.js` in the root
`node_modules` to not conflict with `@types/bignumber.js`, specify
`"bignumber.js": "5.0.0"` in `devDependencies` and `"embark-ui/bignumber.js"`
in `nohoist` of the root `package.json`.

In `packages/plugins/rpc-manager` switch from callback to promise usage with
respect to `web3.eth.accounts.signTransaction` because of a [bug][bug]
discovered in web3 v1.2.4.

In `packages/plugins/solidity-tests` specialize the tsc compiler options with
`"skipLibCheck": true` because of a problematic web3-related typing in the
`.d.ts` files of the remix-tests package.

Bump ganache-cli from 6.4.3 to 6.7.0 (latest) because 6.4.3 doesn't support
`eth_chainId` but web3 1.2.4 makes use of the `eth_chainId` RPC method (EIP
695).

BREAKING CHANGE: bump embark's minimum supported version of parity from
`>=2.0.0` to `>=2.2.1`. This is necessary since web3 1.2.4 makes use of the
`eth_chainId` RPC method (EIP 695) and that parity version is the earliest one
to implement it.

[bug]: https://github.com/ethereum/web3.js/issues/3283
2019-12-20 08:35:48 -06:00
Iuri Matias 4091296924 chore(release): 5.0.0-alpha.8 2019-12-19 14:14:23 -05:00
Jonathan Rainville 03bd49cf64 fix(@embark/rpc-manager): fix duplicated accounts in rpc manager
Was caused by the fact that each rpc-modifier got its own node
accounts, but once the eth_accounts modifier is enabled, the
"node" accounts are always going to contain the custom accounts too
Now, the node accounts are set once eth_accounts is initiated, so
that every modifier is on the same page
Also implement a second layer of protection to make sure that if a
duplication happens, it is gotten rid of
2019-12-19 11:19:03 -05:00
emizzle 6f49992d57 fix(@embark/cockpit): Remove loading from ENS util
Removed loading component from rendering as it was causing the ENS components to unmount and ultimately not show ENS results.
2019-12-19 10:22:27 -05:00
Iuri Matias f72d6f2915 chore(release): 5.0.0-alpha.7 2019-12-18 12:07:13 -05:00
Pascal Precht fba4ccfee8 refactor(@embark/engine): move back to arrow functions and ...args
As discussed in https://github.com/embark-framework/embark/pull/2143#issuecomment-566671315
2019-12-18 11:22:45 -05:00
Jonathan Rainville 1201879bdc fix contract app test by increasing gas 2019-12-18 11:22:18 -05:00
Jonathan Rainville 1bc967c6d1 fix(@embark/rpc-manager): fix sign data address comparison
Did not check correctly for if the account is a node account
2019-12-18 11:22:18 -05:00
Jonathan Rainville 13312128b3 fix(@embark/mocha-tests): set accounts correctly on each contracts 2019-12-18 11:22:18 -05:00
Iuri Matias 5893bc38b9 chore(release): 5.0.0-alpha.6 2019-12-17 15:41:00 -05:00
emizzle aea2b6f97f fix(@embark/ens): Show ENS controls for Test DApp
For the test DApp, when ENS is enabled, ENS controls were not showing in Cockpit (under Utils), nor were they available to test in the DApp interface as they did not exist.

Fix ENS controls not showing in Cockpit when enabled.

Add ENS tab to Test DApp for ENS UI.
2019-12-17 13:48:06 -05:00
emizzle 7dfa2b939c fix(@embark/dapps): Contracts app test failure
During `embark test`, the contracts dapp was throwing an error:
```
connection not open on send()
Error: Invalid JSON RPC response: ""
    at Object.InvalidResponse (/Users/michael/repos/embark/node_modules/web3-core-helpers/src/errors.js:42:16)
    at XMLHttpRequest.request.onreadystatechange (/Users/michael/repos/embark/node_modules/web3-providers-http/src/index.js:92:32)
    at XMLHttpRequestEventTarget.dispatchEvent (/Users/michael/repos/embark/node_modules/xhr2-cookies/xml-http-request-event-target.ts:44:13)
    at XMLHttpRequest._setReadyState (/Users/michael/repos/embark/node_modules/xhr2-cookies/xml-http-request.ts:219:8)
    at XMLHttpRequest._onHttpRequestError (/Users/michael/repos/embark/node_modules/xhr2-cookies/xml-http-request.ts:379:8)
    at ClientRequest.<anonymous> (/Users/michael/repos/embark/node_modules/xhr2-cookies/xml-http-request.ts:266:37)
    at ClientRequest.emit (events.js:198:13)
    at Socket.socketErrorListener (_http_client.js:392:9)
    at Socket.emit (events.js:198:13)
    at emitErrorNT (internal/streams/destroy.js:91:8)
    at emitErrorAndCloseNT (internal/streams/destroy.js:59:3)
    at process._tickCallback (internal/process/next_tick.js:63:19)
(node:75120) UnhandledPromiseRejectionWarning: Error: Provider not set or invalid
...
```

This was due to the fact that during testing, the Ganache VM **provider** is used as the blockchain node, instead of spinning up an instance of Ganache. Due to this, there is no HTTP nor WebSockets RPC endpoint opened on the VM node, and the contracts dapp was not able to connect to the node during tests.

Add `$EMBARK` to the contract config’s `dappConnection` list, so that the contract test dapp can successfully connect to Embark’s proxy, which ultimately communicates with the Ganache VM.

As a side note, without `$EMBARK` in the `dappConnection` list, the tests could run successfully when using `embark test —node=embark`. This succeeds because the geth node exposes the RPC WebSockets endpoint that the contracts app connects to on `ws://localhost:8546`.
2019-12-17 10:44:01 -05:00
Pascal Precht aa5121ae0d fix(@cockpit/contracts): ensure contract state is emitted in realtime
This fixes a bug that redeployment of contracts has not been properly
reflected in the cockpit contract list.

The reason for that was that it's listening for a websocket API that
only updates when the `contractsState` event has been emitted.

The commit ensures `contractsState` is emitted during dedicated deployment
events.
2019-12-17 10:43:32 -05:00
Pascal Precht 920b07853a fix(@embark/engine): ensure deployment hook logs don't produce unexpected output
Since ee56f37713, any deployment hook that
was using simple `console.log()` statements to output information, would result in
unexpected `[[object object], [object object]]`.

Unfortunately, the reason for that was that we switched from non-arrow functions to
arrow functions [here](ee56f37713 (diff-a7c4cef8bfebeb39fcd092aca5570fecL324-L340)). Usually switching from non-arrow functions to arrow functions solves
a lot of lexical scope issues where the current reference of `this` isn't pointing at the
right thing.

We're tempering with the global `console.log` inside Embark, which then, combined with
**proper** lexical scope, causes the output described above.

Generally there are a few ways to go about this:

1. Ensure that our custom log functions doesn't turn every log statement into an array output
2. Tell users not to use `console.log` inside deployment hooks and instead rely on `deps.logger`
3. Revert the changes made in the mentioned commit and use non-arrow functions inside `interceptLogs`

Option 2) is not really a solution as we can't simply tell our users that they can't use one of
the most used functions in JavaScript. Option 1) requires finding out why we're formatting logs
by default in an array shapre in the first place. On top of that, we might be relying on this
inside Embark, so it could break certain output.

Option 3) seems to be the most pragmatic solution for now as it doesn't introduce any of the
downsides mentioned above at the cost of using non-arrow functions.
2019-12-17 10:42:14 -05:00
Iuri Matias 78a06c9d76 chore(release): 5.0.0-alpha.5 2019-12-16 13:49:41 -05:00
Iuri Matias fc4188d247 bugfix(@embark/parity): add missing new to BlockchainClient initialization 2019-12-13 17:39:02 -05:00
Iuri Matias bd0da80625 bugfix(@embark/geth): add missing new to BlockchainClient initialization 2019-12-13 17:39:02 -05:00
Jonathan Rainville 926b2bb046 fix(@embark/whisper): fix whisper status check 2019-12-13 16:34:01 -05:00
Michael Bradley, Jr ee56f37713 build: implement collective typecheck
This PR replaces #2057.

Implement a collective typecheck action that can be invoked in the root of the
monorepo with `yarn typecheck` or in watch-mode with `yarn watch:typecheck`.
Include the watch-mode typecheck action as part of `yarn start` (a.k.a
`yarn watch`).

To activate collective typecheck for a package in the monorepo, its
`package.json` file should specify:

```
{
  "embark-collective": {
    "typecheck": true
  }
}
```
*-or-*
```
{
  "embark-collective": {
    "typecheck": {...}
  }
}
```

Where `{...}` above is a `tsconfig.json` fragment that will be merged into the
config generated for the package according the same rules that `tsc` applies
when merging [configs][config].

When collective typecheck begins, it generates a `tsconfig.json` for the root
of the monorepo and for each package that is activated for the action. If the
generated JSON is different than what's on disk for the respective root/package
config, or if the config is not present on disk, then it will be
written. Changes to generated `tsconfig.json` files should be committed; such
changes will arise when there are structural changes to the monorepo, e.g. a
package is added, removed, moved and/or the directory containing it is
renamed. Since the configs are only generated at the beginning of collective
typecheck, when structural changes are made in the monorepo `yarn typecheck`
(or `yarn start` or `yarn watch:typecheck`) should be restarted.

Nearly all of the packages in the monorepo (i.e. all those for which it makes
sense) have been activated for collective typecheck. Even those packages that
don't contain `.ts` sources are activated because `tsc` can make better sense
of the code base as a whole owing to the project references included in the
generated `tsconfig.json` files. Also, owing to the fully cross-referenced
`tsconfig.json` files, it's possible for `tsc` to type check the whole code
base without babel (`yarn build` or `yarn watch:build`) having been run
beforehand.

**NOTE** that a *"cold typecheck"* of the whole monorepo is resource intensive:
on this author's 2019 MacBook Pro it takes around three minutes, the fans spin
up, and `tsc` uses nearly 0.5 GB of RAM. However, once a full typecheck has
completed, the next full typecheck will complete in a few seconds or less; and
when running in watch-mode there is likewise a *big* speedup once a full
typecheck has completed, whether that full check happened before it's running
in watch-mode or when watch-mode itself resulted in a full check before
switching automatically to incremental check, as well a corresponding *big*
reduction in resource consumption. A full check will be needed any time
`yarn typecheck` (or `yarn start` or `yarn watch:typecheck`) is run in a fresh
clone plus `yarn install`, or after doing `yarn reboot[:full]` or `yarn reset`.

The combination of options in each generated package-level `tsconfig.json` and
the root `tsconfig.base.json` result in `tsc` writing `.d.ts` files (TypeScript
declaration files) into the `dist/` directory of each package. That
output is intended to live side-by-side with babel's output, and therefore the
`"rootDir"` option in each generated config is set to `"./src"`.

In projects activated for collective typecheck, `.js` may be converted to `.ts`
and/or `.ts` sources may be added without any additional changes needed in
package-level `package.json`.

---

Reorganize types in `packages/core/typings` (a.k.a `@types/embark`) into
`packages/core/core` (`embark-core`), refactor other packages' imports
accordingly, and delete `packages/core/typings` from the monorepo. This results
in some similarly named but incompatible types exported from `embark-core`
(e.g. `Events` and `EmbarkEvents`, the latter being the one from
`packages/core/typings`); future refactoring should consolidate those types. To
avoid circular dependency relationships it's also necessary to split out
`Engine` from `embark-core` into its own package (`embark-engine`) and to
introduce a bit of duplication, e.g. the `Maybe` type that's now defined in
both `embark-i18n` and `embark-core`.

In the process of the types reorg, move many dependencies spec'd in various
`package.json` to the `package.json` of the package/s that actually depend on
them, e.g. many are moved from `packages/embark/package.json` to
`packages/core/engine/package.json`. Related to those moves, fix some Node.js
`require`-logic related to bug-prone dependency resolution.

Fix all type errors that appeared as a result of activating collective
typecheck across the whole monorepo.

Reactivate `tslint` in `packages/core/core` and fix the remaining linter errors.

Tidy up and add a few items in the root `package.json` scripts.

Bump lerna from `3.16.4` to `3.19.0`.

Bumpt typescript from `3.6.3` to `3.7.2`.

Bumpt tslint from `5.16.0` to `5.20.1`.

Make various changes related to packages' `import`/`require`ing packages that
weren't spec'd in their respective `package.json`. More refactoring is needed
in this regard, but changes were made as the problems were observed in the
process of authoring this PR.

[config]: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html
2019-12-13 13:59:47 -05:00
Jonathan Rainville a9c91c9503 chore(@embark/embark): fix embark config test 2019-12-13 10:46:02 -06:00
Jonathan Rainville 60f4d2f27f fix(@embark/embarkjs): use getNetworkId to test connection
This fixes the case when dappAutoEnable is false and tehn in Status
getAccounts returned an error
2019-12-13 10:38:53 -05:00
Jonathan Rainville 7e707616be fix(@embarkrpc-manager): fix infinite loop in eth_accounts modifier
This was caused by the fact that we registered the action to change
the accounts, but that action needs the node accounts, which is
a request to eth_accounts, hence creating a loop
2019-12-13 10:38:53 -05:00
Jonathan Rainville 0503bb24a3 fix: fix node connection test to use the endpoints correctly
This caused issues to connect to Infura for example, because we did
not support HTTPS at all, nor WSS
2019-12-13 10:38:53 -05:00
Pascal Precht 1a7fc663b7 fix(@embark/transaction-logger): handle non-contract transactions
The transaction logger takes care of intercepting any responses coming from the
blockchain proxy, determines what response it's dealing with and then extracts
information from the response to output useful log information to the user, such as
when a contract methods has been called etc.

It turned out that it didn't properly handle cases where value transactions
from account to account (such as done here in [Status Teller](a5ab4d4b26/embarkConfig/data.js (L100-L110))) have been made.

Since Embark couldn't map any of those accounts to actual contracts, while
still having stored corresponding transactions, it logged them as transactions
from "Unknown Smart Contracts".

This commit ensures via heuristics that, if the address a transactions is sent to is
included in any of the nodes accounts, the transaction logger logs a useful message
that a certain value is sent from one to anover account.
2019-12-13 09:45:02 -05:00
Michael Bradley, Jr b630a71f7f test: updated remapImports tests re: `.embark/contracts/node_modules` -> `.embark/node_modules`
Related to #2132
2019-12-12 17:28:23 -06:00
Iuri Matias b25ade64f0 bugfix(@embark/core): remove contracts from path which was causing getting contracts from npm packages not to work 2019-12-12 15:27:40 -05:00
Iuri Matias c00511a0e2 chore(release): 5.0.0-alpha.4 2019-12-12 11:38:22 -05:00
Iuri Matias 5d53847c6f fix(@embark/geth): only register console command if in dev mode; use endpoint; use dev account for regular txs that fix geths stuck tx issue
fix(@embark/geth): only register console command if in dev mode; use endpoint; use dev account for regular txs that fix geths stuck tx issue

fix(@embark/geth): only do regular txs if miningMode is dev

fix(@embark/geth): only register console command if in dev mode; use endpoint

fix(@embark/geth): only register console command if in dev mode; use endpoint

fix(@embark/geth): only register console command if in dev mode; use endpoint

fix(@embark/geth): only register console command if in dev mode; use endpoint
2019-12-12 10:30:43 -05:00
Michael Bradley, Jr 9f2a5949c2 build: specify missing test action in relevant package.json "qa" scripts
It's a relevant `package.json` if the package has a test suite. If `test` isn't
specified then the tests won't run in CI (they have't been running).

Include a fix for one failing test in `packages/plugins/ens` and two failing
test in `packages/stack/deployment`. In all three cases, the mock embark
object's config needed a `blockchainConfig` section with `{ enabled: true }`.
2019-12-11 14:01:12 -06:00
Pascal Precht 9df24309e7 fix(@embark/ens): fix broken test due to async API
As part of 8ed5376533 we made `ENS.getEnsConfig()`
asynchronous, hence it needs a callback. This change was not done in one of the
ENS tests, resulting in the test to fail. The test mocked that particular API,
turning it into noop, which is why the test kept timing out.

This commit fixes the test by not mocking the API and adding the needed configuration
to the environment.
2019-12-11 11:34:27 -05:00
emizzle a208db97b3 chore(@embark/embark): Change default log level
Change default log level for all embark actions (except for tests) to `info`.
2019-12-11 11:31:12 -05:00
Pascal Precht 9839e92584 fix(@cockpit/ens): ensure default account is set when registering subdomains
Prior to this commit, registering ENS subdomains would fail due to `defaultAccount`
being null. This is because the underlying API was still relying on `blockchain:defaultAccount:get`.

However since the bigger refactor, every plugin/module is in charge of creating its own
blockchain connector instance and ensuring it has a default account.

This commit makes use of ENS' module's `webDefaultAccount` async getter to
ensure a valid default account is set when registering an ENS subdomain.
2019-12-11 11:30:58 -05:00
emizzle e72aeba892 chore(@embark/geth): Add back DevTxs
Add back DevTxs.

DevTxs sends a zero-value tx to push through any pending txs that may get stuck with geth while in `—dev` mode.

When the geth client is running, devtxs is started automatically, sending a transaction every 10 seconds.

Converted the legacy code in to typescript.
2019-12-11 11:28:21 -05:00
emizzle acd1d72f2d fix(@embark/tests): Tests exiting early
Tests were exiting early and Mocha was reporting an exit code of 0. This allowed CI to complete as if the tests were successful.

Change `compiler:contracts` event request to `compiler:contracts:compile` and update documentation. Because the `compiler:contracts` event didn’t exist, this test was silently failing.

Update the `TestEvents` mock object to allow passing of parameters to an event that is not a callback.

Add unit tests to test for contracts loaded via node_modules.

1. This PR contains a change where any contracts loaded from node_modules will be imported in to `.embark/contracts/node_modules`. Previously, these contracts were loaded in to `.embark/node_modules` (with the `/contracts`).
2019-12-11 11:27:45 -05:00
emizzle ad26533f4a chore(@embark/core): Set DApp plugins to load last
DApp plugins were already been setup to load last for run and test. This PR sets updates `console`, `build`, `graph`, and `upload` to do the same.
2019-12-11 11:24:40 -05:00
emizzle 8e0f8b44d1 fix(@embark/debugger): Re-enable debugger
Re-enable debugger for cockpit and console.

Add missing request `blockchain:getTransaction` required to start a debugging session.

Fix error in console when stopping a debug session.
2019-12-11 11:12:52 -05:00
emizzle bd4b110a78 feat(@embark/whisper): Add Whisper client config
Add option in communication config to choose which Whisper client to use.

Because Parity’s implementation of Whisper is not compatible with Whisper v6, and therefore web3.js in its current form, the following changes have been made:
1. remove any functionality associated with launching a Parity Whisper process.
2. Warn the user when the Parity Whisper client has been opted for in the communication config.
3. Return an error for API calls when Parity Whisper client has been opted for in the communication config.
4. Update Cockpit’s Communication module to show errors returned from API calls.
5. Update the messaging configuration documentation for the new communication client option.
2019-12-11 11:12:18 -05:00
Pascal Precht 446197baff fix(@embark/blockchain): make disabling blockchain feature work
Users can turn of blockchain support if they want to using the blockchain.js
configuration. In practice however, this has never properly worked as several
places in Embark's codebase weren't actually honoring that configuration value.

This commit introduces the necessary changes so that disabling blockchain support will:

No longer generate blockchain related EmbarkJS artifacts
No longer try to deploy Smart Contracts but still compile them
2019-12-11 11:08:13 -05:00
Jonathan Rainville b82a240933 fix(@embark/test): fix using --node option in tests 2019-12-11 11:05:12 -05:00
Jonathan Rainville eae97dee4f fix(@embark/proxy): fix conflict for WS port in the proxy
This error arose when using tests parallel to Embark
2019-12-11 11:05:12 -05:00
emizzle db0e45e96e chore(@embark/site): Add `—template` deprecation notice. 2019-12-11 09:39:20 -05:00
Pascal Precht 2ae46640e9 feat(@embarkjs/ens): Introduce `dappConnection` configuration for namesystem
This commit removes the need for `EmbarkJS.onReady()` and `EmbarkJS.Blockchain.blockchainConnector` APIs
in the ENS provider implementation and instead relies purely on vanilla `Web3`. This comes
with the effect that `EmbarkJS.Names` needs to figure out itself what to connect
to, as well as when a connection has been established.

To make that possible, `EmbarkJS.Names` now implements a similar algorithm to
`EmbarkJS.Blockchain` that tries to connect different endpoint, given a `dappConnection`
configuration.

If no `dappConnection` configuration is given via `namesystem.json`, Embark will fallback
to the same connection list that's provided in `contracts.js|json`.

wip
2019-12-09 12:07:03 +01:00
Iuri Matias 37ae942b99 chore(release): 5.0.0-alpha.3 2019-12-06 06:15:07 -05:00
Michael Bradley, Jr 6044576ca0 refactor(@embark/core): spec embark-whisper-* as deps of embark-core instead of embark
It is unnecessary and not a good idea for `packages/embark` to provide
dependencies to other monorepo packages via any kind of transitive dependency
relationship. In this case, `embark` depended on `embark-core` and
`embark-core` needs `embark-whisper-*` packages but it's `embark` that supplies
those packages indirectly. It works out in the monorepo, *probably* in
production too, but we need to move away from that pattern completely.
2019-12-05 18:47:01 -05:00
Michael Bradley, Jr a5d06509a3 fix(@embark/core): spec embark-rpc-manager as a dependency 2019-12-05 18:03:53 -05:00
Iuri Matias 6efe791cfd chore(release): 5.0.0-alpha.2 2019-12-05 15:03:09 -05:00
Michael Bradley, Jr 6bb673ef87 style(@cockpit/utils): remove stray type annotation 2019-12-03 11:05:27 -06:00
Michael Bradley, Jr 3a3182076e build(deps-dev): bump remaining @storybook/* packages from 5.2.5 to 5.2.7 2019-11-30 15:53:19 -06:00
dependabot-preview[bot] eb9f342868 build(deps-dev): bump @storybook/addon-knobs from 5.2.5 to 5.2.7
Bumps [@storybook/addon-knobs](https://github.com/storybookjs/storybook/tree/HEAD/addons/knobs) from 5.2.5 to 5.2.7.
- [Release notes](https://github.com/storybookjs/storybook/releases)
- [Changelog](https://github.com/storybookjs/storybook/blob/next/CHANGELOG.md)
- [Commits](https://github.com/storybookjs/storybook/commits/v5.2.7/addons/knobs)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-11-30 15:53:19 -06:00
Pascal Precht a7edca0be8 fix(@embark/core): don't exit in Engine consumer API
`Engine.startEngine(cb)` potentially exits the current process if
any registered plugins emits an error in the bootstrap phase.

This limits consumers of this API to react accordingly. Embark's APIs
should be considered library APIs that propagate errors, but let callers
decide what to do with them.

This commit ensures we keep propagating the error of `startEngine()` without
exiting the current process.
2019-11-29 12:57:19 +01:00
Michael Bradley, Jr 5f33b93b31 refactor(@embark/core): make 8547 the default port of communication provider node
Client traffic with the communication provider node, e.g. a whisper node, is
not proxied so make the default port 8547 instead of 8557. It's not a technical
problem for it to be 8557, but our convention to present has been for 855*
ports to be proxied while the upstream is an 854* port.

Update the boilerplate and demo templates to match.
2019-11-29 11:49:30 +01:00
emizzle 05a41b48de
chore(@embark/whisper): Remove CHANGELOG’s for new modules 2019-11-29 11:44:32 +01:00
Jonathan Rainville abac9845c5 fix(@embark/whisper): fix ipc conflict on Windows with 2 Geths
Disables IPC for Whisper as it conflicts with the main process IPC
2019-11-27 11:43:13 -05:00
Jonathan Rainville 04a02af524 fix(@embark/whisper): fix whisper node printing twice because of duplicated name 2019-11-27 11:43:13 -05:00
dependabot-preview[bot] cab1986ff5 build(deps): bump file-loader from 4.2.0 to 5.0.2
Bumps [file-loader](https://github.com/webpack-contrib/file-loader) from 4.2.0 to 5.0.2.
- [Release notes](https://github.com/webpack-contrib/file-loader/releases)
- [Changelog](https://github.com/webpack-contrib/file-loader/blob/master/CHANGELOG.md)
- [Commits](https://github.com/webpack-contrib/file-loader/compare/v4.2.0...v5.0.2)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-11-27 09:44:38 -06:00
Michael Bradley, Jr 873890813b build(deps): remove unneeded os-locale dep in packages/embark 2019-11-27 09:44:21 -06:00
Michael Bradley, Jr 86bc69b54a build(deps-dev): remove unneeded @types/os-locale dev-dep in packages/core/i18n 2019-11-27 09:44:21 -06:00
dependabot-preview[bot] 8fa7da8eeb build(deps): bump os-locale from 3.0.1 to 4.0.0
Bumps [os-locale](https://github.com/sindresorhus/os-locale) from 3.0.1 to 4.0.0.
- [Release notes](https://github.com/sindresorhus/os-locale/releases)
- [Commits](https://github.com/sindresorhus/os-locale/compare/v3.0.1...v4.0.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-11-27 09:44:21 -06:00
Michael Bradley, Jr 3416b051d0 build(deps): remove unused tar package 2019-11-26 15:16:40 -06:00
Michael Bradley, Jr 8ede518bd2 build(deps): bump core-js from 3.3.5 to 3.4.3 2019-11-26 15:16:29 -06:00
Michael Bradley, Jr da7ceb8c54 build(deps/-dev): update babel and babel-related deps and devDeps to latest versions 2019-11-26 13:22:13 -06:00
Michael Bradley, Jr 92f6d41c3b fix(@cockpit): adjust table-related styling so changes in updated core-ui don't override font color 2019-11-26 13:04:09 +01:00
emizzle 4a10476e85 refactor(@embark/whisper): Remove unneeded whisper layer
1. get rid of the whisper layer and handle everything in the communication layer
2. Create a gethWhisper and a parityWhisper plugin that has the same files as packages/embark/src/lib/modules/geth, except with a whisperClient instead of gethClient, and will include most of https://github.com/embark-framework/embark/blob/master/packages/plugins/whisper/src/index.js.
3. Get rid of any whisper registration in geth.
4. In the whisperGeth and whisperParity plugins, modify the request for communication:node:register, to end up calling `startWhisperNode`
2019-11-26 12:22:05 +01:00
Michael Bradley, Jr 57db0abc69 build(deps-dev): bump react-dom from 16.9.0 to 16.12.0 2019-11-25 17:51:09 -06:00
dependabot-preview[bot] cc0a8d8b7b build(deps-dev): bump react from 16.9.0 to 16.12.0
Bumps [react](https://github.com/facebook/react/tree/HEAD/packages/react) from 16.9.0 to 16.12.0.
- [Release notes](https://github.com/facebook/react/releases)
- [Changelog](https://github.com/facebook/react/blob/master/CHANGELOG.md)
- [Commits](https://github.com/facebook/react/commits/v16.12.0/packages/react)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-11-25 17:51:09 -06:00
Michael Bradley, Jr abfa8ca50a build(deps): bump ipfs-http-client from 39.0.2 to 40.0.0
Refactor constructor call in light of breaking change in the release notes:

https://github.com/ipfs/js-ipfs-http-client/releases/tag/v40.0.0

> Multi parameter constructor options are no longer supported
2019-11-25 11:46:39 -06:00
dependabot-preview[bot] 405e4d527d build(deps-dev): bump redux-saga from 0.16.2 to 1.1.3
Bumps [redux-saga](https://github.com/redux-saga/redux-saga) from 0.16.2 to 1.1.3.
- [Release notes](https://github.com/redux-saga/redux-saga/releases)
- [Changelog](https://github.com/redux-saga/redux-saga/blob/master/CHANGELOG.md)
- [Commits](https://github.com/redux-saga/redux-saga/compare/v0.16.2...v1.1.3)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-11-22 10:54:51 -06:00
dependabot-preview[bot] 6695ab9d23 build(deps): bump mocha from 6.2.0 to 6.2.2
Bumps [mocha](https://github.com/mochajs/mocha) from 6.2.0 to 6.2.2.
- [Release notes](https://github.com/mochajs/mocha/releases)
- [Changelog](https://github.com/mochajs/mocha/blob/master/CHANGELOG.md)
- [Commits](https://github.com/mochajs/mocha/compare/v6.2.0...v6.2.2)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-11-22 09:50:51 -06:00
Michael Bradley, Jr 4ebbb4488e fix(@embark/rpc-manager): implement missing RPC modifier for eth_sign 2019-11-22 08:29:15 -06:00
Jonathan Rainville 14dbb63775
chore(@embark/whisper): add warning if comm port is the same as node
Co-Authored-By: Eric Mastro <ericmastro@status.im>
2019-11-22 11:37:16 +01:00
Jonathan Rainville 23f9a8c49c
fix(@embark/whisper): show message when geth port is already taken 2019-11-22 11:37:08 +01:00
emizzle dba5f771f2 fix(@embark/simulator): fix port used in simulator
When using websockets, the simulator was starting on port `8545` instead of `8546`, so the blockchain check was failing.

Update the simulator port to be websockets port from the config when using websockets.
2019-11-22 11:25:02 +01:00
emizzle cb0f8b011e chore(@embark/whisper): improve whisper startup logging
When whisper was being started in a new process, the message displayed in the console was “Starting Blockchain node in another process”. This is misleading as it is the same message that geth/parity use to start up their processes.

Update whisper initialisation process messaging so it states “Starting Whisper node in another process”.
2019-11-22 11:24:20 +01:00
emizzle 23e94d6197 fix(@embark/tests): Improve expiration unit test
Improve the reliability of the expiration unit test in the test dapp by explicitly setting the `block.timestamp` and comparing an expiration value against that.

This improves on the current implementation that relies on time passed which varies depending on the speed of unit tests run (CPU speed, logs shown, etc).
2019-11-22 11:23:18 +01:00
emizzle 6f9e82d8b9 chore(@embark/geth): remove unneeded APIs 2019-11-22 11:22:43 +01:00
emizzle f6f45077e9
fix(@embark/proxy): Fix unsubsribe handling and add new provider
When `eth_unsubscribe` is received in the proxy, ensure this request is forwarded through on the correct socket (the same socket that was used for the corresponding `eth_subscribe`).

Move subscription handling for `eth_subscribe` and `eth_unsubscribe` to RpcModifiers (in `rpc-manager` package).

For each `eth_subscribe` request, a new `RequestManager` is created. Since the endpoint property on the proxy class was updated to be a provider, the same provider was being assigned to each new `RequestManager` and thus creating multiple event handlers for each subscription created. To circumvent this, we are now creating a new provider for each `RequestManager`.

Co-authored-by: Pascal Precht <pascal.precht@googlemail.com>
2019-11-21 15:38:48 +01:00
Jonathan Rainville 3c760c3515 fix(@embark/library-manager): add web3 to versions list
This is needed by the cockpit for the communication component
2019-11-21 08:46:55 -05:00
Jonathan Rainville ebdd573548 chore: small fixes to cockpit 2019-11-21 08:46:55 -05:00
Michael Bradley, Jr d5ebdafb55 refactor(@embark): remove unnecessary `undefined` argument in calls of registerActionForEvent 2019-11-19 13:59:39 -06:00
Michael Bradley, Jr b28054530d refactor(@embark/cmd_controller): remove logger call in initConfig 2019-11-19 13:56:25 -06:00
emizzle c7ec49a38f feat(@embark/embark-rpc-manager): Add support for `eth_signTypedData_v3`
This PR adds support for EIP-712 (https://github.com/ethereum/EIPs/blob/master/EIPS/eip-712.md), by allowing the signing of typed data transactions using the `eth_signTypeData_v3` or `eth_signTypedData` request.

Add a module called `embark-rpc-manager` to handle all RPC transaction modifications.

The internal events management module extracted to `embark-core`. This allows other modules (ie plugins) to use a private instance of Embark’s event API.

Remove transaction modifications in `embark-accounts-manager` and leave only the functionality in this module that handle account management (ie funding of accounts). Other functionality was moved to `embark-rpc-manager`.

- Transactions should now reflect when a new node account is added via `personal_newAccount` or via the node itself (and once `eth_accounts` is requested).
- In the proxy, errors are handled for all cases and are now JSON-RPC spec-compliant.
- Always register `eth_signTypedData` RPC response and display error message if account cannot be found.

NOTE: Updated yarn.lock due to conflict after rebase.

Avoid race condition with rpc modifications

Refactor proxy to make request handling asynchronous, and to allow circumvention of forwarding requests to the node in cases where it is not needed.

Move loading of plugins to after core and stack components (in cmd_controller).

We should load custom plugins LAST (ie after all core and stack components, and after all Embark plugins). To do this, we disable automatic loading of plugins in the config, and allow them to be loading explicitly in cmd_controller.

Create a system that allows registration of custom plugins. Each plugin is generated in EmbarkJS by instantiating the registered class. For example, we can register a Plasma plugin and it will be generated in to EmbarkJS.Plasma with an instantiation of `embarkjs-plasma`. The DApp itself can then do what it wants with `EmbarkJS.Plasma` (ie call `EmbarkJS.Plasma.init()`.

NOTE: loading of custom plugins needs to be applied to all other commands in `cmd_controller`. This PR only loads custom plugins for the `run` command.

NOTE: This PR is based on branch fix/ws-eth-subscribe (#1850). I will rebase this PR when (and if) #1850 is merged.
2019-11-18 13:36:37 -06:00
Pascal Precht 5dc4b2134e fix(@embark/core): ensure type declaration for Plugin.registerActionForEvent() is legit
In 776db1b7f7 (diff-5cab125016e6d753f03b6cd0241d5ebbR267) we've introduced the ability to add
a `priority` parameter to plugin actions, so the order of actions can be semi-ensured.

That commit also introduced typings for that new API but it actually didn't match the
implementation of the API, namely that the second parameter of `Plugin.registerActionForEvent()`
can be either an options object **or** a callback function.

This forces consumers to call the API as `registerActoniForEvent(name, undefined|null, callback)`
which shouldn't be necessary.
2019-11-18 18:05:47 +01:00
Michael Bradley, Jr 978e17daa1 build(deps): bump deprecated ipfs-api@17.2.4 to ipfs-http-client@39.0.2
BREAKING CHANGE:

Related to #1985. Prior to Embark's minimum supported version of Node.js being
bumped to to 10.17.0, Embark was incompatible with any relatively recent
release of the `ipfs-http-client` package.

While *internal* changes are needed re: ipfs's `Buffer` export for
e.g. `embark_demo` to function correctly *(and this PR makes those changes)*,
Embark otherwise runs/tests okay.

Keep in mind #2033.

However, if a dApp author were to explicitly `require('ifps-api')` in the
front-end that wouldn't work as before; and swapping `"ipfs-http-client"` for
`"ipfs-api"` might also not be enough — there are API changes that dApp authors
would need to consider, regardless of Embark presently supplying the dependency
and EmbarkJS wrapping around it.

Closes #1994.
2019-11-18 09:41:24 -06:00
Michael Bradley, Jr 08933dec90 refactor(@embark/plugins/profiler): re-enable embark-profiler plugin
Hook `embark-profiler` into the engine's contracts group.

Adjust `request` signatures to match v5 usage.

Ensure gas numbers are formatted consistently in the ascii table.

Display non-json output in cockpit's console as monospace/pre to preserve
profiler table formatting.
2019-11-18 09:02:05 -06:00