Commit Graph

80 Commits

Author SHA1 Message Date
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] 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 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 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
Michael Bradley, Jr d5ebdafb55 refactor(@embark): remove unnecessary `undefined` argument in calls of registerActionForEvent 2019-11-19 13:59:39 -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
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
dependabot-preview[bot] 92c5062e3e build(deps-dev): bump @types/async from 2.0.50 to 3.0.3
Bumps [@types/async](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/async) from 2.0.50 to 3.0.3.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/async)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-11-14 09:26:22 -06:00
emizzle 7482107374 refactor(@embark/blockchain): Move check for blockchain started
The blockchain module should not contain any ethereum-specific code, and currently it contains a check to see if the blockchain has already been started.

This PR moves this check to blockchain client (ie geth or parity). This check function is registered along with the started callback.

style(@embark/stack/blockchain): add missing semicolon
2019-11-14 15:35:09 +01:00
Pascal Precht 0d20cb5d86 fix(@embark/ens): don't break when determining contract addresses
Turns out that, when Embark tries to replace ENS subdomains, it would fail
if `subdomains` aren't defined in the namesystem configuration.

This commit adds a safeguard so that not defining `subdomains` is fine.
2019-11-14 12:28:41 +01:00
Jonathan Rainville aecb99d428 feat(@embark/tests): enable comms and storage in tests
But only enabled at the start and not changed per test
2019-11-12 09:31:05 -05:00
Jonathan Rainville de9e667794 feat(@embark/ens): enable changing namesystem config per test
Adds back the feature to change ENS config per test
Fixes ENS not working in the console because EmbarkJS was not ready
2019-11-12 09:31:05 -05:00
Pascal Precht b4478a9c46 fix(@embark/ens): don't change shape of Smart Contract args in action hooks
This commit fixes the issue that it wasn't possible anymore to use named constructor arguments
in Smart Contract configurations.

For example, the following Smart Contract expects two constructor arguments:

```solidity
contract SomeContract {
  constructor(address[] _addresses, int initialValue) public {}
}
```

The first being a list of addresses, the second one a number. This can be configured as:

```js
SomeContract: {
  args: [
    ["$MyToken2", "$SimpleStorage"],
    123
  ]
}
```

Notice how the order of arguments matters here. `_addresses` come first in the constructor,
so they have to be defined first in the configuration as well.

Another way to configure this is using named arguments, which is what's broken prior to this commit:

```js
SomeContract: {
  args: {
    initialValue: 123,
    _addresses: ["$MyToken2", "$SimpleStorage"]
  }
}
```

Using a notation like this ^ the order no longer matters as Embark will figure out the right
values for the constructor arguments by their names.

The reason this is broken is because there are several modules in Embark that register and
run a `deployment:contract:beforeDeploy` action, which are allowed to mutate this configuration
object. One of those modules is the `ens` module, which searches for ENS names in the arguments
and figure out whether it has to replace it with a resolved address.

One thing that particular module didn't take into account is that `args` could be either and
array, or an object and will always return an array, changing the shape of `args` in case it was
an object.

This is a problem because another module, `ethereum-blockchain-client`, another action is registered
that takes this mutated object in `determineArguments()` and ensure that, if `args` is actually an
object, the values are put in the correct position matching the constructor of the Smart Contract in
question.

One way to solve this was to use the newly introduced [priority](https://github.com/embark-framework/embark/pull/2031) and ensure
that `ens` action is executed after `ethereum-blockchain-client`'s.

However, the actual bug here is that the ENS module changes the shape of `args` in the first place,
so this commit ensures that it preserves it.
2019-11-11 14:01:48 -05:00
Pascal Precht d2556af8ba refactor(@embark/core): move Engine into embark-core 2019-11-11 17:00:01 +01:00
Jonathan Rainville 8733ca911c chore(@embark/deploy-tracker): fix tests and make them run in CI 2019-11-08 16:53:57 -06:00
Michael Bradley, Jr 25d0510d5b feat(@embark/plugins/geth): bump min supported geth version from 1.8.14 to 1.9.7
This is not a breaking change because Embark doesn't strictly enforce the
mininum version, it only prints a warning.
2019-11-08 12:45:45 -06:00
Michael Bradley, Jr 7b991bb58a refactor(@embark/plugins/geth): don't run empty commands
The `WhisperGethClient` returns empty strings for its "new account" and "list
accounts" commands; if a command is an empty string then `Blockchain` should
not execute it.
2019-11-08 11:28:03 -06:00
dependabot-preview[bot] 98b688cc1a build(deps): bump remix-tests from 0.1.14 to 0.1.20
Bumps [remix-tests](https://github.com/ethereum/remix-tests) from 0.1.14 to 0.1.20.
- [Release notes](https://github.com/ethereum/remix-tests/releases)
- [Commits](https://github.com/ethereum/remix-tests/commits)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-11-08 11:12:43 -06:00
Jonathan Rainville 95b5ae48c6 fix(@embark/accounts-manager): limit funding accounts to 1 at a time 2019-11-08 08:46:32 -05:00
Jonathan Rainville 776db1b7f7 feat(@embark/plugin): add priority to regsiterActionForEvents 2019-11-08 08:46:32 -05:00
Michael Bradley, Jr fccda21623 chore(release): 5.0.0-alpha.1 2019-11-05 14:55:06 -06:00
Jonathan Rainville 863ae51a2f Fix embark test with --node (#2021)
* fix(@embark/solidity): fix solidity ipc connection with blockchain

When blockchain was run in another process, the IPC was connected,
but the compiler was not loaded, so the IPC calls never returned

* fix(@embark/geth): fix cb is not a fn because it needs request2
2019-11-05 12:00:42 -05:00
Pascal Precht abe79c87f4 fix(@embark/cockpit): ensure correct data is send to web3's `ecRecover` (#2024)
We've introduced a regression in https://github.com/embark-framework/embark/commit/f9557d4c9 where invalid data
has been sent to web3's `ecRecover()` method to verify signed messages.

This causes an internal server error and the utility feature inside Cockpit
unsuable.

This commit ensures that the correct data is sent to `ecRecover()` making verifying
messages through Cockpit functional again.
2019-11-05 10:21:43 -05:00
dependabot-preview[bot] d0f4236aff build(deps): bump core-js from 3.3.4 to 3.3.5
Bumps [core-js](https://github.com/zloirock/core-js) from 3.3.4 to 3.3.5.
- [Release notes](https://github.com/zloirock/core-js/releases)
- [Changelog](https://github.com/zloirock/core-js/blob/master/CHANGELOG.md)
- [Commits](https://github.com/zloirock/core-js/compare/v3.3.4...v3.3.5)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-11-01 12:21:12 -05:00
Jonathan Rainville 9e654c533e fix: fix ws providers to have the patch for a bigger threshold (#2017)
* fix: fix ws providers to have the patch for a bigger threshold

* chore (@embark/dapps): add big contract to test WS issue with large contracts
2019-10-30 16:02:17 -04:00
Jonathan Rainville 72278aad72 fix(@embark/deploy-tracker): fix not storing different chains 2019-10-30 12:39:21 -05:00
Michael Bradley, Jr 85235f88b2 chore(release): 5.0.0-alpha.0 2019-10-28 16:05:13 -05:00
Jonathan Rainville 395ae83f9c fix(@embark/transaction-logger): don't show logs for stray receipts 2019-10-28 13:20:25 -05:00
Jonathan Rainville a4b3ef454a fix(@embark/parity): fix version result not available 2019-10-28 12:10:34 -05:00
Jonathan Rainville 9803507221 fix(@embark/geth): fix version result not available 2019-10-28 12:10:34 -05:00
Jonathan Rainville 1302f9fb48 fix(@embark/ens): fix trying to resolve when ENS is not registered 2019-10-28 12:10:34 -05:00
Michael Bradley, Jr 1225cb14e8 build(deps): add core-js@3 as a dep to all pkgs that have @babel/runtime-corejs3 dep
When making use of the `useBuiltIns: 'usage'` option for @babel/preset-env
(which is the case for all transpiled packages in Embark's monorepo) a package
needs to have both @babel/runtime-corejs3 and core-js@3 specified as
dependencies.
2019-10-28 11:40:48 -05:00
Michael Bradley d22cd58db3 reorg some deps from packages/embark to the packages that actually depend on them (#1990)
* build(deps): move @types/os-locale from packages/embark to packages/core/i18n

* build(deps) move @types/globule from packages/embark to packages/plugins/coverage

* build(deps): refactor stack/{api,proxy,webserver} deps relative to packages/embark

* build(deps): remove unneeded @types/async dep from packages/stack/test-runner

* build(deps): remove unneeded deps from packages/embark
2019-10-25 13:04:51 -04:00
Michael Bradley, Jr 0af6e13779 build(deps): move deps needed by embark-basic-pipeline from packages/embark
Introduce additional refactors to ensure the packages can be resolved by the
basic pipeline's webpack child process.
2019-10-25 11:13:49 -05:00
Michael Bradley d17fe33339 build: update babel and webpack dependencies (#1987)
Includes a switch from core-js@2 to core-js@3
2019-10-24 17:41:28 -04:00
Michael Bradley ed02cc849f build: bump all packages' engines settings (#1985)
BREAKING CHANGE:

node: >=10.17.0 <12.0.0
npm: >=6.11.3
yarn: >=1.19.1

node v10.17.0 is the latest in the 10.x series and is still in the Active LTS
lifecycle. Embark is still not compatible with node's 12.x and 13.x
series (because of some dependencies), otherwise it would probably make sense
to bump our minimum supported node version all the way to the most recent 12.x
release.

npm v6.11.3 is the version that's bundled with node v10.17.0.

yarn v1.19.1 is the most recent version as of the time node v10.17.0 was
released.
2019-10-24 09:52:05 -04:00
Jonathan Rainville 6e9635c12b fix(@contract-app): fix contracts app tests (#1982)
* refactor(@embark/dapps/tests/app): use function syntax

These changes don't fix the race conditions related to the test dapp's tests
but are a step in the right direction.

* refactor(@embark/dapps/tests/contracts): adjustments to get tests passing

Further refactoring is needed re: potentially duplicated or overlapping logic
in `packages/plugins/solidity-tests` and
`packages/core/utils/src/solidity/remapImports.ts`, as well in disabled test
dapp tests

* test(dapps/tests/app): temporarily disable intermittently failing tests

They are failing because of a race condition; once that race condition has been
fixed these tests should be reenabled.

* fix(@embark/solidity-tests): fix importing the library for the tests
2019-10-23 14:58:40 -04:00
Michael Bradley 183d9a05b5 Fix/solo spawn (#1981)
* build(@embark/stack/blockchain-client): remove unneeded typescript related scripts and deps

In addition to being unneeded their presence is causing build errors.

* build(embark): remove unneeded typescript related scripts and deps

In addition to being unneeded their presence is causing build errors.

* build(@embark/plugins/ethereum-blockchain-client): remove unneeded typescript related scripts, deps

In addition to being unneeded their presence is causing build errors.

* build(@embark/plugins/ganache): remove unneeded typescript related scripts and deps

In addition to being unneeded their presence is causing build errors.

* build(@embark/plugins/geth): remove unneeded typescript related scripts and deps

In addition to being unneeded their presence is causing build errors.

* fix(@embark/plugins/transaction-logger): require 'web3' not 'Web3'

* fix(@embark/utils/solo): spawn npm(.cmd) instead of npx(.cmd)

* test(@embark/plugins/basic-pipeline): add test stub

* test(@embark/stack/blockchain): add test stub
2019-10-22 09:27:28 -04:00
Jonathan Rainville 2193d82399 fix(test-app): make test app test all pass (#1980)
Fix a lot of bugs and reenable a couple of modules
Some tests were kept disabled, mostly the ENS and EmbarkJS tests
Those need to add back a fairly significant feature to work
Add back missing solidity contracts
2019-10-22 09:27:22 -04:00
Jonathan Rainville a3b52676fc Fix part of the test app and add new test util functions (#1977)
* fix: fix tests hanging because the console is not started

* fix(@embark/proxy): send back errors correctly to the client

Code originally by @emizzle and fixed by me

* feat(@embark/test-runner): add assert.reverts to test reverts

* fix: make test app actually run its test and not hang

* fix(@embark/proxy): fix listening to contract event in the proxy

* feat(@embark/test-runner): add assertion for events being triggered

* docs(@embark/site): add docs for the new assert functions

* feat(@embark/test-runner): add increaseTime util function to globals

* docs(@embark/site): add docs for increaseTime
2019-10-17 14:39:25 -04:00
Eric Mastro 9b57a912cf refactor(@embark/ethereum-blockchain-client): move module into own package (#1956) 2019-10-16 10:02:05 -04:00
Eric Mastro e2efbbd846 refactor(@embark/parity): move module into own package (#1951)
Contains bug fixes to get parity to work as a blockchain client.

**NOTE:** Please merge https://github.com/embark-framework/embark/pull/1950 first before merging this PR, as this PR contains removal of dependencies from `packages/embark` that are needed for geth. So if this is merged first, and the geth PR (https://github.com/embark-framework/embark/pull/1950) is not merged, then geth will not have some of the dependencies it needs.
2019-10-16 09:35:26 -04:00
Jonathan Rainville 08c97a2964 fix: fix windows build for pipeline and embarkjs (#1971) 2019-10-16 09:07:42 -04:00
Eric Mastro 908064f4e1 refactor(@embark/ganache): move module into own package (#1952)
**NOTE:** Running a dapp with `client: “vm”` does not work, however I am not sure if that is intentional in v5 or not.

**NOTE:** Running `embark test` in the demo DApp does work, although there is an error that I am assuming does actually pertain to this PR:
```
made request without listener: whisper:node:register
Trace:
    at EmbarkEmitter.trace [as request] (/Users/emizzle/Code/__Github/embk-fw/embark/packages/embark/src/lib/core/events.js:142:13)
    at new request (/Users/emizzle/Code/__Github/embk-fw/embark/packages/embark/src/lib/modules/geth/index.js:49:17)
    at Plugin.loadInternalPlugin (/Users/emizzle/Code/__Github/embk-fw/embark/packages/embark/src/lib/core/plugin.js:117:10)
    at Plugins.loadInternalPlugin (/Users/emizzle/Code/__Github/embk-fw/embark/packages/embark/src/lib/core/plugins.js:96:40)
    at Engine.loadInternalPlugin [as registerModule] (/Users/emizzle/Code/__Github/embk-fw/embark/packages/embark/src/lib/core/engine.js:69:18)
    at Engine.registerModule [as blockchainComponents] (/Users/emizzle/Code/__Github/embk-fw/embark/packages/embark/src/lib/core/engine.js:183:10)
    at Engine.apply [as registerModuleGroup] (/Users/emizzle/Code/__Github/embk-fw/embark/packages/embark/src/lib/core/engine.js:104:18)
    at registerModuleGroup (/Users/emizzle/Code/__Github/embk-fw/embark/packages/embark/src/cmd/cmd_controller.js:740:16)
    at nextTask (/Users/emizzle/Code/__Github/embk-fw/embark/node_modules/async/dist/async.js:5324:14)
    at next (/Users/emizzle/Code/__Github/embk-fw/embark/node_modules/async/dist/async.js:5331:9)
    at /Users/emizzle/Code/__Github/embk-fw/embark/node_modules/async/dist/async.js:969:16
    at callback (/Users/emizzle/Code/__Github/embk-fw/embark/packages/embark/src/lib/core/engine.js:47:9)
    at Client.done (/Users/emizzle/Code/__Github/embk-fw/embark/packages/core/core/src/ipc.js:46:11)
    at Client.emit (/Users/emizzle/Code/__Github/embk-fw/embark/node_modules/event-pubsub/es5.js:74:21)
    at Socket.connectionClosed (/Users/emizzle/Code/__Github/embk-fw/embark/node_modules/node-ipc/dao/client.js:201:20)
    at Socket.emit (events.js:198:13)
```
2019-10-14 16:28:54 +09:00
Eric Mastro 8aa6496f93 refactor(@embark/geth): move module into own package (#1950) 2019-10-14 16:14:07 +09:00